2

AMSRefs allows one to define abbreviations for names, publishers and journals by using the commands \DefineName, \DefinePublisher and \DefineJournal, respectively (see section 8.4 of the user's guide). AMSRefs allows three ways to input a bibliography (see section 2 of the user's guide): (1) directly in the LaTeX document, (2) import items from an external .ltb file, (3) import items from a .bib file using BibTeX. The last method is not relevant for my problem.

When I use method (1), if I place my definitions in the document anywhere before the bibliography items, the abbreviations are expanded properly.

But, when I use method (2) where should I place the definitions? I tried keeping them in the LaTeX document in the preamble, in the body, in the .ltb file, in a separate .ltb file, and in a .sty file and invoked using \usepackage in the preamble, but there always seems to be some error—some or all of the abbreviations are left unexpanded.

Could someone tell me what I'm doing wrong? I would prefer to use method (2) in general, since that way it is easier to manage a large database of references.

MWE
The LaTeX file:

\documentclass{article}

\usepackage{amsrefs}

\DefineName{na}{Alon, Noga}
\DefinePublisher{cup}{Camb. Univ. Press}{Cambridge University Press}{Cambridge}
\DefineJournal{jcta}{0097-3165}{J. Comb. Theory, Ser.~A}{Journal of Combinatorial Theory. Series~A}


\begin{document}


\begin{bibdiv}
\begin{biblist}

\bibselect*{mybib}

\end{biblist}
\end{bibdiv}

\end{document}

The mybib.ltb file:

\bib{AloKle90}{collection.article}{
    author={na},
    author={Kleitman, Daniel~J.},
    title={Sum-free subsets},
    book={
        title={A Tribute to Paul Erd{\H o}s},
        editor={Baker, Andrew},
        editor={Bollob{\'a}s, B{\'e}la},
        editor={Hajnal, Andr{\'a}s},
        publisher={cup},
        address={New York},
        date={1990},
        isbn={978-0-521-38101-7},
        isbn={978-0-521-06733-1}
    },
    pages={13\ndash 26}
}

\bib{AloYus95}{article}{
    author={na},
    author={Yuster, Raphael},
    title={The $123$ theorem and its extensions},
    journal={jcta},
    volume={72},
    date={1995-11},
    number={2},
    pages={322\ndash 331},
    doi={10.1016/0097-3165(95)90071-3}
}

The console displays the following warnings when I compile the LaTeX file:

Package amsrefs Warning: Abbreviation 'na' undefined on input line 7.


Package amsrefs Warning: Abbreviation 'na' undefined on input line 19.


Package amsrefs Warning: Abbreviation 'jcta' undefined on input line 19.

So, the abbreviation for the publisher is being recognised but the others are not.

If I place the definitions at the top of the LTB file, then I get the following warning:

Package amsrefs Warning: Abbreviation 'cup' undefined on input line 11.

So, it's the reverse this time.

2 Answers 2

2

You should put the \Define... commands inside of your external .ltb file. When you do this, as you mention, the Name and Journal abbreviations are expanded properly, but the Publisher one is not. This is because these \Define... commands expand to \bib* commands, which are special entries used exclusively for cross-referencing. These \bib* entries get tossed onto a 'defer list' -- its elements get ignored if there is no known citation key. amsrefs does not recognize a publisher key in your example because it's hidden inside of your book key.

You can get amsrefs recognize these internal keys by modifying its control sequence for parsing them, essentially turning them into recognized keys. Try adding this bit of code to your LaTeX file's preamble:

\makeatletter
\def\output@inner@xref@#1{%
     \in@={#1}%
     \ifin@
     \RestrictedSetKeys{\modify@xref@fields}{bib}{\the\rsk@toks}{#1}%
     \else
     \output@xref@{#1}%
     \fi
}
\makeatother
0
0

What seems to work for me when using an .ltb file to input the references is the following:

  1. I insert the abbreviations at the top of my .ltb file;
  2. I create separate \bib* entries for any book, partial, translation, and reprint entries that are to appear in any of the \bib entries, and then insert these as cross-references.

Doing these two things seems to make the abbreviations work without any issues. Here's an MCVE, based on the example given by the OP:

The .tex file:

\documentclass{article}

\usepackage{amsrefs}

\begin{document}

\begin{bibdiv}
\begin{biblist}

\bibselect*{mybib}

\end{biblist}
\end{bibdiv}

\end{document}

The mybib.bib file:

\DefineName{na}{Alon, Noga}
\DefineJournal{jcta}{0097-3165}{J. Comb. Theory, Ser.~A}{Journal of Combinatorial Theory. Series~A}
\DefinePublisher{cup}{Camb. Univ. Press}{Cambridge University Press}{Cambridge}

\bib*{BakBolHaj90xref}{book}{
    title={A Tribute to Paul Erd{\H o}s},
    editor={Baker, Andrew},
    editor={Bollob{\'a}s, B{\'e}la},
    editor={Hajnal, Andr{\'a}s},
    publisher={cup},
    address={New York},
    date={1990},
    isbn={978-0-521-38101-7},
    isbn={978-0-521-06733-1}
}

\bib{AloKle90}{collection.article}{
    author={na},
    author={Kleitman, Daniel~J.},
    title={Sum-free subsets},
    book={BakBolHaj90xref},
    pages={13\ndash 26}
}

\bib{AloYus95}{article}{
    author={na},
    author={Yuster, Raphael},
    title={The $123$ theorem and its extensions},
    journal={jcta},
    volume={72},
    date={1995-11},
    number={2},
    pages={322\ndash 331},
    doi={10.1016/0097-3165(95)90071-3}
}

You must log in to answer this question.