Tag Info

New answers tagged

4

I suggest a look at the fancyvrb package, which introduces several customization facilities. The main environment is called Verbatim, so \documentclass{article} \usepackage{fancyvrb} \begin{document} \begin{Verbatim} \begin{verbatim} This is a verbatim block. \end{verbatim} \end{Verbatim} \end{document} will work flawlessly. There's still a problem if ...


9

verbatim is a very special environment which looks for the exact string \end{verbatim} to end it. Unlike other latex environments you can't use \env ...\endenv instead of \begin{env} ...\end{env} with verbatim. If you really want to start with \verbatim then you must do something like this to get around the errors due to the various latex settings for ...


9

Package verbatim supports the creation of own verbatim environment, see section 2.1 of the package documentation. The following example defines environment metaverbatim in order to allow \begin{verbatim} and \end{verbatim} inside the verbatim block: \documentclass{article} \usepackage{verbatim} \newenvironment{metaverbatim}{\verbatim}{\endverbatim} ...


1

The listings package has a make option: \documentclass{article} \usepackage{listings} \begin{document} \begin{lstlisting}[language=make] # I am a comment CC=g++ # CFLAGS options passed to the compiler. CFLAGS=-c -Wall all: hello hello: main.o factorial.o hello.o $(CC) main.o factorial.o hello.o -o hello clean: rm *.o hello ...


1

Based on David Carlisle's answer, I defined these macros, which allow almost verbatim input (I still have to escape a few characters). \def\beginlisting{% \par\vskip\baselineskip% \begingroup% \tt\obeylines\obeyspaces% \catcode`\{12\catcode`\}12% } \def\endlisting{% \endgroup\par% \vskip\baselineskip% } @ Let's say we want to write ...


2

@ Let's say we want to write a \.{CWEB} program that manipulates \.{bibtex} files. How can we do a multiline verbatim code listing? Like this? \begingroup\tt\obeylines\catcode`\{12 \catcode`\}12 @@Book{Author:2000, author={Last,First}, title={Title}, year=2000, } \endgroup



Top 50 recent answers are included