# RevTex-4 footnote and updownarrow don't work together

I am working with the footnote command in RevTex-4, and LaTeC throws errors when I use this with the \updownarrow command. The following code has issues:

\documentclass{revtex4-1}
\begin{document}
\footnote{$\updownarrow$}
\end{document}


However, similar commands do end up working, such as \leftarrow and \nearrow. The errors that are thrown don't make sense to me; they are errors in the output.bbl file, and say things like "missing number treated as zero". Does anybody have any insight?

revtex moves footnotes around. This means that you must protect fragile commands:

\documentclass{revtex4-1}
\begin{document}
\footnote{$\protect\updownarrow$}
\end{document}

• Thanks! Can you explain why \updownarrow is fragile, whereas the other ones are not? – Aaron Oct 24 '17 at 21:44
• While \footnote has a moving argument in revtex4-1, \updownarrow is not generally a fragile command. That it becomes so in revtex4-1 is a by-product of a bug. – egreg Oct 25 '17 at 11:13

This is a bug in revtex4-1, which writes out a .bib file using " as field delimiter; if, for instance, babel for German is used, double quotes used as shorthand would confuse BibTeX when preparing the .bbl file and chaos ensues.

This is also the case for some macros defined as delimiters, such as \updownarrow: the LaTeX definition is

\delimiter "326C33F


and indeed you will find, in aaronNotes.bib (I named aaron.tex your test file)

@FOOTNOTE{Note1,key="Note1",note="$\delimiter "326C33F$"}


You clearly see what goes wrong: the " after \delimiter is mistaken by BibTeX as the field delimiter.

Solution: fix revtex4-1 to use braces for delimiting BibTeX fields.

\documentclass{revtex4-1}

% fix \@endnotetext
\makeatletter
\long\def\@endnotetext#1{%
\begingroup
\endnote@relax
\immediate\write\@bibdataout{%
@FOOTNOTE{%
\@endnotelabel,%
key={\@endnotelabel},% not "\@endnotelabel"
note={\unexpanded{#1}}% not "#1"
}%
}%
\endgroup
}
\makeatother

\begin{document}

\footnote{$\updownarrow$}

\end{document}


Also @CONTROL entries are written with double quotes, but this doesn't seem likely to create similar problems.

NOTES

• I added \unexpanded for better safety.
• As Ulrike Fischer comments, unmatched \{ braces in the argument of \footnote will break anyhow; in this case, \lbrace should be used.
• This solves the " problem, but now it will break if there is a lonely \{ in the footnote (less probable, so probably the better solution, but should be noted). – Ulrike Fischer Oct 25 '17 at 11:58
• @UlrikeFischer I think it's a general BibTeX problem, because it's not able to do the correct matching due to \{. – egreg Oct 25 '17 at 13:23
• Yes but in the end it means that either revtex would have to sanitize the complete footnote to get a bibtex compatible entry (imho difficult or impossible) or the user has to be careful and avoid or protect problematic content (regardless if revtex uses quotes or braces for the bib entry). – Ulrike Fischer Oct 25 '17 at 14:02