listofsymbols
パッケージを使用して、本内のシンボル リストに含まれるシンボルを定義しようとしています。 コマンドを使用して\newsym
、 コマンドを含むシンボルを定義するときに問題が発生します\cdots
。
以下は、問題を説明する簡単なシンボル定義です。
\opensymdef
\newsym[A family of sets]{sFam}{A_{1},\cdots,A_{n}}
\closesymdef
シンボル ファイルを含むドキュメントをコンパイルすると、pdflatex
次のエラー メッセージが発行されます。
Undefined control sequence.
Undefined control sequence.
Undefined control sequence.
Undefined control sequence.
Undefined control sequence.
エラーの説明は次のとおりです。
... family of sets]{sFam}{A_{1},\cdots,A_{n}}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
上記のシンボル定義で、が などの文字列または などのコマンド\cdots
に置き換えられた場合、ドキュメントはコンパイルされます。xxxx
\alpha
pdflatex
誰かこの問題を解決するのを手伝ってくれませんか。どんな助けでも大歓迎です。
答え1
エラーはlistofsymbols
を使用するパッケージにありますが\immediate\write
、これが間違っており、問題の原因となっています。
新しいシンボルのリストの後にロードすることamsmath
は、他のコマンドが影響を受ける可能性があるため、実際には解決策ではありません。たとえば、\sqrt
どのような順序で使用しても、は機能しません。
より良いとは、次のように定義されるように\immediate\write
なることである。\protected@iwrite
私の答えの一つ。
\documentclass{article}
\usepackage{listofsymbols}
\usepackage{amsmath}
\usepackage{xpatch}
\makeatletter
% get a copy of \protected@write
\let\protected@iwrite\protected@write
% patch the copy to add \immediate
\xpatchcmd{\protected@iwrite}{\write}{\immediate\write}{}{}
% patch \addsymline to use \protected@iwrite instead of \immediate\write
\xpatchcmd{\addsymline}
{\immediate\write#5}
{\protected@iwrite{#5}{}}
{}{}
\makeatother
\opensymdef
\newsym[A family of sets]{sFam}{A_{1},\cdots,A_{n}}
\closesymdef
\begin{document}
\listofsymbols
test The symbol \sFam means \sFamdoc
\end{document}
この再定義により、一部のシンボルが依然として問題を引き起こす可能性があります。この場合は、\protect
問題のあるシンボルの前に を追加します。
ちなみに、\cdots
この文脈では を使用せず、単に を使用します\dots
。カンマ間の省略記号は常に低いドットを使用する必要があります。
答え2
アップデート
エグレが言うようにhis comment
これは単なる部分的な解決策です。
質問へのコメントでは、問題はパッケージをこの簡単なドキュメントamsmath
と一緒に使用することに限定されています。listofsymbols
\documentclass{article}
\usepackage[draft]{listofsymbols}
\usepackage{amsmath}
\opensymdef
\newsym[A family of sets]{sFam}{A_{1},\cdots,A_{n}}
\closesymdef
\begin{document}
test The symbol \sFam means \sFamdoc
\end{document}
エラーメッセージが表示される
! Undefined control sequence.
\DN@ ->\def \next@
l.6 ...A family of sets]{sFam}{A_{1},\cdots,A_{n}}
?
この問題はロードすることで解決できますamsmath
後シンボルのすべての定義は次のようになります。
\documentclass{article}
\usepackage[draft]{listofsymbols}
\opensymdef
\newsym[A family of sets]{sFam}{A_{1},\cdots,A_{n}}
\closesymdef
\usepackage{amsmath}
\begin{document}
test The symbol \sFam means \sFamdoc
\end{document}