Generalfancyvrb, dash and commandchars= option cause trouble

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
mssm
Posts: 4
Joined: Thu Aug 19, 2010 7:46 pm

fancyvrb, dash and commandchars= option cause trouble

Post by mssm »

Using the Verbatim environment provided by the fancyvrb package, the following code will not compile for me:

Code: Select all

\documentclass[a4paper,12pt]{article}
\usepackage{fancyvrb}
\begin{document}
\begin{figure}
\begin{Verbatim}[commandchars=\\\{\},frame=single,numbers=left,label={Sample input}]
%POSITION 385-472 \label{vrb:mdconstr-pos}
\end{Verbatim}
\label{fig:input}
\end{figure}
\end{document}
The issue clearly is '%POSITION 385-472' in conjuction with the 'commandchars=\\\{\}' option.

Does anyone have an idea what is going wrong there?


EDIT: I was mistaken, the issue is not with the the code itself I want to have displayed, but with the label; it seems like the Verbatim environment freaks out if there is a dash in the label itself. Changing it to '\label{vrb:mdconstr_pos}' makes it compile.
This is a bit odd, if you ask me...

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

Post Reply