chemnum を使用して、別のカウンターを持つ新しい一時ラベルを定義するにはどうすればよいでしょうか?

chemnum を使用して、別のカウンターを持つ新しい一時ラベルを定義するにはどうすればよいでしょうか?

.epschemnum を使用して、ファイル内に異なるタイプの TMP ラベルを作成し、それをテキスト内で別のラベル/番号に置き換える方法はありますか?

たとえば、テキスト内に番号が付けられた多くのケムドロー (1、2、3...) がありますが、独自のカウンター (L1、L2、L3...) を持つリガンドに別のラベルを付けたいとします。

ありがとう

\documentclass{article}

\usepackage{graphicx}
\usepackage[crop=off]{auto-pst-pdf}
\usepackage{chemnum}
\setchemnum{init,log=verbose}

% regular labels
\initcmpd{1,2,3.a}

% ligands
\resetcmpd
\initcmpd[pre-label-code=\textbf{L}]{L1.a,L2,L3.a}

\begin{document}

\begin{center}
\cmpdref{compound1} %replaces TMP1
\cmpdref{compound2} %replaces TMP2
\includegraphics{scheme.eps}
\end{center}

Here are two compounds: \refcmpd{compound1} and \refcmpd{compound2}.

\begin{center}
\setchemnum{replace-tag=L}
\cmpdref[tag=L1]{ligand1} 
\includegraphics{ligand.eps}
\end{center}

Here is a ligand: \refcmpd{ligand1}

\end{document}

答え1

編集:

もう一度質問を読んでみると、あなたの質問はタグ置き換えたいが、ラベルのセットが違うのですか? おそらく、何を望んでいるのかを示す完全な MWE を投稿したほうがよいでしょう...

ただし、2 番目のラベル セットを定義する前にカウンターをリセットして を設定すると、2pre-label-codeセットのラベルを取得できます。(これは、EPS ファイルでのタグの置き換えとはまったく関係ありません。) ドキュメント内でこれを行う場合は、変更をローカルに保持するか、新しいラベルを定義した後で設定を元に戻すように注意する必要があります。次のようにプリアンブルで定義する方が簡単です。

\documentclass{article}

\usepackage{chemnum}
\setchemnum{init,log=verbose}

% regular labels
\initcmpd{1,2,3.a}

% ligands
\resetcmpd
\initcmpd[pre-label-code=\textbf{L}]{L1.a,L2,L3.a}

\begin{document}
Here are two compounds: \cmpd{1} and \cmpd{2}.

Here are two ligands: \cmpd{L1.a} and \cmpd{L2}.

Here we have \cmpd{1} and \cmpd{2} again.

And now \cmpd{3.a}. Again \cmpd{2} but then \cmpd{L3.a}.
\end{document}

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

元の回答:

chemnumは、このための手段を提供します。標準的な動作は、タグなどを置き換えることですTMP1TMP2番号付けはローカルです。つまり、\replacecmpdがグループ内 (通常は環境だと思います) で使用される場合TMP1、次の図では から再び開始されます。 (次の例では、v1.0 構文を使用していますchemnum。)

\documentclass{article}
\usepackage{graphicx,auto-pst-pdf,chemnum}
\begin{document}

\begin{center}
  \replacecmpd{compound1}% replaces TMP1
  \replacecmpd{compound2}% replaces TMP2
  \includegraphics{myscheme.eps}
\end{center}

\end{document}

これを変更する 1 つの方法は、ケースごとに変更することです。

\documentclass{article}
\usepackage{graphicx,auto-pst-pdf,chemnum}
\begin{document}

\begin{center}
  \replacecmpd[tag=L1]{compound1}% replaces L1
  \replacecmpd[tag=L2]{compound2}% replaces L2
  \includegraphics{myscheme.eps}
\end{center}

\end{document}

TMPただし、オプションを使用してタグの一部を変更することもできます。

\documentclass{article}
\usepackage{graphicx,auto-pst-pdf,chemnum}
\begin{document}

\begin{center}
  \setchemnum{replace-tag=L}
  \replacecmpd{compound1}% replaces L1
  \replacecmpd{compound2}% replaces L2
  \includegraphics{myscheme.eps}
\end{center}

\end{document}

関連情報