{verbatim} is about macros and environments like “\verb” and “verbatim” which implement some form of verbatim mode, i.e. change the {catcodes}. A popular package is {fancyvrb}. For questions about the {listings} or the {minted} package, use the respective tag instead.

learn more… | top users | synonyms

8
votes
1answer
330 views

todonotes and verbatim

I want to put some comments about actual code into my document, and for that I thought I'd use \verb or \begin{verbatim}, but it turns out that the todonotes package does not like that: ...
3
votes
1answer
455 views

Command right after closing a verbatim environment

I need to use a form of a verbatim environment, so that after the closing of the environment, there immediately follows another command. In particular I need something like the following - assuming ...
24
votes
2answers
4k views

Ensure verbatim code block is copy/paste-able

After rendering a document containing this code block \begin{verbatim} if [ ! -d .git ]; then git init; fi # Initialises a new Git repository, if doesn't already exist. if [ ! -f README.md ]; ...
5
votes
2answers
2k views

How to cross-reference inside of a verbatim (or listings) environment

I would like to reference other parts of my document (e.g. equations, figures) inside of some source code. Is there an escape sequence such that \ref will be parsed instead of printed as a literal ...
2
votes
1answer
1k views

Change background colour of {verbatim} environment

In an existing document which is not to be modified (except for the preamble), all instances of \begin{verbatim}...\end{verbatim} should have their contents rendered not only in a monospaced font but ...
2
votes
2answers
444 views

Is it possible to use the verbatim environment in an XY-pic node?

Is it possible to use the verbatim environment (i.e. \begin{verbatim}...\end{verbatim}) in an XY-pic node? If so, please could you provide a MWE (Minimal Working Example)? Update for those who want ...
4
votes
0answers
262 views

Is it possible to use the `verbatim` environment in a dot2tex node?

Is it possible to use the verbatim environment (i.e. \begin{verbatim}...\end{verbatim}) in a dot2tex node? If so, please could you provide a MWE? Update: this is the closest I've got so far: ...
3
votes
1answer
2k views

Alternative way to print source code [duplicate]

Possible Duplicate: Syntax Coloring in LaTeX I want to add source code of my program in document but verbatim really bugs me. All that ugly fonts and stuff.
2
votes
1answer
446 views

Tufte-Latex sidenote breaks indentation in alltt

I'm trying to the the alltt environment in tufte-book. My problem is that \sidenote seems to break the indentation in alltt. \documentclass{tufte-book} \usepackage{alltt} \begin{document} ...
3
votes
0answers
617 views

Xelatex, verbatim and hyphenation [closed]

I have the following problem with XeLatex, Russian language, hyphenation and verbatim. Consider the following tex file (text below). It is compiled with XeLaTex, and before verbatim hyphenation is ...
14
votes
2answers
1k views

LaTeX Verbatim Source Code Beside the Typeset Output

I am a beginner to LaTeX, and I am reading Leslie Lamport's A Document Preparation System. In various places of his book, he puts the LaTeX source code beside the output obtained by running latex on ...
7
votes
1answer
2k views

Customize \verb!…! output in beamer

I would like to change my verbatim throughout a beamer presentation in the preamble. Actually I would like to have it more or less like on slide no. 9 here. I am using verbatim usually with ...
9
votes
4answers
280 views

\verb in csquotes

The following code gives me an error: \documentclass[ngerman]{article} \usepackage{babel,csquotes} \begin{document} \enquote{\verb|foo|} \end{document} I guess this is the classic "you can't use ...
4
votes
1answer
941 views

How to handle special characters in LaTeX?

I am working on one file which has some special chacters. König IR : KA}unig ,K ~ A}unig % : Comment in latex (so no text after this %) - : escape I get different output ...
4
votes
1answer
130 views

listing's lst@BeginWrite gobbles '->' and '=>' from input [closed]

I'm trying to write a package that takes verbatim input and appends it to several files. My current approach is based of off an answer by Martin Scharrer to a similar problem. The difficulty arises in ...
10
votes
3answers
924 views

typing \end{verbatim}

I am preparing a presentation in which I want to display the following as it is \begin{verbatim} foo \end{verbatim} For this I used \begin{verbatim} \begin{verbatim} foo \end{verbatim} ...
2
votes
2answers
597 views

