I've been trying to get a generic environment for putting code listings going using adjustbox and minted. I've found a few examples where people got minted wrapped by an adjustbox where they seemed to have actually gotten it to compile. However, I have been scratching my head trying to get this to work for several hours and have about thrown in the towel on it.
For context, I'm using pdflatex on Windows with MiKTeX.
Here's somewhat of a Minimum ~Working~ Example (MWE), though I it doesn't work at all for me:
\documentclass{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[export]{adjustbox}
\usepackage{fancyvrb}
\usepackage{xcolor}
\usepackage{xstring}
\definecolor{CodeBlack}{RGB}{30, 30, 39}
\usepackage{minted}
\setminted{linenos, autogobble, bgcolor=CodeBlack, fontsize=\scriptsize, frame=single, framerule=0pt, tabsize=2, numbersep=3pt, style=inkpot}
\newenvironment{bothtest}[1]
{%
\VerbatimEnvironment
\begin{adjustbox}{fbox}%
\begin{minted}{#1}%
}
{%
\end{minted}%
\end{adjustbox}%
}
\begin{document}
Minted Test:
\begin{minted}{python}
lambda x: x
\end{minted}
Adjust box test:
\begin{adjustbox}{fbox}
lambda x: x
\end{adjustbox}
Adjust box minted test:
\begin{adjustbox}{fbox}
\begin{minted}{python}
lambda x: x
\end{minted}
\end{adjustbox}
\begin{bothtest}{python}
lambda x: x
\end{bothtest}
\end{document}
In the end, I'd like to have something more like
\newenvironment{bothtest}[3]
{%
\VerbatimEnvironment
\begin{adjustbox}{max width=\paperwidth, max height=40em, keepaspectratio, pagecenter=\paperwidth, vspace=0pt -3mm, label={lst:#1}, captionbelow={#3}, nofloat=listing}%
\begin{minted}{#2}%
}
{%
\end{minted}%
\end{adjustbox}%
}
as what I'm trying to accomplish is getting a code listing that expands beyond the normal margins of the main column of writing to the edges of the paper should it need to, along with being able to be linked to via a reference and has a nice caption to boot.
A few caveats, I'd prefer to continue to use pdflatex as my compiler for this and not switch over to something else like LuaLaTeX for example. I cannot install arbitrary software in the environment that I'm working in; I can, however, install arbitrary LaTeX packages. So perhaps if there is another package I'm not aware of that can solve my problem I could check that out.