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

learn more… | top users | synonyms

14
votes
2answers
217 views

Dash in Environment Name

I'm trying to make a verbatim environment called "my-environ" \documentclass{article} \usepackage{fancyvrb} \DefineVerbatimEnvironment{myenviron}{Verbatim}{numbers=left,frame=lines,label=My ...
12
votes
3answers
265 views

Is there a way to make a certain character in a Verbatim have a certain formatting?

I am writing this report on a computing simulation of the Ising model. I am pressenting lattice configuration samples, which are just an array of "+" and "-". This is done in order to visualize the ...
11
votes
3answers
386 views

fancyvrb ShortVerb and tikz incompatibity

I've been working on a document that has a lot of little verbatim bits so I'm using fancyvrb \DeflneShortVerb{\|}. Now I want to add a tikz picture, and the whole thing fails. It there a simple way ...
11
votes
2answers
308 views

How can I define a new minted environment with optional arguments?

I have the following mwe: % arara: pdflatex: { shell: true } % arara: pdflatex: { shell: true } \documentclass{article} \usepackage{minted} \usepackage{listings} \usepackage{caption} ...
11
votes
2answers
239 views

How to suppress extra vertical space before/after fancy Verbatim environments?

I am using fancyvrb's DefineVerbatimEnvironment to create differently-styled verbatim environments for user input and output. When two or more of these follow each other, there is extra vertical space ...
9
votes
5answers
401 views

how fancyvrb background color fill completely with fillcolor?

I'd like the whole Verbatim (fancyvrb) block to have a background color. How do I do it? The fancyvrb package does define a fillcolor -- but that only colors the area around the margin -- not the ...
8
votes
2answers
2k views

Background color for fancyvrb

For reasons unclear to me, fancyvrb doesn't have a background option. However, the minted package, which it is based on, has one, which suggests it should not be too difficult to add. The relevant ...
7
votes
1answer
120 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. ...
7
votes
2answers
93 views

Break line within a macro while writing to a file

I am trying to use (La)TeX as a macro pre-processor for a programming language. My idea is to use the VerbatimOut environment from the fancyvrb package to output essentially verbatim text, but using @ ...
6
votes
2answers
405 views

Inconsolata italics?

Please see http://stackoverflow.com/questions/23975828/how-to-specify-non-standard-font-in-fancyvrb-verbatim/ for the start of this discussion. I am using fancyvrb to create a fancy Verbatim ...
6
votes
1answer
960 views

LaTeX commands in Verbatim using fancyvrb and listings

I am trying to use LaTeX commands like \textbf, \textit, \textcolor in fancyvrb combined with listings. Especially I want to bold and color any text or entire blocks of Java code (not just keywords) ...
6
votes
2answers
69 views

get rid of whitespace when using in Verb in tabu*

Is there any way, to get rid of the extra whitespace between the command and the curly braces when using a Verb in a tabu*? \documentclass{article} \usepackage{fancyvrb, tabu} \begin{document} ...
6
votes
1answer
844 views

Problem about program code included in LaTeX

I have some Matlab code which I would like to include in my LaTeX document. I use fancyvrb package, based on which I define a new environment called code. An complete and minimum example is: ...
6
votes
2answers
2k views

You can't use `macro parameter character #' in restricted horizontal mode. [duplicate]

I get a strange error with a \Verb escape in a footnote: \documentclass{article} \usepackage{fancyvrb} \begin{document} Works inline \Verb!S#Var! but doesn't in footnote. % \footnote{No really, it ...
6
votes
2answers
172 views

How to add a phantom character to the beginning of a verbatim block

I am trying to understand the commandchars of fancyverb's Verbatim: \documentclass{article} \usepackage{fancyvrb} \begin{document} \phantom{foo} \begin{Verbatim}[commandchars=\\\!\!] \phantom{bar} ...
6
votes
1answer
438 views

Determine number of lines in a verbatim environment

I'm trying to implement two new key-value pairs for the fancyvrb package: head= and tail= specify how many lines to display: That is, head=10, tail=5 specifies to print the first 10 lines of the ...
5
votes
3answers
755 views

Use sans-serif in a verbatim environment?

