# Displaying a (set of) control sequences in verbatim

I want to have some code (or package, or documentclass) that I can put in the header of the Latex document so that when compiling it reads certain commands in verbatim.

For example: all cross references like \cref \eqref etc should be displayed in verbatim if I turn that code on, but if I remove it, I compile the document including these control sequences. Ideally that would work for the inline math environment, too.

It feels like their must be an easy way to do, yet I am unable to find it.

UPDATE: (found decent workaround) So far I have been able to achieve a slightly more sophisticated workaround using ideas from here: Is there a way to produce \cite{xx} as it is in the generated PDF file?. I have a proofread.sty that looks like this

\AtBeginDocument{
\catcode_=12
\begingroup\lccode~=_
\lowercase{\endgroup\let~}\sb
\mathcode_="8000
}
\usepackage{twoopt}
\renewcommand{\foo}[1]{\textbackslash foo\{#1\}}
\renewcommand{\footwoopt}[3][\empty][\empty]{\textbackslash foo[#1][#2]\{#3\}}


for all command foo that I have. The first part solves problems with entering math mode if there are underscores in labels. (see Underscore in textmode vs mathmode)

The twoopt package and the associated control \footwoopt deals with potential optional arguments.

I am not entirely happy with this solution (since I still have to redefine all handles, the math thing is anoying, and I am afraid it is not very robust), but for now that works.

Some background: I want to hand the paper to someone that operates in MS Word. If she suggests changes (using MS Word track cahnges), I want to copy paste entire paragraphs back into the latex file. I am aware that Latex/Word compatibility is not the best, but there is no other way.

I am looking for an efficient way to get comments on the text into latex without losing crossreferences or control sequence from the copy-pasting exercise.

My workaround so far is flagging all in line commands putting \\$ in front of it and then replacing them one by one afterwards. But that seems ineffecient.

• @Cicada: I was playing around with this, it is close to, but not yet ideal. Ideally, I would get \section{Section Text} as the output. Instead I get sectionSection Text. The closest I got so far was using the \renewcommand{\command}[1]{\textbackslash command\{#1\}} option. Yet there I have two problems: 1. if there are optional arguments (more than 1 in particular) it seems to get messed up. 2. if I had e.g. \section{section_text} I cannot get around the math interpretation of section_text – johaschn Feb 26 at 13:52
• I have updated the question. – johaschn Feb 26 at 14:06
• Getting a tick to display as a tick is a bit tricky: \catcode{=12. – Cicada Feb 27 at 12:50