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
3
votes
1answer
60 views

Wrapped line of verbatim text get re-numbered

In ConTeXt, I followed the example on the official wiki of inputting verbatim text. The screenshot there shows, the long line, when it is wrapped, is correctly refrained from being numbered twice. ...
3
votes
1answer
56 views

Verbatim text in tcolorbox goes outside right margin

\documentclass{article} \usepackage{tcolorbox} \begin{document} \begin{tcolorbox}[sidebyside=true, title=test] \begin{verbatim} this is <strong>not</strong> a test this is not a test ...
3
votes
4answers
38 views

How to remove spaces around verbatim in tabular

I learned there are two ways to put verbatim inside tabular. \begin{tabular}{cccp{3cm}} \hline SID & the number of elements & length & the number of its non-empty\\ \hline ...
3
votes
1answer
28 views

Verbatim with Wrapping?

I want to copy/paste some text in my latex file as is. I use \begin{verbatim} ... \end{verbatim} The problem is when I copy long text like the following, the text is rendered in one line which ...
1
vote
2answers
35 views

How to highlight code inside verbatim environment?

I am writing a book containing tutorials and I need to show code: Write this: \begin{verbatim} function doit() { console.log("Hello"); } \end{verbatim} And then add these lines: \begin{verbatim}...
0
votes
0answers
53 views

How to use $ sign and tilde in Verbatim environment?

I'd like to write some bash commands in a LaTeX Verbatim environment. Therefore I need to use the tilde(~) to display the users home directory (normal mid lineheight tilde) and also the dollar sign ($)...
0
votes
1answer
32 views

echo command (bash) in verbatim

I want to integrate bash code in Latex. Therefore, I have used verbatim with the following code. \begin{enumerate} \item Generation of a \verb+\texttt{index.html}+ with content: \begin{verbatim} ...
5
votes
1answer
121 views

Keyboard TAB character in argument v (xparse)

I'm trying to understand how the TAB character of the keyboard behaves within verbatim. I have defined a new command using the v argument of the xparse, but, I get errors and a rather strange output ...
1
vote
1answer
49 views

(fancyvrb) Error when finishing environment followed by text

I'm trying to compare he different packages that support verbatim content and I noticed that there is a small, but, big difference in behavior when closing the environment followed by text (not a new ...
0
votes
1answer
26 views

Printing plain underscores in file names

I would like to display the filename when an \includegraphics command refers to a missing file (without producing errors). Currently it doesn't work for files with an underscore in the file name. ...
1
vote
1answer
18 views

How to vertically align verbatim text and image in two columns to the top in Beamer?

Code: \documentclass{beamer} \begin{document} \begin{frame}[t,fragile] \begin{columns}[T] \begin{column}{0.45\textwidth} \begin{verbatim} Lorem ipsum dolor sit \end{verbatim} ...
0
votes
0answers
63 views

Verbatim inline

I'd like to put a verbatim inline. For example: Consider the text: blah blah blah \verbatim_inline{y = x1 + x2} and \verbatim_inline{y_value}. I tried to use \newcommand{\code}[1]{\texttt{#1}} in ...
0
votes
0answers
59 views

Sphinx Verbatim (Code block) with background color

I would like to remove the frames and set a light grey shade background to my code blocks. I know I could use colorbox such as \begin{tcolorbox}, but I have no idea where to place it. Sphinx uses ...
1
vote
0answers
13 views

cnltx-example package is not working with beamer

When I am going to compile the following codes, \documentclass[11pt]{beamer} \usepackage{amsmath,amsthm,amssymb,amsxtra} \usepackage{cnltx-example} \begin{document} \begin{frame}[fragile]{} \...
2
votes
1answer
31 views

How to write matrix and its source code using cnltx-example

I want to get output of the matrix \begin{pmatrix} \frac{1}{2} & 0 & \frac{9}{5} \\ -2 & \frac{2}{3} & -\frac{1}{4} \\ 12 & 0 & \frac{11}{7} \\ \end{pmatrix} along with the ...
3
votes
0answers
33 views

Is there a downside of always using fragile? [duplicate]

