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

LaTeX documentation with verbatim environment

I am trying to document some LaTeX macros concerning marginals. I think a good way for the documentation would be the LaTeX code on the verso page and the output on the recto page. So I came up with ...
12
votes
4answers
395 views

How can I write % into a file?

How can I write % into an auxiliary file? % will not work, because LaTeX thinks that I start a comment with it (in the main file, not in the auxiliary file!), and \% will write \% into the file. How ...
1
vote
1answer
456 views

Listings settings for command line arguments [closed]

I am typesetting a set of instructions which includes several (Unix) command line arguments. I have been using the listings package to include these arguments, but the colouring is less than ideal. ...
3
votes
2answers
739 views

How listing and verbatim do to escape special character?

I use one macro to display text using texttt style. For the moment this macro is very basic. For example, if I want to use the character _, its catcode must be changed. Is there a clever way to ...
6
votes
2answers
2k views

Superscripts in verbatim environment

I have some lines in a verbatim environment ... \begin{verbatim} line 1 * line 2 line 3 * line 4 line 5 \end{verbatim} ... at the beginning of some lines I want to add a number ...
4
votes
2answers
1k views

\verb in custom command

I have \newcommand\dd[2]{\item[\texttt{#1}] #2} and later I have \dd{bc}{text \verb#$(echo 5+4 | bc)# text \verb#$((5+4))# text} and I get ! You can't use `macro parameter character #' in math ...
5
votes
3answers
2k views

Have verbatim code as an equation

I have a little snippet of program code / input that needs to be rendered with the exact layout as typed in (verbatim). Is it possible to have this as an equation? I tried to nest the Verbatim ...
6
votes
2answers
147 views

How can I show a macro as text?

Say I want to make a file which has as text \documentclass{article} I found out I can do it like this: \documentclass{article} \begin{document} \begin{verbatim} \documentclass{article} ...
2
votes
1answer
318 views

A simple implementation of comment/verbatim: drawbacks?

While considering how to exclude \items in Yossi Farjoun's recently active question onlyitems? How to select specific items from an item list, I thought I would do what I proposed in my first answer: ...
7
votes
2answers
3k views

verbatim and overlays

I am trying to display a verbatim environment in an overlay. I have the following code but it is giving errors: \only<2->{ \begin{verbatim} Select T3.Subject From T as T1, T as T2, T as T3 ...
2
votes
1answer
464 views

Potential problems from passing macro arguments to \verb

I've been working on a command that will typeset snippets of code within a paragraph. I'm aware of listings and company, but I want something that will just typeset the code verbatim and also allow ...
4
votes
1answer
1k views

New command using inline verbatim

I would like to define a command using verbatim like in the commented line in the following code. \documentclass{article} \usepackage{amsmath,amsfonts,amssymb} % ...
1
vote
0answers
119 views

How to prevent contents of verbatim text from running off the page? [duplicate]

Possible Duplicate: Verbatim environment that can break too long lines? How to prevent contents of verbatim text from running off the page? \documentclass[12pt,a4paper]{article} ...
6
votes
1answer
504 views

Determine number of lines in a verbatim environment

I'm trying to implement two new key-value pairs for the fancyvrb package: head= and tail= specify how many lines to display: That is, head=10, tail=5 specifies to print the first 10 lines of the ...
4
votes
1answer
4k views

Using \verbatiminput on filenames with underscores

I'm trying to include some source files using \verbatiminput{}. Some of these filenames have underscores in them. This works fine by default. But if I try to include the underscore package so that I ...
1
vote
1answer
1k views

Beamer and indentation with alltt

The following beamer code \begin{frame}[fragile] \frametitle{PROC TEMPLATE for a fancy graph (part 2)} \begin{alltt} rowaxes; rowaxis /label = 'Infant Mortality (\%)' ...
4
votes
3answers
653 views

Verbatim in plain-format with XeTeX

(I'm aware there has been a similar question before, but this one has a twist) I wanted a verbatim macro to use which would use an unlikely character as an end-of-verbatim -marker (unlikely as in it ...
15
votes
2answers
3k views

Colored background in inline listings

I would like to make inline code more distinguishable from the text surrounding it, and I thought that using a background might work (like it is done on the stackexchange pages.) Since I use the ...
7
votes
5answers
2k views

Wrapping code (listings, verbatim, or other method) inside a newcommand

For some teaching I've been doing, I'd like to have code from two different languages side-by-side. To do so, I hacked together a newcommand which uses a tabular environment to arrange two verb ...
18
votes
3answers
3k views

How to put \verb command inside of \textbf{} block?

It looks like you can't use \verb|...| inside of \textbf{...}. I tried the following: \textbf{Be very careful when using \verb|-i| as it's destructive and it's not reversible!} And got this error: ...
4
votes
2answers
171 views

Problem putting answers in a macro

I want to put the \begin{sol} and \end{sol} from the answers package in a macro like \newcommand{\assignment}[2] { \item #1 \begin{sol} #2 \end{sol} } ### \assignment{question}{answer} It's just ...
2
votes
1answer
703 views

Verbatim text can't be shown correctly in pdf

I try to change the font of verbatim text as below % Used by @verbatim ... @endverbatim \newenvironment{DoxyVerb}{% \verbatim% \fontencoding{OT1}\fontfamily{ptm}\fontseries{m}\fontshape{n}% ...
3
votes
2answers
2k views

How to prevent verbatim from generating linebreak?

I tried: \begin{verbatim} is_terminating() \end{verbatim} function can be implemented as follows: But the text after verbatim section will be printed in a next line, is there a way to prevent this ...
1
vote
2answers
812 views

How to configure the verbatim text?

In LaTex, I use \verbatim to add a block of text. But the problem is that the verbatim text doesn't follow the page style, and it exceeds the page boundary if the text is long. The result is shown as ...
2
votes
1answer
2k views

Code indentation gets lost in Beamer

For any unknown reason I have to use verbatim instead of listings. Note: This issue also appear when using listings but Herbert's answer can fix it. Unfortunately, the trick Herbert used there ...
2
votes
1answer
2k views

Change font of Verbatim slide in Beamer

I have several slides in a beamer presentation where i'm presenting some programming code. However, the font ends up being too large and isn't fully featured on the slide. How can I change the font on ...
4
votes
1answer
3k views

fancyvrb alternate commandchars and \textcolor

The following works: \documentclass{article} \usepackage{fancyvrb} \usepackage{color} \begin{document} \begin{Verbatim}[commandchars=\\\{\}] test\textcolor{red}{foo}test \end{Verbatim} ...
5
votes
2answers
318 views

A version of shortvrb for listings?

So, shortvrb is a neat little package that allows you to do \MakeShortVerb{\|} which then has |foo| behave like \verb|foo|. Now, I like listings. Is there a \MakeShortListings that makes |bar| act ...
5
votes
1answer
1k views

Code listing in subfigure

I am trying to use the subfigure package of LaTeX to display a code listing. Here was my first attempt: \begin{figure} \subfigure[Standard approach]{ {\footnotesize \begin{verbatim} var caps = new ...
8
votes
3answers
755 views

How can I redefine the \verb|…| command?

I'd like to redefine the \verb|...| command so that it had a light-gray background and a little bit darker border around it, and a little bit of padding to make this background "box" noticable. Anyone ...
4
votes
1answer
433 views

fancyvrb, helvetica and underscore… is it just me?

Ran into some weirdness with fancyvrb, helvetica and _. Here's a MWE (for me): \documentclass{article} \usepackage{fancyvrb} \begin{document} \begin{Verbatim}[fontfamily=helvetica] Oh no! It's a ...
5
votes
1answer
906 views

Proper spaces with verbatim

there is following code: \begin{verbatim} pc:~$ ls folder1 Documents folder2 New Folder folder3 folder4444 Downloads folder5 Pictures ...
7
votes
1answer
3k views

lstlisting, tt fonts, and alignment.

I (mostly) love the listings package, which I have started migrated to from verbatim for code listings. I prefer to continue to use teletype for code, and so I changed my default listing configuration ...
4
votes
2answers
1k views

Why is the indentation in my alltt environment not consistent?

I am writing a paper that involves some code. I set the code using alltt because I like to use \color and that doesn't seem to work in verbatim or listings. But I am having problems with ...
4
votes
1answer
560 views

How to treat the arguments of a macro as literal or verbatim text?

I'm working on a package that allows Python code to be entered within certain commands and environments, saves the Python code to external files and executes it, and brings back the results via ...
6
votes
2answers
1k views

How to prevent text generated with `Sweave` from running off the right margin?

I am using Sweave to generate output for some R analysis. Some of the code generates long lines that are run off the right margin when the .tex file is compiled. I have pasted an example Schunk ...
3
votes
1answer
751 views

Underlining a coloured DNA sequence

In the posts to the question of Timtico (here) several ways have been proposed to colour the As,Ts,Cs and Gs differently within a DNA sequence. What I want is also to be able to underline some ...
1
vote
1answer
142 views

matching comment environments, no longer able to comment out text

I have a long LaTeX document and I am trying to comment out lines of text using \begin{comment} text \end{comment} and while compiling the document I have the interpreter giving out: <recently ...
3
votes
1answer
3k views

using fancyvrb Verbatim environment from within newenvironment

As with this question, I want to use a verbatim environment from within an environment definition, but I want the listings to be numbered, so I think I need to use fancyvrb. It appears that fancyvrb ...
4
votes
2answers
732 views

Include binary data

How do I include binary data (e.g. the contents of a binary file) in a LaTeX generated PDF-document? If I just copy and paste them into a verbatim environment it results in garbage.
10
votes
2answers
1k views

Beamer and verbatim sync

I'm preparing a beamer presentation to show some basic TikZ stuff. I would like to have a two columns slide, where on the left I have the TikZ figure, and on the right the generating code. BUT, I also ...
9
votes
1answer
1k views

Using minted to define a new environment

Can I define a newenvironment that has inside it a minted environment? eg and environment that would be a quickhand for the following code: \begin{figure}[htp] \centering ...
2
votes
3answers
2k views

Any ideas why this \newcommand{\n}{\lstinline|\n|} macro doesn't work?

So I created a new macro \newcommand{\n}{\lstinline|\n|} but for some reason when I use it, all I get is bold 'n' letter and not a nice \n. Any ideas?
10
votes
3answers
6k views

How to box verbatim to prevent page break?

If I try \mbox{ \begin{verbatim} Some looooong text... \end{verbatim} } Then some compilation errors occur.
6
votes
3answers
4k views

Teletype \textbackslash in alltt environment

The alltt package provides a beefed up verbatim environment where \ and {} are not treated literally. A literal backslash can be inserted with \textbackslash, however, it does not have the same ...
21
votes
5answers
1k views

typesetting different characters with different colors in a DNA sequence

I have created a macro which I used to format DNA sequences, as they should be in the monospaced font and uppercased: \newcommand{\DNA}[1]{\texttt{\uppercase{#1}}} Now I have a column with some ...
6
votes
2answers
6k views

How do I use mathematical symbols in verbatim mode?

How can I get mathematical symbols in verbatim mode? If I use them, for example \equiv, it is just reproduced as is in the pdf.
7
votes
4answers
861 views

Search and replace in a verbatim token list

I maintain a package for the R programming language that contains a vignette which gets processed using the Sweave literate programming system. Now, one of the irks about Sweave is that it always ...
2
votes
1answer
3k views

Background color in Verbatim

I've to use the yellow background for data values in the following code. \usepackage \begin{Verbatim}[commandchars=\\\{\}] \color{blue}DATA \color{black}Heart; \color{blue}INPUT \color{black}X Y @@; ...
2
votes
1answer
593 views

LaTeX Combined hyper reference and footnote lacks verbatim argument behaviour [duplicate]

Possible Duplicate: Getting those %#!^& signs in the footnote! Here's my first version of a clever command for URL-footnotes. It combines pdftex's hyperlink behaviour with a \footnote ...