{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

0
votes
1answer
45 views

How can I include the R source code in the appendix?

I really have no idea how to include the R code into latex, so I only can provide my R code. I would like to put it in the appendix. I am really looking forward to your help. Thx! The codes will show ...
11
votes
0answers
71 views

Workaround for open lualatex bug in \scantokens?

As package author I am in need of writing a manual with lots of examples. Now I started to make heavy use of lualatex in order to speed up operations which take a long time in TeX (of my package, not ...
5
votes
1answer
41 views

Why does `! Missing $ inserted.` occur when using \verb in beamer?

When I use \verb+...+ within beamer I get ! Missing $ inserted. <inserted text> $ l.6 \end{frame} ? What is going wrong and how do I fix this problem? A minimal example is ...
4
votes
1answer
97 views

Verbatim inside a minipage inside a tikz node — beamer class

I am trying to get a boxed text as part of a tikz node. I found an example here that I am trying to follow, but it is giving me an error: Argument of \@xverbatim has an extra }. I can't figure it out. ...
3
votes
1answer
62 views

How to copy/paste multiple spaces from lstlistings?

This is a continuation of a question that I asked already: How to copy/paste from lstlistings?. The solution presented there does not work if the text within the lstlistings environment contains ...
0
votes
0answers
34 views

LyX 2.1.1 does not recognizing verbatim environment

I updated to LyX 2.1.1 and have issues with previous versions created files. LyX 2.1.1 throws the following error: does not recognizing verbatim environment I wonder how to overcome this issue. Any ...
4
votes
1answer
67 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
22 views

Why can't I use multiplie verbboxes? [closed]

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
33 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
115 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
50 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 % ...
5
votes
1answer
58 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
68 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
60 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}}{}{} ...
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] ...
1
vote
2answers
61 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
142 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 ...
0
votes
1answer
80 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. ...
6
votes
1answer
368 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 ...
9
votes
3answers
162 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
54 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 ...
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 ...
4
votes
1answer
57 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 ...
3
votes
1answer
75 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
32 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} ...
0
votes
1answer
102 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
43 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 { ...
3
votes
0answers
45 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 ...
4
votes
2answers
118 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 ...
2
votes
2answers
58 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 ...
5
votes
2answers
114 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} ...
3
votes
2answers
39 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
66 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
65 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
34 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 ...
1
vote
2answers
36 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
81 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 ...
10
votes
2answers
174 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
39 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
92 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
55 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
58 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 ...
7
votes
1answer
77 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
259 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
79 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 ...
10
votes
4answers
2k views

Change font size of the verbatim environment

I want to apply small fonts inside the Verbatim environment e.g. {\small \begin{Verbatim} 1 double x, y; 2 double z, w; 3 main(); 4 return 0; \end{Verbatim}} Before the command \small ...
6
votes
2answers
107 views

Seemingly trivial: verbatim, newenvironment, and colorbox

I am, once again, trying to achieve what seems like a trivial goal. I want to use \newenvironment to define a verbatim environment with a background color. I need to define my own environment because ...
5
votes
0answers
31 views

How can I replicate verbatim's letter spacing in listings? [duplicate]

I was trying to imitate the code listings in the book Mathematical Recipes in C, I understand that it uses the CM TT font. What I am interested is in the proportion between the text and the code, and ...