{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
0answers
118 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
499 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
645 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 ...
5
votes
4answers
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
170 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
697 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
793 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
2k 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
317 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
744 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
430 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
857 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
555 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
746 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
141 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
715 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
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
849 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
590 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
796 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
306 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
339 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
402 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
333 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
617 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
598 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
534 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. ...
18
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
2k 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 ...