我试图在自定义宏中操作铸造代码,但是出现了错误File ended while scanning use of \FancyVerbGetLine
。注释也发生了类似的事情,我怀疑原因也类似(尽管它们对我来说不那么重要)。
这是一个最小(非)工作示例
\documentclass{article}
\usepackage{minted}
\usepackage{xparse}
\usepackage{comment}
\NewDocumentCommand{\mytestCmd}{+m}{% a trivial command
#1}
\newenvironment{mytestEnv}{}{} % a trivial environment
\begin{document}
\mytestCmd % commenting this removes the error
{
\begin{minted}{py}
u = rand()
\end{minted}
}
\mytestCmd % commenting this removes the error
{
\begin{comment}
My comment
\end{comment}
}
\begin{mytestEnv} % Environments work without issue, but not macros
\begin{minted}{py}
u = rand()
\end{minted}
\begin{comment}
My comment
\end{comment}
\end{mytestEnv}
\end{document}
有没有办法让铸造和评论环境作为宏的参数?