For example
\footnote{\verb+https://en.wikipedia.org/wiki/Constitution_of_France+}
treats _
as meaning a subscript and produces o
as a subscript of n
and F
as a subscript of f
.
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.
Sign up to join this communityFor example
\footnote{\verb+https://en.wikipedia.org/wiki/Constitution_of_France+}
treats _
as meaning a subscript and produces o
as a subscript of n
and F
as a subscript of f
.
As a general answer the memoir
class (a superset of book
, report
, article
) has a \verbfootnote
macro which lets you include verbatin material in a footnote.
% verbfprob.tex SE 564552
\documentclass{memoir}
\begin{document}
Some text%
\verbfootnote{Footnote with a \verb!verbatim entry! as shown}
followed by more text.
\end{document}
\verb
does not work in the arguments to any command. The simplest approach is to use \texttt
and explicitly escape special characters, e.g.,
\footnote{\texttt{https://en.wikipedia.org/wiki/Constitution\_of\_France}}
although there isn't a simple escape for a backslash so maybe not so simple as you desire.
I have to admit I'm not crazy about the memoir
class solution. It feels to me that memoir
includes a lot of functionality that really should be in packages rather than the document class.
For URLs, there is the url
package as mentioned by Ulrike Fischer in the comment on your question. This has the advantage that it incorporates line breaking in a fashion that we would expect for URLs while \verb
and the \texttt
solution above do not. To do this, you would, somewhere before your footnote do something along the lines of
\urldef{\frenchconst}\url{https://en.wikipedia.org/wiki/Constitution_of_France}
and then in your footnote you could write
\footnote{\frenchconst}
\verb
does not work in the arguments to any command" but the memoir
class, which you dislike, disproves that. Also Knuth's footnote
macro can include \verb
text in its argument. One of the ideas behind memoir
was to reduce the number of packages for most documents.
Sep 29, 2020 at 18:05
\begin{document}
to change classes. memoir
bundles a lot of stuff that would be better unbundled. \verbfootnote
does not actually allow \verb
in an argument, it uses \aftergroup
trickery to make it look like it does.
Sep 29, 2020 at 19:40