开发者

Word wrap in verbatim environments [closed]

Closed. This question is off-topic. It is not currently accepting answers.

Want to improve this question? Update the question so it's on-topic for Stack Overflow.

Closed 9 years ago.

Improve this question

I noticed t开发者_高级运维hat LaTeX's verbatim environment doesn't do word wrapping. How do I get it to word wrap verbatim text?


Essentially you can’t.

But the listings package, whose actual purpose is to format source code, does support word wrapping. So maybe you can use the listings environment instead.


Here is the full example for the listings package:

\documentclass{report}

\usepackage{listings}
\lstset{breaklines=true} 

\begin{document}

\begin{lstlisting}
some text here
\end{lstlisting}

\end{document}

You might also add the following definitions for line numbering and _background_color:

\lstset{numbers=left, numberstyle=\scriptsize\ttfamily, numbersep=10pt, captionpos=b} 
\lstset{backgroundcolor=\color{gray-5}}
\lstset{basicstyle=\small\ttfamily}
\lstset{framesep=4pt}

Add this for inline code:

\newcommand{\inlineCode}{\lstinline[basicstyle=\normalsize\ttfamily]}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