I am preparing a presentation and since I am presenting a lot of code, I find myself adding [fragile] to many slides such that I can put verbatim code in it (actually lstlisting from from the listings ...
0
votes
0answers
23 views

Python code does not format properly and Overleaf just outputs 1 page despite code being longer than that

This is what it looks like: The code gets off the margins and the output is only 1 page. All I added to the code was \begin{document} \begin{verbatim} <code> \end{verbatim} \end{...
0
votes
1answer
79 views

\verb with % in tabularx

Is there any way of typesetting the % symbol in \verb within a tabularx-cell? \documentclass[]{article} \usepackage[utf8]{inputenc} \usepackage{tabularx} \begin{document} \verb|b%a| \begin{...
1
vote
2answers
52 views

Including and altering a .txt input in LaTeX

I am using \usepackage{verbatim} to show a .txt file in my LaTeX document, via \verbatiminput{<path to .txt>}. And this works fine. However, the data that I display looks like this: 5.35 0....
1
vote
2answers
69 views

Defining Commands with \verb||

Is there any way to define some custom command using the \verb|| environment? As an example, I want to write {\color{SteelBlue4} \verb|my_data.txt|} since using the _ will cause an error if I only use ...
1
vote
0answers
24 views

How to typeset \end{verbatim} in verbatim environment? [duplicate]

How to typeset \end{verbatim} in verbatim environment or in any other verbatim-like environment its own \end tag?
2
votes
2answers
35 views

Problems when defining a general inline code command with listings or verb

I am trying to define an inline \code command (not language specific, just a smarter \texttt{} without the need to escape underscores or tildes, for example). I tried the three versions below based on ...
1
vote
1answer
88 views

How can I only make one word 'verbatim'?

How can I make only one word "verbatim" in LaTeX? For example: \usepackage{verbatim} \begin{document} The\begin{verbatim} TableForm[]\end{verbatim} shown below is a trig table which.... The only ...
0
votes
0answers
61 views

What's a nice way to display code in a document?

I'm looking for a nice or creative way to display code in a LaTeX document. I see a lot of nice layouts in books, with text-boxes, titles, annotations, delimiters, and all sorts of attractive things. ...
1
vote
1answer
48 views

Decreasing font size and space in verbatimInput{data.txt}

How to decrease the text size and reduce space in VerbatimInput{data.txt}. Also text goes out of page both horizontally and vertically. \begin{figure} \fbox{\begin{minipage}{16.7em} \...
0
votes
1answer
44 views

width-fitted (shrunk!) verbatim that can break pages

Is there a verbatim variant that can check if the content exceeds the \textwidth, and [if so] shrink the contents (font-size) inside the verbatim to fit the textwidth? (pdflatex is an ok requirement.)...
0
votes
1answer
39 views

Use environment into (new) xparse environment

I'm writing a small library, and for some reasons, it seems that I can't nest environments with xparse's new way of defining environments. It's quite annoying as my users may want to nest environments....
0
votes
3answers
66 views

Line breaking for ConTeXt `\type`

[Edit: What I wanted is a clickable url, or if impossible, at least a nicely wrapped url in mono font, but the original wording is somewhat vague.] In ConTeXt, when using \type for verbatim text (as ...
1
vote
0answers
34 views

How can I use Fira Code with ligatures in pdflatex?

Basically, I've come to really like Fira Code and its ligatures while coding, and I'd like to use it for my code listings in LaTeX, too. Specifically, I am looking for a way to use Fira Code with ...
1
vote
1answer
51 views

Using verbatim within a onslide environment

I want to use \onslide<2-> with verbatim environment inside in beamer, e.g.: \onslide<2->{ \verb+foo+ } This does not work due to overlays and verbatim conflicts... I found out that ...
4
votes
3answers
191 views

How to scale a verbatim environment on a minipage?

I have a plain vebatim environment. Questions 1, 2 are too complex to understand. I would simply like to align in the center and rescale the ascii art logo. MWE: \documentclass{article} \usepackage{...
0
votes
0answers
29 views

Add caption to verbatim environment and adjust padding?

I do like the verbatim setting and the ascii border, but the wanted algorithm caption padding is too great, same with the top to flow text. Am i doing it right? \documentclass{article} \usepackage{...
2
votes
1answer
34 views

Inline todo-notes including verbatim blocks?

I'm making a major change to a document, and I want to turn some quite large sections into notes using todonotes. According to the documentation, this can be done with \todo[inline,caption={My ...
0
votes
1answer
36 views

pagenote converts spaces to newlines and breaks verbatim typesetting

I want to typeset verbatim end notes (using minted). Unfortunately pagenote converts all spaces in my page notes into newlines, as the following minimal example shows: \documentclass{memoir} \...
1
vote
2answers
102 views

verbatim listing with trailing spaces

I'm trying to redefine \verb just for fun. It should act like the LaTeX starred version: \verb<some-char><arbitrary chain of chars not containing it><same char again> should yield ...
1
vote
0answers
42 views

Is there some new conflict between newtxtext and \verb? [closed]

I have LaTeX file that ran a couple of months ago but now generates a fatal error. Here is an MWE getting the same error \documentclass{article} \usepackage{newtxtext} \begin{document} \verb"a" ...
3
votes
1answer
149 views

\verb not working in beamer even though I use [fragile]

Just trying to display a command like \section{} in the presentation, but \verb doesn't work. It works without the \uncover{}, but is there anyway to get around that? \documentclass[t,xcolor=...
1
vote
1answer
27 views

Cannot overline a word inside a verbatim block

I am trying to a overline a word inside a verbatim block but it does not work, for example: \begin{verbatim} Hwy3 =1 Hwy3 Hooterville = 0 \overline{Hooterville} \end{verbatim} I have also tried ...
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 ...
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 \...
2
votes
2answers
55 views

LaTeX 2e's verbatim-environment and different input-encodings

The inputenc-package provides means for selecting an input-encoding for subsequent tex-input. If I understand correctly, the verbatim-environment as of the LaTeX 2ε-kernel does change ...
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 ...
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
63 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
42 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
90 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
232 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
71 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.