Making more easy the itemized of item with tabulation system

Actually, isn’t not really a question. (Since my examinations get close, I don't really have the time to search for a solution to my problems.) Rather than using the common \item, I'd like to use ...
7
votes
1answer
290 views

Typeset text as written (similar to verbatim) within a custom command?

I'm trying to define a new command that puts text in a coloured background, reproduces it exactly how it's defined in the .tex file (in a similar way to verbatim), and won't force me to use ...
7
votes
2answers
1k views

How can I set stretch of verbatim to be different than “global” setting?

In my file I need to use 1.5 line stretch. But, as for verbatim I need it to be 1.0. What should I add to preamble to achieve that? \documentclass{article} \usepackage[nodisplayskipstretch]{setspace} ...
3
votes
1answer
1k views

\pause won't generate extra slides in a containsverbatim frame

It seems that the [containsverbatim] option when applied to a frame prevents beamer from generating intermediate slides if text animation is wanted in it. Only the first step of the animation is ...
7
votes
1answer
3k views

How to force line breaks within a fancyvrb verbatim environment?

Consider the following LaTeX document: \documentclass{article} \usepackage{fancyvrb} \DefineVerbatimEnvironment{example}{Verbatim}{commandchars=\\\{\}} \begin{document} \begin{example} Foo\\{}Bar ...
6
votes
4answers
4k views

Verbatim environment with background color (PDFLaTeX and tex4ht)

I need to make a verbatim environment with gray background color, such as: That needs to work with PDFTeX and tex4ht on an older TeX installation (from 2009 I believe). My approach so far is ...
7
votes
3answers
3k views

Putting in MATLAB codes in a box as figures? [duplicate]

how do I put MATLAB codes in a box or deal with them as if they are figures? Is there a way to do it within LaTeX itself? I am currently using the verbatim environment to present my codes and to be ...
3
votes
1answer
2k views

Custom divider between 2 minipage and lstlisting

I am using the following code to have 2 boxes beside each other for code comparison: \documentclass[12pt]{article} \usepackage{listings} \begin{document} \begin{singlespace} ...
3
votes
1answer
450 views

Color box with outline but some difference

\begin{boxedlaw}{6.4in} \colorbox[HTML]{F8E0E0}{ \begin{minipage}[c]{380px} \begin{center} \begine{verbatim} \# define LM_ENCA 18 //Port0 \# define LM_ENCB 17 ...
8
votes
3answers
511 views

Verbatim in environ’s \BODY

I’d like to print a TeX install guide for different OS, but the most text is the same for all OS. So I build the following \documentclass{article} \usepackage{environ} \newcommand{\mlw}[3]{} ...
10
votes
1answer
2k views

Displaying `\begin{verbatim}…\end{verbatim}` inside the environment verbatim

I would like to display \begin{verbatim}...\end{verbatim} inside the environment verbatim like in the folowing piece of code. Is it possible ? \begin{verbatim} Bla, bla, ...
6
votes
1answer
2k views

Problem with TikZ, beamer and verbatim

I'm trying to put verbatim text inside a node (in a beamer frame): \begin{frame}[fragile]{P} \tikzstyle{cell} = [rectangle, draw, thin , fill=black!10 , minimum size=5mm] \begin{tikzpicture}[node ...
9
votes
1answer
997 views

verbatim environment does not produce monospace

I use quite a lot packages in my document and I cannot find which one's fault is that verbatim does not produce monospaces. Anyway, if I knew this, I have no idea how to solve problems when packages ...
20
votes
3answers
1k views

Highlighting a .diff file

Is there a way to highlight the syntax of a diff file (i.e. by using the listings package)?
11
votes
2answers
964 views

Produce a hyperlinked DOI?

Friends, I'm trying to write a command that prints appropriately hyperlinked DOIs for a bibliography system. Here was my first attempt \newcommand{\formatdoi}[1]{\href{http://dx.doi.org/#1}{#1}} ...
6
votes
2answers
818 views

Define my own short-verb like macro?

I'm trying to define shorthand macros for \texttt that are a bit like the \verb ones. The end result is to do +asdf+ and this have the same effect as \texttt{asdf}. This is like the DefineShortVerb ...
10
votes
2answers
4k views

Inserting LaTeX code into LaTeX

I have problem with adding text into LaTeX document. I have LaTeX document about LaTeX and I need to insert some code snippets. I need to add "\usepackage{musixtex}" as a text, which should be ...
0
votes
1answer
268 views

Redefining \verb to be \url

How can I redefine \verb!! to translate into \url{}? I have to do this to fool Emacs highlighting so it thinks I have \verb, in the background I like \url{} wrapping capability.
6
votes
5answers
14k views

Verbatim environment with correct tab handling and special characters

I'm looking for an environment similar to Verbatim which will allow me to say something like the following code (which uses indentation instead of spaces): \documentclass{article} ...
3
votes
1answer
2k views

Verbatim going beyond borders

I use \begin{verbatim} and \end{verbatim} and have enclosed a Fortran code within it. (I am not using listing for a reason). However, Verbatim is crossing the boundaries. How do I fix this? My ...
3
votes
2answers
529 views

Measuring the width of a verbatiminput block

Is there any way of measuring the width of a VerbatimInput block? In other words, I would like something along the following lines, except that the verbatim data should be taken from an external file ...
4
votes
1answer
2k views

inputenc error with unicode chars and verbatim

I am writing a package where I need to save the contents of several environments in verbatim mode to an auxiliary file. Then the auxiliary file is processed by an external program. In the next ...
17
votes
3answers
2k views

Writing { and } to a file with LaTeX

How can the special characters { and } be written literally to an external file in LaTeX, without being balanced? Obviously the following does not work: \immediate\write\my@outfile{{} ...
12
votes
2answers
5k views

Inline code and short verb with minted

I it possible to use minted for inline code and to add a short verb sing for minted? Like \lstMakeShortInline| in listings.sty? \documentclass{article} \usepackage{minted} \newminted{tex}{} ...
2
votes
2answers
375 views

verbatim text in ConTeXt tables

I want to create a table for a few blocks of source code. In LaTeX, I would do \hline \begin{lstlisting} abc; def; \end{lstlisting} \tabularnewline Is there a way to accomplish something like ...
6
votes
2answers
1k views

How to display accents inside verbatim command

I have the following piece of code: \newenvironment{mylisting} {\begin{list}{}{\setlength{\leftmargin}{1em}}\item\scriptsize\bfseries} {\end{list}} \newenvironment{mytinylisting} ...
6
votes
2answers
1k views

How can I fix verbatim causing an extra newline inside a description list environment?

I'm trying to create a documentation listing similar to that used by MSDN. Here was my first attempt at that: \subsubsection{User Default Page URL} \begin{description} \item[Rationale] This is the ...
11
votes
2answers
2k views

How to change color of some particular environment for entire document

I want to change color of particular environment in document. For example wherever I found verbatim environment or equation environment appears in my tex file. With some global settings, I want to ...
14
votes
1answer
5k views

control vertical space before and after verbatim environment?

How do I control how much vertical space appears before and after a verbatim environment? With the following source (run through pdflatex): \documentclass[varwidth]{standalone} \begin{document} text ...
4
votes
2answers
977 views

verbatim inside subfloat?

When I write the following \subfloat[caption]{\label{fig:xxxx}\verb+xxxx+} I get \verb illegal in command argument. Seems that isn't possible to define a verbatim environment inside a \subfloat. ...
4
votes
1answer
2k views

Including a text file in LaTeX

I write a program by DevC++ compiler and save it by .cpp format, and want to paste the code in my editor, Do I have to paste all the code each time? Is there a way to include the file instead of ...
1
vote
2answers
3k views

How can I fix the path to LaTeX fonts?

I'm using LaTeX on osx via TexLive 2011 and the TextMate bundle. Currently I'm trying to list some code in a document (using verbatim), but I get this error: ! I can't find file `pcrr7t'. ! ...
14
votes
1answer
3k views

Manual highlight of TeX code in a verbatim environment

Friends, I'm stuck with a unusual situation: I'm trying to highlight specific words of a TeX code inside a verbatim environment. I know listings can help me by defining a set of keywords, but in this ...
3
votes
1answer
97 views

Create command that displays input exactly

I want to create a command whose argument is used within a \label{} command. I also want a boolean switch that turns on/off the display of this label for editing purposes. Here is pseudo-code for what ...