{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

1
vote
1answer
2k 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
675 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 ...
8
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
5k 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
3k 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
834 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
2k 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
580 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 ...
4
votes
1answer
766 views

How can I input part of a file in verbatim?

I'm writing the documentation to a large piece of Matlab code. I would like include tags in my Matlab code and then read the lines of code between the tags into Latex and output them as verbatim (or ...
1
vote
2answers
302 views

don't split verbatim by tables

I have quite long verbatim, which I don't want to be split by table, which is present in source document before verbatim. I have my table wrapped by \begin{table}[h]. Any suggestions?
13
votes
4answers
2k views

Hard whitespace

I am using plainTeX and would like to typeset some (python) code examples. Switching to \tt gets me partway there, but I (obviously) need the whitespace respected. Is there a trick for doing this? The ...
0
votes
1answer
323 views

SAS output through verbatim in beamer

I've tough time to manage SAS output through verbatim in beamer. Could someone help in this regard. Thanks in advance.
6
votes
2answers
386 views

In the verbatim environment, how can I display an 'if' statement I declared as '\ifcondition'?

I have declared a couple of if commands of the form \newif\iffinal \newif\ifsolutions Now I want to write about it in the same document! So I want to write something like \iffinal (...) ...
4
votes
1answer
324 views

Printing verbatim command inputs in commands

I want to define a command \mydef that does something like this: \mydef{\foo{bar}} produces \def\foo{bar} \verb|\foo=bar| The command: \newcommand{\mydef}[1]{\def #1} does the first bit, but ...
17
votes
5answers
2k views

How can I provide a verbatim (unescaped) commandline for executing with \write18?

When using \write18 to execute shell commands, there are some cases where lots of backslash strings, and other 'special' LaTeX characters are required in the commandline to be executed (e.g. if a ...
3
votes
2answers
606 views

Use of pdftricks with memoir

below is a (long, non-working) minimal example for use of pdftricks with the memoir document class. It is based directly on the (shorter, working) minimal example of use of pdftricks found at ...
7
votes
0answers
573 views

using \input and pygmentize together: trying to get line numbers to show [closed]

I am using pygments to highlight the code I insert in my lyx document. The external file gets inserted in my document like this: {\small \input{listings/blah.tex} } And I use this command to ...
5
votes
3answers
509 views

Display “.\integrate blah” in monospaced font (like \texttt and \verb)

I'm trying to display the following: .\integrate blah in a monospaced font. For everything else I've wanted to put in a monospace font, \texttt or \verb has worked fine, but it doesn't with this. ...
17
votes
4answers
4k views

Getting those %#!^& signs in the footnote!

This is basically an expanded version of part of Control command arguments . The original questioner there wants to redefine \href so that all the links end up in foonotes (rather than in the main ...
3
votes
2answers
1k views

LaTeX verbatim environment inside lists

I am using LaTeX and I have a verbatim environment inside an enumerate one. However, there is much whitespace between the verbatim text and the following list item. What I have now is something like ...
15
votes
1answer
4k views

Verbatim environment and line-breaking

I've been wondering about how to display simple codes. I used verbatim and then found the fancyvrb package which added a lot of nice little features, but then I inserted some code with a long line and ...
9
votes
3answers
629 views

Hyperref using the wrong language script for \url?

In a mixed language document, I try to use a URL. Here is minimal input demonstrating \documentclass{article} % compile with xelatex \usepackage{hyperref} \usepackage{polyglossia} ...
9
votes
2answers
1k views

How do I backcolor in verbatim?

I have some code I want to typeset as verbatim (lstlisting would be ok as well) - but I want to highlight some parts of it via a different background color, i.e. something like this: \begin{verbatim} ...
5
votes
1answer
2k views

FancyVerb error for Sweave output in Beamer

I'm having trouble including Sweave output in my Beamer file. Specifically, the Soutput environment is causing problems (it runs if I comment those lines out, but, of course, the table is not ...
2
votes
2answers
639 views

ignorespace and unskip in verbatim/listings?

I am writing a \bashDemo macro that will (a) execute its argument in a shell, e.g., bash, script, and (b) display the argument in a listings. So, \bashDemo ls -ls > myfiles \END will both run ls ...
15
votes
1answer
1k views

beamer's fragile frame as default

Is there a way to specify fragile mode as default for all frames? Now I know how to define a fragile frame: \begin{frame}[fragile].
7
votes
2answers
538 views

Aligning columns, but allowing for text inbetween

I need help aligning text that spans multiple lines where I have Verbatim code in between. Here is a mock example to show what I mean: Fruit Amount Apple $3.00 \begin{verbatim} ... ...
12
votes
1answer
645 views

escape `|' in \verb

In LaTeX, if I use \verb, how can I escape |? For example, I want to display ab|bc: \verb|ab[]bc|. What should replace []?
14
votes
1answer
38k views

In-line \verb — overfull hbox problem

I'm having a problem that I've had before and I'm tired of hacking my way through it and hope that there is some supported solution. I'll go ahead and create a document for example: \documentclass ...
5
votes
3answers
615 views

Verbatim in Marginnote doesn't work

I have a really sort quastion. The following Code is not working: \documentclass{memoir} \usepackage{verbatim} \usepackage{marginnote} \begin{document} Lorem ipsum dolor sit amet, consetetur ...
11
votes
3answers
1k views

How to pass an optional argument to an environment with verbatim content?

This is an attempt to make clear what happened in this question of xport (now deleted, sorry). The now deleted question included code that tried to make my answer to this question of xport work for ...
7
votes
1answer
836 views

verbatim with black background and white text

How could I set up a verbatim-environment which has black background white text in scriptsize ?
1
vote
1answer
250 views

How to make my unusual environment accept one argument?

I cannot find a good title to express my question. Therefore, please parse the following code first. Minimal Code \documentclass[dvips,dvipsnames,cmyk,table]{book} ...
4
votes
2answers
2k views

How to add indentation to all verbatim environment?

I have a style where all paragraphs have indentation of about 5cm. Verbatim environment does not have any indentation to the combination of paragraphs and verbatim environments does not look good. ...
15
votes
3answers
7k views

How to include verbatim in a figure caption?

I would like to include verbatim in a caption of a figure. I only want part of it to be verbatim, not the entire caption. The simple approach does not work because verbatim is not allowed in arguments ...
1
vote
2answers
780 views

Combination of \verb and \texttt

Also I read: When should one use \verb!! and when \texttt{} My issue at hand is that I would like to write a little more than just "small pieces" (wording in linked question) of program code, but ...
10
votes
1answer
3k views

verbatim useable with a newenvironment definition?

I'm trying to create a simple newenvironment allowing me to display source code in a verbatim text block with a caption, numbering etc. The solution I'm after is with the in-built LaTeX verbatim ...
12
votes
1answer
2k views

fancy verbatim - bold letters for the first 4 columns

I am writing a book on Python and IPython. I want to insert in this book code listings of Python and IPython. For the code itself I have no problem customizing listings for my intents. Including ...
2
votes
2answers
2k views

Making Verbatim and Beamer play nice

I'm writing a beamer presentation on basic math type-setting in latex and I've been trying to use verbatim to display how math equations are typed. Using fragile this works, but I still get several ...
11
votes
1answer
2k views

Alternatives to $\backslash$

Background Instead of marking up the text with bold or emphasis, I read (and agree) that it is better to define a command, or environment, that describes the content. Then apply text formatting ...
9
votes
2answers
2k views

Latex equivalent of <pre>

This is probably a simple question, but I can't find the answer anywhere. How can I tell tex (latex specifically) not to format a piece of text? I.e. I want to keep indentation, line breaks, etc.
4
votes
2answers
388 views

showexpl LTXexample and references inside enumerate

I've used the wonderful LTXexample environment defined by showexpl to illustrate some LaTeX basics. However, the following code confuses it: the reference remains ?? no matter how many times I ...
10
votes
5answers
10k views

How to draw box around text that contains a verbatim block?

Typically, to box in some text, I use the following: \fbox { \parbox{\linewidth}{ This is some text! Blah blah blah... } } However, say I have a verbatim block within that. It will ...
7
votes
5answers
988 views

How does one automatically escape a sequence of text, like “verbatim” but without the formatting?

I want to escape TeX codes on a range of text; this is for a macro providing slightly neater URL formatting. The code I have now is, \newcommand{\serifurl}[2]{\textsf{\href{#1://#2}{#2}}} where the ...
8
votes
1answer
857 views

Line length in fancyvrb

What I'm doing: Typsetting source code using pygments. What is happening: the code typsets fine, but because pygments puts the code into a Verbatim environment, some of the lines are far too long. ...
5
votes
1answer
3k views

Using listings and subfigure together

I am writing a document in which code listings and diagrams appear side-by-side frequently. I am using the listings package for the code and \includegraphics for the diagrams. I want to put them both ...