0

I have a minimal text with a footnote. Adding \VerbatimFootnotes crashes the file with

! Missing number, treated as zero.
<to be read again> 
]
l.10 blub\footnote{blah}
                      .
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)

The MWE is

\documentclass[a4paper,openany,nobib]   {tufte-handout}   

\usepackage{fancyvrb}   % to define Verbatim environment 
\VerbatimFootnotes      % allow footnotes inside 
                         

\begin{document}
 
blub\footnote{blah}.


\end{document}

The error does not occur with documentclass article.

I use LuaHBTeX, Version 1.17.0 (TeX Live 2023) (format=lualatex 2023.7.3)

1 Answer 1

2

\VerbatimFootnotes does not seem to be compatible with tufte-handout, but \SaveVerb and \UseVerb can be used in this case:

\documentclass[a4paper,nobib]{tufte-handout}
\usepackage{fancyvrb}

\begin{document}

\SaveVerb{latex}|\LaTeX\ book|
blub\footnote{\UseVerb{latex}}

blub\footnote{blah}

\end{document}

The following solution is easier to use, in which the \cMakeRobust command of the cprotect package is used instead of fancyvrb.

\documentclass[a4paper,nobib]{tufte-handout}
\usepackage{cprotect}
\cMakeRobust{\footnote}

\begin{document}

blub\footnote{\verb|verb text|}

blub\footnote{blah}

\end{document}
3
  • I tried your suggestion, it works here, but my case is the tex code produced by pandoc from markdown files. I need a solution which works with \footnotes (ie. sidenotes) automatically.
    – user855443
    Commented Jul 15, 2023 at 16:48
  • @user855443 I have updated my answer. Commented Jul 15, 2023 at 18:47
  • thank you; I see the improvement and will use it, unless some other solution does not require special treatment in the text. My preference is something which can be added to the preamble and nothing in the text. the footnote is produced by \autocite from a markdown source. Sorry for not having stated this initially.
    – user855443
    Commented Jul 15, 2023 at 21:55

You must log in to answer this question.

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