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
2
votes
1answer
842 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
277 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
253 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
91 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
73 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
84 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
182 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
23k 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
356 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
105 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
361 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
12k 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
125 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
165 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
336 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
927 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{...
20
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
583 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
92 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
15k 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
805 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
422 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
164 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
4k 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 ...
23
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
342 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
248 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
953 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
128 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-...
1
vote
0answers
60 views

Numbering correctly indented Verbatim code blocks

I have been looking through the tex.stackechange community answers and questions and I've not managed to find an answer to my problem. I want to be able to write blocks of code in a verbatim-like ...
11
votes
2answers
240 views

tcolorbox breaks the verbatim definition of ltugboat documentclass

This code: \documentclass{ltugboat} \usepackage{tcolorbox} \begin{document} \begin{verbatim}[\small] \documentclass{article} \usepackage{tikzduck} \begin{document} \begin{...
6
votes
1answer
323 views

Latex beamer verbatim problem with \end{frame} in TeXLive 2017

The following MWE does not compile with beamer 2017/07/13 v3.42 from TeXLive 2017-20170807: \documentclass{beamer} \begin{document} \begin{frame}[fragile] \begin{verbatim} \end{frame} \end{...
1
vote
0answers
106 views

Use \verb inside \seqsplit

I need to use the \verb command inside the \seqsplit command. The compiler warns me when I insert \verb inside \seqsplit. How can I do? thank you all EDIT: \seqsplit{\verb |#####|} Error: ! ...
2
votes
2answers
80 views

Creating a boxed output with macro style

I'm trying to get a specific output and for now it's not as I wish. Desired output: It's for a TugBoat article. For now I have this solution : \documentclass{ltugboat} \usepackage{...
11
votes
3answers
2k views

typing \end{verbatim}

I am preparing a presentation in which I want to display the following as it is \begin{verbatim} foo \end{verbatim} For this I used \begin{verbatim} \begin{verbatim} foo \end{verbatim} \end{...
11
votes
2answers
2k views

Produce a hyperlinked DOI?

Friends, I'm trying to write a command that prints appropriately hyperlinked DOIs for a bibliography system. Here was my first attempt \newcommand{\formatdoi}[1]{\href{http://dx.doi.org/#1}{#1}} ...
4
votes
1answer
1k views

New command using inline verbatim

I would like to define a command using verbatim like in the commented line in the following code. \documentclass{article} \usepackage{amsmath,amsfonts,amssymb} % \newcommand{\example}[1]{\verb!...
4
votes
1answer
269 views

Vertical bar as verbatim

According to p. 881 of the TikZ & PGF manual for version 3.0.1a, the following LaTeX manuscript: \documentclass{article} \usepackage{pgfkeys} \begin{document} \pgfkeysdefargs{/my key}{#1+#2}{\...
8
votes
3answers
7k views

remove double spacing inside {verbatim}

I'm using the uwthesis class which generally typesets with a lot of space between lines. This is generally fine, however, I want to override the spacing in certain examples which appear in the ...
10
votes
2answers
722 views

Macro \verb inside tabu environment

I would like to use the \verb command inside of a tabu enviroment. Here is my example \documentclass{article} \usepackage{tabu} \begin{document} \begin{tabu}{lll} a & \verb+\wedge+ & b\\ c ...
5
votes
1answer
709 views

Why does verb throw an error using in multicolumn command?

I encounter an error when using the \verb command within the multicolumn command. I reduced the problem to the example below: \documentclass{article} \begin{document} \begin{table}[htb] \begin{...