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
4
votes
2answers
96 views

Include arrows in text file read by \verbinput

I have the following tex program: \documentclass{article} \usepackage{sverb} \begin{document} \verbinput{arrowfile.txt} \end{document} arrowfile.txt: longest_chain ← 0 The arrow is not displayed:...
2
votes
1answer
158 views

Fraction in verbatim environment

First: This is a a question similar to the one here. How do I write a fraction as output in the green box? The fraction should appear just after the 2 and by similar to the output from \frac{3}{5} ...
6
votes
1answer
185 views

Raise character in verbatim mode

Consider the following code (see here for the original code): \documentclass[ a4paper, 11pt ]{article} \usepackage[varg]{newpxmath} \usepackage[ hmargin = 2.4cm, vmargin = 3cm ]{geometry} \...
1
vote
0answers
107 views

Change the output of the sage function latex() on a string

Currently if you run the sage command latex('a string') using sage (or sagetex) the latex output looks like: \text{\texttt{a{ }string}}. I would like to eliminate either of these (preferably the \...
6
votes
4answers
200 views

Expand multiple math-tokens before detokenize

I am a long time Latex user and over the last few weeks I am involved in a project that needs to do the following: I want to put in verbatim some math latex code that may include user-defined macros. ...
8
votes
1answer
902 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 environment. Unfortunately, I can't use listings package (due to Cyrillic ...
5
votes
1answer
171 views

How to print a verbatim block at its end automatically in LuaLaTeX?

This is a follow-up question to this answer by Mico. I try to adjust his Lua code to my needs and line numbering already works. Actually there is one real usability issue and that's my question: How ...
0
votes
1answer
53 views

Adding color and lines in a preloaded table (text file)

I apologize in advance if this has already been asked. I've tried numerous combinations but to no avail. I have a text file with ~60 rows and 3 columns. The first thing I did (successfully) was to ...
-1
votes
2answers
94 views

Re: Lack Of Optional Argument Makes 1st Item Of Environment Get Executed As If It Were Optional Argument

\documentclass{article} \usepackage{verbatim} %\usepackage{fancyvrb} \usepackage{xcolor} \usepackage{xkeyval} %RE: LACK OF OPTIONAL ARGUMENT MAKES 1ST ITEM OF ENVIRONMENT GET EXECUTED AS IF IT WERE ...
0
votes
0answers
52 views

How the verbatim environment of LaTeX works exactly with a simple, clear example [duplicate]

As I am a beginner of learning the TeX and LaTeX internal mechanism, I tried to find some information about the verbatim environment and how it is handle by LaTeX. For example, if we have this command ...
5
votes
2answers
395 views

How can I justify text with line number in Verbatim environment?

My minimal file is: \documentclass{article} \usepackage{fancyvrb} \usepackage{ragged2e} \usepackage{lipsum} \usepackage{pbox} \begin{document} \begin{Verbatim}[numbers=left,fontsize=\bf,commandchars=\...
0
votes
1answer
184 views

change font of verbatim environment, but not of \verb [duplicate]

I use both \begin{verbatim} ... \end{verbatim} and \verb.something. in my document. I would like the contents of \begin{verbatim} ... \end{verbatim} to be displayed in a smaller font. I found this, ...
0
votes
0answers
32 views

Weird unwanted multiple line break in ShareLaTeX [duplicate]

It's my first time using LaTeX and I've encountered something very strange. I have some mathematical/logic stuff that I wanted to put inside a verbatim tag (in order to enforce linebreaks and for ...
2
votes
1answer
70 views

How can I use \hspace in fancyvrb package, without use the key space?

My minimal file is: \documentclass{article} \usepackage{fancyvrb} \begin{document} \begin{Verbatim}[numbers=left,fontsize=\bf] \begin{document} I want to have indent in the amount of hspace{34pt} at ...
5
votes
1answer
113 views

\verbatimInput prints unnecessary lines at the end

test.tex contains the following code \begin{itemize}[(i)] \item One \item Two \item Three \end{itemize} When I use this file using \verbatimInput it prints c@FancyVerbLi as the final line. \...
1
vote
1answer
883 views

\verbatim environment compatible with lingmacros \enumsentence

Using the verbatim environment inside an \enumsentence fails. Here is a MWE: \documentclass{article} \usepackage{lingmacros} \begin{document} \enumsentence{ \begin{verbatim} foo \end{verbatim} } \...
1
vote
1answer
99 views

A Verbatim Caret Which Is Copy/Pastable

Is there a way to typeset a caret in a verbatim-like environment (\verb, \begin{verbatim}, or \texttt) so that it can be copy/pasted into the terminal?
1
vote
1answer
205 views

A simple way to typeset preformatted text blocks or pseudocode

A am looking for a package or a simple method for typesetting blocks of pseudocode or just pre-formatted text. I know about the multitude of packages for typesetting algorithms, but all I need is a ...
19
votes
1answer
3k 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 []?
3
votes
4answers
2k views

verbatiminput and fontsize

Is there a way to set an option of fontsize that would affect the command \verbatiminput ? MWE: \documentclass{article} \usepackage{verbatim} % NOT WORKING %\makeatletter %\newcommand{\verbatimfont}...
5
votes
2answers
292 views

Greek and Latin letters in verbatim

I want to write a code snippet where the commands are in greek and variables are in latin. I use the verbatim command but automatically the latin characters are translated to their greek equivalent. I ...
0
votes
0answers
67 views

Embed .txt file, abiding to defined margins

I am using this link to embed text files within my thesis. Include data from a .txt verbatim Unfortunately, the contents of the text file keeps ignoring the margins. I have tried using | and (/) ...
1
vote
1answer
145 views

Displaying source code

I have the following, generated, code: \documentclass[twoside]{book} \RequirePackage{alltt} \RequirePackage{xcolor} \definecolor{comment}{rgb}{0.5,0.0,0.0} \definecolor{keywordtype}{rgb}{0.38,0.25,...
3
votes
3answers
277 views

How to change the font(size) for verbatim in ltxdoc

The MWE shows what I mean. Using class article I can change the verbatim font. Using ltxdoc nothing happens. I looked in doc.sty and ltxdoc.cls but found nothing. Why does the verbatim environment ...
1
vote
0answers
40 views

fancyvrb:embedding Verbatim environemnt in new environemnt, default parameter not works

\documentclass{article} \usepackage{fancyvrb} \newenvironment{code}[1][5mm] {\VerbatimEnvironment\begin{Verbatim}[xleftmargin=#1]} {\end{Verbatim}} \begin{document} ***************************** \...
2
votes
1answer
122 views

Include a file, verbatim, with a picture on every page

I want to include an arbitrary file, probably using the fancyvrb VerbatimInput command (or something similar). However, I want to put a LaTeX picture environment on every page, much in the way that ...
3
votes
3answers
2k views

Latex environment to write in plain text mode

A paragraph I am writing contains a lot symbols such as "{" or "_". To display those symbols as text instead of command, I have to write them as "\{" and "\_". Otherwise, Latex will say there are ...
0
votes
0answers
56 views

verbatiminput on a file without .txt extention

I'm wanting to include the git hash automatically into a document using verbatiminput. However I seem to be unable to use verbatiminput on a file name does that not end with an extention. \...
5
votes
3answers
18k views

How to indent code in \begin{verbatim}

I have code. I used \begin{verbatim} \end{verbatim}. My code contains indentation to organize the code. But the verbatim does not add spaces. When I try to add vertical spaces using \quad, the ...
12
votes
3answers
8k views

How to treat verbatim as a block that can be referenced just like a figure?

This code for example: \begin{verbatim} int main() { } \end{verbatim} How to add a label below it to be referenced? int main() { } [code 1]
4
votes
1answer
66 views

create verbatim-like macro for use inside escaped lstlisting environment

My goal is to be able to make font changes to arbitrary selections of text within a lstlisting environment by escaping to LaTeX and constructing the new font in the escaped section (is there a smarter ...
1
vote
0answers
63 views

Text editor highlighting in a verbatim-like environment? [closed]

This might be a long shot, but I'm planning to include a roughly 300-line block of python code as an appendix to my undergraduate thesis, and I was wondering if there's a way to make it display with ...
1
vote
1answer
84 views

Verbatim environment nesting troubles [duplicate]

I have troubles trying to nest verbatim environment inside my \newenvironment definition one so I can include my source code faced to its result as on the most latex books printed. I can do it in a ...
1
vote
3answers
85 views

Resize verbatim in exponent equation mode

I have this inline equation $2^{\verb|N|-1}$ that gives this result The problem is that using \verb|N| leaves N with the same size as in \displaystyle but I want it to be smaller. How can I do?
0
votes
1answer
72 views

Export code samples AND display verbatim

I'd like to write a LaTeX document with code samples in a verbatim environment. I'd also like to export those code samples to named files so that they can be built and run. This allows me to easily ...
1
vote
1answer
90 views

How show line in Verbatim environment?

I have a simple Latex code \documentclass{article} \usepackage{fancyvrb} \usepackage{lipsum} \begin{document} \lipsum[2] \begin{Verbatim} CPD of G: ╒═════╤═════╤══════╕ │ F │ F\_0 │ F\_1 │ ├───...
2
votes
1answer
64 views

Use `shortvrb` without needing to end the command manually

Currently, using shortvrb, it's possible to define a single character to start, by itself, an inline verbatim command: \documentclass{article} \usepackage{shortvrb} \begin{document} \MakeShortVerb{\|...
0
votes
2answers
59 views

How to have one code to be typeset both as final and as source code [duplicate]

I'm very limited in writing Latex code and I could not find how to solve my problem searching in the forum ou googling around. My problem: I have to write a document with many algorithms and show ...
0
votes
1answer
302 views

How to use verbatim with tcolorbox?

The following gives many strange errors: \begin{tcolorbox}[fit,height=5cm,blank, borderline={1pt}{-2pt},nobeforeafter] \begin{verbatim} [83 democrat / 66 republican] | | a_b_c = y: [28 democrat / 64 ...
13
votes
2answers
1k views

How is verbatim implemented?

I'm curious as to how verbatim is implemented internally in TeX. I am mostly familiar with the basics of TeX's inner mechanics (catcodes, and what not), but I'm just curious about this command.
3
votes
1answer
11k 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 ...
0
votes
1answer
93 views

Verbatim with direct lua

I would like to add newlines inside a verbatim, through \directlua. Why is there no newline in the first verbatim? \documentclass{article} \usepackage{luacode,verbatim} \begin{document} \directlua{...
5
votes
2answers
231 views

issue with Verbatim

I have a \n in my code which is not compiling correctly in verbatim environment. \documentclass[]{article} \usepackage{fancyvrb} \usepackage{color} \begin{document} \begin{Verbatim}[commandchars = \...
4
votes
2answers
215 views

How to override line numbering for displaying codes in verbatim package

I have a code block that I want to display in latex using verbatim package but I would like to custom number the code lines rather than having them start from 1. Here's the example of the latex code ...
2
votes
1answer
810 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
273 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
0answers
235 views

Pandoc Output PDF with Code Block using listing other than verbatim

I using RStudio and Pandoc to output my document created in markdown to PDF. Pandoc always convert the code blocks in markdown using verbatim environment. Does anyone know how to switch the default ...
1
vote
1answer
159 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
249 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=\...