{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.

learn more… | top users | synonyms

0
votes
0answers
26 views

Framing and colorizing a LaTeX command [duplicate]

I normally use \verb|\LaTeXe| to typeset the command \LaTeXe in my document. But now I want to frame or/and colorize the command \LaTeX2e. How can we do that? \documentclass{article} ...
14
votes
1answer
37k views

In-line \verb — overfull hbox problem

I'm having a problem that I've had before and I'm tired of hacking my way through it and hope that there is some supported solution. I'll go ahead and create a document for example: \documentclass ...
13
votes
1answer
6k 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 ...
1
vote
0answers
24 views

Add verbatim code to longtable caption

I'd like to add a caption containing verbatim characters using \verb to a long table using the package longtable. The reason for this is that I want to improve the LaTeX output of pandoc, which uses ...
1
vote
1answer
28 views

Beamer overlays with tikz nodes break verbatim whitespace handling

I can't get any of the verbatim environments (alltt, semiverbatim) to respect white space as soon as I place it in an overlay macro: \documentclass{beamer} \begin{document} \begin{frame}[fragile] ...
3
votes
0answers
33 views

Strange verbatim issue in beamer even after issuing `fragile` option [duplicate]

I am trying to develop a beamer tutorial in beamer. Let us suppose that we have the following code: \begin{frame}[fragile]{A slide with the table of contents} For having a slide with the table of ...
12
votes
4answers
343 views

How can I write % into a file?

How can I write % into an auxiliary file? % will not work, because LaTeX thinks that I start a comment with it (in the main file, not in the auxiliary file!), and \% will write \% into the file. How ...
4
votes
2answers
40 views

Empty groups {} when writing environment contents verbatim (but with expanded macros)

In answering this question, I noticed some trickiness regarding empty groups {} in an otherwise verbatim context. Suppose you capture the contents of an environment verbatim (as in that question), ...
2
votes
1answer
84 views

TikZ annotation inside listing inside TikZ node

In the below code, on the first frame I typeset a code snippet with verbatim, and all is well. On the second frame I want to add a TikZ annotation to the code snippet, but I have to switch back to ...
5
votes
2answers
69 views

Writing environments out to files and prepending/appending additional code

I am using the following code snippet to write environments out to files and run arbitrary commands (like python or Rscript). It works quite nice however I would like to write something to the file ...
1
vote
1answer
44 views

How to add labels in verbatim env. in Latex?

I'm writing master thesis where I need to include some parts of program code. This code needs to be commented and properly described in text below/above. I would like to add some specific labels in ...
0
votes
0answers
46 views

Append verbatim material to a file

I am using the fancyvrb package. I'd like to create a verbatim-like environment that does the following two things: 1) Append the verbatim material as-is to a file that has already been opened. 2) ...
2
votes
1answer
433 views

Potential problems from passing macro arguments to \verb

I've been working on a command that will typeset snippets of code within a paragraph. I'm aware of listings and company, but I want something that will just typeset the code verbatim and also allow ...
4
votes
2answers
107 views

Manually specifying a system TTF font seems to break curly/smart quotes

The following code... \documentclass{article} \usepackage{lipsum} \usepackage[a4paper, margin = 0.4in]{geometry} \usepackage{fontspec} \begin{document} \fontspec[Scale=3]{URW Bookman L Light} ...
5
votes
2answers
52 views

How do i put verbatim text as the body of a link?

Is there a way i can have verbatim text inside a link? \href{www.numpy.org}{\verb|numpy|} does not work. I tried using cprotect; \cprotect\href{www.numpy.org}{\verb|numpy|}, but then I end up with ...
4
votes
1answer
34 views

How to create a minimal working example for verbatim use in macro definition with cprotect?

cprotect can be used to use verbatim in a macro definition according to the package specification. Just like everything else in the world that doesn't provide an example it doesn't work in real life ...
3
votes
1answer
52 views

Getting WinEdt to ignore lstlisting

WinEdt 9.0 gives me incorrect TOC in its side panel when I use listings package to illustrate a piece of LaTeX code: How can I get WinEdt to ignore \begin{lstlisting} ...\end{lstlisting} (and ...
9
votes
5answers
466 views

how fancyvrb background color fill completely with fillcolor?

I'd like the whole Verbatim (fancyvrb) block to have a background color. How do I do it? The fancyvrb package does define a fillcolor -- but that only colors the area around the margin -- not the ...
11
votes
1answer
133 views

Expansion of verbatim material

I am passing a file name in the command line which contains underscores and would like to print the name of the file in the resulting PDF. So, need some expansion magic so that the output is: The ...
0
votes
0answers
62 views

Ș and ș: the “character is uncodable in verbatim paragraphs” error

I am using LyX 2.1.2 and upon pressing ctrl+l to insert a new tex code and writing \title{Și e ușor} I got the error Character is uncodable in verbatim paragraphs referring to the two ...
1
vote
2answers
36 views

Escaping “math” characters in boxed verb

When I want to print out some common "special meaning" characters, I use the \verb command, i.e. \verb?x^2 + 1? (No, I don't wan't to use the math mode, I want to print out that ^ character.) ...
4
votes
2answers
168 views

Difference between fixed-width and proportional typewriter fonts in listings?

In the MWE below, I wonder why does the pcr (Courier) font align in both escaped and unescaped versions and for whatever column setting of {listing} - while the cmtt (Computer Modern Teletype) aligns ...
3
votes
3answers
80 views

How to insert the inbuilt keywords in latex

I am creating a simple tutorial file to take a seminar. My problem is: I want to get the output as "\textbf is used for making the font bold". How can I get that? Likewise, i want to make this for ...
5
votes
1answer
90 views

Incorrect tree view of document structure with Winedt, VerbatimPlus and listings package

I´m having some trouble working with Winedt 8 and 9 and VerbatimPlus add-on. Here is my MWE. File "main.tex" \documentclass[a4paper]{article} \usepackage[utf8]{inputenc} % Codificação da entrada ...
3
votes
2answers
81 views

Problem with verbatim in a beamer frame

It seems that verbatim is not working properly. It produce an error and the output is not as I expected. Here is the latex code % !TEX encoding = UTF-8 Unicode \documentclass{beamer} ...
2
votes
2answers
56 views

How can a verbatim environment be centered using a basic LaTeX installation?

I want to centre some verbatim text in a reasonable way using only a basic LaTeX installation, i.e. the packages listings and fancyvrb are not available. \documentclass{article} \begin{document} ...
2
votes
0answers
45 views

Passing content as argument (or macro to be expanded) to verbatim environment

Is it possible to custom what it's inside a verbatim environment? Suppose I want to print as verbatim something to be calculated on the fly, inserted in a kind of verbatim template. Think for example ...
2
votes
0answers
39 views

Verbatim and Bacground&TikZ compatibility problems

If to compile below MWE, you'll get next error: According the error message, the problem is tikz and calc library package, which looks like links with background package. Also, you will not find ...
2
votes
3answers
96 views

verbatim text with C code

I'm trying to typeset a lot of C code in the latest ConTeXt (MKIV). It tried: \startC printf("Hello, world\n"); \stopC only to find that \startC macro is undefined. It is defined in ...
3
votes
2answers
74 views

Verbatim and polyglossia

I use polyglossia in arabic tex files and I want to use the verbatim environment to write the Latex commands for a user's manual. All works well, with adding the command '\let\arabicfonttt\ttfamily' ...
1
vote
1answer
38 views

Boxed equation on the right and its verbatim on the left

How to write a verbatim form of an equation on the left and its output form on the right inside a box?
2
votes
0answers
39 views

Is there a solution to the differences between listings and verbatim [duplicate]

My code is here, \documentclass{article} \usepackage{listings,xcolor} \lstnewenvironment{code} {\lstset{language={Matlab}, lineskip=-1pt, belowskip=3pt, breaklines=true, ...
4
votes
1answer
76 views

How can I get a macro (e.g. for a function parameter) to gracefully expand within a listing?

I try to pass a parameter to code environment (lstlisting): \documentclass{standalone} \usepackage{listings} \def\parameter{home/Desktop/example_01/} \begin{document} \begin{lstlisting} \parameter ...
13
votes
1answer
189 views

Comparison of LaTeX example typesetting packages?

I am writing a (longer) text on LaTeX usage, and I want to typeset some LaTeX source code together with its results – and I'm not sure how to achieve it. I am aware of this question, however, it only ...
2
votes
1answer
76 views

Break on special characters in inline verbatim

I'm using Pandoc to generate LaTeX. My text contains inline code spans (backticks in markdown) that are rendered as \texttt{...} in TeX. However, some of them are quite long and overflow the line, for ...
5
votes
3answers
146 views

How could a verbatimtab environment in a figure environment be resized (perhaps using the package adjustbox)?

How could a verbatimtab environment in a figure environment be resized (perhaps using the package adjustbox)? I have some code something like the following: \begin{figure}[htb] \centering ...
9
votes
2answers
2k views

Latex equivalent of <pre>

This is probably a simple question, but I can't find the answer anywhere. How can I tell tex (latex specifically) not to format a piece of text? I.e. I want to keep indentation, line breaks, etc.
5
votes
2answers
49 views

table with a column of verbatim

\documentclass{article} \usepackage{amsmath,array,booktabs,multirow} \begin{document} \begin{table}[!htb] \centering %\begin{tabular}{ l l } \begin{tabular}{ >{\verb=}l<{=} l } ...
1
vote
1answer
109 views

Latex Error: File `readarray.sty` not found

all, I tried to use \usepackage{verbatimbox,xcolor}, and when I tried to TeXify my tex file, an error message popped up (after install verbatimbox): ! Latex Error: File `readarray.sty` not found. ...
6
votes
2answers
330 views

Custom verbatim that sets all spaces (“ ”) as visible spaces (“␣”) that can line-break

It makes sense to typeset code in a monospaced font. Sometimes such code needs to be embedded in a paragraph context, and then it will be useful to allow it to linebreak. In order to visualize spaces ...
5
votes
3answers
2k 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 ...
0
votes
0answers
47 views

Creating a document template that works with verbatim

I need to produce a lot of documents that all look like this: Question 1: Answer 1. -------------------------- Question 2: Answer 2. The end. There are always exactly two questions and two ...
1
vote
1answer
48 views

how to use verbatim within a list

I tried to use verbatim within a list like this: \begin{lstlisting} Search(HTMLpage, \begin{verbatim}``<TITLE>*</TITLE>''\end{verbatim}); Copy(HTMLpage); Paste(Title); \end{lstlisting} ...
2
votes
0answers
42 views

Polyglossia, French and verbatim [duplicate]

Using Polyglossia with setdefaultlanguage{french} breaks spacing in verbatim and \verb: \verb|a:b| typesets as a :b. Minimal working example, GitHub bug report. Before I delve into Polygloglossia's ...
3
votes
1answer
29 views

how to make the content within \verb different line

I tried to make the text contained within \verb different line by using \verb#<TITLE>*\\</TITLE>#, but the result is now what I expected: <TITLE>*\\</TITLE> since I want to ...
2
votes
1answer
29 views

Prefix on newlines in lstlisting environment

I've defined my own lstlisting environment with \lstnewenvironment. Now I'd like to prefix every new line of the code with arbitrary text (a bash cursor). Basically I'd like this \begin{commands} ...
1
vote
2answers
41 views

Vertical spaces in htlatex \ScriptEnv

I am using htlatex to generate the HTML version of book and I am having problems with vertical spacing. I have configured an environment like this: \ScriptEnv{tawny} ...
2
votes
1answer
43 views

htlatex inserting environment in verbatim

I want to get htlatex to put some text into my HTML file verbatim. The problem is that it keeps redo-ing my spacing. So, for example, I use a cf.cfg like this. \Preamble{html} \ConfigureEnv{tawny} ...
3
votes
1answer
24 views

catchfilebetweentags bug with \verb command

With example \RequirePackage{filecontents} \begin{filecontents*}{main.tex} %<*example> \verb|This is an example| %</example> \end{filecontents*} \documentclass{article} ...
6
votes
1answer
77 views

Code listing inside of tabu environment

I'm trying to insert a small code listing into a tabu table, however I'm unable to build a PDF. The code I'm trying to use (well- a simplified form of it) is as follows: % !TEX encoding = UTF-8 ...