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
1
vote
1answer
98 views

Verbatim environment nesting troubles [duplicate]

I have troubles trying to nest verbatim environment inside my \newenvironment definition one so I can include my source code faced to its result as on the most latex books printed. I can do it in a ...
1
vote
3answers
93 views

Resize verbatim in exponent equation mode

I have this inline equation $2^{\verb|N|-1}$ that gives this result The problem is that using \verb|N| leaves N with the same size as in \displaystyle but I want it to be smaller. How can I do?
0
votes
1answer
80 views

Export code samples AND display verbatim

I'd like to write a LaTeX document with code samples in a verbatim environment. I'd also like to export those code samples to named files so that they can be built and run. This allows me to easily ...
1
vote
1answer
114 views

How show line in Verbatim environment?

I have a simple Latex code \documentclass{article} \usepackage{fancyvrb} \usepackage{lipsum} \begin{document} \lipsum[2] \begin{Verbatim} CPD of G: ╒═════╤═════╤══════╕ │ F │ F\_0 │ F\_1 │ ├───...
2
votes
1answer
76 views

Use `shortvrb` without needing to end the command manually

Currently, using shortvrb, it's possible to define a single character to start, by itself, an inline verbatim command: \documentclass{article} \usepackage{shortvrb} \begin{document} \MakeShortVerb{\|...
0
votes
2answers
64 views

How to have one code to be typeset both as final and as source code [duplicate]

I'm very limited in writing Latex code and I could not find how to solve my problem searching in the forum ou googling around. My problem: I have to write a document with many algorithms and show ...
0
votes
1answer
344 views

How to use verbatim with tcolorbox?

