2009-04-14 List of publications of a person (en)

Once in a while you want to typeset a list of publication of somebody (maybe yourself, maybe not). It would be good if this could be automated somehow.

I am a big fan of the amsrefs package, which is an excellent replacement for BibTeX. One of its nice features is that you don’t have to learn a strange language—everything is done within LaTeX. Changing amsrefs settings so that the author field is omitted in the bibliography is very easy; but then, a problem arises: sometimes you have coauthors, and you don’t want their names to disappear. A possible solution would be to store the author’s name and modify the author-typesetting macros so that they ingore it; this might be a good idea, although a bit difficult because you would have to take into consideration a few special cases, like having both “Smith, J.” and “Smith, John” disappear (and what about a paper by, say, Jack Newman and John Newman?). Having to do some manual work is not a big problem for me, especially that any good editor has a search-and-replace feature, so I went for another solution: change the relevant “author” into “coauthor” fields. And this is a code fragment I put into the preamble to achieve this:

\BibSpec{article}{%
  +{}  {\textit}                      {title}
  +{.} { }                            {part}
  +{:} { \textit}                     {subtitle}
  +{,} { \PrintContributions}         {contribution}
  +{.} { \PrintPartials}              {partial}
  +{,} { }                            {journal}
  +{}  { }                            {volume}
  +{}  { \PrintDatePV}                {date}
  +{,} { \issuetext}                  {number}
  +{,} { \eprintpages}                {pages}
  +{,} { }                            {status}
  +{,} { \PrintDOI}                   {doi}
  +{,} { available at \eprint}        {eprint}
  +{}  { \PrintTranslation}           {translation}
  +{;} { \PrintReprint}               {reprint}
  +{}  { \PrintCoAuthors}             {coauthor}
  +{.} { }                            {note}
  +{.} {}                             {transition}
}
\BibSpec{book}{%
  +{}  {\textit}                      {title}
  +{.} { }                            {part}
  +{:} { \textit}                     {subtitle}
  +{,} { \PrintEdition}               {edition}
  +{}  { \PrintEditorsB}              {editor}
  +{,} { \PrintTranslatorsC}          {translator}
  +{,} { \PrintContributions}         {contribution}
  +{,} { }                            {series}
  +{,} { \voltext}                    {volume}
  +{,} { }                            {publisher}
  +{,} { }                            {organization}
  +{,} { }                            {address}
  +{,} { \PrintDateB}                 {date}
  +{,} { }                            {status}
  +{}  { \PrintTranslation}           {translation}
  +{;} { \PrintReprint}               {reprint}
  +{}  { \PrintCoAuthors}             {coauthor}
  +{}  { \parenthesize}               {note}
  +{.} {}                             {transition}
}
\BibSpec{collection.article}{%
  +{}  {\textit}                      {title}
  +{.} { }                            {part}
  +{:} { \textit}                     {subtitle}
  +{,} { \PrintContributions}         {contribution}
  +{,} { \PrintConference}            {conference}
  +{}  {\PrintBook}                   {book}
  +{,} { }                            {booktitle}
  +{,} { \PrintDateB}                 {date}
  +{,} { }                            {pages}
  +{,} { }                            {status}
  +{,} { \PrintDOI}                   {doi}
  +{,} { available at \eprint}        {eprint}
  +{}  { \PrintTranslation}           {translation}
  +{;} { \PrintReprint}               {reprint}
  +{}  { \PrintCoAuthors}             {coauthor}
  +{}  { \parenthesize}               {note}
  +{.} {}                             {transition}
}
\BibSpec{report}{%
  +{}  {\textit}                      {title}
  +{.} { }                            {part}
  +{:} { \textit}                     {subtitle}
  +{,} { \PrintEdition}               {edition}
  +{,} { \PrintContributions}         {contribution}
  +{,} { Technical Report }           {number}
  +{,} { }                            {series}
  +{,} { }                            {organization}
  +{,} { }                            {address}
  +{,} { \PrintDateB}                 {date}
  +{,} { \eprint}                     {eprint}
  +{,} { }                            {status}
  +{}  { \PrintTranslation}           {translation}
  +{;} { \PrintReprint}               {reprint}
  +{}  { \PrintCoAuthors}             {coauthor}
  +{}  { \parenthesize}               {note}
  +{.} {}                             {transition}
}
\BibSpec{thesis}{%
  +{}  {\textit}                      {title}
  +{:} { \textit}                     {subtitle}
  +{,} { }                            {type}
  +{,} { }                            {organization}
  +{,} { }                            {address}
  +{,} { \PrintDateB}                 {date}
  +{,} { \eprint}                     {eprint}
  +{,} { }                            {status}
  +{}  { \PrintTranslation}           {translation}
  +{;} { \PrintReprint}               {reprint}
  +{}  { \PrintCoAuthors}             {coauthor}
  +{}  { \parenthesize}               {note}
  +{.} {}                             {transition}
}

\DefineAdditiveKey{bib}{coauthor}{\name}
\def\PrintCoAuthors#1{%
  \PrintNames{(coauthor\Plural{s}: }{)}{#1}%
}

(Note that most stuff is copied-and-pasted from the amsrefs source.)

Now how does this work? \BibSpec is a normal, user-level command documented in the amsrefs manual. \DefineAdditiveKey defines a new field, which is additive (i.e., may be repeated a few times in one bibliographical entry). Next we define the \PrintCoAuthors command (very similar to \PrintAuthors). The \PrintNames macro takes three arguments: the start string, the end string and the actual list (we are currently not really interested in its form).

(In fact, \PrintAuthors is a bit more complicated since it has to take care for inverting the name in certain cases; I skipped this problem here. To be sincere, I don’t know how to enable a similar option for coauthors:(.)

The last interesting part is the \Plural command, whose meaning should be obvious.

Now you can try the whole document:

\documentclass{article}

\usepackage{amsrefs}[2007/10/22]

\makeatletter
...
!!!PUT THE REST OF THE CODE FROM THE BEGINNING HERE!!!
...
\makeatother

\begin{document}

List of publications:
\begin{biblist}
  \normalsize % you don't want your publication list in \footnotesize!
  \bib{a1}{article}{
    author={Borkowski, Marcin},
    coauthor={Smith, John},
    title={Some paper},
    journal={Some Journal},
    volume={1},
    date={2001},
    pages={1\textendash 10},
  }
  \bib{a2}{article}{
    author={Borkowski, Marcin},
    coauthor={Smith, John},
    coauthor={Newman, Jack},
    title={Another paper},
    journal={Another Journal},
    volume={2},
    date={2002},
    number={1},
    pages={12\textendash 20},
  }
  \bib{b3}{book}{
    author={Borkowski, Marcin},
    coauthor={Smith, John},
    coauthor={Newman, Jack},
    coauthor={Brown, Jill},
    title={A book},
    publisher={A Publishing Company},
    date={2003},
  }
\end{biblist}

\end{document}

(this example should Just Work™;)—with reasonably recent TeX installation, at least).

Happy LaTeXing (and don’t forget to run LaTeX twice on this document)!

CategoryBlog, CategoryTeX, KategoriaLateXPorady, KategoriaLateX