63

I want to employ a \verb command in a footnote. But, when I run pdflatex on

\documentclass{article}

\begin{document}

I want this.\footnote{\verb|But, it does not work!|}

\end{document}

I get this:

! LaTeX Error: \verb illegal in command argument.

How can I do what I am after? (I know that I could just use \footnote{\texttt{But, I lose the semantic mark-up.}})

lockstep
  • 250,273
vanden
  • 30,891
  • 23
  • 67
  • 87
  • You want to do something that LaTeX doesn't allow you to do. You either (a) go in and mess with the code under the hood to allow you to do it or (b) work around it. For (b), it'd be nice to know what "semantic mark-up" you are after. – Willie Wong Jul 26 '10 at 22:53
  • 6
  • I know that LaTeX doesn't allow it. (a) That is in the question. (b) I'm trying to help seed in the beta.

  • I'm puzzled by your (b). As I understand it \texttt{} is formatting mark-up, and \verb|| is semantic mark-up. (You mark something as \verb and leave the formatting of it up to LaTeX and your documentclass.

  • – vanden Jul 26 '10 at 23:04
  • 6
    \verb is absolutely the opposite of semantic markup it is just a low level instruction to the TeX parser to change the lexical analysis of its input (which is why it doesn't work in macro arguments where the input has already been tokenised). It doesn't say anything about what the content means, just that \ and {} should be parsed in a different way. – David Carlisle Dec 18 '12 at 12:22