I would like to define an environment that puts verbatim text using the spverbatim
package into a frame defined by the mdframed
package. Here's my (naive) approach:
\documentclass{scrreprt}
\usepackage{mdframed}
\usepackage{spverbatim}
\usepackage{color}
\definecolor{lightblue}{RGB}{240,248,255}
\newmdenv
[
backgroundcolor=lightblue,
hidealllines=true,
frametitlerule=false,
frametitle=,
]{notesx}
\newenvironment{notes}
{\begin{notesx}\begin{spverbatim}}
{\end{spverbatim}\end{notesx}}
\begin{document}
% works
\begin{notesx}
\begin{spverbatim}
Test 1
Test 2
\end{spverbatim}
\end{notesx}
% does not work
\begin{notes}
Test 1
Test 2
\end{notes}
\end{document}
When using the defined environment notes
I get the following error:
Runaway argument?
\end{document}
! File ended while scanning use of \@xverbatim.
Using the environment notesx
with added spverbatim
environment works fine.
EDIT:
Using surroundwithmdframed
works but when setting this for a custom defined environment \newenvironment{notes}{\begin{spverbatim}}{\end{spverbatim}}
instead of spverbatim
to have a nicer name it does not work: ! File ended while scanning use of \@xverbatim.
spverbatim
is likeverbatim
and wants to “see” the string\end{spverbatim}
for being able to end. – egreg Sep 1 '14 at 11:22surroundwithmdframed
works but when setting this for a custom defined environment\newenvironment{notes}{\begin{spverbatim}}{\end{spverbatim}}
instead ofspverbatim
to have a nicer name it does not work:! File ended while scanning use of \@xverbatim.
@egreg What would be a possible solution for this issue? – problemzebra Sep 1 '14 at 11:28