{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

7
votes
0answers
51 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 ...
3
votes
1answer
33 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} ...
1
vote
0answers
20 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
2answers
35 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 } ...
2
votes
1answer
28 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
30 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} ...
0
votes
0answers
34 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
53 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. ...
1
vote
0answers
24 views

Polyglossia, French and verbatim

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 ...
1
vote
1answer
39 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} ...
3
votes
1answer
21 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
23 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
29 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
25 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
16 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
42 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 ...
1
vote
0answers
41 views

Define environment with two sections and verbatim

I'am writing a class for the standardization of some documents and I want the interface to be smoothly as possible. One of the things I need is define an environment that produces something like this. ...
3
votes
1answer
39 views

Displaying verbatim content with \tl_to_str:*

\documentclass{article} \usepackage{expl3} \ExplSyntaxOn \begin{document} \tl_to_str:n { testing _ things } \par \tl_set:Nn \l_tmpa_tl { testing _ things } \tl_to_str:N \l_tmpa_tl \end{document} ...
7
votes
1answer
86 views

What characters can delimit the argument of \verb?

I have seen \verb's argument delimited by many characters. I started out with " ", then I saw it done with # # and verified it worked, and I just saw it done with | | right here in egreg's answer. So ...
3
votes
3answers
100 views

Clash between verbatim and libertine

I have a document with some verbatim in it and I wanted to change the font to libertine, but this also changes the verbatim parts. Is there a way to keep the verbatim parts in computer-y font while ...
2
votes
2answers
85 views

you can't use `macro parameter character #` in horizontal line

