{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.
0
votes
0answers
27 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 ...
0
votes
1answer
47 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:
...
2
votes
2answers
37 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 ...
4
votes
4answers
78 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}}
...
3
votes
1answer
78 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.
...
11
votes
2answers
246 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. ...
9
votes
1answer
49 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
...
5
votes
3answers
77 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.}
...
3
votes
1answer
60 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
2answers
73 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 ...
12
votes
2answers
83 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:
...
1
vote
1answer
31 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 ...
4
votes
1answer
46 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}
...
9
votes
2answers
166 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 ...
2
votes
2answers
67 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}
}
...
6
votes
2answers
95 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 ...
1
vote
0answers
35 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
1answer
38 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
108 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
1answer
55 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 ...
5
votes
2answers
83 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 ...
3
votes
1answer
55 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
67 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
55 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
77 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 ...
6
votes
2answers
131 views
Highlighting code like one would in a SE post
When posting on SE, users can "highlight" code by using the ` symbol. Is there any way to get that in LaTeX?
My intention is to highlight segments of code or particular functions. To be clear, I'm ...
4
votes
2answers
136 views
How to add line numbers to a program listing/code?
How do I copy code in to latex to get a result which looks like this:
...Without the red bars of course. I don't know how to get the numbering on the left side when I compile LaTeX. Using \verbatim ...
6
votes
3answers
99 views
Merging bib files from within LaTeX
I have two .bib files that I want to use in my bibliography. Entries do not overlap. I have found quite a few forum topics on that, but none of them really satisfied me. So my idea is to merge the two ...
1
vote
0answers
31 views
How to get bengali font script as output written within verbatim package?
\documentclass{article}
\usepackage{verbatim}
\begin{document}
\begin{verbatim}
$\alpha=\beta$
Here is my text.
এখানে আমার টেক্সট ।
\end{verbatim}
\end{document}
This gives the following output ...
8
votes
4answers
122 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 ...
5
votes
2answers
82 views
Why can't curly braces be used as a delimiter for \verb? i.e. \verb{foo}
When I try to do the following:
\documentclass{article}
\begin{document}
Hello \verb{foo}.
...
7
votes
2answers
101 views
How to get whole tex in the output document file with actual output?
Consider the following LaTeX document
\documentclass{article}
\usepackage{enumerate}
\begin{document}
\begin{enumerate}[(a)]
\item Here is the 1st line.
\item Here is the 2nd line.
\end{enumerate}
...
0
votes
0answers
30 views
verbatim in two columns [duplicate]
I have a 2 column document that I wish to add some verbatim to.
However, when its added it spans both columns instead of remaining in one (what I need it to do).
Is there any way to do this? or an ...
0
votes
1answer
65 views
wrap listings package - Problem with verbatim argument
I would like to define a command that wraps a lstlisting environment in some other environments (esp. a minipage). I understand that working with verbatim arguments is a difficult task. I tried the ...
2
votes
1answer
42 views
Ceiling function within verbatim in latex
I am preparing a latex document. Inside the body of a function I need to use the ceiling function. How will I use the ceiling function inside verbatim?
\begin{verbatim}
Method a(b)
.
.
...
0
votes
0answers
55 views
Small square at the end of line when \verb and \verbatim [closed]
Hi every time I use \verb at the end of a line or \verbatim mode I get the output with a small black square at the end of the line. For example the output for
\verb!NumSectors * SectorsPerTrack!
is ...
0
votes
1answer
101 views
How to print any command on the PDF document exactly like in the TeX file?
\documentclass{article}
\begin{document}
My text.
\end{document}
Here 'My text' is the output.But I want to get the following output:
\begin{document}
My text
\end{document}
Is there any way ...
2
votes
1answer
51 views
too many curly brace using verbdef
I would like to create an inline verbatim text for a regular expression. The verbdef package does not like when I put curly braces into its second argument. I tried with escaping backslashes but that ...
3
votes
1answer
93 views
Using math mode escapes with listings enabled fancyvrb
I am trying to escape math mode within Verbatim, using this answer. This works fine, until I use the listings package with fancyvrb=true
\documentclass{article}
\usepackage{fancyvrb}
...
0
votes
0answers
100 views
latex export of org-mode: verbatim block in a figure [closed]
What I would like to do is simple: wrap a verbatim code block within a Figure, so that I can refer to it elsewhere in my org-mode file. How is this achieved? A naive solution, which does not work, ...
2
votes
1answer
53 views
verbatim environment inside algorithm2e
I need to output prolog style inside algorithm2e and It seems that I cannot use \verb inside algo2e.
How can I use \verb or verbatim for only one line inside algorithm2e in Latex?
1
vote
1answer
119 views
Displaying (source)Code in research article [duplicate]
I have this urgent need to display two pieces of code side by side for comparison in my article. Displaying a code, I've couple of requirement
Should indent properly
Output should be syntax ...
1
vote
1answer
53 views
Using verbatim in a definition [duplicate]
I actually need to store some verbatim text in a definition so I can reuse it several times.
Here is a very short snippet:
% here I store verbatim text
\def\foo{
bar \verb'baz' spam
}
% now I ...
2
votes
1answer
73 views
How can I create wrapper macro for lstinline?
Using \lstinline I can include inline code snippets in a paragraph. I would like to provide a macro that selects formatting, etc, for lstinline so I can just do, say, \codeinline{snippet}.
I had ...
3
votes
1answer
127 views
lrbox with border in beamer
Can I have border around a \lrbox in beamer?
I have a minipage inside the lrbox.
I know I can use \fbox.
Update
Sorry for the confusion. I need a border around the block of data, it is inside a ...
2
votes
2answers
27 views
verbatim within… a package delivers a string from a file and that string needs to be printed without interpretation
The csvtools package warns in its documentation from interpretable inputs but offers no solution as far as I can see.
This Code generates a table
\documentclass{article}
\usepackage{csvtools}
...
0
votes
2answers
151 views
Importing separate file into my LaTeX file
I'm curious as to whether it's possible to insert an entire separate file into a LaTeX document as an inline command. For example, I have the following LaTeX code:
\begin{Verbatim}[frame=single]
...
1
vote
2answers
146 views
Drawing a rectangle box around code fragment
How to produce the effect of drawing a rectangle box surrounded the code, and put it in the figure? (Any methods including non-tikz-pgf method that helps is welcome)
1
vote
1answer
103 views
Listings: use greek letters
Is it possible (and if yes, of course, and how) to use Greek letters within lstlisting (of the listings package)? \epsilon, for instance, puts of course exactly that and not a Greek epsilon.
I have ...
1
vote
0answers
56 views
Help with verbatim-like environments
I am writing a script for LaTeX shallow parsing (assuming that there are no complicated definitions in the preamble). First of all I decided to check
the document for in-line verbatims and comments, ...


