{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

6
votes
1answer
151 views

Formating verbatim (not using listing package)

Considering the following verbatim: \begin{verbatim} ...
3
votes
3answers
206 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
230 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
170 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
507 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
162 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
191 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
138 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
165 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
186 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: ...
5
votes
2answers
113 views

How to locate the verbatim text in centre of the page?

Here is an code that i want to display in verbatim mode. But the displayed code is locate at the left of the page. \begin{singlespace} \begin{verbatim} Imread('filename'); \end{verbatim} ...
8
votes
1answer
169 views

Formatting code fragments extracted from file with minted

I would like to use the catchfilebetweentags package to grab code snippets from a source file and use minted to highlight them. Imagine I have the following in program.scala: //<a def ...
3
votes
1answer
113 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
344 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
118 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
238 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
220 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
134 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
325 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
166 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
506 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
250 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
252 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
285 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
333 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
4k 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
63 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
275 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
125 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
91 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
535 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
518 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
490 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
86 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
109 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
339 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} ...
5
votes
1answer
567 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
123 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
84 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
178 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
245 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
655 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 ...