{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.
11
votes
2answers
483 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
636 views
Customize \verb!…! output in beamer
I apologize because I am sure this has been asked elsewhere however I couldn't find it anywhere. I would like to change my verbatim throughout a beamer presentation in the preamble.
Actually I would ...
9
votes
4answers
168 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
346 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
97 views
listing's lst@BeginWrite gobbles '->' and '=>' from input
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 ...
9
votes
3answers
221 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
323 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
177 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
499 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} ...
2
votes
1answer
441 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 ...
4
votes
1answer
860 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
...
4
votes
4answers
957 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
...
6
votes
2answers
848 views
Putting in MATLAB codes in a box as figures?
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
685 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
306 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
266 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]{}
...
9
votes
1answer
446 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,
...
5
votes
1answer
685 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 ...
7
votes
1answer
353 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 ...
8
votes
2answers
393 views
Highlighting a .diff file
Is there a way to highlight the syntax of a diff file (i.e. by using the listings package)?
10
votes
2answers
399 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}}
...
4
votes
2answers
285 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 ...
5
votes
2answers
504 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
202 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.
3
votes
5answers
3k 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}
...
2
votes
1answer
771 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
340 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 ...
3
votes
1answer
1k 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 ...
14
votes
3answers
489 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{{}
...
6
votes
1answer
774 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}{}
...
1
vote
2answers
205 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
384 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}
...
4
votes
2answers
677 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 ...
8
votes
2answers
859 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 ...
6
votes
1answer
1k 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 ...
3
votes
2answers
372 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.
...
3
votes
1answer
886 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 ...
0
votes
2answers
724 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'.
! ...
12
votes
1answer
1k 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
80 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 ...
5
votes
1answer
852 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}
...
10
votes
1answer
1k 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
127 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" ...
3
votes
1answer
511 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}
...
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 ...
5
votes
2answers
1k 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
178 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 ...
14
votes
2answers
408 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 ...
14
votes
2answers
499 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).
...
11
votes
1answer
3k 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?
