{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
4answers
140 views

Change font size of the verbatim environment

I want to apply small fonts inside the Verbatim environment e.g. {\small \begin{Verbatim} 1 double x, y; 2 double z, w; 3 main(); 4 return 0; \end{Verbatim}} Before the command \small ...
6
votes
2answers
51 views

Seemingly trivial: verbatim, newenvironment, and colorbox

I am, once again, trying to achieve what seems like a trivial goal. I want to use \newenvironment to define a verbatim environment with a background color. I need to define my own environment because ...
4
votes
0answers
27 views

How can I replicate verbatim's letter spacing in listings? [duplicate]

I was trying to imitate the code listings in the book Mathematical Recipes in C, I understand that it uses the CM TT font. What I am interested is in the proportion between the text and the code, and ...
16
votes
1answer
129 views

Why is there a \null in \verb?

In source2e.pdf, the definition of \verb is \def\verb{\relax\ifmmode\hbox\else\leavevmode\null\fi \bgroup \verb@eol@error \let\do\@makeother \dospecials \verbatim@font\@noligs ...
2
votes
1answer
44 views

Source code customization for specific words?

I'd like to highlight some specific words for HTML5 code manually in LaTeX. In other words, I don't want to define an exact structure for highlighting the language, but do the highlights only for the ...
3
votes
1answer
34 views

put a link in the document

I'm using the following code snippet to put a link in the document: \begin{footnotesize} \begin{verbatim} http://vlm1.uta.edu/~zhangzhong/fall_detection/ \end{verbatim} \end{footnotesize} But the ...
4
votes
2answers
67 views

Indent content of verbatim / lstlisting environment relative to containing environment

I want the content of \verbatim to be indented relative to the actual indent of \verbatim, not the exact number of spaces. For example, I like to indent at sections to make the LaTeX source more ...
3
votes
0answers
58 views

ConTeXt: Double or Triple Hyphen are Interpreted inside Verbatim Blocks

For example: \definetyping [code] [numbering=line, bodyfont=small, before={\startframedtext[width=\textwidth]}, after={\stopframedtext}] \startcode <-- \stopcode will produce < ...
7
votes
1answer
173 views

© not handle correctly by a verbatim

Is there a reason why the following verbatim section doesn't work as expected: \begin{verbatim} © copyright blahblah ..... \end{verbatim} In fact I get: Âl’ copyright blah blah Instead of the ...
7
votes
4answers
166 views

how fancyvrb background color fill completely with fillcolor?

I'd like the whole Verbatim (fancyvrb) block to have a background color. How do I do it? The fancyvrb package does define a fillcolor -- but that only colors the area around the margin -- not the ...
3
votes
3answers
156 views

Verbatim frame latex with no waste

I have a frame/boarder round my Verbatim environment however the frame is extended to the page side, thus alot of wasted space. The following is my code: \begin{Verbatim}[frame=single] s=0 ...
4
votes
1answer
74 views

Adding Non-breaking space after single character in text mode

Is it possible in LaTeX (2e) to create macro or other processing command that will add non-breaking space after single character in text mode? Example: A new example here will add a "tilde", after ...
1
vote
1answer
62 views

How to escape properly and output regex in latex?

Escaping regex is a heck of a work on LaTeX. How should I write in latex syntax such that I can output the following regexes: ^\(?\s?\w{1,5}\s*[):.]\s* and [\[\(].{1,}[\]\)] I've tried ...
8
votes
3answers
205 views

How can I have numbered verbatim environments?

How can I have an automatically numbered verbatim environment, just like equations? I tried putting it like this: \begin{equation} \begin{verbatim} bla... bla... bla... \end{verbatim} \end{equation} ...
3
votes
2answers
45 views

Decreasing font size in verbatim

How can I modify the following command to make it work? \newcommand{\code}[1]{\begingroup \fontsize{10pt}{10pt}\selectfont \begin{verbatim} #1 \end{verbatim} \endgroup} I currently get the ...
1
vote
1answer
97 views

verbatim environment does not work with beamer

I want my Java code to be typeset in a monospaced font, so I am using the verbatim environment. LaTeX commands are highlighted in Eclipse, but as soon as I use the verbatim environment everything ...
3
votes
2answers
119 views

create macro to verbatim output of command [closed]

The code \newcommand{\dosomething}[1]{#1 #1} \expandafter\verb\expandafter+\dosomething{blub}+ produces the verbatim-output blub blub. Now I want to create a macro \myverb for the second line, ...
7
votes
2answers
61 views

Break line within a macro while writing to a file

I am trying to use (La)TeX as a macro pre-processor for a programming language. My idea is to use the VerbatimOut environment from the fancyvrb package to output essentially verbatim text, but using @ ...
11
votes
3answers
421 views

How to make this verbatim code look nice?

I am doing some slides using Beamer. One of this slides is pure code \begin{frame}[fragile] \begin{verbatim} > dim(X) #dimension of our matrix X [1] 2194 12276 > length(Y) # length of ...
4
votes
1answer
32 views

Is there a way to format a diff patch block? [duplicate]

I'm trying to inline a few snippets of diff patches, and manually formatting them is a droll - is there a way to do it automatically? In general I want it to look like the following example, but ...
11
votes
2answers
224 views

Splitting verbatim inside figure across pages

I want to include a long section of verbatim text, which is too long for a single page, inside a figure with a caption. Unfortunately, when the verbatim environment is put into a figure, it does not ...
2
votes
0answers
31 views

How can I mark a verbatim-part that is gets on it's own page with exact the proper size?

At the moment, I do some documentation for an old database (lucky me). To help people (including myself) understand what it does, I list 5 entries of every table inside of verbatim. But some of these ...
2
votes
3answers
115 views

Printing LaTeX command without compiling it

How could I write a command in LaTeX, so after compiling it will be shown as a text in PDF and not executed? For Example, I would write \it This is how you write in italic and the compiled pdf would ...
3
votes
2answers
63 views

wrapbox with tabular has extraneous vertical space

\begin{wrapfigure}{r}{0in} \begin{tabular}{|p{2in}|} \hline \begin{verbatim} Some stuff here, hi mom abcdefghijklmno \end{verbatim} \\ \hline \end{tabular} \end{wrapfigure} This doesn't quite do ...
3
votes
2answers
163 views

Which package to use for typesetting objective-C source code?

I would like to typeset some source code (~70k lines). The language is Objective-C so it is organized into classes. I would like a table of contents, and page numbers. I would also like each class to ...
5
votes
1answer
65 views

pdfcomment with reserved characters

I would like to include reserved characters such as _ within comments so that I can include file links in comments. If I try to enclose a sentence in a verbatim environment within a pdfcomment ...
1
vote
1answer
60 views

tikz callout shape not working with alltt environment

I want to use the callout shape from tikz in order to explain some elements of a program listed in an alltt environment. But the callout shape is not pointing correctly to the desired element in the ...
3
votes
1answer
53 views

Description definitions and ntheorem

I want to have inline listings in description items, so I used this very nice answer. Unfortunately this hackery destroys my theorem environments with error something's wrong--perhaps a missing \item ...
4
votes
1answer
76 views

Handling a PDF with user text strings

I am using LaTeX to generate descriptive receipts for an online system. I use special character tags and replace these with content e.g. {{ first_name }}. Now, there are several of these and they ...
7
votes
3answers
124 views

Shrink monospaced font in custom (verbatim) environments

I'm redesigning lecture notes for a university class since the students wanted to read the notes on their tablets, e-book readers, etc. I have code blocks in these documents, defined in the cdblk and ...
2
votes
1answer
83 views

Displaying Examples Side By Side [duplicate]

I am currently learning LaTeX from 'The Not So Short Introduction To LaTeX' and in that book many examples are displayed side by side: $a^2$ 'Left side of page' --------------------------------- ...
3
votes
2answers
765 views

Insert symbols inside verbatim mode LaTeX

I cannot insert mathematics symbols inside a verbatim mode in LaTeX. This how I do: \usepackage{alltt} \begin{verbatim} 1- Train triggers model \( X_{i} \) -> Y_j (X_i: source phrase ...
1
vote
0answers
72 views

Using braces in verbatim environment

I want to put some code in a verbatim environment: \begin{verbatim} data _≥_ : Nat → Nat → Set where ge0 : {y : Nat} → y ≥ zero geS : {x : Nat} {y : Nat} → x ≥ y → suc x ≥ ...
6
votes
1answer
186 views

How to write math symbols in a verbatim?

Basically I have a section that is describing my algorithm in a pseudo code kind of way, and so I want that text to look like the verbatim text except I still want to be able to use math symbols. Is ...
3
votes
1answer
122 views

How to display Euro sign in verbatim mode?

I need to display the Dollar and Euro sign in verbatim mode. This is the code I got: \begin{verbatim} fr_FR: 123 456,78 € de_DE: 123.456,78 € en_US: $ 123,456.78 \end{verbatim} It works with the ...
3
votes
1answer
77 views

define a newcommand that will put text in verbatim

For making a report of my work, I am facing a problem of writing varbatim too frequently. So, I need a workout. Say, I define a newcommand as (for example) \newcommand{\uve}{\textbf{In verbatim}} ...
11
votes
4answers
143 views

How can I indent verbatim blocks?

I have blocks surrounded by \begin{verbatim} and \end{verbatim}. I'd like to indent these about half an inch. I'm using pandoc to write pdfs via XeLaTeX and the default.latex pandoc template, so I'd ...
31
votes
2answers
412 views

Viewer-independent copyable spaces at the beginning of a line?

I need to include a couple of Python code listings, where the indentation of the lines (using some number of spaces) is significant. I would like for the code listings to be copyable, so the spaces at ...
6
votes
1answer
77 views

boxed verbatim environment disappears

I want to center a box containing a verbatim environment. The (almost)MWE below is my attempt to use the answer at center /verbatim text in /figure . \documentclass{article} \usepackage{verbatimbox} ...
5
votes
1answer
148 views

Code highlighting for imported source files

I have several source code files that I would like to include in my document. I know that I can use verbatiminput to get the lines from the file, and use lstlisting to highlight the code, but I ...
1
vote
0answers
105 views

How can I insert verbatim text to beamer notes?

I would like to inset Verbatim text to beamer notes. When using Verbatim in beamer notes, I got errors. For your information, below is what I would like to do. \begin{frame}[containsverbatim] ...
4
votes
1answer
151 views

ConTeXt: How to achieve fine-grained font size control over the \type command?

In below minimum working example, I was able to configure the bodyfont in \setuptyping to 9.5pt. However, ConTeXt \setuptype documentation is not as detailed to explain me how I can achieve the same ...
4
votes
2answers
65 views

Width of tab character

I'm using the verbatim environment to format some code. Is there a way to set the desired number of spaces represented by a tab character? What is the default number of spaces?
7
votes
1answer
90 views

Two block commands in \newenvironment [duplicate]

What is wrong with following document? \documentclass{article} \usepackage{xepersian} \usepackage{verbatim} \newenvironment{code} {\begin{latin}\begin{verbatim}} {\end{verbatim}\end{latin}} ...
8
votes
4answers
215 views

Verbatim, wrappable and Unicode text included from a file

I am trying to output several megabytes of UTF8 text into a printable format. As enscript and friends don't like Unicode, this Unix SE question soon turned to LaTeX. Summary of requirements: ...
7
votes
1answer
64 views

Modifying alltt

I want to create an environment which wraps alltt in such a way that the character ' is replaced by \textquotesingle wherever it occurs inside the environment but is as normal elsewhere. I have tried ...
1
vote
1answer
440 views

Wrap lines in verbatim

I just started to learn LaTeX, and I have to do some documentation with it. However, the guy editing the TeX manuscript of the documentation before me didn't pay attention to word wrapping, so long ...
5
votes
3answers
184 views

Underscore vs. subscript in new command with fancyvrb

I'm using fancyvrb to have math in my verbatim environment as suggested here. I use a math escape command like so: \newcommand{\m}[1]{$#1$} But underscores are not being type set as subscripts, they ...
6
votes
2answers
119 views

How to add a phantom character to the beginning of a verbatim block

I am trying to understand the commandchars of fancyverb's Verbatim: \documentclass{article} \usepackage{fancyvrb} \begin{document} \phantom{foo} \begin{Verbatim}[commandchars=\\\!\!] \phantom{bar} ...
2
votes
1answer
108 views

Can I use Beamer's \alert<x>{…} inside fancyvrb Verbatim with overlay?

I would like to use Beamer's \alert<x>{...} command inside of a Verbatim environment (from the fancyvrb package) to highlight the text. I've found that when the \alert command is inside the ...