0

According to amsrdoc.pdf,

when amsrefs treats nonsense.ltb as a database file, it ignores every- thing except for the \bib commands.

However, that is not true in this case:

test1.tex

\documentclass{amsart}

\usepackage{hyperref}
\usepackage[lite]{amsrefs}
\usepackage{amsmath,amssymb,latexsym}

\begin{document}

\title{Xyz}
\author{Dale R. Worley}
\email{[email protected]}
\date{\today}

\maketitle

\section{References}

\begin{biblist}[\normalsize]*{labels={alphabetic}}

\bibselect{test2}

\end{biblist}

\end{document}

test2.ltb

\documentclass{amsart}

\usepackage{hyperref}
\usepackage[lite]{amsrefs}
\usepackage{amssymb}

\newcommand{\foobar}{foobar}

\begin{document}

\title{Abc}
\author{Dale R. Worley}
\email{[email protected]}
\date{\today}
\maketitle

\section{Annotated bibliography}

\begin{biblist}[\normalsize]*{labels={alphabetic}}

\bib{Ber1986}{article}{
    label = {Ber1986},
    author = {Berele, Allan},
    title = {A Schensted-type correspondence for the symplectic group},
    journal = {J. Combin. Theory},
    volume = {Ser. A 43},
    date = {1986},
    pages = {320--328},
    %review = {\MR{***}},
    doi = {10.1016/0097-3165(86)90070-1},
    eprint = {https://www.sciencedirect.com/science/article/pii/0097316586900701},
    note = {https://scholar.google.com/scholar?cluster=11001899118143708236},
}
\bigskip
\foobar.  Topics:  ***
\bigskip

\end{biblist}

\end{document}

In that case, LaTex objects that \foobar is an undefined control sequence. However, if I put "%", "xxx", or "\null" in front of the use of \foobar, LaTeX produces no error message.

What is going on here and how can I get amsrefs to behave as documented?

6
  • \relax also works to prevent anomalous behavior.
    – Dale
    May 21 at 17:41
  • Leave a blank line before \bigskip. I haven't checked to see if this is explicitly documented, but the examples in the user guide show a blank line after every ]bib entry. (This is second nature to most experienced LaTeX users.) May 21 at 18:00
  • A blank line before \bigskip (after \bib) doesn't change the behavior.
    – Dale
    May 22 at 3:21
  • Sorry, it did work in your MWE when I tested it. So there's something else in your real file. May 22 at 13:51
  • I've got amsrefs version 2013/03/07 v2.14; what version worked?
    – Dale
    May 23 at 19:19

1 Answer 1

0

The underlying problem is that when \bibselect is processing the .ltb file, it not only checks each line to see if it starts with \bib, it also expands the initial token on the line to see if the expansion starts with \bib. The advantage of this is that \bibselect will notice bibliography entries that are created with a macro that generates a \bib. The disadvantage is that it chokes if the .tex file doesn't define a macro which appears as the first token of a line in the .ltb.

The fix is to add the additional \ifdefined check to \ReadBibLoop@a shown below:

% Do not expand the token at the beginning of a line of the .ltb file
% to check if it expands into \bib if it is not defined.
\makeatletter
\long\def\ReadBibLoop@a#1#2\@nil{%
\ifx\bib#1%
    \CurLine % just exec it
\else
    \ifx\endinput#1%
    \let\ReadBibLoop\@empty
    \else
        \ifdefined#1
            \@xp\ReadBibLoop@b#1#2\@empty\@nil
        \fi
    \fi
\fi
}
\makeatother

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .