{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
29 views

Why do some spacing commands work correctly after end commands, and others don't?

Why is it that \begin{verbatim} some verbatim \end{verbatim}\bigskip will work without errors, but if I changed the ending line to \end{verbatim}\\[1\baselineskip] I'll get errors? Am I ...
0
votes
1answer
15 views

Why can't I use multiplie verbboxes? [on hold]

I am writing some documentation for a testing framework I am using at work and I use verb boxes to show code and add comments/captions that pertain specifically to that code. But I am getting the ...
2
votes
1answer
27 views

I have included verbatim to show a small section of code, how can I add a comment/caption for this verbatim?

I am writing some documentation on a tool I am using at work and I have included some code that has a comment to explain what a particular line is there for, this comment runs off the page if I leave ...
7
votes
1answer
105 views

How can I change a glyph in a Verbatim environment?

I have a document which contains example program code in Verbatim environments. The caret symbol produced by typing ^ looks too flat to me, so I defined a macro to produce a sharper version. ...
2
votes
1answer
45 views

macro to showcase newly defined macros

I have the following MWE which takes an argument and prints it verbatim. I have obtained the code from this answer. \documentclass{article} \makeatletter \newcommand{\myverb}{% \begingroup % ...
12
votes
1answer
593 views

escape `|' in \verb

In LaTeX, if I use \verb, how can I escape |? For example, I want to display ab|bc: \verb|ab[]bc|. What should replace []?
5
votes
1answer
47 views

New environment for minipage and colorbox

I would like to create a new environment that would automate the following code: \setbox0=\hbox{\begin{minipage}{5.8in} \color{black} \begin{verbatim} <Some verbatim text here> \end{verbatim} ...
2
votes
1answer
40 views

Difference between fixed-width and proportional typewriter fonts in listings?

In the MWE below, I wonder why does the pcr (Courier) font align in both escaped and unescaped versions and for whatever column setting of {listing} - while the cmtt (Computer Modern Teletype) aligns ...
5
votes
1answer
56 views

How to use \pretocmd with \verb or \lstinline?

I write my document in other language, then I need to switch to English (switch font) when show code: \newcommand\code[1]{\lstinline{#1}} \pretocmd{\code}{\begin{otherlanguage}{english}}{}{} ...
8
votes
2answers
5k views

Verbatim in beamer showing error: “File ended while scanning use of \@xverbatim.”

I am using Texmaker and MiKTeX on Windows 7. I have the following beamer code, \documentclass{beamer} \theme{AnnArbor} \begin{document} \begin{frame} \begin{verbatim} ...
16
votes
3answers
976 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 ...
3
votes
1answer
33 views

whitespaces in alltt environment get merged

\begin{frame}{Beispiel Mergesort} \begin{alltt} mergesort :: (Ord a, Trans a) => [a] -> [a] mergesort [] = [] mergesort [x] = [x] ...
0
votes
1answer
71 views

LaTeX: C++ source code can be included with verbatim, but not with lstlisting [closed]

When trying to compile my .tex files, I can only include some of my C++ source code as "lstlisting"s, while other source code breaks compilation. The error I get is: Extra }, or forgotten \endgroup. ...
1
vote
2answers
59 views

Shrinking the text in verbatim mode [duplicate]

I need to deal with loads of code lines in verbatim mode and append them to the appendix. That is, I may not need to show them in a fancy way but I want them to occupy least amount of space. As you ...
2
votes
2answers
132 views

The correct way to type tilde?

So, I know there are a lot of posts about this already, with answers like \textasciitilde, \texttildelow and $\sim$ and they all seam to work in their own way. But what I've found is that they look ...
6
votes
1answer
348 views

How can I make bash-code look good both in LaTeX and HTML?

As I am new to Latex and this kind of typing in general, I find myself in need of some basic guidelines when it comes to how to make things look good in text. I have a document that looks good when ...
3
votes
1answer
234 views

verbatim environment inside algorithm2e

I need to output Prolog style inside algorithm2e and It seems that I cannot use \verb inside algorithm2e. How can I use \verb or verbatim for only one line inside algorithm2e in Latex?
9
votes
3answers
151 views

Fancy code environment

I'm writing a small tutorial about LaTeX. So I'd like to insert some code and obtain the result on the right. I'm almost there. I got the desired output but I'd like something more clear, that is, ...
2
votes
1answer
51 views

How to combine simultaneously the fragile- and the label-command for a frame?

I am currently facing the following problem in the beamer-class for LaTeX: I would like to label a frame and simultaneously use a verbatim-environment. Most likely the solution is very easy but I do ...
4
votes
1answer
53 views

Redefine verbatim environment

I have a text with source code, which I would like to display. I am using pandoc, so I have to use either verbatim or listings enviroment. Unfortunately, I can't use listings package (due to ...
2
votes
0answers
31 views

lstlistings messes up spacing before subsequent section headings [duplicate]

I'm typesetting a grammar specification for a programming language, which leads to many short snippets of grammar and example code interleaved in the document text. The issue I observe is that an ...
3
votes
1answer
68 views

Verbatim environment with gray background color and italics

I want a verbatim environment with gray background color and italics(bold fonts may be used also). The \lstlisting can set background but can't set italics. The \mdframed combined with \alltt can ...
3
votes
1answer
30 views

Creating command: FanceVerb Error, Paragraph ended before

Hi and sorry if that question might be already asked. I try to create a command like this: \documentclass{scrbook} \newcommand{\code}[1]{\texttt{#1}} \newcommand{\smallx}[1]{ \begin{center} ...
2
votes
2answers
46 views

How to specify non-standard font in fancyvrb Verbatim?

I am using Inconsolata for code in paragraphs, and would like to use it for code in verbatim environments as well. I have tried using fancyvrb's Verbatim environment to do this, but cannot get any ...
0
votes
1answer
68 views

How to properly format pseudocode (algorithm) in LNCS (Lecture Notes in Computer Science)?

I know that when I need to paste the source code, I should use \verb or \verbatim. But how about pseudocode\algorithms? Should I use \verb or \verbatim as well? Can't really find any official Springer ...
4
votes
2answers
41 views

unmatched curly brace in \PVerb argument

I do realize that a verbatim { can be obtained by \verb|{|. However, I need \PVerb which is robust to work in \item command. Obviously, a \PVerb{{} won't work. So is there a solution for unmatched { ...
4
votes
2answers
112 views

Define a special verbatim commmand

To learn more about Plain TeX, I try to define a special verbatim command \verb{code}, which puts code inside braces. When there is no braces in code, It's easy. But when there are some balanced ...
3
votes
0answers
41 views

Show whitespace characters in monospace environments

I need to render an ASCII file for printing in a way that removes ambiguity if (very unlikely) one decides to type it in and validate the signatures. Essentially, I need a monospace typesetter that ...
5
votes
2answers
108 views

How do I center a boxed 'Verbatim'?

Here's a MWE: \documentclass[12pt]{article} \usepackage{fancyvrb} %=== \begin{document} \begin{Verbatim}[fontsize=\small, frame=single, xrightmargin=5cm] Text. \end{Verbatim} \end{document} ...
10
votes
2answers
830 views

Using \lstinline inside a \item

I know about the fragility of verbatim-like commands, and that they should not be used as an argument of another macro, but a need to write a description environment in which the terms to be defined ...
3
votes
2answers
37 views

How to avoid the empty lines before and after a verbatim environment in a tabular cell

I want to insert some raw text and used verbatim in the cell of a tabular. Here is the code: \documentclass{article} \begin{document} \begin{tabular}{p{0.45\textwidth}|p{0.45\textwidth}} \hline ...
3
votes
1answer
57 views

Usage of minted inside newenvironment in minted 2.0a³

As a followup question to Lstinline macro inside another environment, I kind of want to do the same thing for minted as well, but I'm held back by the following: I used the code from Using minted to ...
5
votes
1answer
59 views

Lstinline macro inside another environment

Why does the MWE below compile with errors only if I use ths \lstnewenvironment line? And how to define the verbatim macro inside an environment? I heard it's possible using plain TeX? ...
3
votes
1answer
31 views

\verbatiminput stopped working?

In the past, I've used the \verbatiminput command in \fancyvrb without problems, but today it's not working for me. I checked, and /usr/share/texlive/texmf-dist/tex/latex/fancyvrb/fancyvrb.sty is ...
2
votes
1answer
72 views

Using Sagetex on cloud.sagemath.com, is it possible to make Sageblock code wrap automatically?

Creating a LaTeX document on the Sage Math Cloud. Whenever I use a sageblock, I end up with endless typesetting warnings because the notes and code inside the sageblock does not automatically wrap ...
1
vote
2answers
35 views

How would I take imported file and format it to account for spacing?

Basically what I'm trying to do is use something like \input{details.txt} which contains: ____Here are some random details with stuff everywhere. This is to see if latex will use this ...
2
votes
1answer
2k views

fancyvrb alternate commandchars and \textcolor

The following works: \documentclass{article} \usepackage{fancyvrb} \usepackage{color} \begin{document} \begin{Verbatim}[commandchars=\\\{\}] test\textcolor{red}{foo}test \end{Verbatim} ...
10
votes
2answers
169 views

Overlay red rectangles on top of verbatim text

I am using Beamer to prepare a presentation. In some slide I need to print a great deal of verbatim text and, also, I need to draw some red rectangles on top of it. What would be the most ...
2
votes
1answer
36 views

Usage of minted inside a new environment, inside IfFileExists

I want to conditionally load minted and define an environment, but after using IfFileExists I'm running into an error: FancyVerb Error: Extraneous input `resetoptions \setkeys ...
2
votes
0answers
29 views

LaTeX doesn't create new pages of bibliography or in the verbatim

It seems that I have some inherent problem in my document and I don't even know what the problem can be and where to search... When I create a bibliography using \bibliography{bibliography} LaTeX ...
2
votes
0answers
42 views

Package tikz Error when writing some text in verbatim [duplicate]

I got from texlive on windows 8.1 an error when I wrote some text in verbatim. The error was: (c:/texlive/2013/texmf-dist/tex/latex/lm/t1lmtt.fd) ...
2
votes
0answers
83 views

fancyvrb inline verbatim with \newcommand and \CustomVerbatimCommand

I've just registered. This is my first question to this site. I am trying to make a verbatim command for inline code. This has been asked and answered many times before, but I never found a direct ...
4
votes
1answer
54 views

How can I mimic the output of syntax macros (\marg, \oarg, etc.) without using the ltxdoc class?

I have come to realize that the pleasant style (argument in italics, enclosed by angle brackets) of macro descriptions in numerous package documentations is actually produced by a number of special ...
6
votes
1answer
56 views

Problem in using comment line in tcolorbox in a bash code

I am recently introduced to tcolorbox, which is a great package. I am trying to use it to highlight computer codes such as bash, python, and c++ in my document. When I run the following MWE, I get the ...
5
votes
2answers
360 views

How to add line numbers to a program listing/code? [duplicate]

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 ...
7
votes
3answers
2k 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 ...
7
votes
1answer
69 views

Conflict between verbatim.sty and ltxdoc.cls

I am writing a package which uses the verbatim package. \RequirePackage{verbatim} For the documentation I'm using the ltxdoc class. So I have to put an % character before every line of the ...
11
votes
2answers
224 views

How can I make lstlisting look exactly like verbatim?

I like the way the verbatim environment looks, and I want to make my lstlistings look like it. I've tried setting the basic style to \ttfamily, but the letter kerning and line spacing seem to be ...
4
votes
2answers
121 views

Indent content of verbatim / lstlisting environment relative to containing environment

I want the content of \verbatim to be indented relative to the actual indent of \verbatim, not the exact number of spaces. For example, I like to indent at sections to make the LaTeX source more ...
4
votes
2answers
73 views

Change Verbatim Font To PCR

I'm writing a document using LaTeX, and I would like to use the PCR font inside of a verbatim block. This question is almost identical to mine, but when I try to apply it to use PCR, I can't get it ...