What is the right way get fancyvrb’s verbatim environment (or any other variation) to use \textsf as the font? I can do it with: \begin{Verbatim}[commandchars=\\\{\}] \textsf{Here’s some textsf.} ...
5
votes
3answers
121 views

Shift Verbatim environment to the left using \hspace

I pasted some code into a document in a Verbatim environment from fancyvrb. Because it is within two nested enumerate environments, the code is indented quite far over. As a result, one long line of ...
5
votes
1answer
122 views

too much space between two environment create with tcolorbox

i want write a maple book, see this example code in that book: ‎\documentclass{article}‎ ‎\usepackage{tcolorbox,fancyvrb}‎ ‎\tcbuselibrary{skins,breakable}‎‎ ‎‎ ...
5
votes
2answers
243 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} ...
5
votes
1answer
129 views

Only draw part of a borderline in tcolorbox

I want to tune the type of tcolorbox that I'm making. I want specifically to only draw a border on one side of the image, similar to how minted allows to draw only a border on one side by specifying ...
5
votes
1answer
886 views

Colored line numbers with algorithmicx?

The fancyvrb allows me to customize line number style which I find very useful. I'm using it to give line numbers a different color and then use that same color in the text describing the code. I ...
5
votes
1answer
70 views

How to have fancyvrb number every other line starting with the first?

The following MWE using fancyvrb produces line numbers every other line, starting on the second line, like so: Writing some test 2 third line 4 fourth line fifth line so the numbers are 2, 4, ...
5
votes
2answers
420 views

Problem with hyphen in URL when using fancyvrb with hyperref

There seems to be a problem using a hyphen in a URL inside a fancyvrb Verbatim environment when using the hyperref package. The Problem The following document: \documentclass{article} ...
5
votes
1answer
159 views

Retrieve em-width from another font

I’m trying to align verbatim segments with their outputs. Consider this MWE: \documentclass{article} \usepackage{lmodern} \usepackage{fancyvrb} ...
5
votes
1answer
167 views

How to make letter spacing in verbatim/fancyvrb look like listings

I've just noticed that the spacing between letters is different in verbatim vs. lstlisting environments: Given that I add the option columns=flexible to the lstlisting environment, the spacing in ...
5
votes
1answer
235 views

fancyvrb and \overfullrule

I know I can use \overfullrule=5pt to get overfull lines marked with a black marker, but using the Verbatim environment from the fancyvrb package the overfull lines are not marked. For example, ...
5
votes
1answer
510 views

Combining DefineVerbatimEnvironment with UseVerbatim

I would like to combine the power of \DefineVerbatimEnvironment with \UseVerbatim within a combined beamer presentation and handout scenario. I have already defined the environment coding, and now I ...
4
votes
3answers
806 views

Error using \usepackage{fancyvrb, fancybox}

With TeX Live 2009, with this MWE. \documentclass{article} \usepackage{fancyvrb, fancybox} \begin{document} \begin{Verbatim}[frame=single] auto eth0 \end{Verbatim} \end{document} I ...
4
votes
2answers
118 views

How can I get straight single quotes in a custom Verbatim command?

I use the \Verb command from the fancyvrb pacakge for in-text verbatim fragments. To get straight single quotes, I also loaded the upquote package. Unfortunately, this does not work when I use a ...
4
votes
2answers
110 views

How to embed verbatim in pspicture?

I'm trying to insert a QR code at the beginning of my thesis with the contents being the BibTeX entry for it. Any way of embedding the raw text in \psbarcode? \documentclass[a4paper,12pt]{minimal} ...
4
votes
1answer
2k views

inputenc error with unicode chars and verbatim

I am writing a package where I need to save the contents of several environments in verbatim mode to an auxiliary file. Then the auxiliary file is processed by an external program. In the next ...
4
votes
2answers
149 views

How can I automatically replace subscripts and highlight GoTo labels?

I have to show a lot of autogenerated code throughout my document. The generated code represents loops with explicit block labels and gotos. The following code applies function f to each element of ...
4
votes
1answer
154 views

How to handle listings, fancyvrb, newfloat and caption?

I am planning a "small thesis" for university which will need to display lots of code (C, C++, gnuplot, LaTeX, ...) - thus I spent this evening reading about listings and fancyvrb. The latter I've ...
4
votes
1answer
44 views

fancyvrb: multiple actives

