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
2answers
377 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
95 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
78 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
176 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
115 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 ...
1
vote
0answers
185 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
828 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
239 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
107 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
297 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
644 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
144 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
244 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
213 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
172 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
102 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
101 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
304 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
80 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
346 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
168 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
205 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
152 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} ...
1
vote
0answers
108 views

To modify Verbatim generated by sphinx-python

I would like to define \renewenvironment (later will put it in preamble in conf.py) so that tcolorbox appears around Verbatim code. Here is a sample of Verbatim: ...
7
votes
1answer
143 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
131 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
389 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
113 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
277 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
146 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
135 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
321 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
147 views

Formating verbatim (not using listing package)

Considering the following verbatim: \begin{verbatim} ...
3
votes
3answers
192 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
221 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
164 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}{% ...
6
votes
1answer
440 views

How to scale a verbatim block in a user-defined environment?

In order to produce an ereader-friendly PDF with small page dimensions, I'd like to scale down some oversize verbatim blocks such as program output with lines too long for the small page. Then readers ...
4
votes
1answer
149 views

How to globally set \verb font style to match the default document style?

I would like to set the \verb{} font so to correspond to the current family and size of my document. That is, the output must be indistinguishable by the rest of the text body whatever style is set as ...
8
votes
2answers
181 views

Allow source code to wrap around a figure

I would like to be able to wrap source code around a figure. Here's a MWE that should make it clear what I have in mind: \documentclass{article} \usepackage{wrapfig} \usepackage{listings} ...
3
votes
3answers
2k views

How to set font size for all verbatims in Beamer presentation?

I'm trying to read through the Beamer manual, but I don't even really know what I'm looking for, so please help. How do I change globally (but even if it is a per-frame, it will be still good) size ...
1
vote
0answers
50 views

displaying tex file from external file [duplicate]

I have som .tex with are input for a program, how do I display this files? Is there any way to input it, or do i have to write it alle in or make a screen shot?! I'm gonna be chaining these files a ...
1
vote
1answer
127 views

Using `minted` environment inside a `tabu` table

I am trying to use a piece of highlighted code using the minted package inside a tabu table: \documentclass{article} \usepackage{minted} \usepackage{longtable} \usepackage{tabu} \begin{document} ...
4
votes
1answer
158 views

Tikz + Verbatim + Sphinx , output drawn twice with slight offset. Works great Tikz + Verbatim

I'm working on a piece of software that outputs IPython Notebooks as tex documents. One of my requirements is to be able to draw code input output blocks that look like the Notebook's UI. ...
5
votes
1answer
176 views

Getting Math Operators to work in verbatim

I'm very new to Latex and I'm looking to simply have math operators appear with in verbatim tags as follows: \begin{verbatim} 24: max:=0 25: for i:=n downto 1 do 26: found:=false 27: ...