First, there seems to be some trouble with the \bgroup
/ \egroup
pairs. For reasons I cannot see in the moment, they behave differently in the verbatim context. After replacing them by {
and }
, there is a 'normal' error which is resolved by replacing \begin{tcblisting}
and \end{tcblisting}
by the corresponding macros. The following compiles:
\documentclass{beamer}
\usepackage[most]{tcolorbox}
\newenvironment{VList}
{\tcblisting{
enhanced,oversize,lower separated=false,
colframe=red!50!black,colback=yellow!10!white,
interior style={top color=yellow!5!white,bottom color=yellow!20!white},
listing side comment,sidebyside gap=5mm,
listing options={style=tcblatex,texcsstyle=*\color{red!70!black}}%
}
}{%
\endtcblisting%
}
\begin{document}
\begin{frame}[fragile]{Sample GNUPLOT code}{A {\tt gnuplot} and \LaTeX{} combo}
Start {\tt gnuplot}, and write the following codes:
\begin{VList}
set term tikz color solid size 4in,3in
set output "sin.tex"
set xr [-2*pi:2*pi]
plot sin(x) with lines
exit
\end{VList}
\end{frame}
\end{document}
But, I would recommend to use the environment generation procedure using \newtcblisting
which handles everything:
\documentclass{beamer}
\usepackage[most]{tcolorbox}
\newtcblisting{VList}{
enhanced,oversize,lower separated=false,
colframe=red!50!black,colback=yellow!10!white,
interior style={top color=yellow!5!white,bottom color=yellow!20!white},
listing side comment,sidebyside gap=5mm,
listing options={style=tcblatex,texcsstyle=*\color{red!70!black}}%
}
\begin{document}
\begin{frame}[fragile]{Sample GNUPLOT code}{A {\tt gnuplot} and \LaTeX{} combo}
Start {\tt gnuplot}, and write the following codes:
\begin{VList}
set term tikz color solid size 4in,3in
set output "sin.tex"
set xr [-2*pi:2*pi]
plot sin(x) with lines
exit
\end{VList}
\end{frame}
\end{document}
\bgroup
and\egroup
in that context.