this works great---well, I stole it right out of the docs: { \catcode`!=\active \begin{Verbatim}[defineactive=\def!{\color{red}\bf}] black ! red black \end{Verbatim} } now I would ...
4
votes
1answer
57 views

Alternative commandchars in fancyvrb

In my Verbatim I need to specify colour for my code. In this answer (fancyvrb alternate commandchars and \textcolor) the solution is to put this code in the preamble: ...
4
votes
2answers
240 views

Integrating listings with fancyvrb

I am trying to use fancyvrb with listings and I get an error saying l.2 ...{Verbatim}[formatcom={\lstset{style=Java}}] Package Listings Error: language java undefined. ...
4
votes
1answer
206 views

How to wrap floated minted listing in my own environment?

Here's what I'd like to do: \begin{code}{c}{Hello World in C}% I would prefer the caption to be optional #include <stdio.h> int main(void) { printf("Hello, world!\n"); return 0; } ...
4
votes
1answer
166 views

fancyvrb and multicols together

I am using fancyvrb to list code in a multicols situation. I number the code using: \begin{Verbatim}[numbers=left] When the code is in the left column, this is good, but not when it is in the right ...
4
votes
1answer
160 views

Tikz + Verbatim + Sphinx , output drawn twice with slight offset. Works great Tikz + Verbatim

I'm working on a piece of software that outputs IPython Notebooks as tex documents. One of my requirements is to be able to draw code input output blocks that look like the Notebook's UI. ...
3
votes
1answer
2k views

fancyvrb alternate commandchars and \textcolor

The following works: \documentclass{article} \usepackage{fancyvrb} \usepackage{color} \begin{document} \begin{Verbatim}[commandchars=\\\{\}] test\textcolor{red}{foo}test \end{Verbatim} ...
3
votes
1answer
402 views

fancyvrb, helvetica and underscore… is it just me?

Ran into some weirdness with fancyvrb, helvetica and _. Here's a MWE (for me): \documentclass{article} \usepackage{fancyvrb} \begin{document} \begin{Verbatim}[fontfamily=helvetica] Oh no! It's a ...
3
votes
2answers
626 views

Reduce space between Sinput and Soutput

I'm using Sweave in the book document class, and I'm getting really huge spacing between Sinput and Soutput evironments. \documentclass[11pt]{book} \usepackage{Sweave} \usepackage{boxedminipage} ...
3
votes
2answers
131 views

Babel spanish option and fancyvrb incompatibility

The following MWE compiles without problems \documentclass{article} \usepackage[english]{babel} \usepackage{amsmath} \usepackage{fancyvrb} \begin{document} \SaveVerb{x>y}|x > y| ...
3
votes
1answer
430 views

how to use fancyvrb Verbatim in tabularx?

When using tabular and p it is possible to insert Verbatim block in a table using minipage \documentclass[]{article}% \usepackage{fancyvrb} \begin{document} \begin{tabular}{|p{2in}|p{3in}|} ...
3
votes
1answer
726 views

Using same font for \texttt and \Verb

I would like to configure my document to use exactly the same font for \texttt and \Verb. I got as far as this, which still misses making \ttdefault smaller: \documentclass{article} ...
3
votes
1answer
985 views

New command using inline verbatim

I would like to define a command using verbatim like in the commented line in the following code. \documentclass{article} \usepackage{amsmath,amsfonts,amssymb} % ...
3
votes
1answer
187 views

Block element characters (pmboxdraw) are shown too wide in verbatim and Verbatim (fancyvrb) environments

I want to put source code into verbatim and Verbatim (fancyvrb) environments that uses box-drawing characters from codepage 850 (0xDB, 0xDC, 0xDF) (see http://en.wikipedia.org/wiki/Code_page_850). By ...
3
votes
1answer
669 views

Using math mode escapes with listings enabled fancyvrb

I am trying to escape math mode within Verbatim, using this answer. This works fine, until I use the listings package with fancyvrb=true \documentclass{article} \usepackage{fancyvrb} ...
3
votes
1answer
317 views

How to set the Top Margin for a custom Verbatim environment (fancyvrb)

From the fancyvrb documentation, it looks like I can set left and right margins (paragraph 4.1.13) only. How can I set the top margin for my environment? More specifically, given that I have a frame ...