The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [verbatim]

{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.

Filter by
Sorted by
Tagged with
2
votes
1answer
52 views

Footnotes in a verbatim environment that also appear in (or just below) that environment

I require a verbatim like environment that allows footnotes and, in addition, displays the footnote text in that environment (as opposed to the page) or just below the environment floating with it. I ...
3
votes
1answer
170 views

Xetex, typewriter fonts and quotes

I use XeTeX with C-language code inside verbatims. The aim is that my students can perform copy/paste from the resulting PDF document into their programming IDE. Using XeTeX is great because I can ...
15
votes
2answers
11k views

Inserting LaTeX code into LaTeX

I have a problem with adding text into a LaTeX document. I have a LaTeX document about LaTeX and I need to insert some code snippets. I need to add "\usepackage{musixtex}" as a text, which should be ...
3
votes
2answers
103 views

Add ASCII image

I want to add many ASCIIs Art images on my document. But If I use verbatim environment, the output is ugly ! How to solve? (I lovely a solution with the possibility to import only my txt file with ...
2
votes
1answer
32 views

verbatim-environment inside group implies unwanted paragraph-break. Why? How to avoid?

When I wrap a verbatim-environment into an additional group, a new paragraph will be started after that group. (In the example below, \parindent-glue is inserted before the YYY when \begingroup and \...
1
vote
0answers
29 views

savetrees and \verbatim interact badly

My MWE $ cat test1.tex \documentclass{article} %usepackage{savetrees} \begin{document} \begin{verbatim} for i in range(3): for j in range(3): for k in range (3): plot(i,j,k) # ...
2
votes
1answer
64 views

use \path instead of \verb in biblatex [duplicate]

Noting that \path can be made to wrap arbitrary text as per Forcing linebreaks in \url, I would like to use \path instead of \verb inside of biblatex for the "verbatim" fields. This would mean ...
0
votes
0answers
13 views

How to get line number within minted using Verbatim figure environment? [duplicate]

I noticed that using Verbatim to use minted within a figure environment removes the line number, compare the following: 1) the figure environment: \begin{figure}[htp] \centering \...
1
vote
0answers
44 views

How can I hide (or blur) some code in a pythontex environment?

My question is directly related to this one. Does there exists a solution for pythontex ? At least for the verbatim environment. More precisely, let us consider the following MWE : \documentclass[...
0
votes
0answers
43 views

Including empty lines in verbatim text in command environment

I am trying to typeset some text on an included pdf page with the pdfpage package. This can be easily done with the pagecommand={} option. But it seems we cannot insert an empty line inside the ...
3
votes
1answer
91 views

beamer, verbatim, and `\end{frame}`

as of current TL2018 a minimal beamer/verbatim file containing a line \end{frame} in the verbatim code fails to compile: \documentclass{beamer} \usepackage{fancyvrb} \begin{document} \begin{frame}[...
1
vote
2answers
235 views

Verbatim inside \block

I already searched for a solution but found none which works for me. My aim is to write some command inside a block environment. Even though I used \cprotect or \protect it still won't work. Normally ...
2
votes
2answers
72 views

overline command in math mode with verbatim

Does anyone know how to get something like \overline{\verb!signal!} to work? I cannot seem to figure out how to get \overline to understand a verbatim command.
2
votes
4answers
15k views

Printing LaTeX command without compiling it

How could I write a command in LaTeX, so after compiling it will be shown as a text in PDF and not executed? For Example, I would write \it This is how you write in italic and the compiled pdf would ...
20
votes
2answers
1k views

Incompatibility between verbatim and tabu? (Danger of using \scantokens in a package)

With the following MWE \documentclass{article} \usepackage{verbatim} \usepackage{tabu} \makeatletter \renewcommand\verbatim@processline {% \begin{tabu}to\textwidth{|l|X[-1,l]|} foo&\the\...
2
votes
2answers
487 views

beamer, overlay in allt or fancyvrb

I'd like to highlight some text inside an alltt or verbatim or Verbatim (or whatever environment/package that would produce what I want) on some slides. So, I create a newcommand<> that does the ...
0
votes
1answer
68 views

What is the advantage of using a pseudocode package instead of simply putting code inside of a verbatim block? [closed]

What are the advantages of using a pseudocode package (like algorithm2e) above simply putting code inside of a verbatim block? Edit: In order to make the question less vague, I will say this: ...
4
votes
2answers
168 views

How to renew verbatim to Verbatim from fancyvrb?

I am using pandoc to convert Markdown to Tex, pandoc will render code blocks to \begin{verbatim}CODE\end{verbatim}, and fvextra only works with \begin{Verbatim}[breaklines]. How can I make {verbatim} ...
3
votes
3answers
112 views

How can I put every `verbatim` environment inside a `Shaded` environment by changing the preamble only?

Unfortunately, I have a lot of TeX code which should look different that it does not, but I cannot modify its code body. However, I can modify the preamble and for example, I have learned that I can ...
2
votes
1answer
124 views

Why enclose a \verb block with curly braces?

Why would you enclose a \verb block with curly braces? Does it change anything? Consider the following examples: The \verb|acmart| document is \verb|orange| and \verb|blue|. Use the {\verb|verb|} ...
2
votes
3answers
121 views

\verb and align

I am getting an error when I am using the verb command in align. I prefer not to use \texttt because the underscore isn't the right length for a single underscore or a double underscore - the right ...
0
votes
0answers
105 views

Change language inside verbatim environment

I have the following: \documentclass[a4paper]{article} %% Language and font encodings \usepackage[greek, english]{babel} \usepackage[iso-8859-7]{inputenc} \usepackage{amsfonts} \usepackage{amsmath} ...
3
votes
0answers
153 views

Suppress Fira Code ligatures involving “{” and “}” in verbatim

I am trying to improve the current implementation (v0.1b) of the lstfiracode package. In particular, I wish to achieve the opposite of Use Fira Code font with ligatures in code listings. ...
2
votes
1answer
74 views

How can I use `\renewcommand` to wrap `\colorbox` around `\Verb` by only changing the preamble?

What works: I have TeX files which contain code like: I want \texttt{this text} to have a background color. I want the \texttt to have a background color: I want \colorbox{lightgray}{\texttt{this ...
3
votes
1answer
76 views

How can I wrap `\colorbox` around `\Verb[commandchars=\\\{\}]` by only changing the preamble?

This is a follow-up question to How can I use `\renewcommand` to wrap `\colorbox` around `\Verb`? I have TeX files which contain code like: \Verb|print("Hello World", end="")| The \Verb content ...
2
votes
1answer
60 views

Escape lots of backslashes and other special characters

I'm trying to write a Unix command in LaTeX, but it seems to be stuck on special characters. Is there a way to escape backslashes, accolades, dollar signs etc.? The command is the following $(python -...
2
votes
1answer
116 views

Minted Linenos not working after using RecustomVerbatimEnvironment

Currently I am trying to work with the minted package. My aim is to have a code snippet with the numbering for each line, which is centered in a figure. My top level configuration looks like ...
2
votes
1answer
61 views

Hebrew within sourcecode

I need to include LaTeX source code, which contains Hebrew text, within an Hebrew document. I tried doing so within a verbatim environment, but Hebrew words appear in opposite order. Any solution ...
1
vote
1answer
39 views

lualatex using vebatim package

This was working and I don't see what has changed, but the code below is now throwing a "Missing \endcsname inserted" error. If I just press Return, lualatex continues, reads the text file myfile.lua,...
2
votes
1answer
810 views

How to write č,ć,ž,š,đ in verbatim?

I have a problem with verbatim, it can't read my Serbian language symbols like č, ć, ž, š, đ. If I try \begin{verbatim} č,ć,ž,š,đ \end{verbatim} I get blank space, also if I try with \v{c},\'{c},\...
1
vote
1answer
37 views

Some very odd behaviour of \verb and \verbatim in connection with TeXMaker

I cannot but assume that whatever <text> is placed between the delimiters (in this case +) in \verb+<text>+ and \verbatim+<text>+ has no effect whatsoever on the world outside the ...
2
votes
2answers
96 views

Getting fancyvrb and mdframed to work togegher

I would like to format terminal output as follows: white text on black background commands written by the user are emphasized (slanted typewriter) Using a combination of mdframed and fancyvrb I got ...
0
votes
1answer
50 views

nomenclature and \verb|text|

I tried different solutions but without result I have configured arara on texstudio to be able to use the nomenclature package. \usepackage[refpage,intoc,italian]{nomencl} \makenomenclature \...
0
votes
1answer
65 views

Command verbatiminput error with Keyboard character used is undefined

This is the probit.txt file I use the verbatim package to insert some text file. In particular using the command, \verbatiminput{probit.txt}. But there are some characters in the text file that cause ...
2
votes
1answer
76 views

How to keep the correct line numbering when using ConTeXt vim module?

Consider the following code: \usemodule[vim] \definevimtyping [somecode] [numbering=yes,lines=split] \starttext \startsomecode Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam ...
4
votes
3answers
116 views

\verb in label or pin of a tikz node

The documentation of tikz gives following example containing the \verb command in the node text (Section 2.21 Adding Text, v3): \begin{tikzpicture} \draw (0,0) rectangle (2,2); \draw (0.5,0.5) node [...
0
votes
1answer
22 views

executable code containing symbol `'` inserted with verbatim on pdf. Error while copying back into a text editor

I'm trying to insert Octave code in a pdf. However, there is a problem with the sign ' (which means transposition in Octave code). However when I copy the code from the generated pdf, the code doesn't ...
1
vote
2answers
132 views

AucTeX issue with BVerbatim in newenvironment

I have the following newenvironment command: \newenvironment{code} { \VerbatimEnvironment \begin{mdframed}[ backgroundcolor=black!70, leftmargin=1, rightmargin=1, innerleftmargin=4, ...
1
vote
1answer
120 views

How to include a file with the verbatim environment

I would like to include a file within the verbatim environment but this of course doesn't work: \begin{verbatim} \input{file.tex} \end{verbatim} Is there way of getting LaTeX to execute \input ...
2
votes
2answers
57 views

Tabularx printing regex incorrectly

When printing regex in a tabularx environment, spaces get inserted after each character class. Is there any way to fix this? MWE: \usepackage{tabularx} Outside table: \verb~/\d+/~ \begin{tabularx}{...
1
vote
1answer
46 views

Code using verbatim doesn't work when copied back in a text editor

I'm trying to use verbatim to copy the implementation of an algorithm written in octave. For this I introduced the following lines in latex \begin{verbatim} F = @(z) [z(1) + 2*z(2) - 2; 2*z(2)*z(3)^2 ...
1
vote
1answer
89 views

How can I create a callout box that does not conflict with verbatim?

My goal is to make a small box in the top-right of the page that holds a small table. This serves as an "infobox" much like the ones seen on wikipedia pages. I've implemented this using wrapfigure ...
5
votes
4answers
12k views

Decreasing font size in verbatim

How can I modify the following command to make it work? \newcommand{\code}[1]{\begingroup \fontsize{10pt}{10pt}\selectfont \begin{verbatim} #1 \end{verbatim} \endgroup} I currently get the following ...
1
vote
1answer
62 views

How to use boolean to toggle display of environment that may contain verbatim?

I'd like to create an environment solution that either displays its contents or nothing depending on whether the boolean solutions is set. Currently I'm trying: \documentclass{article} \usepackage{...
3
votes
2answers
119 views

Without loading fontspec, \verb* cannot produce visible space under XeLaTeX

\verb* fails to produce visible space, under XeLaTeX. The problem repairs if package fontspec is loaded. By the way, \textvisiblespace produces visible space under both occasions. Moreover, \verb* ...
1
vote
1answer
51 views

tcblisting apparently not a verbatim environment

MWE % arara: pdflatex \documentclass{article} \usepackage{tcolorbox} \tcbuselibrary{listings} \begin{document} \begin{tcblisting}{listing options={language=ruby}} "hello #{world}" \end{tcblisting} \...
3
votes
1answer
283 views

How do I set a background color and font for inline verb text?

I wish to customize the verb command such that I can customize the font and color, as well as set a rounded colored rectangle as background. I found this in the Tcolorbox manual: \DeclareTotalTCBox{\...
155
votes
6answers
269k views

When should one use \verb and when \texttt

Sometimes people here use \verb!A SHORT COMMAND! and sometimes \textt{A SHORT COMMAND}. I'm unsure when to use which. Are there any guidelines or arguments for \verbatim vs. \texttt?
50
votes
5answers
51k views

Verbatim environment that can break long lines?

I want to generate a PDF of user-submitted text using LaTeX. To handle crazy user input, I first thought about using the verbatim package, but of course it doesn't break up too long lines. Is there ...
1
vote
1answer
157 views

\verb illegal in command argument in \begin{align*}

I am trying to generate a set of aligned equations that looks like, (note: random and variable are supposed to be pseudo-code) However, instead I got this along with an error, that says, \verb ...