I get a strange error with a \Verb
escape in a footnote:
\documentclass{article}
\usepackage{fancyvrb}
\begin{document}
Works inline \Verb!S#Var! but doesn't in footnote.
% \footnote{No really, it doesn't \Verb!S#Var! you see.}
\end{document}
When I uncomment the footnote line, the complaint is:
You can't use `macro parameter character #' in restricted horizontal mode.
Best Answer
Fun exercise.
;-)
With
\detokenize
you can print all characters, except backslashes and%
(actually backslashes are allowed, but they might produce unwanted spaces), so long as braces are balanced.The trick is to modify
\@footnotetext
not to absorb its argument, but just doing\insert\footins\bgroup
, changing the category code of#
(you quite certainly won't be defining commands in a footnote) and calling\do@footnotetext
that will absorb the argument. Somebody might enjoy looking how\regexpatch
does its work on a copy of the original\@footnotetext
.The command
\ttvar
will locally change the category code of#
.Alternative solution.