Complex sentence: For practicality, usually only the last surname (excluding prepositions) is used in formal greetings or in scientific papers indexing, but in a list of persons, the first given name, not the surname, is used for alphabetical sorting.
Split into simpler sentences: For practicality, usually only the last surname (excluding prepositions) is used in formal greetings or in scientific papers indexing. But, in a list of persons, the first given name, not the surname, is used for alphabetical sorting.