Skip to main content

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

Use minted for plain-text? (without syntax-highlighting) [duplicate]

I'm possibly too lazy to find how to do it without minted, but since I already use minted and I want to keep it's styles it applies to code boxes (like background color, the line break features, ...
5 votes
2 answers
2k views

How can I justify text with line number in Verbatim environment?

My minimal file is: \documentclass{article} \usepackage{fancyvrb} \usepackage{ragged2e} \usepackage{lipsum} \usepackage{pbox} \begin{document} \begin{Verbatim}[numbers=left,fontsize=\bf,commandchars=\...
2 votes
0 answers
52 views

Frankenstein’s Conscience conflicting with tabular environment? How to patch?

I'm using compsci and friends for a LaTeX course. But the following MWE \documentclass{article} \usepackage{compsci} \begin{document} Well, the following works: ``\cs\_'' % but there's an extra ...
1 vote
1 answer
42 views

Decorating verbatim text in OpTeX

I want to decorate listings with a border and background color. Specifically I would like a similar appearance to this: How can this be achieved?
23 votes
6 answers
3k views

typesetting different characters with different colors in a DNA sequence

I have created a macro which I used to format DNA sequences, as they should be in the monospaced font and uppercased: \newcommand{\DNA}[1]{\texttt{\uppercase{#1}}} Now I have a column with some ...
1 vote
0 answers
21 views

codehigh, for verbatim text in tabularray table

In the tabularray package documentation is suggested that for the verbatim text in tables should be used \fakeverb instruction defined in the codehigh package instead of \verb. Using it I' faced with ...
2 votes
1 answer
2k views

A verbatim-like environment, but inline

I would like to find a solution to use a verbatim-like environment, but inline. Indeed, I would like to ask not to compile Latex functions but just for a specific place in a text. I tried this : ...
0 votes
0 answers
29 views

Create alias of verbatim environment with optional arguments

I'd like to create an alias of the verbatim (xsim-based) environment \begin{CacheMeCode}{tikzpicture, optional arguments} \end{CacheMeCode} to \begin{tikzpicture}<optional arguments> \end{...
5 votes
2 answers
535 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 ...
2 votes
2 answers
440 views

What are the alternatives to catchfilebetweentags? [duplicate]

I want to be able to have files chapter1.tex, chapter2.tex, etc. (with preambles) that can compile on their own and a file allChapters.tex that gather the actual contents of the chapters. So far, I ...
1 vote
2 answers
36 views

`verbatim*` environment in a `minipage` defined by a `\newcommand` does not work

Still a novice at LaTeX - I was attempting to define a custom command for creating minipages of a certain width using this code: \newcommand{\col}[2]{\begin{minipage}{#1\linewidth}#2\end{minipage}} ...
39 votes
2 answers
41k views

Inline code and short verb with minted

I it possible to use minted for inline code and to add a short verb sign for minted? Like \lstMakeShortInline| in listings.sty? \documentclass{article} \usepackage{minted} \newminted{tex}{} \...
24 votes
4 answers
9k views

Colored background in inline listings

I would like to make inline code more distinguishable from the text surrounding it, and I thought that using a background might work (like it is done on the stackexchange pages.) Since I use the ...
18 votes
5 answers
14k views

How can I have a verbatim text in specific sized box?

I am trying to typset the following \resizebox{0.95\textwidth}{!}{% \begin{verbatim} require( "lattice" ) require( "grid" ) \end{verbatim} } I have a lot more to add to this box, and it needs ...
1 vote
1 answer
81 views

Verbatim inside tabular, inside a macro

I would like to achieve a macro which makes a 2x2 table to show example inputs and outputs of a program (test cases). Something like this: --------------------------- |input | example input | |-----...
2 votes
1 answer
580 views

How to use sagesilent (or verbatim) environment in pgffor loops?

I want to create different versions of an exam paper and corresponding sample solutions using sagetex. I need to assign variables for more involved computations, so I am reliant on the sagesilent ...
5 votes
2 answers
287 views

Has the handling of whitespace by \alltt changed recently (i.e. since 2021)?

after moving to a new computer (and installing a current (2024) texlive system), I noticed that the layout in my document was messed up in several places. After some experimenting, it turned out that ...
4 votes
3 answers
167 views

Indentation of verbatim environment result in additional empty line before the following content, why?

At first, I added an indent to the verbatim environment, code is shown below: \documentclass{article} \begin{document} Some text before the verbatim environment. \begin{verbatim*} % <--...
2 votes
1 answer
54 views

verbatim mode and carriage return character tokens

This question refers to how the program TeX creates tokens after reading a line of a .tex-file. It does actually not refer to writing macros or doing typesetting work which takes place in stages after ...
0 votes
0 answers
27 views

Removing spaces before ```center```

\documentclass[12pt] {article} \usepackage{palatino} \usepackage{fancyvrb} \usepackage{authblk} \usepackage{fancyhdr} \usepackage{titlesec} \def\baselinestretch{2.0} \titleformat{\paragraph}{\...
1 vote
1 answer
121 views

Macro with verbatim argument

Is it possible to define a macro \foo such that it can accept verbatim code like: \foo{cos(16 % 2)} without interpreting them as latex code first? I know I can use an environment for that, but I ...
0 votes
0 answers
16 views

Insert pagebreak in \begin{center} with \begin{BVerbatim}

\documentclass[12pt] {article} \usepackage{amsmath} \usepackage[breakable]{tcolorbox} \usepackage{fancyvrb} \usepackage{fancyhdr} \def\baselinestretch{2.0} \usepackage{tocloft} \def\toright#1{\...
0 votes
0 answers
32 views

Importing parts of a .txt file in LaTeX document [duplicate]

Can you define which lines and columns from a .txt file to show up in LaTeX? I tried the \lstinputlisting command where it seems I can only limit the output to specific lines and not columns as well, ...
0 votes
1 answer
64 views

How to get lstdefinestyle to accept a custom command with an argument?

I want to customize the style of Matlab-editor in matlab-prettifier package. What I want is to produce background for MATLAB styled commands, but it does not seem that basicstyle key accepts commands ...
0 votes
0 answers
32 views

Sphinx Verbatim (Code block) inside mdframed environment

My code-block don`t break on new page when a use code-block inside mdframed environmen: \begin{mdframed} \begin{sphinxVerbatim}[commandchars=\\\{\}] Tablespaces: PRIMARY (1) Full path: /home/test/...
0 votes
1 answer
58 views

How do I keep my code example from going off the page

I am trying to add a code example with the ability to caption it at the end but it keeps going off the page to the right (see image). I have tried different verbatim and verbox and floats after hours ...
2 votes
3 answers
202 views

Typing grave accent for double quotes

I'm writing a little document on LaTeX to explain how to type LaTeX to some of my fellow colleagues. What's giving me a headache are double quotes. As an alternative to \textquotedblleft text \...
1 vote
2 answers
103 views

Bold font style in \verb environment

I'm looking to get a \verb string to output with bold font style as well as word wrapping. The closest I've come is by using the commented code rather than the currently live one. I realize I'm ...
0 votes
0 answers
54 views

v-type argument in \NewDocumentCommand ignores spaces

Consider the following code: \documentclass{article} \usepackage{listings} \NewDocumentCommand{\hey}{v}{\lstinline|#1|\ignorespaces} \begin{document} \hey|a |b \lstinline|a |b \end{document} Why ...
0 votes
0 answers
31 views

Biblatex/Memoize: Error if cited bib entry includes verbatim field

If Biblatex is used with the current version of Memoize, citing any entry containing a verbatim field results in compilation failure. I've reported this as a bug, but is it possible to workaround the ...
0 votes
1 answer
57 views

How to define a \verb-like command that can be used in table and headings?

I want to define a \verb-like command, \keyword, for example, to make the following code work as desired. Can anybody help me? \documentclass{article} \usepackage{float} \usepackage{newverbs} \...
0 votes
0 answers
76 views

! LaTeX Error: Environment Verbatim undefined in Texlive in Linux Mint

I'm using Texmaker with Texlive in Linux Mint 21.3 Cinnamon to write an article with some Python code. Then I got a problem: ! LaTeX Error: Environment Verbatim undefined in Texlive in Linux Mint The ...
1 vote
1 answer
50 views

memoir, verbatim: how to remove blank space symbol in verbatim text

Why the following MWE produce the following result: \documentclass{memoir} \begin{document} why in the verbatim text is shown blank space symbol \verb!verbatim text!? \end{document} How to remove ...
1 vote
1 answer
85 views

tabularray: Using \fakeverb in the cmd argument

I have a table with cells that include characters which I want to treat as verbatim. Section 6.2 of the tabularray documentation states that we can wrap the contents of cells in \fakeverb{} to ...
2 votes
1 answer
23 views

Left aligning Verbatim / fancyvrb environment with beamer slide

I would like to have the content of the Verbatim environment to be on the left of this beamer slide. However, whatever I try it always gets centered. How can I control the position of the start of the ...
4 votes
1 answer
103 views

How to format description label with a command (enumitem)

I have to make list environment based on description that should be used to describe C functions. For example: % !TeX program = lualatex \documentclass[11pt]{report} \usepackage{enumitem} \usepackage{...
0 votes
1 answer
34 views

VerbatimOut crashes on special symbols inside if-then-else

This code compiles just fine with lualatex, xelatex, and pdflatex: \documentclass{article} \usepackage{fancyvrb} \begin{document} \begin{VerbatimOut}{x.txt} ^^_ \end{VerbatimOut} \end{document} ...
3 votes
2 answers
350 views

Including emojis in verbatim

This is a follow-up question to this one on arbitrary size pages. How would one include emojis in a verbatim environment? E.g. \begin{verbatim} |-------+--------+-------------------------------------+-...
0 votes
1 answer
57 views

Arbitrary size pages

Is it possible to create a latex document where some pages have a unique size [width & depth] that basically is the right size to contain all the data from some input file? More details. I am ...
0 votes
0 answers
62 views

How to get straight single quotes in verbatim and and codeexample

I have in my documentation stuff like print('abc'), but it is turned into print(’abc’) (note the changed quote), which breaks compilation. How could I make the environments \begin{codeexample} and \...
0 votes
1 answer
32 views

Reconstruction of a Pseudocode Observing Horizontal Spacing and Alignment

In an attempt to reconstruct the following picture, I have tried verbatim environment as below: \documentclass[11pt]{book} \usepackage{algcompatible} \usepackage{algorithm} \usepackage{mathrsfs} \...
0 votes
1 answer
80 views

How to display code in a frame with ASCII ' and ` and evaluation of macros

I want to display a block of code with ' and ` displaying as themselves and with evaluation of macros.The closest that I've been able to come was \documentclass[b4paper]{article} \usepackage{alltt} \...
0 votes
1 answer
60 views

Why did my center works so weird

I wanna include some code in my text so I use center+BVerbatim environment, but it shifts my code in a weird way. Here's my code. %%% 一个文档 % 导言:文件格式设置 \documentclass[UTF8]{ctexart} % 该文档为中文文档,...
1 vote
1 answer
103 views

Limiting the width of the verbatim text [closed]

Hello Stack Exchangers I am trying to limit the width of the verbatim text and the 'line 5' is out of the margins of the page. The example is showed in the picture where the rest of the lines are ...
2 votes
1 answer
324 views

`talltblr`, `longtblr`: how to use `\verb` command in caption, note and remarks?

Finally MiKTeX provide version 2022A! So, I make some tests if in this new version (2022A) can be used \verb command in caption, note and remark. Unfortunately, as at old version, not (as least as I ...
8 votes
2 answers
234 views

Get rid of extra white space inserted when using \verb with tabularx

I noticed a peculiar behavior of tabularx when using \verb. The following minimal working example illustrates the problem. Note the wicked extra space introduced between test and {123}. \documentclass{...
0 votes
1 answer
42 views

Why does the vertical (line) spacing scrunch up for certain paragraphs? [duplicate]

I'm writing a series of notes, and I've begun to see the vertical (line) spacing of certain paragraphs to substantially decrease compared to others. I've attached a photo to describe what I mean. The ...
3 votes
1 answer
437 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. ...
4 votes
0 answers
38 views

When verbatim is loaded, \verb behaves as \verb*

With recent versions of LaTeX, when the package verbatim is loaded, the standard command \verb always behaves as \verb*. Is it a feature or a bug? \documentclass{article} \usepackage{verbatim} \begin{...
0 votes
1 answer
49 views

Verbatim coloring but keep brackets

I have this code: \begin{Verbatim}[commandchars=\\\{\}] > \textcolor{names}{A}={\textcolor{numbers}{6},\textcolor{numbers}{75},\textcolor{numbers}{46}} > \textcolor{names}{B}={\textcolor{...

1
2 3 4 5
23