hyperref and \verb

barbara beeton bnb at tug.org
Wed Jan 29 16:10:06 CET 2020

On Wed, 29 Jan 2020, Fernando Gouvea wrote:

> I am working on a book, and the publisher has just (as I was finishing)
> asked me to use \hyperref to make links active on the electronic version.
> Adding \usepackage{hyperref} and making no other changes, I get a new error
> message:
>       ! LaTeX Error: \verb illegal in command argument.
>       See the LaTeX manual or LaTeX Companion for explanation.
>       Type  H <return>  for immediate help.
>        ...                                              
> This happens because I used something like \verb|Qp| in a footnote. Despite
> the error message, the resulting pdf looks ok. Of course, I haven't actually
> tried using any hyperref functionality yet. Can anyone explain what is going
> on?

\verb is just too deeply nested.  You can try changing that to
\protect\verb to delay its expansion, or change it to \texttt{Qp}
which should produce output that looks the same.
 						-- bb

> Thanks,
> Fernando
> [...]

More information about the texhax mailing list.