{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

2
votes
1answer
84 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 ...
2
votes
2answers
72 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
28 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 ...
11
votes
2answers
226 views

Print small TeX code verbatim and render it

To write some documentation, I would like the ability to define a command such as \showcase{x^{y}\in\Omega} which expands to something roughly equivalent to \verb|x^{y}\in\Omega| & ...
14
votes
1answer
137 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 ...
0
votes
1answer
41 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 ...
6
votes
3answers
143 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. ...
3
votes
1answer
38 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
61 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 ...
4
votes
3answers
736 views

help me write verbatim

I'm trying to write HMX_Y, and because someone out there (mr. or ms. TeX) thinks this is a math notation, I have to use verbatim function to convince him (or her) otherwise. So far I've been using ...
3
votes
1answer
84 views

A templating system in LaTeX

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
36 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
54 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 ...
5
votes
1answer
55 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 ...
7
votes
1answer
1k views

Customize \verb!…! output in beamer

I would like to change my verbatim throughout a beamer presentation in the preamble. Actually I would like to have it more or less like on slide no. 9 here. I am using verbatim usually with ...
8
votes
2answers
280 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 ...
4
votes
1answer
121 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
78 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 ...
35
votes
2answers
603 views

Viewer-independent copyable spaces at the beginning of a line?

I need to include a couple of Python code listings, where the indentation of the lines (using some number of spaces) is significant. I would like for the code listings to be copyable, so the spaces at ...
0
votes
0answers
60 views

LyX 2.1.1 does not recognizing verbatim environment [closed]

I updated to LyX 2.1.1 and have issues with previous versions created files. LyX 2.1.1 throws the following error: does not recognizing verbatim environment I wonder how to overcome this issue. Any ...
4
votes
1answer
69 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
24 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
35 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
115 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
53 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 % ...
12
votes
1answer
602 views

escape `|' in \verb

In LaTeX, if I use \verb, how can I escape |? For example, I want to display ab|bc: \verb|ab[]bc|. What should replace []?
5
votes
1answer
68 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} ...
5
votes
1answer
70 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}}{}{} ...
8
votes
2answers
6k views

Verbatim in beamer showing error: “File ended while scanning use of \@xverbatim.”

I am using Texmaker and MiKTeX on Windows 7. I have the following beamer code, \documentclass{beamer} \theme{AnnArbor} \begin{document} \begin{frame} \begin{verbatim} ...
17
votes
3answers
1k views

In LuaLaTeX, how do I pass the content of an environment to Lua verbatim?

In LuaLaTeX, how would I go about capturing the content of an environment for (verbatim) processing by Lua? For example, consider something like \begin{foobar} Hello {World} \end{foobar} I'd like ...
3
votes
1answer
34 views

whitespaces in alltt environment get merged

\begin{frame}{Beispiel Mergesort} \begin{alltt} mergesort :: (Ord a, Trans a) => [a] -> [a] mergesort [] = [] mergesort [x] = [x] ...
0
votes
1answer
87 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. ...
1
vote
2answers
63 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
158 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 ...
6
votes
1answer
398 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 ...
3
votes
1answer
259 views

verbatim environment inside algorithm2e

I need to output Prolog style inside algorithm2e and It seems that I cannot use \verb inside algorithm2e. How can I use \verb or verbatim for only one line inside algorithm2e in Latex?
9
votes
3answers
173 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
56 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 ...
5
votes
1answer
72 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 ...
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 ...
3
votes
1answer
83 views

Verbatim environment with gray background color and italics

I want a verbatim environment with gray background color and italics(bold fonts may be used also). The \lstlisting can set background but can't set italics. The \mdframed combined with \alltt can ...
3
votes
1answer
36 views

Creating command: FanceVerb Error, Paragraph ended before

Hi and sorry if that question might be already asked. I try to create a command like this: \documentclass{scrbook} \newcommand{\code}[1]{\texttt{#1}} \newcommand{\smallx}[1]{ \begin{center} ...
2
votes
2answers
66 views

How to specify non-standard font in fancyvrb Verbatim?

I am using Inconsolata for code in paragraphs, and would like to use it for code in verbatim environments as well. I have tried using fancyvrb's Verbatim environment to do this, but cannot get any ...
0
votes
1answer
134 views

How to properly format pseudocode (algorithm) in LNCS (Lecture Notes in Computer Science)?

I know that when I need to paste the source code, I should use \verb or \verbatim. But how about pseudocode\algorithms? Should I use \verb or \verbatim as well? Can't really find any official Springer ...
4
votes
2answers
48 views

unmatched curly brace in \PVerb argument

I do realize that a verbatim { can be obtained by \verb|{|. However, I need \PVerb which is robust to work in \item command. Obviously, a \PVerb{{} won't work. So is there a solution for unmatched { ...
4
votes
2answers
120 views

Define a special verbatim commmand

To learn more about Plain TeX, I try to define a special verbatim command \verb{code}, which puts code inside braces. When there is no braces in code, It's easy. But when there are some balanced ...
3
votes
0answers
50 views

Show whitespace characters in monospace environments

I need to render an ASCII file for printing in a way that removes ambiguity if (very unlikely) one decides to type it in and validate the signatures. Essentially, I need a monospace typesetter that ...
5
votes
2answers
122 views

How do I center a boxed 'Verbatim'?

Here's a MWE: \documentclass[12pt]{article} \usepackage{fancyvrb} %=== \begin{document} \begin{Verbatim}[fontsize=\small, frame=single, xrightmargin=5cm] Text. \end{Verbatim} \end{document} ...
12
votes
2answers
900 views

Using \lstinline inside a \item

I know about the fragility of verbatim-like commands, and that they should not be used as an argument of another macro, but a need to write a description environment in which the terms to be defined ...
3
votes
2answers
43 views

How to avoid the empty lines before and after a verbatim environment in a tabular cell

I want to insert some raw text and used verbatim in the cell of a tabular. Here is the code: \documentclass{article} \begin{document} \begin{tabular}{p{0.45\textwidth}|p{0.45\textwidth}} \hline ...