3

Is there a package or command that can automatically abbreviate names (similar to what bibtex does but not specifically for author names or citations)? The goal is to have a command that generates both, a properly formatted index entry, e.g. "Einstein, A." and a name in the text, e.g. "Albert Einstein". Ideally, the command would take only a single argument (the full name). Also for persons with several first names the command should work.

EDIT

I have a long document which contains many names. I would like them to appear in a unified manner and create an index for them. Right now "A. Einstein" and "Albert Einstein" can both appear. In the index the two versions should of course be merged to one entry. I could write a script that that edits the text file but a latex solution could be flexible enough to change the formatting later and not loose the information contained in the full names.

\newcommand{\myname}[1]{%
   \index{\shortname{#1}}%
   \longname{#1}%
 }%

 \myname{Albert Einstein}

should print "Albert Einstein" and add an element "Einstein, A." to the index.

  • 1
    Something like an acronym? – user31729 Nov 24 '15 at 12:50
  • Looks good. How would I use it for persons names? – highsciguy Nov 24 '15 at 12:54
  • Can you be a bit clearer about your intentions? – egreg Nov 24 '15 at 14:24
  • Please see my edit. – highsciguy Nov 24 '15 at 19:16
  • I've just discovered the nameauth package: I don't know if it can fully answer your question, but maybe it can help. – LucaD Nov 27 '15 at 10:11
2

The nameauth package was designed exactly with these and similar needs in mind. Version 2.1 is what I would call "feature-complete" as well as "fault-tolerant." If you have a distribution that has not upgraded to 2.1, I highly recommend that you manually install this version in your local texmf tree.

The package has a "main" interface and a "simplified" interface, depending on how you want to use it. The whole idea is to make something that will be malleable and fit different styles and workflows. Moreover, the newest version still is backward-compatible with the early versions.

Here is a brief summary of what it does:

  1. Track first and subsequent uses of names: \Name[Albert]{Einstein} produces "Albert Einstein" at the first occurrence of the name, then "Einstein" thereafter.

  2. Handle variants of names:

    a. \Name*[Albert]{Einstein} always produces "Albert Einstein" regardless of occurrence.

    b. \Name[Albert]{Einstein}[A.] gives "A. Einstein" at the first occurrence of the name, then "Einstein" thereafter.

    Caveat: Its identifying control sequence is the same as \Name[Albert]{Einstein} and both will create the same index entry "Einstein, Albert". If \Name[Albert]{Einstein} comes first, \Name[Albert]{Einstein}[A.] only prints "Einstein" in the text, while \Name*[Albert]{Einstein}[A.] always prints "A. Einstein".

    c. \FName[Albert]{Einstein} prints "Albert" if it is a subsequent reference to Einstein, again sharing the same index entry "Einstein, Albert".

  3. Properly sort names in the index. Even without creating styles in makeindex or collating sequences in xindy, you can "pretag" a name in makeindex and texindy to get what you need. For example, \PretagName{Æthelred, II}{Aethelred 2} will sort the "æsc" as "ae" in the index. This also helps to sort Roman numeral name suffixes.

    Moreover, once tagged, a name always includes the tag automatically!

  4. Add info tags or specials to index entries automatically via \TagName.

  5. Handle see-references to names in the index:

    \AKA{Æthelred, II}{Æthelred}[the Unready] puts "Æthelred the Unready" in the text and "Æthelred the Unready see Æthelred II" in the index.

  6. Deal properly with Romanized Eastern names, medieval and ancient names, royal names, and Western names with generational suffixes.

  7. Handle a variety of "special cases" that include

    a. Particles: de, de la, d’, von, van, ten, Le, La, and L’, among others.

    b. Hyphenation needs

    c. Unicode accents under NFSS, xelatex, and `lualatex'.

  8. Name formatting for first uses (or subsequent ones as well).

  9. Other miscellany dealing with names (the manual tells all).

As time permits I hope to update my very old tutorial videos on YouTube.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.