Questions tagged [fancyvrb]

{fancyvrb} is a package that provides sophisticated facilities for reading and writing verbatim TeX code.

Filter by
Sorted by
Tagged with
5 votes
2 answers
186 views

Is there a simple method of attaching labels to some lines inside a "Verbatim" environment?

I have many Verbatim environments in my document, which contain source code with different characters inside, including {, (, [, <. I'm trying to find a way of attaching labels to some lines inside ...
yegor256's user avatar
  • 12.1k
2 votes
2 answers
226 views

Why curly brackets are treated incorrectly when "commandchars" is used in "Verbatim"?

This is what I'm doing: \documentclass{article} \usepackage{fancyvrb} \begin{document} \begin{Verbatim}[commandchars=+\{\}] Hello, \emph{world}! Bye, +emph{world}! \end{Verbatim} \end{document} The ...
yegor256's user avatar
  • 12.1k
3 votes
2 answers
145 views

How to pass arguments to a "Verbatim" environment from a variable?

The arguments that I need to pass to a Verbatim environment are in a variable. I'm trying to do this: \documentclass{article} \usepackage{fancyvrb} \begin{document} \def\opts{numbers=left} \begin{...
yegor256's user avatar
  • 12.1k
4 votes
1 answer
67 views

How to disable "commandchars" in a "Verbatim" environment?

How can I disable commandchars for a particular Verbatim environment, if I set it as a global option via \fvset earlier? I'm trying this: \documentclass{article} \usepackage{fancyvrb} \fvset{...
yegor256's user avatar
  • 12.1k
4 votes
1 answer
134 views

How to escape a TeX command inside a Verbatim environment?

I'm trying this: \documentclass{article} \usepackage{fancyvrb} \fvset{commandchars=\|} \begin{document} \begin{Verbatim} Hello, |\textbf{world}|! \end{Verbatim} \end{document} However, I'm getting ...
yegor256's user avatar
  • 12.1k
2 votes
1 answer
21 views

Left aligning Verbatim / fancyvrb environment with beamer slide

I would like to have the content of the Verbatim environment to be on the left of this beamer slide. However, whatever I try it always gets centered. How can I control the position of the start of the ...
tomka's user avatar
  • 305
0 votes
1 answer
34 views

VerbatimOut crashes on special symbols inside if-then-else

This code compiles just fine with lualatex, xelatex, and pdflatex: \documentclass{article} \usepackage{fancyvrb} \begin{document} \begin{VerbatimOut}{x.txt} ^^_ \end{VerbatimOut} \end{document} ...
yegor256's user avatar
  • 12.1k
1 vote
1 answer
33 views

Minted fancyverb error in beamer [closed]

I'm using minted for code higlight in a beamer presentation, and I'm getting an error: FancyVerb Error:. ^^I^^I^^I\end{minted}^^I \documentclass[]{beamer} \usepackage{minted} \begin{document} \begin{...
td211's user avatar
  • 153
1 vote
1 answer
50 views

How to make new environment using an existing environment? File ended while scanning use of \FancyVerbGetLine

I have a setup that works OK as is. I needed to make this code as an environment so less typing. When I do that I get an error. Here is the original setup \documentclass[12pt,titlepage]{article} \...
Nasser's user avatar
  • 20.2k
2 votes
3 answers
133 views

TikZ messes up spacing of fancyvrb environments

I'm trying to use environments saved with SaveVerbatim of fancyvrb in TikZ nodes. But TikZ seems to mess up the spacing in a way that I can't use this for code snippets. The following MWE shows how ...
Frunobulax's user avatar
  • 2,228
0 votes
1 answer
77 views

How to display code in a frame with ASCII ' and ` and evaluation of macros

I want to display a block of code with ' and ` displaying as themselves and with evaluation of macros.The closest that I've been able to come was \documentclass[b4paper]{article} \usepackage{alltt} \...
shmuel's user avatar
  • 1,449
1 vote
1 answer
172 views

Control vertical space after Verbatim environment

I want to control the vertical space after a Verbatim environment from fancyvrb. Even setting \topsep and \partopsep to 0pt, as suggested in muzimuzhi's answer, gives me some extra spacing after the ...
Atcold's user avatar
  • 1,727
1 vote
1 answer
50 views

Rewriting non float code listings Pandoc compatibility

In a previous question I asked whether it would be possible to create a listing in LaTeX using fancyvrb and fvextra satisfying the following requirements: Allowing for page breaking (non-float) Line ...
user32882's user avatar
  • 1,594
1 vote
2 answers
110 views

How to apply captions to non-floating Listings

One way to add captions to code listings is as follows: \documentclass{article} \usepackage{fancyvrb} \usepackage{fvextra} \usepackage{xcolor} \usepackage{caption} \usepackage{float} \newfloat{...
user32882's user avatar
  • 1,594
1 vote
0 answers
76 views

Line breaking with fancyvrb and fvextra doesn't work when injecting commands in Verbatim environment

Using fancyvrb and fvextra, it's possible to get verbatim environments to breaklines at any location to accomodate the text width. \documentclass{article} \usepackage{fancyvrb} \usepackage{fvextra} \...
user32882's user avatar
  • 1,594
1 vote
0 answers
113 views

Formatting lines of fvextra input -- problems with line breaks

I'm trying to integrate this answer into my document. While it mostly works, I have run into a new issue. I'm using fvextra because I need the line break control. Unfortunately, once a line break ...
vwegert's user avatar
  • 2,875
1 vote
1 answer
90 views

Formatting lines of \VerbatimInput

I have some text files I need to include in a document, preferably using fancyvrb or fvextra. I want to highlight some of the lines of these files. The exact conditions are not important here, since ...
vwegert's user avatar
  • 2,875
1 vote
1 answer
56 views

How to adjust fancyvrb verbatiminput text to fit inside tabularx cell

I would like to include text from file into tabularx cell but got two issues: verbatiminput text overflow defined margins The cell has extra vertical margins How I may fix this ? Code \...
ppk's user avatar
  • 113
0 votes
1 answer
15 views

Why my \verb-ish command is not escaped inside \VerbatimEnvironment?

Here is the code: \documentclass{article} \usepackage{fancyvrb} \NewDocumentCommand\foo{v}{\texttt{#1}} \catcode`\|\active \AtBeginDocument{\catcode`\|\active\def|{\foo|}} \catcode`\| 12 % \...
yegor256's user avatar
  • 12.1k
0 votes
1 answer
60 views

How to use a macro for the list of optional arguments to another macro?

This is the code: \documentclass{article} \usepackage{fancyvrb} \begin{document} \def\p{fontsize=\small} \VerbatimInput[\p]{a.txt} \end{document} It doesn't compile. What is the right way to use \p ...
yegor256's user avatar
  • 12.1k
2 votes
1 answer
123 views

Options of fancyvrb do not work

I want to have breaklines with verbatim. For this I use: \documentclass[12pt,a4paper]{article} \usepackage{fancyvrb} \usepackage{fvextra} And I set my environment like this: \begin{verbatim}[...
Guillaume's user avatar
1 vote
1 answer
75 views

How to replace `right floor' symbol with `hyphenation' symbol inside \Verb

I'm now encountering a problem when using \Verb command from the package fvextra, which may be used as a drop-in replacement for package fancyvrb. fvextra will load fancyvrb if it has not yet been ...
GL_n's user avatar
  • 193
1 vote
1 answer
104 views

Automatically label line numbers in minted enviornment

I've recently swapped from the listing package to the minted package for my code listings. When I used lstlistings, I was able to redefine \lst@Key to automatically place labels of the format \lst@...
candr's user avatar
  • 21
0 votes
2 answers
53 views

Leaving tiny gap between == in Verbatim (fancyvrb) environment

\texttt{==} typesets the two equals signs with a tiny gap in between. However, \documentclass[11pt]{article} \usepackage{fancyvrb} \usepackage{fontspec} \setmonofont{JetBrainsMono-Regular.otf} \...
PartialOrder's user avatar
0 votes
0 answers
36 views

How to add color to text snippets in modified verbatim environment

\usepackage{fancyvrb} \usepackage{framed,color,verbatim} \definecolor{shadecolor}{rgb}{.9, .9, .9} \newenvironment{code}% {\snugshade\verbatim}% {\endverbatim\endsnugshade} I have a new ...
reyna's user avatar
  • 111
0 votes
1 answer
170 views

How to justify text in \VerbatimInput

Is it possible to use \justify (from this previous question) with \VerbatimInput? \begin{filecontents*}{\jobname.txt} Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor ...
Arianna Angeletti's user avatar
0 votes
1 answer
159 views

\sim needs to display in Verbatim

My codes are follows: \documentclass[executive,twoside, justified, symmetric, notoc, openany]{tufte-book} \usepackage{color} \usepackage{fancyvrb} \newcommand{\VerbBar}{|} \newcommand{\VERB}{\Verb[...
MadyYuvi's user avatar
  • 13.8k
0 votes
1 answer
143 views

How to make vertical space around fancyvrb symmetric?

How can I get rid of the extra space that appears here? I want the space above and below the Verbatim to be the same, but here it seems that about 4-8pt of extra space is being added only to the ...
Eric's user avatar
  • 679
4 votes
2 answers
269 views

Inline verbatim text keeping the same font as normal text

My software automatically creates LaTeX documents. I need to display some text that I have no control over (it will be provided by the user), so it can contain problematic characters (like _ or \ or $ ...
zezollo's user avatar
  • 491
0 votes
1 answer
100 views

Increase space between lines (not globally) by using fancyvrb

My codes are follows: \documentclass{book} \usepackage{xcolor} \usepackage{fancyvrb}% \DefineVerbatimEnvironment{Highlighting}{Verbatim}{fontsize=\small,commandchars=\\\{\}} \newcommand{\DecValTok}[1]{...
MadyYuvi's user avatar
  • 13.8k
0 votes
1 answer
87 views

Error in package fancyvrb: Too many }'s

When I include the package fancyvrb via \usepackage{fancyvrb} or other packages that make use of that package (for example minted), I get the error Missing \endscname inserted (line 535 of fancyvrb....
Mike van Dyke's user avatar
5 votes
1 answer
505 views

Scale down verbatim environment even further

I am using the fancyvrb package. Even though I set the font size to \tiny, it still doesn't properly fit in a single slide. I was wondering is there a way to scale it down even further. Thank you \...
Node.JS's user avatar
  • 685
8 votes
3 answers
2k views

Minted ` \begin{minted}{...}` KO but `\inputminted` OK

Since a few days I can't color anymore python code with minted; I don't have any error message in the log file, only the minted output doesn't appear in the pdf file. On the other hand, everything ...
jowe_19's user avatar
  • 939
0 votes
2 answers
59 views

Extension defaults to .tex in VerbatimOut environment

When I try to write a file with some name for example a (then read it afterwards) \usepackage{fancyvrb} ......... \begin{VerbatimOut}{a} file content here... \end{VerbatimOut} % process the file ...
user202729's user avatar
  • 7,213
1 vote
1 answer
310 views

How can I add additional spacing between some lines in `minted`?

I would like to add a little separation between some lines of code for readibility. Consider this MWE: \documentclass{article} \usepackage{minted} \begin{document} \begin{minted}[linenos]{python} ...
bp99's user avatar
  • 605
1 vote
1 answer
71 views

Unable to use listing with toptesi

Everytime I open a new listing the compiler complaints about it. Try to compile the following example % !TEX options = -shell-escape \documentclass[% corpo=12pt, twoside, oldstyle, tipotesi=...
Antonio Santoro's user avatar
2 votes
1 answer
142 views

Problem changing fancyvrb's default font

I would like to change the default font for fancyvrb in the following MWE. % arara: xelatex: { shell: true } \documentclass{article} \usepackage[svgnames]{xcolor} \usepackage{fontspec} ...
hsmyers's user avatar
  • 1,509
2 votes
3 answers
181 views

How to make a macro that prints verbatim text?

I'm trying to do automatic linebreaking right now with verbatim, and I have this setup. \usepackage{fancyvrb} \usepackage{fvextra} \begin{Verbatim}[breaklines=true,numbers=left,breakafter=\},...
generallyconfuzzled's user avatar
1 vote
2 answers
61 views

Behavior of environment with optional argument changes when optional argument is not passed

Recently, when I've been working with environments with an optional argument, I've noticed that the behavior changes when I introduce a set of square braces, even when there is nothing inside them. ...
Dennis Chen's user avatar
1 vote
1 answer
140 views

verbatim environment or lstlisting as part of newenvironment with samepage and \ill?

I'd like to make a "codeillustration" environment that's something like: \newenvironment{codeillustration}[1]{ \begin{samepage} {\ill{#1}} \VerbatimEnvironment \begin{Verbatim}{\end{Verbatim}...
dfrankow's user avatar
  • 233
5 votes
1 answer
155 views

Unicode characters within VerbatimOut of fancyvrb

Consider the following example, in which the sentence Ceci est un résumé. is written into the file \jobname.mytmp and then being read back. \documentclass{article} \usepackage{fancyvrb} \begin{...
Jinwen's user avatar
  • 8,538
3 votes
2 answers
225 views

Using \VerbatimInput with text files that contain Greek and English

I have to include some text files in my document, which are reports derived from another program. The text in these files is mixed (Greek and English). I'm using the fancyvrb package to include the ...
Alex St's user avatar
  • 99
0 votes
0 answers
88 views

Force to unindent default code

I want to unindent the default indent by mmacells. Here you can see the input and output are indented, and i want to force them to the left start. How to do that? Using \noindent and hspace*{-.5cm} ...
user516076's user avatar
4 votes
1 answer
238 views

line number not works for fancyvrb with SaveVerbatim

The following code tells every thing \documentclass{article} \usepackage{fancyvrb} \begin{SaveVerbatim}{FOO} However, if I define an reusable Verbatim by SaveVerbatim, line number failed ...
Qiang's user avatar
  • 184
1 vote
1 answer
177 views

Define an environment with verbatim body, that removes TAB characters and writes it to a file with VerbatimOut

I'm coding a LaTeX interface for mscgen (another one) and I'm using fancyvrb::VerbatimOut inside a newenvironment to output a part of the tex file into an external file, process it, then import the ...
Kochise's user avatar
  • 155
0 votes
2 answers
124 views

can't pass optional arguments to a \newenvironment using fancyvrb

I am trying to define a new script environment built on fancyvrb's Verbatim environment. Preamble: \usepackage{fancyvrb} \newenvironment{script}[1][firstnumber=1] {\VerbatimEnvironment\...
janonime's user avatar
  • 111
1 vote
1 answer
265 views

About verbatim in LaTeX (and LuaTeX)

What I intend to do... Initially, I wanted to write a series of environments that help me typeset verbatim environments. For example, I would like \begin{myverb}{stylea} \end{myverb} to be equivalent ...
Alan Xiang's user avatar
  • 5,237
2 votes
3 answers
411 views

How can one construct a macro that contains a pythontex or fancyvrb environment?

Goal: I want to create a command that executes pythontex code blocks from within a macro. Application: I have a macro that typesets some equations. I'd like for a side-effect of their use to be the ...
Rob Hall's user avatar
  • 143
2 votes
1 answer
572 views

Resolving a FancyVerb error when making a new code environment

full MWE presented at the end I am creating my own code environment with minted for a text I am writing. It is enumerable, as well as reference-able. Everything works fine and the document compiles ...
George Datseris's user avatar
2 votes
1 answer
1k views

Change font size in verbatim and Verbatim using scaling

This question is closely related to several other questions here, but I believe it hasn't been asked (or answered) exactly like this. Is it possible to change the font size in verbatim and Verbatim ...
itzy's user avatar
  • 747