4

I would like to use the symbol " inside \verb. Is that possible? For example, in

\verb"abc"defg"

the second " will be interpreted as the end of the verbatim environment though my intention is that the whole string abc"defg is in verbatim.

6

You could use different delimiters for the verb command, such as !

% arara: pdflatex
\documentclass{article}

\begin{document}

\verb!abc"defg!
\end{document}

As detailed in Why can't curly braces be used as a delimiter for \verb? i.e. \verb{foo} you can use any character you like for the delimiter, provided that it isn't *. So, for example, any of the following will work

  • \verb&abc"defg&

  • \verb3abc"defg3

  • \verb^abc"defg^

Of course, the sense in using such delimiters may be questionable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.