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.

1
vote
1answer
42 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
19 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
58 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
182 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
61 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
45 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
31 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
421 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
33 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
59 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
28 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
25 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
3answers
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
33 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
165 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
24 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
21 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
33 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
81 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 ...
4
votes
1answer
357 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 ...
1
vote
0answers
35 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
85 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
21 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
49 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
149 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 ...
13
votes
2answers
10k 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
42 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
94 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
30 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
27 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
53 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
41 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
36 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
66 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
153 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
61 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
14k 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
457 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
61 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
112 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
94 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
107 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
94 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
66 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
97 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
57 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
62 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 ...