I'm trying to use adjustbox to make a frame around listings (I know that listings itself can do this, but its implementation produces sub-optimal results when the line heights are not equal throughout the code). Here is what I tried:
\documentclass{article}
\usepackage{listings}
\usepackage{adjustbox}
% sanity checking: the following line works
%\lstnewenvironment{listing}{}{}
% the following line is what I'd like to do
\lstnewenvironment{listing}{\begin{adjustbox}{left,trim=0 0 0 2pt,fbox}}{\end{adjustbox}}
\begin{document}
\begin{listing}
this is
some
test
code
\end{listing}
\end{document}
I tried defining a new listings environment that uses adjustbox to put a frame around the listing. However, this does not compile, but just hangs on running pdflatex:
* % I just pressed enter here
(Please type a command or say `\end')
*\end % typing \end does not work either ;)
*\end
*
(Please type a command or say `\end')
In Texmaker, pdflatex is a bit more chatty: "Emergency stop. <> test.tex (job aborted, no legal \end found)"
