1

I'm rigging up some code so that I get the references cited on a slide displayed directly in the footline of my beamer presentation, and I've run into an error that mystifies me. The code I have (which works) is this:

\def\framerefs{}
\def\interframerefs{}
\def\clearframerefs{\gdef\framerefs{}\gdef\interframerefs{}}

\def\cite#1{\xdef\framerefs{\framerefs\interframerefs#1}\gdef\interframerefs{~}}
\defbeamertemplate{footline}{footline refs}{
    \hbox{\begin{beamercolorbox}[wd=\paperwidth,dp=1ex]{refs in foot}%
        \framerefs
    \end{beamercolorbox}}%
    \clearframerefs
}
\setbeamerfont{footline}{size=\normalsize}
\setbeamertemplate{footline}[footline refs]

But if I want each reference on a separate line, and change \cite to be:

\def\cite#1{\xdef\framerefs{\framerefs\interframerefs#1}\gdef\interframerefs{\\}}

The compilation fails with a capacity exceeded error:

! TeX capacity exceeded, sorry [main memory size=3000000].
<argument> ...le }\framesubtitle }\framesubtitle }
                                                  \framesubtitle }\framesubt...

I find it a bit odd that having a space be the separator works fine but newlines explode (same thing happens with \newline). Does someone know what's wrong (or a better way to do the newline-separated list thing I want to do?

3
\xdef\framerefs{\framerefs\interframerefs#1}

is an accident waiting to happen.

Try

 \protected@xdef\framerefs{\framerefs\interframerefs#1}

or safer

 \g@addto@macro\framerefs{\interframerefs#1}

(Untested as no runnable example supplied)

  • \protected@xdef did the trick. \def\cite#1{\g@addto@macro\framerefs{\interframerefs#1}\gdef\interframerefs{\\}} seems to have different semantics, as with that I get a \newline before the first cite (which LaTeX complains about: "There's no line here to end."). Thanks for the help! – arnsholt Oct 15 '12 at 16:53

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.