{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

10
votes
1answer
2k views

Displaying `\begin{verbatim}…\end{verbatim}` inside the environment verbatim

I would like to display \begin{verbatim}...\end{verbatim} inside the environment verbatim like in the folowing piece of code. Is it possible ? \begin{verbatim} Bla, bla, ...
6
votes
1answer
1k views

Problem with TikZ, beamer and verbatim

I'm trying to put verbatim text inside a node (in a beamer frame): \begin{frame}[fragile]{P} \tikzstyle{cell} = [rectangle, draw, thin , fill=black!10 , minimum size=5mm] \begin{tikzpicture}[node ...
9
votes
1answer
918 views

verbatim environment does not produce monospace

I use quite a lot packages in my document and I cannot find which one's fault is that verbatim does not produce monospaces. Anyway, if I knew this, I have no idea how to solve problems when packages ...
19
votes
3answers
1k views

Highlighting a .diff file

Is there a way to highlight the syntax of a diff file (i.e. by using the listings package)?
11
votes
2answers
924 views

Produce a hyperlinked DOI?

Friends, I'm trying to write a command that prints appropriately hyperlinked DOIs for a bibliography system. Here was my first attempt \newcommand{\formatdoi}[1]{\href{http://dx.doi.org/#1}{#1}} ...
5
votes
2answers
751 views

Define my own short-verb like macro?

I'm trying to define shorthand macros for \texttt that are a bit like the \verb ones. The end result is to do +asdf+ and this have the same effect as \texttt{asdf}. This is like the DefineShortVerb ...
10
votes
2answers
4k views

Inserting LaTeX code into LaTeX

I have problem with adding text into LaTeX document. I have LaTeX document about LaTeX and I need to insert some code snippets. I need to add "\usepackage{musixtex}" as a text, which should be ...
0
votes
1answer
260 views

Redefining \verb to be \url

How can I redefine \verb!! to translate into \url{}? I have to do this to fool Emacs highlighting so it thinks I have \verb, in the background I like \url{} wrapping capability.
6
votes
5answers
13k views

Verbatim environment with correct tab handling and special characters

I'm looking for an environment similar to Verbatim which will allow me to say something like the following code (which uses indentation instead of spaces): \documentclass{article} ...
3
votes
1answer
2k views

Verbatim going beyond borders

I use \begin{verbatim} and \end{verbatim} and have enclosed a Fortran code within it. (I am not using listing for a reason). However, Verbatim is crossing the boundaries. How do I fix this? My ...
3
votes
2answers
525 views

Measuring the width of a verbatiminput block

Is there any way of measuring the width of a VerbatimInput block? In other words, I would like something along the following lines, except that the verbatim data should be taken from an external file ...
4
votes
1answer
2k views

inputenc error with unicode chars and verbatim

I am writing a package where I need to save the contents of several environments in verbatim mode to an auxiliary file. Then the auxiliary file is processed by an external program. In the next ...
17
votes
3answers
2k views

Writing { and } to a file with LaTeX

How can the special characters { and } be written literally to an external file in LaTeX, without being balanced? Obviously the following does not work: \immediate\write\my@outfile{{} ...
12
votes
2answers
4k 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}{} ...
2
votes
2answers
364 views

verbatim text in ConTeXt tables

I want to create a table for a few blocks of source code. In LaTeX, I would do \hline \begin{lstlisting} abc; def; \end{lstlisting} \tabularnewline Is there a way to accomplish something like ...
6
votes
2answers
1k views

How to display accents inside verbatim command

I have the following piece of code: \newenvironment{mylisting} {\begin{list}{}{\setlength{\leftmargin}{1em}}\item\scriptsize\bfseries} {\end{list}} \newenvironment{mytinylisting} ...
6
votes
2answers
1k views

How can I fix verbatim causing an extra newline inside a description list environment?

I'm trying to create a documentation listing similar to that used by MSDN. Here was my first attempt at that: \subsubsection{User Default Page URL} \begin{description} \item[Rationale] This is the ...
10
votes
2answers
2k views

How to change color of some particular environment for entire document

I want to change color of particular environment in document. For example wherever I found verbatim environment or equation environment appears in my tex file. With some global settings, I want to ...
14
votes
1answer
4k views

control vertical space before and after verbatim environment?

How do I control how much vertical space appears before and after a verbatim environment? With the following source (run through pdflatex): \documentclass[varwidth]{standalone} \begin{document} text ...
4
votes
2answers
917 views

verbatim inside subfloat?

When I write the following \subfloat[caption]{\label{fig:xxxx}\verb+xxxx+} I get \verb illegal in command argument. Seems that isn't possible to define a verbatim environment inside a \subfloat. ...
4
votes
1answer
2k views

Including a text file in LaTeX

I write a program by DevC++ compiler and save it by .cpp format, and want to paste the code in my editor, Do I have to paste all the code each time? Is there a way to include the file instead of ...
1
vote
2answers
3k views

How can I fix the path to LaTeX fonts?

I'm using LaTeX on osx via TexLive 2011 and the TextMate bundle. Currently I'm trying to list some code in a document (using verbatim), but I get this error: ! I can't find file `pcrr7t'. ! ...
14
votes
1answer
2k views

Manual highlight of TeX code in a verbatim environment

Friends, I'm stuck with a unusual situation: I'm trying to highlight specific words of a TeX code inside a verbatim environment. I know listings can help me by defining a set of keywords, but in this ...
3
votes
1answer
96 views

Create command that displays input exactly

I want to create a command whose argument is used within a \label{} command. I also want a boolean switch that turns on/off the display of this label for editing purposes. Here is pseudo-code for what ...
4
votes
1answer
3k views

Environment code undefined

Why do I get ! LaTeX Error: Environment code undefined. when I use: \documentclass[10pt,a4wide]{article} \usepackage{a4wide} \usepackage[utf8]{inputenc} \usepackage[portuguese]{babel} ...
12
votes
1answer
6k views

Difference between {\tt \{} and \verb+{+

Why is {\tt \{} typeset as an ordinary { and not the same as for instance \verb+{+? To illustrate: {\tt With tt:~ \{} \verb+With verb: {+ yields
0
votes
2answers
169 views

Character - changes to { in verbatim environment

I have witten html/jsf code and some comments in Latex verbatim environment: \begin{verbatim} Predloga dokumenta: <f:view> <!– korenski element--> <%@taglib prefix="f" ...
4
votes
1answer
895 views

Create a verbatim mdframed environment

I'd like to use and mdframed environment with verbatim in it. I've read the both documentations, googled but I've found nothing regarding this matter. MWE below: \documentclass[10pt]{article} ...
8
votes
3answers
8k views

encoding problem with \verbatiminput : Package inputenc Error: Unicode char \u8: not set up for use with LaTeX

I'm trying to import some logs files using \verbatiminput to do a automatic report from our logs. I got some encoding problem. My objective: import some logs files with various special char (included ...
7
votes
2answers
3k views

How to import a text file (with accent, special chars)

I got some text file (logs) that I want to import I saw this post: How do I import a text file so that it becomes the body text of my LaTeX document? which work, but all the special chars (UTF-8) are ...
4
votes
2answers
245 views

Disable shortvrb in math mode

I have enabled shortvrb so that I can enclose text in pipes to write small pieces of code. Unfortunately this conflicts with math mode when I write $|A|$ to indicate the cardinality of a set. How can ...
19
votes
3answers
2k views

In LuaLaTeX, how do I pass the content of an environment to Lua verbatim?

In LuaLaTeX, how would I go about capturing the content of an environment for (verbatim) processing by Lua? For example, consider something like \begin{foobar} Hello {World} \end{foobar} I'd like ...
19
votes
2answers
1k views

Write environment body verbatim to a file

How can one write the body of an environment verbatim to an external file. I tried the following but get problems if the body contains undefined macros (error) or e.g. a % (disappears in the output). ...
16
votes
1answer
7k views

How do you insert an inline verbatim?

I'm trying to add an inline verbatim into a \paragraph? Was wondering how do you do that?
3
votes
2answers
2k views

How do I tell alltt environment to wrap text?

I have an already formatted text (space-wise) that is also being colored etc, so I am using alltt environment to print it. The text is code actually, but I am not using listings because I don't want ...
7
votes
2answers
2k views

Multicolumn verbatim

Is there someone who could help me with creating a table with some rows merged and verbatim text in it? I actually want to create 3x2 table. Like this \begin{tabular}{rr} \hline ...
7
votes
2answers
2k views

verbatim text inside italic block

I am trying the following: \begin{frame}[fragile]{OCP en Exceptions} ``If you throw a checked exception from a method in your code and the \verb!catch! is three levels above, \textit{you must declare ...
3
votes
1answer
241 views

checking for whitespace inside verbatim environment

I would like to determine whether a line inside a verbatim environment starts with 3 spaces. I'm using pdflatex and the \pdfmatch primitive. I see that the verbatim environment sets the category ...
9
votes
3answers
2k views

Include Sweave input as verbatim

How do I keep Sweave from compiling things in a verbatim environment? For example: \documentclass{article} \begin{document} \begin{verbatim} <<>>= 1+1 @ \end{verbatim} \end{document} ...
11
votes
1answer
711 views

Point to a Verbatim Line using TikZ

I'm trying to use TikZ in beamer to point to a line of code. Here's what I have so far: \documentclass{beamer} \usepackage{tikz} \usepackage{fancyvrb} \begin{document} \begin{frame}[fragile,t] ...
3
votes
1answer
131 views

Possible to use certain delimiters for macros with fancyvrb?

In this document: \documentclass{article} \usepackage{fancyvrb} \DefineVerbatimEnvironment{AVerb}{Verbatim}{commandchars=\\\{\}} \def\foo#1-#2;{} \begin{document} \begin{AVerb} \foo x-z; ...
7
votes
1answer
294 views

How to output math environment code alongside typeset math?

I have a preamble which defines lots of symbols and a LaTeX document for testing them. In particular, I have source like this: \[\wlength{abc} = 3\] \[\lang{A} = \lang{\varphi}\] \[\kplus{L} \defeq ...
6
votes
1answer
465 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
454 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
474 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
824 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 ...
7
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
150 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} ...