Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Using the verbatim environment inside an \enumsentence fails.

Here is a MWE:

\documentclass{article}
\usepackage{lingmacros}
\begin{document}
\enumsentence{
\begin{verbatim}
foo
\end{verbatim}
}
\end{document}

I can do a workaround using \texttt{ }, but then I have to escape a bunch of funny characters and in general I'd prefer verbatim for this.

Any suggestions?

share|improve this question
    
What are the characters you have to escape? Can you make a "real life" example? –  egreg Dec 8 '12 at 10:02
    
in this example, i was working with many underscores, I had used vim s/_/\_/g and s/$/\\\\/ to put the underscores and explicit line breaks throughout. But I was hoping for a more elegant solution. \cprotect seems to work without issue for this. –  apexofservice Dec 8 '12 at 21:18
    
Do you need typewriter type? Other special characters? –  egreg Dec 8 '12 at 21:24
add comment

1 Answer

up vote 2 down vote accepted

Use the package cprotect. Here is the updated code:

\documentclass{article}
\usepackage{lingmacros}
\usepackage{cprotect}
\begin{document}
\cprotect\enumsentence{
\begin{verbatim}
foo
\end{verbatim}
}
\end{document}

FYI, here is where I found the answer to your question.

share|improve this answer
    
thanks, \cprotect works! –  apexofservice Dec 8 '12 at 21:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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