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
5
votes
1answer
373 views

SageTeX and Commenting Out Code

I'm struggling to find a way to get SageTex and any of the commenting (comment or verbatim) packages to play nicely together. I'd like to be able to comment out a section of LaTeX code, containing ...
0
votes
0answers
13 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
1answer
247 views

Pandoc Output PDF with Code Block using listing other than verbatim

I using RStudio and Pandoc to output my document created in markdown to PDF. Pandoc always convert the code blocks in markdown using verbatim environment. Does anyone know how to switch the default ...
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
27 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
29 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 ...
2
votes
4answers
3k views

! Paragraph ended before \lst@next was complete: Using lstlisting in itemize

I want to print a piece of verbatim within an item of an itemize environment, as below: \documentclass[letter, 11pt]{article} \usepackage{enumitem} \usepackage{pifont} \usepackage{listings} \...
0
votes
0answers
15 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{...
4
votes
1answer
327 views

Is it possible to use the `verbatim` environment in a dot2tex node?

Is it possible to use the verbatim environment (i.e. \begin{verbatim}...\end{verbatim}) in a dot2tex node? If so, please could you provide a MWE? Update: this is the closest I've got so far: digraph ...
1
vote
1answer
44 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 ...
0
votes
1answer
70 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
51 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
66 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 ...
55
votes
6answers
13k views

How to obtain verbatim text in a footnote?

I want to employ a \verb command in a footnote. But, when I run pdflatex on \documentclass{article} \begin{document} I want this.\footnote{\verb|But, it does not work!|} \end{document} I get this:...
1
vote
0answers
21 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?
0
votes
1answer
61 views

Listings not breaking long lines with breaklines=true and breakatwhitespace=false

I have the following code in my Markdown: ```{latex-fontsize=scriptsize} $ ./my-new-application create app_example creating app_example Generating <path-to-app-src>/new-application/...
4
votes
2answers
185 views

\VerbatimInput : adjust a long line of a .dat file

In this document, \VerbatimInput is calling test_2.dat. test_2.dat contains a line too long, so that the compilation produces a pdf where that line is not entirely seen: By using adjustbox, one can ...
1
vote
2answers
32 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
68 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
54 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
37 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
2answers
455 views

How to insert normal-font text inside verbatim?

In the ISO C++ standard papers, blocks of code are displayed in a verbatim-like environment, but the comments inside the code are in normal font. For example: The comments "7.3.5, CommonReference:" ...
0
votes
1answer
39 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
3answers
61 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 ...
0
votes
1answer
31 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....
1
vote
0answers
26 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 ...
4
votes
3answers
177 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
28 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
29 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
34 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
91 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
36 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
104 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
23 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
51 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
155 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 ...
2
votes
2answers
48 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
97 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
28 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
54 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
11 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
43 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
37 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
73 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
181 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
67 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\...