Tagged Questions

{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

3
votes
1answer
1k 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 ...
4
votes
2answers
181 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
93 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
537 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
41 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 ...
12
votes
2answers
346 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
40 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
214 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
98 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
390 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
75 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
96 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
80 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
78 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
179 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
124 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
3k 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 ...
2
votes
0answers
203 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
971 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
252 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
110 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
416 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 ...
35
votes
2answers
657 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
151 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
267 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
238 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] ...
5
votes
1answer
177 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
109 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
104 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
313 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: ...
8
votes
1answer
83 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 ...
3
votes
1answer
1k 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
380 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
171 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
220 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 ...
3
votes
2answers
158 views

Verbatim has different margins than BVerbatim

I am changing some Verbatim blocks to BVerbatim to avoid page breaks in the middle of some short source code examples: \documentclass[a4paper]{book} \usepackage[T1]{fontenc} \usepackage{fancyvrb} ...
7
votes
1answer
148 views

Verbatim code environment dash dash

I have the following environment for displaying code: Which works pretty fine but now I have the problem that -- becomes an en dash inside that environment. For example here: I tried also {-}{-} and ...
5
votes
1answer
140 views

Set line spacing everywhere but in verbatim blocks

Is it possible to change the linespacing of a document except for inside verbatim blocks? \usepackage{setspace} \onehalfspacing The above results in more readable paragraphs, but the code snippets ...
14
votes
2answers
412 views

Getting verbatim with soft grey background, as in tex.stackexchange

Given a verbatim as on below, \begin{verbatim} This is an awesome verbatim \end{verbatim} which is displayed with no background on the compiled pdf page : This is an awesome verbatim I would ...
3
votes
1answer
115 views

verbatim with Arabic script

I try to put together guidelines for linguists. One part concernes typesetting right to left text with the bidi package. I want to use verbatim for the code, but the Persian characters are not printed ...
9
votes
2answers
7k views

Verbatim in beamer showing error: “File ended while scanning use of \@xverbatim.”

I am using Texmaker and MiKTeX on Windows 7. I have the following beamer code, \documentclass{beamer} \theme{AnnArbor} \begin{document} \begin{frame} \begin{verbatim} ...
9
votes
2answers
280 views

How can I encode the current document as a QR code with pst-barcode?

\documentclass{article} \usepackage{pst-barcode} \begin{document} \begin{pspicture} \psbarcode{\input{\jobname.tex}}{}{qrcode} \end{pspicture} \end{document} I tried placing \expandafters before ...
9
votes
1answer
1k views

How to typeset LaTeX code inside a Table environment?

I wanted to typeset LaTeX code directly into my document, but without it doing something, i.e., I just want to show my code in the output. Now, I know there is the verbatim environment for code, as ...
4
votes
2answers
150 views

Shrinking verbatim text

Heiko Oberdiek helped me a lot by finding a solution for shrinking text when needed. I want to apply this method to verbatim text as in the example below, but this is somehow forbidden (Something's ...
5
votes
3answers
140 views

How could a verbatimtab environment in a figure environment be resized (perhaps using the package adjustbox)?

How could a verbatimtab environment in a figure environment be resized (perhaps using the package adjustbox)? I have some code something like the following: \begin{figure}[htb] \centering ...
6
votes
2answers
339 views

Bold monospace font extra-large

I would like to print very large (e.g., font size 43) monospaced bold text. The methods I know don't seem to go together: \documentclass[10pt, a4paper]{article} \usepackage{anyfontsize} ...
6
votes
1answer
148 views

Formating verbatim (not using listing package)

Considering the following verbatim: \begin{verbatim} ...
3
votes
3answers
195 views

How to put lots of brackets

I want to show all valid bracketed strings made from {} [] (). This is the intended output: {[()]} {[]()} {[]}() {([])} {()[]} {()}[] {}[()] {}[]() {}([]) {}()[] [{()}] [{}()] [{}]() [({})] [(){}] ...
3
votes
1answer
227 views

Hyphenation when using \verb command

I'm having a problem using \verb command. Usually when I want some verbatim font in the current line (not in a new paragraph) I use the \verb command, not the verbatim environment. So, when I use ...
2
votes
1answer
167 views

Handle % character in verbatim inside a grey box

I found this snippet on the internet which is used to produce a text area inside a greybox. \newcommand\greybox[1]{% \vskip\baselineskip% \par\noindent\colorbox{lightgray}{% ...