I have the following latex code that I tried to decorate a fragment of html code: [``temperatures'', ``root'', ``\verb#*<TABLE*<TABLE*</TR>#</TABLE>*#''] but I got error message ...
3
votes
1answer
37 views

verbatim text in tables and macros [duplicate]

I have a cheatsheet with a table that looks like \begin{tabular}{l|l} $k > 0$ & \verb+k > 0+ \\ $k \geq 0$ & \verb+k \geq 0+ \\ $\sum_l$ & \verb+\sum_l+ \\ %etc ...
6
votes
3answers
149 views

What's the best way to provide a verbatim command for additional active characters?

I've noticed that the \verb command does not react well to addtional active characters. E.g. \documentclass{minimal} \begin{document} \catcode`\/=\active \verb§/§ \end{document} will fail. ...
0
votes
1answer
48 views

Showing/Hiding verbatim environment based on boolean condition

I would like to show and hide a verbatim or spverbatim environment based on a boolean condition (sth. like \showenv). I tried the solutions proposed at Hide custom environment content based on ...
3
votes
1answer
64 views

Dump command as readable text?

Is it possible to dump the expanded form of a command as text? E.g. when I write a macro \newcommand{\mytest}[1]{\texttt{#1}} I would want to define a macro \mydump such that ...
3
votes
1answer
54 views

New environment based on two existing environments (mdframed, spverbatim)

I would like to define an environment that puts verbatim text using the spverbatim package into a frame defined by the mdframed package. Here's my (naive) approach: \documentclass{scrreprt} ...
3
votes
1answer
104 views

A templating system in LaTeX [closed]

I need to generate quite a few LaTeX files in an automated way. I do not want to use any templating engine in Python or Elisp (two languages I'm probably most comfortable with); I'd prefer to do it ...
2
votes
1answer
43 views

How to use UNC path

I struggle a bit with UNC paths in latex. My paths looks something like \\server\folder\folder I found this. Which recommends to change \ to /. Thats not really a solution. I put the path in ...
0
votes
1answer
71 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 ...
14
votes
1answer
143 views

Workaround for open lualatex bug in \scantokens?

As package author I am in need of writing a manual with lots of examples. Now I started to make heavy use of lualatex in order to speed up operations which take a long time in TeX (of my package, not ...
5
votes
1answer
82 views

Why does `! Missing $ inserted.` occur when using \verb in beamer?

When I use \verb+...+ within beamer I get ! Missing $ inserted. <inserted text> $ l.6 \end{frame} ? What is going wrong and how do I fix this problem? A minimal example is ...
4
votes
1answer
157 views

Verbatim inside a minipage inside a tikz node — beamer class

I am trying to get a boxed text as part of a tikz node. I found an example here that I am trying to follow, but it is giving me an error: Argument of \@xverbatim has an extra }. I can't figure it out. ...
3
votes
1answer
91 views

How to copy/paste multiple spaces from lstlistings?

This is a continuation of a question that I asked already: How to copy/paste from lstlistings?. The solution presented there does not work if the text within the lstlistings environment contains ...
4
votes
1answer
70 views

Why do some spacing commands work correctly after end commands, and others don't?

Why is it that \begin{verbatim} some verbatim \end{verbatim}\bigskip will work without errors, but if I changed the ending line to \end{verbatim}\\[1\baselineskip] I'll get errors? Am I ...
0
votes
1answer
25 views

Why can't I use multiplie verbboxes? [closed]

I am writing some documentation for a testing framework I am using at work and I use verb boxes to show code and add comments/captions that pertain specifically to that code. But I am getting the ...
2
votes
1answer
39 views

I have included verbatim to show a small section of code, how can I add a comment/caption for this verbatim?

I am writing some documentation on a tool I am using at work and I have included some code that has a comment to explain what a particular line is there for, this comment runs off the page if I leave ...
7
votes
1answer
117 views

How can I change a glyph in a Verbatim environment?

I have a document which contains example program code in Verbatim environments. The caret symbol produced by typing ^ looks too flat to me, so I defined a macro to produce a sharper version. ...
2
votes
1answer
54 views

macro to showcase newly defined macros

I have the following MWE which takes an argument and prints it verbatim. I have obtained the code from this answer. \documentclass{article} \makeatletter \newcommand{\myverb}{% \begingroup % ...
5
votes
1answer
98 views

New environment for minipage and colorbox

I would like to create a new environment that would automate the following code: \setbox0=\hbox{\begin{minipage}{5.8in} \color{black} \begin{verbatim} <Some verbatim text here> \end{verbatim} ...
3
votes
1answer
106 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 ...
5
votes
1answer
82 views

How to use \pretocmd with \verb or \lstinline?

I write my document in other language, then I need to switch to English (switch font) when show code: \newcommand\code[1]{\lstinline{#1}} \pretocmd{\code}{\begin{otherlanguage}{english}}{}{} ...
3
votes
1answer
35 views

whitespaces in alltt environment get merged

\begin{frame}{Beispiel Mergesort} \begin{alltt} mergesort :: (Ord a, Trans a) => [a] -> [a] mergesort [] = [] mergesort [x] = [x] ...
1
vote
2answers
64 views

Shrinking the text in verbatim mode [duplicate]

I need to deal with loads of code lines in verbatim mode and append them to the appendix. That is, I may not need to show them in a fancy way but I want them to occupy least amount of space. As you ...
2
votes
2answers
190 views

The correct way to type tilde?

So, I know there are a lot of posts about this already, with answers like \textasciitilde, \texttildelow and $\sim$ and they all seam to work in their own way. But what I've found is that they look ...
0
votes
1answer
108 views

LaTeX: C++ source code can be included with verbatim, but not with lstlisting [closed]

When trying to compile my .tex files, I can only include some of my C++ source code as "lstlisting"s, while other source code breaks compilation. The error I get is: Extra }, or forgotten \endgroup. ...
6
votes
1answer
449 views

How can I make bash-code look good both in LaTeX and HTML?

As I am new to Latex and this kind of typing in general, I find myself in need of some basic guidelines when it comes to how to make things look good in text. I have a document that looks good when ...
16
votes
3answers
217 views

Fancy code environment

I'm writing a small tutorial about LaTeX. So I'd like to insert some code and obtain the result on the right. I'm almost there. I got the desired output but I'd like something more clear, that is, ...
2
votes
1answer
64 views

How to combine simultaneously the fragile- and the label-command for a frame?

I am currently facing the following problem in the beamer-class for LaTeX: I would like to label a frame and simultaneously use a verbatim-environment. Most likely the solution is very easy but I do ...
2
votes
0answers
31 views

lstlistings messes up spacing before subsequent section headings [duplicate]

I'm typesetting a grammar specification for a programming language, which leads to many short snippets of grammar and example code interleaved in the document text. The issue I observe is that an ...
5
votes
1answer
91 views

Redefine verbatim environment

I have a text with source code, which I would like to display. I am using pandoc, so I have to use either verbatim or listings enviroment. Unfortunately, I can't use listings package (due to ...