
私はこれを試しています:
\documentclass{article}
\usepackage{fancyvrb}
\fvset{commandchars=\|}
\begin{document}
\begin{Verbatim}
Hello, |\textbf{world}|!
\end{Verbatim}
\end{document}
しかし、私はこれを受け取っています:
! Improper alphabetic constant.
<to be read again>
\relax
l.5 \begin{Verbatim}
エスケープ内に任意の TeX 構文を配置できる必要があります|...|
。これを行う正しい方法は何ですか?
答え1
キーcommandchars
には値として 3 つのトークンが必要です。最初のトークンはエスケープ文字を示し、他の 2 つは引数の開始と終了の区切り文字を示します。
\documentclass{article}
\usepackage{fancyvrb}
\fvset{commandchars=\|\{\}}
\begin{document}
\begin{Verbatim}
Hello, |textit{world}!
\end{Verbatim}
\end{document}
before と afterは使用せず|
、バックスラッシュを置き換えることに注意してください。
私の知る限り、または にescapeinside
はそのような機能はありません。fancyvrb
fvextra