I am following this QnA to create a renewed \inputminted command.
\documentclass{article}
\usepackage{minted} % code highlighting, uses python pygments
\usepackage{mdframed}
\usepackage{xcolor}
\definecolor{codebg}{rgb}{0.95,0.95,0.95}
\let\inputmintedorig\inputminted % copy original command [pack:minted]\inputminted to \inputmintedorig
\renewcommand{\inputminted}[3][]{% % change original \inputminted
\begin{mdframed}%
\inputmintedorig[#1]{#2}{#3}%
\end{mdframed}%
}
\begin{document}
\inputminted[bgcolor=codebg,mathescape,linenos,numbersep=5pt,gobble=2,frame=none,framesep=2mm,label=Some Code]{py}{pycode.py}
\end{document}
where pycode.py contains some arbitray Python code:
import numpy as np # importing library
ls = np.arange(0, 100, 1)
But I am getting error "Too deeply nested. ...framesep=2mm,label=Some Code]{py}{pycode.py}" when using the renewed command. What am I doing wrong?
\NewCommandCopyto copy the command instead. macros - Can I redefine a command to contain itself? - TeX - LaTeX Stack Exchange – user202729 May 20 '23 at 07:09