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
0
votes
0answers
71 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
108 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
61 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
65 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
58 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
95 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
54 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
35 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
524 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
36 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
87 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
43 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
55 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
75 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
88 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
96 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
56 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
37 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
74 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
11k 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
49 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
111 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
44 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
257 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{\...
151
votes
6answers
261k 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?
48
votes
5answers
49k 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
130 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 ...
0
votes
1answer
56 views

Fixed position for my Verbatim [closed]

I use the fancyvrb package and I'd like that my Verbatim code is always written with 2pt indention. How can I do that?
4
votes
1answer
333 views

beamer and verbatim

why the following mwe doesn't work, if i uncomment line \end{frame}? \documentclass[xcolor={dvipsnames,handout,svgnames,table}]{beamer} \usepackage[utf8]{inputenc} \begin{document} \begin{frame}[...
1
vote
0answers
55 views

Double quote and less characters (">) create a problem with listings [on hold]

I don't know how to fix this problem, when I use "> in a listings I see a weird double > as result. See this example, where the following section of my article: De esta forma si el título ...
6
votes
1answer
181 views

How does \verb* set the visible space?

I'm trying to understand how \verb* works under the hood, especially where the mapping for the visible space character comes into play. Let's have a look at the definitions first: \verb: macro:->\...
5
votes
2answers
97 views

Why doesn't upquote work with tabularx?

Why doesn't upquote work with tabularx? \documentclass{article} \usepackage{upquote} \usepackage{tabularx} \begin{document} This works: \begin{tabular}{c} Inline \verb|`code`| \\ \end{tabular} ...
0
votes
1answer
32 views

linebreaks in lstlisting and verbatim environment

longline*.txt files contain some text and in some files the text is inserted in an environment as indicated in the filename. The following script: \documentclass{article} \usepackage{listings} \...
3
votes
1answer
2k 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 ...
2
votes
1answer
169 views

Using \verb and \begin{verbatim} / \end{verbatim} in NewEnviron

Consider the following MWE: \documentclass[a4paper]{article} \usepackage{environ} \NewEnviron{myitemize} { \show\BODY \begin{itemize} \BODY \end{itemize} } \begin{document} \begin{itemize} \item \...
2
votes
1answer
71 views

insert code listings in the scope of \foreach

In the following code \documentclass[a4paper]{article} \usepackage{listings} \usepackage{tikz} \begin{document} \foreach\a in {x, y}{ \begin{verbatim} ...
9
votes
3answers
636 views

A pseudocode environment allowing for mathmode and UTF-8 characters?

My usual goto for writing pseudocode is the listings package, but unfortunately, I find myself writing a document in my native language (portuguese) and I need to write UTF-8 characters in pseudocode, ...
0
votes
0answers
68 views

\UseVerbatim equivalent for lstlisting

The package fancyvrb provides \begin{SaveVerbatim} and \UseVerbatim, which does almost exactly what I need. I want to use this with a custom lstlisting environment. The environment looks exactly how I ...
3
votes
1answer
99 views

\comment (verbatim-package) inside \parbox throws errors - What is the problem?

I have defined my own environment - lets call it 'myenv' - which shows and hides its content based on some global settings. I'm using the \comment and \endcomment commands from the verbatim package, ...
0
votes
1answer
329 views

how to print all comments in a document

I have used the verbatim package to comment out significant parts of my tex file. 1) I now wish to see these comments in my pdf document when I compile... in a different colour (say red), without ...
0
votes
2answers
124 views

Code listings: shaded background

How do I make sure that my verbatim text output examples have a shaded gray background? \usepackage{alltt} \usepackage{color} .... {\small\begin{alltt} \# mycommand install \# mycommand configure \# ...
3
votes
2answers
105 views

How can I print “$ formulae $” as itself?

If I type $ formulae $, then the result will be formulae But I want to type "$ formulae $" expression itself, so the result will be $ formulae $ (I mean the result include $ expressions!) Thanks ...
11
votes
2answers
387 views

How to handle verbatim material in LuaLaTeX?

While trying to implement an own working alternative to shdoc (one of its issues see here) I encountered an interesting behaviour of LuaLaTeX I cannot explain. Consider the following code: \...
5
votes
2answers
154 views

If first line is empty in verbatim environment remove it

My verbatim environments are generated automatically. As a consequence some have empty first line - but not all. Is it possible to redefine verbatim env. and force it to remove first empty line if ...
2
votes
0answers
53 views

Read out text file until first empty line is found [closed]

Im currently writing a manual for a package and wanted to include parts of a Matlab file. I was able to display the whole file with the listings package but my goal is to only display the first part ...
8
votes
5answers
4k views

Have verbatim code as an equation

I have a little snippet of program code / input that needs to be rendered with the exact layout as typed in (verbatim). Is it possible to have this as an equation? I tried to nest the Verbatim ...
11
votes
2answers
234 views

Why not catcode11 (letter) but catcode12 (other) is used for verbatim?

What would happen if catcodes were changed to 11 (letter) instead of 12 (other) in verbatim environment or something similar? Will any problems happen? Or, are there any advantages to use catcode12 ...
1
vote
0answers
69 views

Root in verbatim environment

First: This is a a question similar to the one here and will (hopefully) be the last of these kind of questions from me. How do I write a pixelated n-th root sign with a number "under" it as input in ...