{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

9
votes
2answers
66 views

Inline links in code listings

I would like to include links inside source code listings by providing URLs within the listing source text. That is, I would like to be able to generate something that looks like the following: ...
2
votes
1answer
35 views

Use \(end)comment instead of \begin/\end{comment}

In my document, the comment environment works fine, but \comment and \endcomment stop processing of what comes next in the document: \documentclass{article} \usepackage{verbatim} \begin{document} X \...
3
votes
1answer
32 views

How to use Verbatim inside tabu table?

I changed my longtable to use tabu and now I am getting lots of errors. It turned out tabu does not like Verbatim inside the table, but according to documenations, tabu* is supposed to do that, but I ...
9
votes
2answers
97 views

Listings for plain tex

Is there a package to produce syntax-colored blocks of source code in plain TeX ? A listings equivalent ? Or (maybe) some macro to produce a colored tex input for some given source code ? Is it ...
0
votes
0answers
39 views

How to display a LaTeX code of a mathematical formula in the output (the code itself eg: $x^2$) [duplicate]

I want to make a table with two columns. Heading for one column is the mathematical expression and in the other one it's the corresponding LaTeX command. How to display the command of x^2 which is $x^...
4
votes
1answer
39 views

How to add a todo notes in verbatim environment?

I need to describe the header of a .ctl file. For this purpose, I am using verbatim package for displaying the header. My command lines are below: \begin{verbatim} dset ^newcase_d01_2612.dat options ...
3
votes
1answer
69 views

How to typeset shell like output in Latex

I'm trying to achieve a output as shown below with latex NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 32G 0 disk ├─sda1 8:1 0 99M 0 part /boot └─sda2 8:2 0 31,9G 0 ...
3
votes
1answer
29 views

difference between \verb and \NewDocumentCommand verb

This MWE \documentclass{article} \usepackage{xparse} \begin{document} \NewDocumentCommand{\myVerbatim}{v}{#1} \myVerbatim|This is some text, which can contain $\sin(x)$ or code or $$| \verb|...
3
votes
2answers
108 views

tcolorbox with fancy text

Driven from Let's get fancy: Text like tag? , I wrote this code: \documentclass{article} \usepackage{tcolorbox} \definecolor{mycolor}{rgb}{0.122, 0.435, 0.698} \newtcbox{\mybox}{nobeforeafter,...
4
votes
1answer
110 views

Isolate Latex Environments [closed]

I want to build a framework for sharing latex mathematics exercises. When trying to assemble exercises from different authors into one "homework assignment", I have a problem. How can I deal with ...
2
votes
1answer
26 views

How to tell alltt not to skip lines at beginning/end?

It seems like there is no option for specifying that, like a hack for verbatim I found on tex.stackexchange: \usepackage{etoolbox}% \makeatletter \preto{\@verbatim}{\topsep=0pt \partopsep=0pt} \...
17
votes
2answers
608 views

Tex capacity exceeded compiling only 50 lines latex file (pdftex), seg. fault (lualatex)

This is one of the strangest things I've seen in Latex (and I have seen many strange things). 50 lines of code, almost all of it is verbatim. Any small change to the verbatim can cause the error to ...
12
votes
4answers
1k views

How to pass an optional argument to an environment with verbatim content?

This is an attempt to make clear what happened in this question of xport (now deleted, sorry). The now deleted question included code that tried to make my answer to this question of xport work for ...
1
vote
1answer
49 views

How to tell latex to write as the text in texmaker?

I intend to attach my C code in my report. However, the code has a lot of special characters that create an error in compilation {, # and so on. Any package to circumvent this issue. For example: \...
3
votes
1answer
64 views

How can I redefine verbatim to wrap lines (add break before or after spaces)?

Before continuing, I would like to inform readers that I know it is generally discouraged to reimplement functionality that packages already support. Automatically wrap the text in verbatim has an ...
1
vote
0answers
17 views

Colouring in-line text within verbatim environment

I wish colour some selected text within the verbatim environment. These texts may not occupy a whole line, but rather be a small part of a line. An illustration is given below. Say for example, in ...
4
votes
2answers
87 views

Doesn't the verbatim environment work with the standalone class?

I have the following code, which is as minimal as it could possibly be ( standalone 2015/07/15 v1.2): \documentclass{standalone} \begin{document} \begin{verbatim} Ciao \end{verbatim} \end{document} ...
3
votes
2answers
61 views

TODONOTES and \reserved@a - nested itemize/enumerate environments

I am having a problem trying to insert come environments into inline todo notes... This MWE should demonstrate. \documentclass{article} \usepackage{todonotes} \usepackage{verbatim} \begin{document}...
3
votes
1answer
326 views

fancyvrb inline verbatim with \newcommand and \CustomVerbatimCommand

I've just registered. This is my first question to this site. I am trying to make a verbatim command for inline code. This has been asked and answered many times before, but I never found a direct ...
1
vote
0answers
65 views

How to use sagesilent (or verbatim) environment in pgffor loops?

I want to create different versions of an exam paper and corresponding sample solutions using sagetex. I need to assign variables for more involved computations, so I am reliant on the sagesilent ...
0
votes
0answers
17 views

\end tag ignored in frame [duplicate]

I have the following slide in a document of class beamer. \begin{frame}{Modular Design} \begin{lstlisting} <code> \end{lstlisting} \end{frame} This however returns these ...
3
votes
1answer
42 views

Use verbatim with \only in beamer [duplicate]

I want to have a frame to showing text and then data ( in verbatim ). And I cant compile it. I made this minimum working example : \documentclass{beamer} \begin{document} \begin{frame}[fragile] \...
17
votes
1answer
553 views

How to display LaTeX code and the typeset version next to each other without repeating myself?

I would like to write some LaTeX code, and without repeating myself, I would like that to be used for displaying that particular piece of code as-is and its typeset version, next to each other. The ...
1
vote
0answers
26 views

line breaks and word wraps for unpredictable character strings

I am writing python to parse and process lots n lots of files to build a final report of results from information in the files. I am using python to write the latex file, then converting the latex ...
3
votes
2answers
22 views

Conditional formating of a verbatim type argument

I write problem sets whose answer keys contain matlab code. To accomplish this, I'm using matlab-prettifier, but I need to condition the output on whether I'm outputing the problem set questions or ...
8
votes
1answer
342 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}
5
votes
0answers
96 views

Using cprotect and environments with multiple arguments

Is there a way to use the cprotect package's \cprotEnv command to use verbatim inside environments that have optional or multiple arguments? My motivation for this question: I am working with ...
3
votes
2answers
31 views

verbatim inside macro with color

Consider the following minimal non-working example (comment the line with the \test{..} to compile. I'd like to have a \verb+something+ inside my \test{} environment. How can I achieve that? \...
3
votes
3answers
788 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
107 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 ...
6
votes
0answers
55 views

Exception from code syntax highlighting in listings

EDIT: The question is not really relevant for me any more, I decided to instead use the highlight package in R to export Code as LaTeX output. This still requires manual modifications, but at least I ...
4
votes
2answers
135 views

Programming code listing: enumeration and left margin

I'd like to inlcude programming codes in LaTeX by using the verbatim package. For the code I use, the enumeration is continous. So if a new code starts, the numbers are ongoing, which should not be ...
4
votes
2answers
52 views

searching for a verbatim package for paragraphs that use reserved characters

I'm looking for a LaTeX package that enables an environment sort of like "verbatim" in that it prints each and every unicode character exactly as typed, but... 1> does NOT replicate linebreaks 2> ...
4
votes
2answers
1k 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 ...
4
votes
2answers
58 views

\MakeShortVerb{\§} and \usepackage[utf8]{inputenc}

I have a book published more than 10 years ago. It contains the following code in its preamble: \documentclass{article} \usepackage[cp1251]{inputenc} \usepackage[T1,T2A]{fontenc} \usepackage[english,...
17
votes
2answers
1k views

Getting verbatim with soft grey background, as in tex.stackexchange

Given a verbatim as on below, \begin{verbatim} This is an awesome verbatim \end{verbatim} which is displayed with no background on the compiled pdf page : This is an awesome verbatim I would ...
1
vote
2answers
1k views

How to configure the verbatim text?

In LaTex, I use \verbatim to add a block of text. But the problem is that the verbatim text doesn't follow the page style, and it exceeds the page boundary if the text is long. The result is shown as ...
4
votes
1answer
64 views

A verbatim column in tabular environment

I want to build a table with a column of verbatim, but I don't want to use \verb command for every line (too many rows), how should I do it? I tried to use array package to define new column type but ...
0
votes
0answers
22 views

How to customize `\verb|…|`? [duplicate]

I would like to customize the output of \verb|...|. For some reasons, I just need to stick to the command \verb|...|, nothing else. Can I customize the output styles of the command? I'd like to change ...
7
votes
1answer
377 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 ...
8
votes
3answers
3k views

verbatim and overlays

I am trying to display a verbatim environment in an overlay. I have the following code but it is giving errors: \only<2->{ \begin{verbatim} Select T3.Subject From T as T1, T as T2, T as T3 ...
4
votes
2answers
83 views

How can I insert complex regular expressions into tabularx cells?

I'm trying to create a table with two columns, in which the second one is representing lots of regular expression with all the character you could imagine. I tried with \verb|text| command, but it ...
1
vote
1answer
44 views

Extract Package question: Not present \Sectionformat statement is extracted

I use the solution shown here (thanks to Mike Renfro!) to extract a synopsis from my LaTeX documents. Sadly I am struggling with the output of the headings. Basically the problem is that the extract ...
8
votes
3answers
177 views

How to use \verb or something similar inside a \newcommand

The command \displaygraphics[width-1in]{figure=some_fig.pdf} will display a graphic. Sometimes I want to typeset when I do not have the graphics files available, so I want to do something like: \...
3
votes
2answers
146 views

Verbatim vs Listings for Thai Font

I have a problem about verbatim and listings. I need write some codes by using Thai font but it shows in picture \documentclass[12pt,a4paper,oneside]{book} \usepackage{verbatim} \usepackage{listings} ...
4
votes
1answer
215 views

A Mathjax 'cheatsheet' in LaTeX [duplicate]

I would like to write a LaTeX document in which several Mathjax commands are shown as source code and compiled. So I want to have a list of items and have them show up on, for example, the left side ...
1
vote
0answers
16 views

transform variable-content to verbatim-like representation inside a newcommand (used then as optional argument)

I spend 8 hours in solving this, made some progress but now face the enormous difficulties with verbatim stuff in latex. Any help would be great! My aim: the todonotes package offers an inline option,...
13
votes
2answers
5k views

Inline code and short verb with minted

I it possible to use minted for inline code and to add a short verb sing for minted? Like \lstMakeShortInline| in listings.sty? \documentclass{article} \usepackage{minted} \newminted{tex}{} \...
19
votes
1answer
9k 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
1answer
37 views

Wrap a verbatim table environmet

I have text with all sorts of characters in it that I want to use in a table so thought that verbatim might be suitable, but this doesn't seem to wrap. I've seen suggestions for listings but this ...