{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

2
votes
1answer
445 views

Tufte-Latex sidenote breaks indentation in alltt

I'm trying to the the alltt environment in tufte-book. My problem is that \sidenote seems to break the indentation in alltt. \documentclass{tufte-book} \usepackage{alltt} \begin{document} ...
3
votes
0answers
608 views

Xelatex, verbatim and hyphenation [closed]

I have the following problem with XeLatex, Russian language, hyphenation and verbatim. Consider the following tex file (text below). It is compiled with XeLaTex, and before verbatim hyphenation is ...
14
votes
2answers
1k views

LaTeX Verbatim Source Code Beside the Typeset Output

I am a beginner to LaTeX, and I am reading Leslie Lamport's A Document Preparation System. In various places of his book, he puts the LaTeX source code beside the output obtained by running latex on ...
7
votes
1answer
2k views

Customize \verb!…! output in beamer

I would like to change my verbatim throughout a beamer presentation in the preamble. Actually I would like to have it more or less like on slide no. 9 here. I am using verbatim usually with ...
9
votes
4answers
280 views

\verb in csquotes

The following code gives me an error: \documentclass[ngerman]{article} \usepackage{babel,csquotes} \begin{document} \enquote{\verb|foo|} \end{document} I guess this is the classic "you can't use ...
4
votes
1answer
923 views

How to handle special characters in LaTeX?

I am working on one file which has some special chacters. König IR : KA}unig ,K ~ A}unig % : Comment in latex (so no text after this %) - : escape I get different output ...
4
votes
1answer
130 views

listing's lst@BeginWrite gobbles '->' and '=>' from input [closed]

I'm trying to write a package that takes verbatim input and appends it to several files. My current approach is based of off an answer by Martin Scharrer to a similar problem. The difficulty arises in ...
10
votes
3answers
902 views

typing \end{verbatim}

I am preparing a presentation in which I want to display the following as it is \begin{verbatim} foo \end{verbatim} For this I used \begin{verbatim} \begin{verbatim} foo \end{verbatim} ...
2
votes
2answers
594 views

Making more easy the itemized of item with tabulation system

Actually, isn’t not really a question. (Since my examinations get close, I don't really have the time to search for a solution to my problems.) Rather than using the common \item, I'd like to use ...
7
votes
1answer
290 views

Typeset text as written (similar to verbatim) within a custom command?

I'm trying to define a new command that puts text in a coloured background, reproduces it exactly how it's defined in the .tex file (in a similar way to verbatim), and won't force me to use ...
7
votes
2answers
1k views

How can I set stretch of verbatim to be different than “global” setting?

In my file I need to use 1.5 line stretch. But, as for verbatim I need it to be 1.0. What should I add to preamble to achieve that? \documentclass{article} \usepackage[nodisplayskipstretch]{setspace} ...
3
votes
1answer
1k views

\pause won't generate extra slides in a containsverbatim frame

It seems that the [containsverbatim] option when applied to a frame prevents beamer from generating intermediate slides if text animation is wanted in it. Only the first step of the animation is ...
7
votes
1answer
3k views

How to force line breaks within a fancyvrb verbatim environment?

Consider the following LaTeX document: \documentclass{article} \usepackage{fancyvrb} \DefineVerbatimEnvironment{example}{Verbatim}{commandchars=\\\{\}} \begin{document} \begin{example} Foo\\{}Bar ...
6
votes
4answers
4k views

Verbatim environment with background color (PDFLaTeX and tex4ht)

I need to make a verbatim environment with gray background color, such as: That needs to work with PDFTeX and tex4ht on an older TeX installation (from 2009 I believe). My approach so far is ...
7
votes
3answers
3k 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 ...
3
votes
1answer
2k views

Custom divider between 2 minipage and lstlisting

I am using the following code to have 2 boxes beside each other for code comparison: \documentclass[12pt]{article} \usepackage{listings} \begin{document} \begin{singlespace} ...
3
votes
1answer
444 views

Color box with outline but some difference

\begin{boxedlaw}{6.4in} \colorbox[HTML]{F8E0E0}{ \begin{minipage}[c]{380px} \begin{center} \begine{verbatim} \# define LM_ENCA 18 //Port0 \# define LM_ENCB 17 ...
8
votes
3answers
503 views

Verbatim in environ’s \BODY

I’d like to print a TeX install guide for different OS, but the most text is the same for all OS. So I build the following \documentclass{article} \usepackage{environ} \newcommand{\mlw}[3]{} ...
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
2k 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
980 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
955 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
799 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
267 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
14k 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
526 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
373 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
960 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
3k 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
97 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
170 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
927 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} ...
9
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
251 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 ...