{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.
4
votes
1answer
60 views
How to copy/paste from lstlistings? [duplicate]
I'm trying to write code in a LaTeX document that can be copy/pasted from an outputted pdf using Adobe Reader and that also word wraps, rather than breach the right margin.
I've found that in ...
7
votes
2answers
69 views
How to prevent angle brackets beautification in semiverbatim environment?
\documentclass{beamer}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[utf8]{inputenc}
\begin{document}
\begin{frame}[fragile]{Angle Brackets}
...
11
votes
3answers
614 views
unicode \begin{verbatim} with cmtt?
A lot of leading-edge programming languages (like Coq and Agda) allow nearly unrestricted use of unicode symbols in program text, so you can have math characters like $\otimes$ (Unicode U+2A02) as ...
5
votes
1answer
36 views
Declare additional Unicode characters in verbatim environments in a Pandoc-generated file
I generate a PDF document via LaTeX with Pandoc. I want to use some additional characters in verbatim environments that are not available by default. Here's a sample input:
Math: $\downarrow$
...
0
votes
0answers
23 views
How can I put \cbstart…\cnbend inside \begin{Verbatim}…\end{Verbatim} in LaTeX
I am trying to place a changebar outside a block of Verbatim text in LaTeX and it barfs at me every time.
\cbstart
\begin{Verbatim}
blah
blah ...blah
blah...
\end{Verbatim}
\cbend
Results in:
! ...
4
votes
1answer
49 views
Use of " in verbatim mode
I would like to use the symbol " inside \verb. Is that possible? For example, in
\verb"abc"defg"
the second " will be interpreted as the end of the verbatim environment though my intention is that ...
3
votes
2answers
71 views
How to do \newcommand{\filepath}[1]{\verb!#1!}?
I want to define a command \filepath so that I can use \filepath{foo_bar.cpp} and it is printed in monospaced font.
Also, why does this not work? I get strange errors:
...
1
vote
2answers
96 views
How do I define a custom verbatim command?
I'm not quite sure how to describe this, but I want to create a custom command that treats its input as verbatim and allows some control of the output.
In pseudocode, I want:
...
7
votes
3answers
3k 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 ...
4
votes
1answer
34 views
How to use verbatim in figure caption (\captionof)?
I want to use verbatim in a caption of a figure. I have tried the cprotect package but it seems to work only with \caption and not with \captionof. Is there a workaround?
\documentclass{scrbook}
...
6
votes
4answers
80 views
Is it possible to use a non-monospace font in verbatim environments?
I know it runs contrary to a lot of the point, but I'd like to experiment with different fonts to see which I like better. I can't seem to find any reference to a way to do this, if it's at all ...
1
vote
1answer
69 views
Using minted environment in user-defined environment (minted inside minipage)
I am having to use the minted environment inside a minipage environment quite often in my document. I wanted to write a new environment for doing this, but since minted isn't designed to be included ...
3
votes
1answer
73 views
How to underline text in verbatim environment?
Am I missing something, or is it simply not possible to underline text within a verbatim environment?
\begin{verbatim}
I want to underline the following word: word
\end{verbatim}
I guess I could ...
9
votes
4answers
164 views
How can I have a verbatim text in specific sized box?
I am trying to typset the following
\resizebox{0.95\textwidth}{!}{%
\begin{verbatim}
require( "lattice" )
require( "grid" )
\end{verbatim}
}
I have a lot more to add to this box, and it needs ...
4
votes
1answer
44 views
Tabular in dtx documentation
How to make table in .dtx documentation with vertical bars?
% \begin{tabular}{c|c}
% |sf| & \emph{mathsf}\\
% \end{tabular}
fails, because |foo| is magic for verbatim.
2
votes
0answers
54 views
How to combine framed and listings packages in new environment
I always use this LaTeX code to display a source code in my article.
\begin{listingbox}{VB style}
\begin{singlespace}
\begin{lstlisting}[style=BASIC]
Private Sub Form_Load()
Dim tex As String
...
4
votes
1answer
45 views
How to make a text { in alltt
I am trying to type computer code in my document using the alltt environment. Some symbols, such as ' and {, do not appear in the document the way they do in the code. I solved the problem with ' by ...
2
votes
1answer
57 views
How to make letter spacing in verbatim/fancyvrb look like listings
I've just noticed that the spacing between letters is different in verbatim vs. lstlisting environments:
Given that I add the option columns=flexible to the lstlisting environment, the spacing in ...
8
votes
2answers
66 views
Preserving (and Controlling) Expandedness
In most cases, by the time output gets to your screen, arguments are fully expanded and my question is moot. But sometimes (verbatim being a common example), one wishes to operate on arguments with ...
2
votes
2answers
177 views
Insert a character in the beginning of each line in a special verbatim environment
How can I insert a special character or a symbol in the beginning of each line in a verbatim environment? In particular, there is a constraint that applies to the verbatim environment: it must be of a ...
2
votes
0answers
37 views
Beamercolortheme: How to set default color for all verbatim?
I want to change the color of all verbatim text in an existing beamer presentation. How do I do this easily?
I know how to use colored verbatim text in general, and I found a lot of suggestions here ...
7
votes
1answer
59 views
Purpose of \do@noligs in LaTeX verbatim environment
I'm trying to figure out how the verbatim environment works. In the basic LaTeX file latex.ltx I find the following definition (line 4037):
...
11
votes
1answer
1k 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 ...
2
votes
2answers
57 views
How do I get selective bold in Verbatim? [duplicate]
I previously wrote a computer professional book in which I showed what the user typed on the console and the computer's resultant output. The way I liked to do this was with everything in courier and ...
5
votes
1answer
167 views
is it possible to add line numbers to input files read using \verbatiminput?
I know one can use \usepackage{listings} which supports line numbers. And I use that for pdf files. But I also generate HTML using Latex2html, and l2h does not support this package. It only supports ...
12
votes
2answers
297 views
Format a verbatim paragraph
How can I format a verbatim paragraph? I.e. break, fill and join input lines to produce globally balanced output with the lengths of each line approaching the target \textwidth as closely as possible. ...
4
votes
4answers
107 views
Defining a new environment extending a verbatim environment
Why is it not possible to define a new environment that extends a verbatim environment?
Consider, e.g.:
\documentclass{article}
\newenvironment{myverbatim}{\tiny\begin{verbatim}}{\end{verbatim}}
...
8
votes
4answers
129 views
How to redefine an environment to produce no output?
I am using the verbatim environment with
\begin{verbatim}
XXXX
\end{verbatim}
I would like the option of redefining the verbatim environment so that nothing between \begin{verbatim} and ...
3
votes
1answer
105 views
LaTeX getting “Missing } inserted” error
I'm getting "Missing } inserted" error, when compiling with pdflatex and I really don't understand why. This is occurring in a beamer frame. Maybe someone comes up with something useful.
...
9
votes
1answer
71 views
Determine width of verbatim characters
I would like to determine how many characters of the verbatim font that fits on a text line. Consider:
\documentclass{article}
\usepackage{fancyvrb}
\begin{document}
\noindent\hrulefill
...
3
votes
1answer
78 views
listing package and vbox warning
I have this many (see below) underfull warnings that are caused by using the listing package and creating \begin{lstlisting}\end{} to make code appear presentable. Is there a may to fix the warnings?
...
5
votes
3answers
92 views
Use sans-serif in a verbatim environment?
What is the right way get fancyvrb’s verbatim environment (or any other variation) to use \textsf as the font?
I can do it with:
\begin{Verbatim}[commandchars=\\\{\}]
\textsf{Here’s some textsf.}
...
6
votes
2answers
111 views
Custom verbatim that sets all spaces (“ ”) as visible spaces (“␣”) that can line-break
It makes sense to typeset code in a monospaced font. Sometimes such code needs to be embedded in a paragraph context, and then it will be useful to allow it to linebreak. In order to visualize spaces ...
5
votes
2answers
75 views
How to show < and > correctly in output?
I am trying to write some XML tags as part of my text but I can not get the < and > symbols to come out right in the output. What am I missing?
I have tried both <tag> and \<tag\>, the ...
13
votes
2answers
96 views
How to make AUCTeX ignore syntax highlighting within environment
I have a problem with syntax highlighting in the Emacs editor using AUCTeX. The problem occurs in particular with the Verbatim environment from the fancyvrb package. Consider the following code:
...
2
votes
1answer
42 views
Problem with \acused from acronym package: Not in list of acronyms
When using the acronym package, acronyms marked with \acused{AC} are not contained in the list of acronyms.
However, I also cannot place \ac{AC}, \acs{AC}, or \acl{AC} since all of it is explained in ...
9
votes
2answers
191 views
Any way to show LaTeX example code *and* execute it? [duplicate]
In (La)TeX documentation and tutorials, it is common to show a snippet of code next to the output it generates. It might be two minipages side by side, or a code listing followed by boxed output, or ...
4
votes
1answer
53 views
Check for special character in verbatim environment
I would like to substitute a > in the beginning of each line of a Verbatim environment with another character. Consider:
\documentclass{article}
\usepackage{fancyvrb,xstring}
...
2
votes
2answers
75 views
Create a new environment that uses a verbatim environment
Consider the following:
\documentclass{article}
\usepackage{environ}
\usepackage{verbatim}
\usepackage{color}
\NewEnviron{vred}{%
\color{red}
\begin{verbatim}
\BODY
\end{verbatim}
}
...
1
vote
0answers
46 views
code-block directive causing error Empty verbatim environment
When I use directive .. code-block:: c in rst on Ubuntu 12.04 version
and compile using latexpdf
Error:
(/usr/share/texmf-texlive/tex/latex/psnfss/t1pcr.fd)
! FancyVerb Error:
Empty verbatim ...
4
votes
5answers
4k 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 ...
5
votes
1answer
59 views
verbatim-like environment with optional arguments poorly behaved
[EDITED to show where I actually want to use the optional argument]
This question may be answered at How to pass an optional argument to an environment with verbatim content?, but I'm having a hard ...
4
votes
1answer
41 views
Optional arguments in verbatim environments
This question is a follow up to verbatim-like environment with optional arguments poorly behaved. Based on David Carlisle's suggestion, I manually looked for an optional argument and employed ...
6
votes
3answers
119 views
verbatim and CJK
I'm not familiar with chinese characters and fonts. But I have to type some characters into a document. XeLaTeX may be an option, but I'm looking for a solution with pdflatex. Here is my MWE, which I ...
5
votes
2answers
93 views
Macro \verb inside tabu environment
I would like to use the \verb command inside of a tabu enviroment. Here is my example
\documentclass{article}
\usepackage{tabu}
\begin{document}
\begin{tabu}{lll}
a & \verb+\wedge+ & b\\
c ...
11
votes
3answers
812 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 ...
3
votes
1answer
64 views
Block element characters (pmboxdraw) are shown too wide in verbatim and Verbatim (fancyvrb) environments
I want to put source code into verbatim and Verbatim (fancyvrb) environments that uses box-drawing characters from codepage 850 (0xDB, 0xDC, 0xDF) (see http://en.wikipedia.org/wiki/Code_page_850). By ...
3
votes
1answer
88 views
lstlisting in a box?
My problem is that I am trying to write a document with coloured sections for examples. Examples can contain code listings. Somehow I can't seem to combine a background colouring with a listing, or ...
4
votes
2answers
62 views
How to embed verbatim in pspicture?
I'm trying to insert a QR code at the beginning of my thesis with the contents being the BibTeX entry for it.
Any way of embedding the raw text in \psbarcode?
\documentclass[a4paper,12pt]{minimal}
...
6
votes
1answer
87 views
How to write text within \begin{verbatim} and \end{verbatim} in same line?
I am stuck on the following problem and don't know how to solve it.
Here is my problem :
\documentclass{article}
\begin{document}
\begin{verbatim}'\hfill\end{verbatim} MKS' which puts the word ...


