{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
95 views

Using collect to gather content with listings, comments or verbatims

I was looking into a way to set up a project with multiple files, in which several files could declare content to be included in different sections of the main tex document. After this Q&A, I ...
3
votes
1answer
296 views

LaTeX complaining commands in Verbatim

Known Fact: Have read this LaTeX complaining about illegal parameter number With a Verbatim environment, every LaTeX commands will be handled as plain text. However, I need a working command in the ...
2
votes
0answers
111 views

Deciding whether to end a line with a character or not in lstlisting [closed]

I need to write a document where there are written inputs and outputs of unix command line interface software (through bash). For example I need to show something like: $ git log --pretty=format:"%h ...
11
votes
2answers
231 views

Print small TeX code verbatim and render it

To write some documentation, I would like the ability to define a command such as \showcase{x^{y}\in\Omega} which expands to something roughly equivalent to \verb|x^{y}\in\Omega| & ...
3
votes
1answer
206 views

Color Text and BG of Verbatim, without affecting `fancyvrb` line numbers

The MWE below aims to color the text and background of a Verbatim environment. \documentclass{article} \usepackage{fancyvrb} \usepackage{color} \usepackage{calc} ...
7
votes
1answer
132 views

Incorporate asymptote environment into macro

I'm trying to write a macro (ideally an environment, but a command would do) that takes a piece of Asymptote code, displays it in a verbatim environment, and then runs it through an asy environment. ...
3
votes
1answer
298 views

How can I center a Sweave verbatim chunk?

I have a very simple sweave chunk with two lines, like this: <<results=verbatim>>== quantile(foo$bar) @ How can I center this element? I've tried embracing the chunk with \begin{center} ...
5
votes
1answer
157 views

difficulties getting lrbox to cooperate with Verbatim environment

This is a follow up to an earlier question of mine: local commands are not recognized when trying to define a wrapper lrbox If I write \documentclass{article} \usepackage{fancyvrb} ...
2
votes
1answer
450 views

Putting math inside a verbatim environment without altering the formatting

In a verbatim code listing, I want to use inline math in comments with the same formatting that I get for inline math in body text. I can use a math environment, but the spacing is weird. In this ...
3
votes
2answers
236 views

One verbatim column in pgfplotstable and a non-verbatim header

I wanted to create a pgfplotstable in which one column would be treated as verbatim. I first tried to straightforwardly use \verb but I almost expected this to fail spectacularly and it did. I found ...
3
votes
1answer
230 views

Indentation with beamer fontspec and alltt

The following document mangles the indentation of the second line of the alltt (the pipe/bar character does not occur under the equals of the previous line). \documentclass[14pt]{beamer} ...
4
votes
1answer
273 views

Replace lstlisting with verbatim depending on a boolean

I use latex2rtf to convert latex documents to .rtf and thence to MS-word (see this thread). To do this, I set up a custom class and limit which packages are used as latex2rtf only accepts a limited ...
2
votes
1answer
281 views

Verbatim Linebreaks

I would like to enable automatic line breaking in Verbatim environment; besides I do not want to use lstlisting as it will not have exactly the same font shapes as Verbatim and some other special ...
9
votes
2answers
3k views

How to center verbatim [duplicate]

\begin{figure} \centerline \begin{verbatim} for (int a = 0; a < 10; a++) for (int b = 0; b < 10; b++) ... \end{verbatim} \caption{C++ code} \end{figure} I would like the figure to be ...
0
votes
1answer
61 views

Is there a package (or command) to escape filesystem paths? [duplicate]

I see this is one option: c:$\backslash$subd1$\backslash$subsubd1 for representing c:\subd1\subsubd1 is there something that leaves the TeX a bit more human-readable, such as ...
12
votes
1answer
1k views

Changing font in tabular

I desperately need someone's help. For the past hour I was trying to perform a task so diabolically difficult, even the Hercules himself couldn't achieve: change the freaking font in a table. My ...
4
votes
1answer
2k views

Automatically wrap the text in verbatim

In tex environment, when I try to use the verbatim function using verbatim packages, sometimes the longer text in the line tend to be cut off. How can I resize the text to fit into the line or ...
7
votes
1answer
236 views

How to write “a” in semiverbatim environment with ngerman without writing “{}a”?

\documentclass{beamer} \usepackage[T1]{fontenc} \usepackage{lmodern} \usepackage[utf8]{inputenc} \usepackage[ngerman]{babel} \begin{document} \begin{frame}[fragile]{Umlauts} \begin{semiverbatim} ...
6
votes
2answers
111 views

How do I get a token list with an end-of-line character in it?

The context of this question is that I have a command defined using xparse that slurps in a verbatim argument which can be long. I want to do a replacement on the resulting token list, but the token ...
2
votes
1answer
107 views

Sweave.sty causing error in verbatim environment?

folks-- The following throws an error, shown below \documentclass{book} \usepackage{Sweave} \begin{document} \begin{verbatim} data ds; infile 'dir_location\filename.csv" ...
2
votes
1answer
89 views

Import author list from a txt file in latex

I'm trying to import author list to my latex article. But keep getting errors. Here is my code: \documentclass{article} \usepackage{verbatim} \title{\verbatiminput{title.txt}} ...
0
votes
0answers
71 views

verbatim environment fails on ' and `? [duplicate]

\begin{verbatim} infile 'dir_location\filename.csv' delimiter=","; \end{verbatim} throws an error on the first '. What the H?
6
votes
2answers
481 views

Highlight \verb in inline text

I'm new in LaTeX and I'm searching for solution to highlight verbatim text inside paragraph (for example, it is like on this page, where code is highlighted). Can anyone help me with this? Let say, ...
3
votes
1answer
452 views

Tilde in verbatim

I am writing a manual for an R file in which expressions like this are common: lm.1 <- lm(y ~ x1 + x2) I will be enclosing code samples in a verbatim environment but this doesn't work properly ...
3
votes
2answers
2k views

Change typeface of verbatim environment

I am new here and the following code is what I am testing. Is it possible to change the typeface of the words from a .txt file? Thank you for any kind help! \documentclass[a4paper]{article} ...
3
votes
1answer
400 views

How to make verbatim text in multicols environment not overflow to other columns?

I prefer to use \begin{multicols}{2} over \documentclass[12pt,twocolumn]{article} so I can control when to have 2 columns and when not. The problem comes when using ...
2
votes
1answer
82 views

Verbatim environment with catchfilebetweentags package

I would like to use a verbatim environment inside an ExecuteMetaData call from the catchfilebetweentags package. The use case is that my econometric software creates a fixed-width table that I don't ...
1
vote
1answer
103 views

Extend keyword list for fancyvrb / listings, based on a given language

I use fancyvrb and listings packages, and I have defined a language scala, which is the default to use. In one occasion, I have an extension of that language, escala, which adds additional keywords. ...
8
votes
2answers
304 views

How to prevent angle brackets beautification in semiverbatim environment?

\documentclass{beamer} \usepackage[T1]{fontenc} \usepackage{lmodern} \usepackage[utf8]{inputenc} \begin{document} \begin{frame}[fragile]{Angle Brackets} ...
4
votes
1answer
479 views

How to copy/paste from lstlistings? [duplicate]

I'm trying to write code in a LaTeX document that can be copy/pasted from an outputted pdf using Adobe Reader and that also word wraps, rather than breach the right margin. I've found that in ...
8
votes
1answer
110 views

Declare additional Unicode characters in verbatim environments in a Pandoc-generated file

I generate a PDF document via LaTeX with Pandoc. I want to use some additional characters in verbatim environments that are not available by default. Here's a sample input: Math: $\downarrow$ ...
1
vote
0answers
75 views

How can I put \cbstart…\cnbend inside \begin{Verbatim}…\end{Verbatim} in LaTeX [closed]

I am trying to place a changebar outside a block of Verbatim text in LaTeX and it barfs at me every time. \cbstart \begin{Verbatim} blah blah ...blah blah... \end{Verbatim} \cbend Results in: ! ...
4
votes
1answer
63 views

Use of " in verbatim mode

I would like to use the symbol " inside \verb. Is that possible? For example, in \verb"abc"defg" the second " will be interpreted as the end of the verbatim environment though my intention is that ...
3
votes
2answers
169 views

How to do \newcommand{\filepath}[1]{\verb!#1!}?

I want to define a command \filepath so that I can use \filepath{foo_bar.cpp} and it is printed in monospaced font. Also, why does this not work? I get strange errors: ...
4
votes
1answer
224 views

How to use verbatim in figure caption (\captionof)? [duplicate]

I want to use verbatim in a caption of a figure. I have tried the cprotect package but it seems to work only with \caption and not with \captionof. Is there a workaround? \documentclass{scrbook} ...
6
votes
4answers
571 views

Is it possible to use a non-monospace font in verbatim environments?

I know it runs contrary to a lot of the point, but I'd like to experiment with different fonts to see which I like better. I can't seem to find any reference to a way to do this, if it's at all ...
1
vote
1answer
280 views

minted Environment Inside minipage Environment

I am having to use the minted environment inside a minipage environment quite often in my document. I wanted to write a new environment for doing this, but since minted isn't designed to be included ...
3
votes
1answer
650 views

How to underline text in verbatim environment?

Am I missing something, or is it simply not possible to underline text within a verbatim environment? \begin{verbatim} I want to underline the following word: word \end{verbatim} I guess I could ...
4
votes
1answer
64 views

Tabular in dtx documentation

How to make table in .dtx documentation with vertical bars? % \begin{tabular}{c|c} % |sf| & \emph{mathsf}\\ % \end{tabular} fails, because |foo| is magic for verbatim.
3
votes
1answer
202 views

How to combine framed and listings packages in new environment

I always use this LaTeX code to display a source code in my article. \begin{listingbox}{VB style} \begin{singlespace} \begin{lstlisting}[style=BASIC] Private Sub Form_Load() Dim tex As String ...
4
votes
1answer
271 views

How to make a text { in alltt

I am trying to type computer code in my document using the alltt environment. Some symbols, such as ' and {, do not appear in the document the way they do in the code. I solved the problem with ' by ...
5
votes
1answer
158 views

How to make letter spacing in verbatim/fancyvrb look like listings

I've just noticed that the spacing between letters is different in verbatim vs. lstlisting environments: Given that I add the option columns=flexible to the lstlisting environment, the spacing in ...
10
votes
2answers
162 views

Preserving (and Controlling) Expandedness

In most cases, by the time output gets to your screen, arguments are fully expanded and my question is moot. But sometimes (verbatim being a common example), one wishes to operate on arguments with ...
4
votes
1answer
250 views

Beamercolortheme: How to set default color for all verbatim?

I want to change the color of all verbatim text in an existing beamer presentation. How do I do this easily? I know how to use colored verbatim text in general, and I found a lot of suggestions here ...
7
votes
1answer
113 views

Purpose of \do@noligs in LaTeX verbatim environment

I'm trying to figure out how the verbatim environment works. In the basic LaTeX file latex.ltx I find the following definition (line 4037): ...
3
votes
2answers
249 views

Insert a character in the beginning of each line in a special verbatim environment

How can I insert a special character or a symbol in the beginning of each line in a verbatim environment? In particular, there is a constraint that applies to the verbatim environment: it must be of a ...
2
votes
2answers
306 views

How do I define a custom verbatim command?

I'm not quite sure how to describe this, but I want to create a custom command that treats its input as verbatim and allows some control of the output. In pseudocode, I want: ...
2
votes
2answers
1k views

How do I get selective bold in Verbatim? [duplicate]

I previously wrote a computer professional book in which I showed what the user typed on the console and the computer's resultant output. The way I liked to do this was with everything in courier and ...
5
votes
4answers
1k views

Defining a new environment extending a verbatim environment

Why is it not possible to define a new environment that extends a verbatim environment? Consider, e.g.: \documentclass{article} \newenvironment{myverbatim}{\tiny\begin{verbatim}}{\end{verbatim}} ...
4
votes
1answer
4k views

LaTeX getting “Missing } inserted” error

I'm getting "Missing } inserted" error, when compiling with pdflatex and I really don't understand why. This is occurring in a beamer frame. Maybe someone comes up with something useful. ...