I want to defne a macro environment that uses the listings
and tcolorbox
packages, something akin to this:
\documentclass{article}
\usepackage{tcolorbox}
\tcbuselibrary{listings}
\newenvironment{codeblock}[1]
{\begin{tcblisting}{title=#1}}
{\end{tcblisting}}
\begin{document}
\begin{codeblock}
code
\end{codeblock}
\end{document}
However, I get the following error message:
! File ended while scanning use of \next.
What do? I've tried searching around, but it seems to be a very general error message that has something to do with empty spaces in verbatim/listing environments.
I have tried implementing the code directly and it compiles. The error only arises when using the macro, and I'd much prefer using the macro considering I have a couple of hundred entries with the same formatting (not included for simplicity's sake).
\newtcblisting
in the tcolorbox documentation