パッケージ listofsymbols に \cdots コマンドを認識させることは可能ですか?

パッケージ listofsymbols に \cdots コマンドを認識させることは可能ですか?

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\alphapdflatex

誰かこの問題を解決するのを手伝ってくれませんか。どんな助けでも大歓迎です。

答え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}

ここに画像の説明を入力してください

関連情報