{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
134 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 ...
3
votes
2answers
867 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} ...
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
25 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 ...
7
votes
2answers
2k 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} ...
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 ...
20
votes
2answers
376 views

Incompatibility between verbatim and tabu? (Danger of using \scantokens in a package)

With the following MWE \documentclass{article} \usepackage{verbatim} \usepackage{tabu} \makeatletter \renewcommand\verbatim@processline {% \begin{tabu}to\textwidth{|l|X[-1,l]|} ...
21
votes
2answers
1k views

Ensure verbatim code block is copy/paste-able

After rendering a document containing this code block \begin{verbatim} if [ ! -d .git ]; then git init; fi # Initialises a new Git repository, if doesn't already exist. if [ ! -f README.md ]; ...
8
votes
2answers
241 views

Macro \verb inside tabu environment

I would like to use the \verb command inside of a tabu enviroment. Here is my example \documentclass{article} \usepackage{tabu} \begin{document} \begin{tabu}{lll} a & \verb+\wedge+ & b\\ c ...
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 ...
2
votes
1answer
74 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}} ...
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
60 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 @ ...
7
votes
3answers
1k views

Putting in MATLAB codes in a box as figures? [duplicate]

how do I put MATLAB codes in a box or deal with them as if they are figures? Is there a way to do it within LaTeX itself? I am currently using the verbatim environment to present my codes and to be ...
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 ...
3
votes
2answers
754 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
30 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
1answer
81 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 ...
3
votes
2answers
162 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 ...
4
votes
2answers
904 views

newcommand for verbatim

I'm trying to write a \newcommand for verbatim: \newcommand{\codeline}[1]{\begin{verbatim}{#1}\end{verbatim}} and use it as \codeline{int foo;} but it gives an error "File ended while scanning ...
3
votes
1answer
52 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' --------------------------------- ...
1
vote
0answers
70 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 ≥ ...
8
votes
2answers
167 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} ...
6
votes
1answer
183 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 ...
31
votes
2answers
411 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 ...
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 ...
10
votes
2answers
1k views

Inline code and short verb with minted

I it possible to use minted for inline code and to add a short verb sing for minted? Like \lstMakeShortInline| in listings.sty? \documentclass{article} \usepackage{minted} \newminted{tex}{} ...
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 ...
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} ...