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
0 answers
31 views

\verb in \itemize?

I want to make an itemized list with verbatim elements which contain underscores (actually \verb just doesn't work) . So far, nothing I have tried worked. Escaping doesn't work, and I have tried ...
user avatar
0 votes
1 answer
64 views

How to type two TeX examples of long Regex in Book JavaScript: The Good Parts?

The following two examples are taken from Douglas Crockford's famous book, Page 69 (or 66) and 76. I don't know how to type them in TeX. Example 1: Those are the factors of the regular expression ...
user avatar
  • 89
0 votes
1 answer
41 views

Counting words with TeXcount in documents using \markdownInput or \verbatiminput

I'm using \markdownInput (via the markdown package) to include Markdown files in a paper on Overleaf. Overleaf uses the TeXcount utility to count the words. But TeXcount doesn't recognize \...
user avatar
  • 103
0 votes
0 answers
16 views

xsim file suffixes [duplicate]

The behavior of the example below is very odd. Every file name suffix I've tried works -- except for .js! I've tested this on Windows, but not Linux. The behavior is the same whether run under ...
user avatar
0 votes
0 answers
30 views

Mathematical Unicode characters in verbatim using XeLaTeX:

The alltt environment interprets backslashes literally, and my input text is full of them, so I use the verbatim environment for typesetting code. It goes fine but it does not typeset a universal ...
user avatar
  • 747
10 votes
1 answer
115 views

\NewDocumentEnvironment eats the first non-letter token when used for verbatim environment

I was messing around with creating verbatim environment saving its contents to a file like the one described in verbatim package documentation (end of section 2.2), but using latex3 features. It ...
user avatar
  • 145
0 votes
1 answer
39 views

How to put in verbatim text with the tikz graphdrawing library?

I want to draw a graph with the tikz graph drawing functionality. And I want some text in some nodes to use a monospace font. I tried this. I compiled with lualatex. I got the error \verb illegal ...
user avatar
0 votes
1 answer
27 views

How to make `\verb` valid inside starred version of sectioning commands?

It seems \cprotect does not make \verb valid inside starred version of sectioning commands, \section*, \paragraph* etc. How to fix this problem? % MWE \documentclass{book} \usepackage{cprotect} \begin{...
user avatar
  • 795
1 vote
2 answers
56 views

Why solutions for macros with lstlisting inside fail if tabulation in the verbatim text? [duplicate]

For instance this solution for macros with lstlisting inside works well, except if the verbatim text contains a tabulation (as shown by the following MCE). Why? \documentclass{article} \usepackage{...
user avatar
1 vote
1 answer
58 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 : ...
user avatar
0 votes
0 answers
24 views

How can use verbatim-like command as \section Argument defining with tcolorbox package

In below code, I cann't use \mybox command in \section, how can I fixed that? \documentclass{book} \usepackage{amsmath,amsfonts,amssymb,amsthm} \usepackage{tcolorbox} \tcbuselibrary{listings,skins,...
user avatar
  • 343
3 votes
2 answers
68 views

Inline verbatim text keeping the same font as normal text

My software automatically creates LaTeX documents. I need to display some text that I have no control over (it will be provided by the user), so it can contain problematic characters (like _ or \ or $ ...
user avatar
  • 449
0 votes
1 answer
31 views

The tcblisting enviroment dosen't work when using it to build a macro

I want to build a macro with the tcblisting enviroment from tcolorbox, as shown below, but fail. What's the reason and how to deal with this? Code: \documentclass[a4paper]{article} \usepackage{...
user avatar
  • 2,213
0 votes
1 answer
42 views

How to change font size for verbatim as used with colorbox?

Answer in Getting verbatim with soft grey background, as in tex.stackexchange Shows how to make verbatim with gray background. But I am not able to make it show with smaller font size. comment below ...
user avatar
  • 18k
2 votes
2 answers
51 views

How to get the desired output with proper alignment?

How to write a c++ code in LaTeX with proper alignment? I am providing more details about my question below: I need to write this: if(a==b): a=2 b=2 I need to write this above code in ...
user avatar
  • 933
0 votes
0 answers
39 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 ...
user avatar
  • 250k
1 vote
1 answer
54 views

Separate declaration and placement of listings, figures, etc. Capturing and storing verbatim content in a token list

I'm trying to separate the definition and placement of figures, tables, listings, etc. I find them highly disruptive when editing the prose of my document. They often take up a large number of lines ...
user avatar
1 vote
2 answers
83 views

Saving the body of an environment to a file verbatim using xparse

Variations of this question have been asked before, but those answers don't seem to work when used within \NewDocumentEnvironment from xparse. For example, see Write environment body verbatim to a ...
user avatar
0 votes
0 answers
36 views

verbatim + hebrew + xelatex

I need to typeset Hebrew text, using xelatex, in a monospace font and a verbatim context. All the paragraphs should be RTL. How can I specify, using \fontspec, the font for verbatim mode?
user avatar
0 votes
0 answers
84 views

I have a template that uses tcolorbox, which requires verbatim package, how can I install it?

I use MikTex on Windows and I can't find the verbatim package anywhere. Apparently, it is not distributed anymore? I can't just try to rebuild the template. In this template, there is a class which ...
user avatar
  • 1
0 votes
0 answers
58 views

examplep package used in description list item error under TexLive 2021

I used the examplep package in description list item, I just follow the answer by Stefan Kottwitz in his answer this question: Verbatim description list item. Here is the test code, which is exactly ...
user avatar
  • 1,158
2 votes
1 answer
92 views

Verbatim/Lstlisting environment with background color highlighting

Use case: Currently we are reporting security findings using MS Word. These findings contain large parts of code snippets, command outputs and HTML code. We highlight relevant parts of this code so ...
user avatar
3 votes
2 answers
85 views

Including an optional answer in an exam paper

I would like to include answers in an exam paper so that the paper could be compiled in two different ways: with and without the answers. The way this is usually done in British universities (or at ...
user avatar
  • 69
0 votes
0 answers
43 views

How to highlight the argument of a certain command as verbatim in TeXstudio?

I am trying to get the argument of \EscVerb to become highlighted as the argument of \verb. I added a custom cwl file with the following command \EscVerb{verbatimSymbol} But this only causes the ...
user avatar
0 votes
0 answers
31 views

Creating a custom adjustbox minted environment

I've been trying to get a generic environment for putting code listings going using adjustbox and minted. I've found a few examples where people got minted wrapped by an adjustbox where they seemed to ...
user avatar
1 vote
2 answers
50 views

`\Block` does not accept `\lstinline`

I would like to typeset verbatim style commands from \lstinline in \Block command, but it does not seem to work \documentclass[a4paper,12pt]{article} \usepackage{nicematrix} \usepackage{listings} \...
user avatar
0 votes
0 answers
47 views

How to get `\section` command to accept verbatim text with '\' inside it?

I am trying to define a verbatim style for LaTeX \lstdefinestyle{verbatim}{basicstyle=\ttfamily,language={[LaTeX]TeX}} Then I use the following command to typeset LaTeX commands as they appear in ...
user avatar
2 votes
1 answer
41 views

verbatim environment inside a tcolorbox results in misalignment

I'm trying to put two code examples in a tcolorbox side by side. The problem is that I am using the alltt environment a derivative of the verbatim environment. Here is my code: \begin{tcolorbox}[...
user avatar
  • 123
0 votes
0 answers
22 views

hyphenating inline verbatim text at underscore [duplicate]

I can hyphenate inline verbatim text at a ':'; however, I want to hyphenate inline verbatim text at an underscore '_', but I can not find a solution. The MWE is as follows. \documentclass{article} \...
user avatar
1 vote
2 answers
36 views

Tilda ups when use code cpp snippets

I use C++ code snippets with latex. I try to use verbatim, lstlisting and minted(imho which is the most beautiful). But they has one trouble. When I want to write code p->~T() I get tilda at the ...
user avatar
  • 113
2 votes
1 answer
44 views

minted framerule option doesn't work

The framerule option should set the thickness of the frame separators for the minted environments. Consider this MWE: \documentclass[corpo=11pt,twoside,tipotesi=magistrale,greek]{toptesi} \usepackage{...
user avatar
0 votes
0 answers
25 views

listings : How to parse character sequences into math symbols

I'm trying to format code snippets using listings. The language I'm targeting (typed template Haskell) features the equivalent of double square brackets brackets [|| and ||]. These look quite poorly ...
user avatar
  • 101
5 votes
4 answers
149 views

verbatim columns of vectors in booktabs columns

After lots of calculation in Python, a Pandas DataFrame is created that has several vectors. Fortunately Pandas can export its table in booktabs format, but the "vectors" get aligned by ...
user avatar
1 vote
1 answer
25 views

Unable to use listing with toptesi

Everytime I open a new listing the compiler complaints about it. Try to compile the following example % !TEX options = -shell-escape \documentclass[% corpo=12pt, twoside, oldstyle, tipotesi=...
user avatar
2 votes
2 answers
68 views

Writing a typewriter-text backslash character in a footnote

I'm having trouble trying to write a typewriter-text backslash in a footnote. There are two solutions for writing a typewriter-text backslash provided at this question: Use \textbackslash. Use \verb, ...
user avatar
  • 205
1 vote
1 answer
95 views

Making TeXstudio syntax highlighting recognize a custom verbatim environment

I'm using TeXstudio for pretty much all my LaTeX needs. I sometimes have to include small code snippets in a document where employing the listings package would be overkill. Since I'd like for these ...
user avatar
  • 3,307
2 votes
2 answers
53 views

Center a verbatim block with long lines, without using a minipage

There are a lot of questions around centering verbatim blocks on the site, but trying them, they either hardcode the width of the verbatim block using a minipage, or they just don't work when the ...
user avatar
  • 123
1 vote
1 answer
65 views

Excluding footnotes in verbatim wordcount

I'm quite new to verbatim and quite confused too. I wanted to include a 'simple' wordcount at the end of my essay (as it has been demanded) and didn't want to run an external pdf-wordcount software ...
user avatar
  • 23
1 vote
1 answer
70 views

Using English and Russian in verbatim

I want to use verbatim to type both English and Russian in the same block. \usepackage[utf8]{inputenc} \usepackage[russian, english]{babel} \usepackage[T1, T2A]{fontenc} \usepackage{fontspec} \begin{...
user avatar
  • 125
3 votes
1 answer
85 views

Expansion issue in tcolorbox

I would like to partially reproduce an example of the tcolorbox manual. The end result (in section 24.1 page 461 of the current documentation) looks like What I am interested in is to nest a \...
user avatar
  • 8,429
2 votes
0 answers
118 views

Produce copy-paste friendly code blocks in PDFs

I have used lslisting for inserting the code blocks. Requirement is to make the code blocks displayed correctly in the compiled PDF and make them as easy as possible to copy as plain text. Please take ...
user avatar
0 votes
1 answer
48 views

Verbatim doesn't follow tab alignment after changing font

I searched online to find a way to match the verbatim font with the outside text. And this is what I used. \makeatletter \newcommand{\verbatimfont}[1]{\def\verbatim@font{#1}}% \makeatother \...
user avatar
  • 15
2 votes
3 answers
109 views

How to make a macro that prints verbatim text?

I'm trying to do automatic linebreaking right now with verbatim, and I have this setup. \usepackage{fancyvrb} \usepackage{fvextra} \begin{Verbatim}[breaklines=true,numbers=left,breakafter=\},...
user avatar
1 vote
1 answer
213 views

Verbatim "breakanywhere" doesn't have any effect with a markdown using fvextra package converted to a pdf with Pandoc

I'm generating a pdf from a markdown file that begins this way : --- header-includes: - \usepackage{fvextra} - \DefineVerbatimEnvironment{Highlighting}{Verbatim}{breaklines, breakanywhere, ...
user avatar
1 vote
1 answer
73 views

How to customize typeset code appearance with pythontex

I use pythontex to execute / display python code in LateX Document (with pdflatex) and this work great. However, when I type \begin{pyverbatim} import numpy as np import numpy.random as rd p=3.6 up=0....
user avatar
2 votes
1 answer
69 views

How are these texttt fonts different?

Below are two examples of fonts. The first is from the verbatim environment (which I read has default font ttfamily). The second is from a lstlisting with basicstyle=\ttfamily. They look different. ...
user avatar
  • 223
1 vote
1 answer
48 views

verbatim environment or lstlisting as part of newenvironment with samepage and \ill?

I'd like to make a "codeillustration" environment that's something like: \newenvironment{codeillustration}[1]{ \begin{samepage} {\ill{#1}} \VerbatimEnvironment \begin{Verbatim}{\end{Verbatim}...
user avatar
  • 223
0 votes
1 answer
81 views

longtable is unnecessarily pushed to the next page

The second longtable is unnecessarily pushed to the next page: I have tried to make it into a minimal example as much as possible: \documentclass[]{article} \usepackage[T1]{fontenc} \usepackage[utf8]{...
user avatar
  • 437
0 votes
2 answers
50 views

Save the content of an environment containing \verb or \lstinline

I wish to copy the content of an environment into a macro (or into a temp file). Previously I use the following code: \usepackage{environ} \def\SavedContent{} \NewEnviron{savecontent}{% \BODY% ...
user avatar
  • 4,662
2 votes
0 answers
50 views

Mintinline in Tabularx / remove space in detokenize

I write a LaTeX manual in memoir class with the Minted package, TeXlive 2021 and TeXmaker. To insert some \mintinline code in a Tabularx X-type column, I used this trick and it work. Except that it ...
user avatar

1
2 3 4 5
21