The following gives many strange errors: \begin{tcolorbox}[fit,height=5cm,blank, borderline={1pt}{-2pt},nobeforeafter] \begin{verbatim} [83 democrat / 66 republican] | | a_b_c = y: [28 democrat / 64 ...
13
votes
2answers
1k views

How is verbatim implemented?

I'm curious as to how verbatim is implemented internally in TeX. I am mostly familiar with the basics of TeX's inner mechanics (catcodes, and what not), but I'm just curious about this command.
3
votes
1answer
11k views

How can I include the R source code in the appendix?

I really have no idea how to include the R code into latex, so I only can provide my R code. I would like to put it in the appendix. I am really looking forward to your help. Thx! The codes will show ...
0
votes
1answer
106 views

Verbatim with direct lua

I would like to add newlines inside a verbatim, through \directlua. Why is there no newline in the first verbatim? \documentclass{article} \usepackage{luacode,verbatim} \begin{document} \directlua{...
5
votes
2answers
245 views

issue with Verbatim

I have a \n in my code which is not compiling correctly in verbatim environment. \documentclass[]{article} \usepackage{fancyvrb} \usepackage{color} \begin{document} \begin{Verbatim}[commandchars = \...
4
votes
2answers
249 views

How to override line numbering for displaying codes in verbatim package

I have a code block that I want to display in latex using verbatim package but I would like to custom number the code lines rather than having them start from 1. Here's the example of the latex code ...
2
votes
1answer
918 views

A simple way to reduce \listings indentation

Is there any simple and easy way to reduce indentation in \listings? The default value is too wide to my liking. \documentclass{article} \usepackage{listings} \lstset{% basicstyle=\ttfamily, ...
2
votes
1answer
284 views

\BVerbatimInput and \adjustbox : the information is cut at the end of the first page

\VerbatimInput calls a test.dat file, and produces the following output, where the long lines are not entirely seen: A solution for this is use \BVerbatimInput together with \begin{adjustbox}. This ...
8
votes
2answers
2k views

Highlight \verb in inline text

I'm new in LaTeX and I'm searching for solution to highlight verbatim text inside paragraph (for example, it is like on this page, where code is highlighted). Can anyone help me with this? Let say, ...
1
vote
1answer
161 views

word wrapping line question

I have a text that looks like {attribute_1=1, ARRAY=[ { "x" : 180 , "y" : 175 , "z" : 176} , { "x" : 179 , "y" : 176 , "z" : 177} , { "x" : 178 , "y" : 177 , "z" : 178} , { "x" : 177 , "y" : 177 , "...
1
vote
1answer
284 views

How can I transform a \defverbatim environment in a \newcommand?

I have in my beamer presentation a lot of \defverbatim like this one \documentclass{beamer} \usepackage[utf8]{inputenc} \usepackage{minted} \usemintedstyle{manni} \newminted{SQL}{fontsize=\...
2
votes
1answer
93 views

How to format code snippets with a custom environment or command?

I'd like to make an environment or command to wrap the this 2-column REPL formatting. For example, as a command (\format{TEXT}{CODE}) it would look like this: \format2cols{ Description of the code }{ ...
7
votes
1answer
1k views

How to stop `^^` getting converted to `M`?

\^^,\^\^,\^ \^ all give error. \verb|^^| works, but if put inside \begin{leftbubbles} and \end{leftbubbles} from this answer How to make every line in a bubble like chat conversations? it gives error ...
9
votes
4answers
5k views

newcommand for verbatim

I'm trying to write a \newcommand for verbatim: \newcommand{\codeline}[1]{\begin{verbatim}{#1}\end{verbatim}} and use it as \codeline{int foo;} but it gives an error "File ended while scanning use ...
5
votes
3answers
2k views

\verb in custom command

I have \newcommand\dd[2]{\item[\texttt{#1}] #2} and later I have \dd{bc}{text \verb#$(echo 5+4 | bc)# text \verb#$((5+4))# text} and I get ! You can't use `macro parameter character #' in math ...
24
votes
1answer
13k views

Center-align the verbatim environment

I am trying to center align the content of a figure that has verbatim text in it. But the verbatim text is always right-aligned: \begin{figure} \centering \begin{verbatim} some text here \...
0
votes
0answers
77 views

Why does a verbatim block produce an error when it is used inside a table?

The following script 14 \begin{tabular}{ l } 15 \begin{verbatim} 16 $\mathcal{M A T H C A L}$ 17 $\mathfrak{M A T H F R A C}$ 18 \end{verbatim} 19 \end{tabular} produces an error: Line 15: ...
2
votes
4answers
1k views

How can I make verbatim's → use a monospace font

I want to show UTF-8 characters representing a map like this: \documentclass[11pt,a4paper]{article} \usepackage[utf8x]{inputenc} \usepackage[spanish]{babel} \begin{document}\shorthandoff{>}\...
1
vote
0answers
104 views

Problem with lstlisting in beamer [duplicate]

\documentclass[10pt]{beamer} \usepackage[utf8]{inputenc} \usepackage{multicol} \usepackage{lipsum}% Just for this example \usepackage{graphicx} \raggedcolumns % for NOT stretching the columns with ...
1
vote
1answer
196 views

verbatim code inside \newcommand definition

All the questions I could find on this subject are about people who want to use \verb in the argument passed to a command, or about people who want within a \newcommand to wrap one of the arguments ...
10
votes
4answers
24k views

Insert symbols inside verbatim mode LaTeX

I cannot insert mathematics symbols inside a verbatim mode in LaTeX. This how I do: \usepackage{alltt} \begin{verbatim} 1- Train triggers model \( X_{i} \) -> Y_j (X_i: source phrase ...
1
vote
1answer
387 views

Using \verbatiminput{} on files containing $

I'm fairly new to LaTEX and I'm trying to include a file in the appendix using the following instructions: \begin{multicols}{2} \footnotesize{\verbatiminput{pattern-representations}} \end{multicols}...
4
votes
1answer
109 views

ConTeXt: number empty lines

This source: \starttext \startlinenumbering \starttyping int x; int y; \stoptyping \stoplinenumbering \stoptext Renders like this: 1 int x; 2 int y; How can I ...
0
votes
1answer
397 views

How to insert Latin accent inside lstlisting - [duplicate]

Could you please help me find a way to insert Latin accents in the lstlistings environment? I've tried the direct way and also the indirect way, i.e using ç and \c{c}. However, when using ç, this ...
9
votes
2answers
13k views

How to show latex commands in text mode

Sorry for the basic question. What I want to do is to show the LaTeX command and, right after that, the output. But how can I show LaTeX formulas without obtaining errors for not using the math mode ...
2
votes
1answer
128 views

Preserve spacing in \verb

I'm writing a document in which I want to insert some Python code. I wanted to display it in a tabular so I used the \verb tag, it is working pretty well, but it just removes the leading spaces ...
1
vote
1answer
179 views

VerbatimInput gives error when file is too large [closed]

I use \VerbatimInput in package fancyvrb to wrap my text, which is loaded from external file. But when the external file is too large, it gives the following error: TeX capacity exceeded, sorry [...
2
votes
1answer
363 views

How can I make Latex respect empty lines when using lstlisting package?

How do I get Latex to respect empty lines when using the lstlisting command? If I put in several empty lines between two rows of text they reduce to a single empty line. Is there a way to make Latex ...
3
votes
1answer
1k views

Verbatim style in a sentence

I'd like to write this sentence with a method in LaTeX: "if you want to use Math.round method" and having Math.round in verbatim style. But if I write the code like this: if you want to use \begin{...
21
votes
5answers
5k views

How can I provide a verbatim (unescaped) commandline for executing with \write18?

When using \write18 to execute shell commands, there are some cases where lots of backslash strings, and other 'special' LaTeX characters are required in the commandline to be executed (e.g. if a ...
2
votes
3answers
599 views

Displaying code blocks parallel with one another

I'm trying to copy an example from a paper which comprises two code snippets next to each other and separated by a symbol, as shown in the image. But I'm not sure how to do something like this. It ...
0
votes
0answers
97 views

Command chars inside colored Verbatim [duplicate]

I want to use color inside verbatim, so the answer here is exactly what I want to use: Use color in verbatim, however I would like to use more complex commandchars (from the answer to the question I ...
16
votes
1answer
16k views

what is the differences between “\verb” and “\tt”

I am wondering the diffference between \verb and \tt. For example \verb|difference| appears the same with \tt{difference}
4
votes
3answers
825 views

How to put lots of brackets

I want to show all valid bracketed strings made from {} [] (). This is the intended output: {[()]} {[]()} {[]}() {([])} {()[]} {()}[] {}[()] {}[]() {}([]) {}()[] [{()}] [{}()] [{}]() [({})] [(){}] [()...
5
votes
1answer
456 views

How can I preserve all whitespace in an environment?

I'm typesetting litterate programs; they look like this: \documentclass{article} \usepackage{fontspec} \newfontfamily{\Symbola}{Symbola} \newfontfamily{\UbuntuMono}{Ubuntu Mono} \...
2
votes
1answer
173 views

ConTeXt - how to allow page breaks for verbatim code listings

I would like to be able produce a source code listing within a box and line numbers applied - using ConTeXt. The snippets below work - however the box does not break across pages and instead just ...
0
votes
0answers
35 views

\expandafter in the definition of vaerbatim [duplicate]

I'm now reading the source code of LaTeX. In the definition of verbatim environment (\@verbatim, exactly), there is something like \everypar \expandafter{\the\everypar \unpenalty} What does this \...
4
votes
2answers
5k views

Inline verbatim

I would like to write something like this inline: This is paragraph element <p> I'm using verbatim for writing the HTML element part, but cannot form everything in one line. I get something ...
3
votes
1answer
54 views

Definition of \@vobeyspaces

In section 53.3 of source2e, the macro \@vobeyspaces (one internal macro for verbatim environment) is defined as {\catcode`\ =\active% \gdef\@vobeyspaces{\catcode`\ \active\let \@xobeysp}} Is there ...
24
votes
5answers
7k views

Getting those %#!^& signs in the footnote!

This is basically an expanded version of part of Control command arguments . The original questioner there wants to redefine \href so that all the links end up in foonotes (rather than in the main ...
0
votes
1answer
363 views

How to make a new environment be verbatim inside \scalebox with listings package?

After @JPi answer on How to use \scalebox around my environment? and comment pointing to the question Verbatim in environ’s \BODY I tried: Writing the contents to a file Print it on verbatim mode, ...
0
votes
1answer
258 views

How to rename the comment or verbatim environment?

Based on the question How to rename or "copy" a latex environment I am tried to rename the comment environment to myenvironment: \documentclass[10pt,a5paper,twoside]{memoir} \usepackage[T1]...
3
votes
2answers
1k views

Changing font size in all fancyvrb from Jupyter Notebook (nbconvert)

I generated latex file from Jupyter Notebook using nbconvert. I need to change the font size in all Verbatim (fancyvrb) enviroments. I tried but nothing I know of works. Here is all the settings from ...
2
votes
1answer
134 views

minted/fancyvrb environment as argument to TikZ command

I want to create a command, accepting an argument, which sets the content of the argument as a TikZ picture. Problem: The argument is a minted/FancyVrb environment. MWE: %!TEX OPTIONS = --shell-...