1

I've found some examples on how to use the fancyvrb package inside a \newenvironment command. But they don't quite cover what I want to do. Here is the code I tried to make work:

\newenvironment{example}
{\VerbatimEnvironment
\begin{BVerbatim}[fontsize=\tiny]}
{\end{BVerbatim}}

\newenvironment{Example}
{\begin{mdframed}[...]\begin{center}\begin{example}}
{\end{example}\end{center}\end{mdframed}}

So I want a BVerbatim environment inside a centered frame. The example environment works fine but it can't get the centered frame part to work. The error I get is:

File ended while scanning use of \FancyVerbGetLine.

1 Answer 1

2

You have to declare also Example as verbatim:

\documentclass{article}
\usepackage{fancyvrb,mdframed}

\newenvironment{example}
{\VerbatimEnvironment
\begin{BVerbatim}[fontsize=\tiny]}
{\end{BVerbatim}}

\newenvironment{Example}
{\VerbatimEnvironment\begin{mdframed}\begin{center}\begin{example}}
{\end{example}\end{center}\end{mdframed}}

\begin{document}

\begin{example}
Something
here
\end{example}

\begin{Example}
Something
here
\end{Example}

\end{document}

enter image description here

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .