![围绕铸造或评论环境的命令](https://linux22.com/image/461078/%E5%9B%B4%E7%BB%95%E9%93%B8%E9%80%A0%E6%88%96%E8%AF%84%E8%AE%BA%E7%8E%AF%E5%A2%83%E7%9A%84%E5%91%BD%E4%BB%A4.png)
我试图在自定义宏中操作铸造代码,但是出现了错误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}
有没有办法让铸造和评论环境作为宏的参数?