如何在“Verbatim”环境中禁用“commandchars”?

如何在“Verbatim”环境中禁用“commandchars”?

如果我之前将其设置为全局选项,如何commandchars针对特定环境禁用它?我正在尝试这样做:Verbatim\fvset

\documentclass{article}
\usepackage{fancyvrb}
\fvset{commandchars=+\{\}}
\begin{document}
\begin{Verbatim}
Hello, +textbf{world}!
\end{Verbatim}
Now, I want to disable command chars:
\begin{Verbatim}[commandchars=]
Hello, +textbf{world}!
\end{Verbatim}
\end{document}

我越来越:

! Improper alphabetic constant.
<to be read again>
                   \relax
l.9 \begin{Verbatim}[commandchars=]

答案1

commandchars=none

\documentclass{article}
\usepackage{fancyvrb}
\fvset{commandchars=+\{\}}
\begin{document}
\begin{Verbatim}
    Hello, +textbf{world}!
\end{Verbatim}
Now, I want to disable command chars:
\begin{Verbatim}[commandchars=none]
    Hello, +textbf{world}!
\end{Verbatim}
\end{document}

在此处输入图片描述

相关内容