Chemnum は EPS ファイル内の TMP マーカーを置き換えません

Chemnum は EPS ファイル内の TMP マーカーを置き換えません

私はラテックスは初めてですが、論文(もちろん化学)を書くのにぜひ使いたいと思っています。実験はほぼ終わりましたが、今のところはハードルが低いようです :D

現在、chemnum パッケージを使用して、すべての化合物に適切なラベルを付けようとしています。理論的には、chemdraw ソフトウェアによって作成された外部 eps ファイルで提供される "TMP" マーカーを自動番号付けに置き換える必要があります。ただし、TeXstudio を使用してサンプル ファイルを実行することすらできません。

https://de.overleaf.com/latex/templates/automatically-numbering-compounds-in-chemical-schemes/kybckmsxnshs

私の場合、マーカーは置き換えられず、代わりに 6 つの例示化合物すべての下に「TMP1」または「TMP2」というテキストが書かれています。また、画像内のフォントは、上記のモデル PDF とは違っています。

何が間違っているのでしょうか? ついでに、TMP ラベルを自分で作成するにはどうすればいいでしょうか? Chemdraw でテキスト ブロックとして「TMP」と書くだけで大丈夫ですか?

前もって感謝します!

答え1

そこで、追加の手がかりが得られました。それはコンパイル設定に関係している可能性があります。

前述のように、コンパイルは Overleaf texmaker を使用してオンラインで機能します。Overleaf は LaTeX コンパイルを使用しますが、pdflatex に変更すると TMP マーカーの再プレートに失敗しますが、図は正しく表示されます。私の設定では、すでに図の描画に失敗しています (下のスクリーンショットを参照してください。ランダムな部分が欠落/移動し、フォントが変更されていることに注意してください)。

auto-pst-pdf コマンドを使用すると、画像はまったく表示されません。

enter\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{graphicx}
\title{Automatically numbering compounds in chemical schemes}
%% Uncomment these lines if you get error about "too many \new..." 
% \let\tmp\newinsert
% \let\newinsert\newbox
\usepackage{chemstyle}
% \let\newinsert\tmp
\usepackage{chemnum}
% For positioning the scheme captions at the top.
\floatsetup[scheme]{position=top}

\begin{document}
\begin{scheme}
%% hexa.eps has "TMP1" and "TMP2" as the markers
%% in fact EVERY .eps should start with TMP1, TMP2 etc
%% for ease of use \replacecmpd{first:compound}  
%% automatically replace TMP1
\replacecmpd{DSV}  %% automatically replace TMP2
\includegraphics[width=\linewidth]{Picture}
\caption{This is something!}
\label{first:chem:scheme}
\end{scheme}
Compounds \refcmpd{first:compound} and \refcmpd{DSV} in \ref{first:chem:scheme}. Here's a reference to in-text creation of \cmpd{RareCompound} that we can later refer to.
\vfill
\end{document}

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

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

答え2

あなたが説明している問題は、pdfLatex / chemnum / Texstudio / ChemDraw の組み合わせでよく発生する問題です。化合物の番号付けは、化学論文では非常に強力であることは明らかです。

私の回答は同様の質問への回答に基づいています。以下を参照してください。番号付け/ChemDraw/MacEPS/ChemDraw/chemnumTexstudioの設定を修正する

以下に、最も一般的なエラーの原因をリストします。

  1. コンパイル: pdflatex -synctex=1 -interaction=nonstopmode --shell-escape %.texTexStudioで使用する必要があります

  2. Texstudio PATH: オペレーティング システムに応じて、PATH を次のように設定します/usr/local/texlive/2019/bin/x86_64-darwin:/Library/TeX/texbin(OS に応じて調整する必要があります)。

  3. \usepackage[crop=off,runs=2]{auto-pst-pdf}Auto-pst-pdf:プリアンブルの早い段階で読み込む必要があります。

  4. EPS: テキスト文字列が明確に定義されるように作成する必要があります。Windows の ChemDraw では問題なく動作しますが (エクスポートの標準パラメータ)、Mac の ChemDraw では動作しません。これはバグであり、以前の質問調べてみました。MWE をコンパイルできたので、問題ないと思います。

以前のジョブ名コメントについては知りません。TexStudio では必要ありませんでしたが、Overleaf では必要になるかもしれません。

この例は、TexStudio v3 を使用して上記の設定で動作しました。

\documentclass{article}
%\def\jobname{main} %<-- your file name
\usepackage[
runs=2,
crop=off
]{auto-pst-pdf} 
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{graphicx}

\title{Automatically numbering compounds in chemical schemes}


%% Uncomment these lines if you get error about "too many \new..." 
% \let\tmp\newinsert
% \let\newinsert\newbox
\usepackage{chemstyle}
% \let\newinsert\tmp
\usepackage{chemnum}

% For positioning the scheme captions at the top.
%\floatsetup[scheme]{position=top}

    \begin{document}
    
    \begin{scheme}
    %% hexa.eps has "TMP1" and "TMP2" as the markers
    %% in fact EVERY .eps should start with TMP1, TMP2 etc
    %% for ease of use
    \replacecmpd{first:compound}  %% automatically replace TMP1
    \replacecmpd{second:compound}  %% automatically replace TMP2
    \includegraphics[width=\linewidth]{hexa}
    \caption{This is something!}
    \label{first:chem:scheme}
    \end{scheme}
    
    Compounds \refcmpd{first:compound} and \refcmpd{second:compound} in \ref{first:chem:scheme}. Here's a reference to in-text creation of  \cmpd{RareCompound} that we can later refer to.
    
    \vfill
    
    \begin{scheme}
    \replacecmpd{next:compound} %% automatically replace TMP1 BUT the autonumbering counter updates to 3!
    \replacecmpd{last:compound} %% automatically replace TMP2
    \includegraphics[width=\linewidth]{hexa}
    \caption{This is something else!}
    \label{second:chem:scheme}
    \end{scheme}
    
    Compounds \refcmpd{next:compound} and \refcmpd{last:compound} in \ref{second:chem:scheme}. Hey remember \cmpd{RareCompound}? \texttt{chemnum} still remembers it correctly, \emph{and} see how the compound numbering continues throughout the scheme diagrams!
    
    \vfill
    
    %% MANUAL UPDATING THE COMPOUND COUNTER; make sure you know what you're doing!
    \setcounter{cmpdmain}{8} 
    
    \begin{scheme}
    \replacecmpd{jumped:compound} %% automatically replace TMP1 BUT the autonumbering counter updates to 9!
    \replacecmpd{nextjumped:compound} %% automatically replace TMP2
    \includegraphics[width=\linewidth]{hexa}
    \caption{This is again something else!}
    \label{third:chem:scheme}
    \end{scheme}
    
    Compounds \refcmpd{jumped:compound} and \refcmpd{nextjumped:compound} in \ref{third:chem:scheme}. (Yes we manually modified the compound numbering counter after \ref{second:chem:scheme}).
    \end{document}

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

答え3

あなたの回答にコメントする資格はありません。それでもpdflatexをコンパイラとして使用したい場合は、Ulrike Fischerがここで行ったように、`\jobname´の名前を変更することをお勧めします。ここ

あなたが引用した Overleaf の例を使用し、名前を変更する行を追加する\jobnameと、{auto-pst-pdf}パッケージが機能します。

\documentclass{article}
\def\jobname{main} %<-- your file name
\usepackage[
%runs=2,
%crop=off
]{auto-pst-pdf} 
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{graphicx}

\title{Automatically numbering compounds in chemical schemes}


%% Uncomment these lines if you get error about "too many \new..." 
% \let\tmp\newinsert
% \let\newinsert\newbox
\usepackage{chemstyle}
% \let\newinsert\tmp
\usepackage{chemnum}

% For positioning the scheme captions at the top.
%\floatsetup[scheme]{position=top}

\begin{document}

\begin{scheme}
%% hexa.eps has "TMP1" and "TMP2" as the markers
%% in fact EVERY .eps should start with TMP1, TMP2 etc
%% for ease of use
\replacecmpd{first:compound}  %% automatically replace TMP1
\replacecmpd{second:compound}  %% automatically replace TMP2
\includegraphics[width=\linewidth]{hexa}
\caption{This is something!}
\label{first:chem:scheme}
\end{scheme}

Compounds \refcmpd{first:compound} and \refcmpd{second:compound} in \ref{first:chem:scheme}. Here's a reference to in-text creation of  \cmpd{RareCompound} that we can later refer to.

\vfill

\begin{scheme}
\replacecmpd{next:compound} %% automatically replace TMP1 BUT the autonumbering counter updates to 3!
\replacecmpd{last:compound} %% automatically replace TMP2
\includegraphics[width=\linewidth]{hexa}
\caption{This is something else!}
\label{second:chem:scheme}
\end{scheme}

Compounds \refcmpd{next:compound} and \refcmpd{last:compound} in \ref{second:chem:scheme}. Hey remember \cmpd{RareCompound}? \texttt{chemnum} still remembers it correctly, \emph{and} see how the compound numbering continues throughout the scheme diagrams!

\vfill

%% MANUAL UPDATING THE COMPOUND COUNTER; make sure you know what you're doing!
\setcounter{cmpdmain}{8} 

\begin{scheme}
\replacecmpd{jumped:compound} %% automatically replace TMP1 BUT the autonumbering counter updates to 9!
\replacecmpd{nextjumped:compound} %% automatically replace TMP2
\includegraphics[width=\linewidth]{hexa}
\caption{This is again something else!}
\label{third:chem:scheme}
\end{scheme}

Compounds \refcmpd{jumped:compound} and \refcmpd{nextjumped:compound} in \ref{third:chem:scheme}. (Yes we manually modified the compound numbering counter after \ref{second:chem:scheme}).
\end{document}

答え4

MacOS で Chemdraw を使用している場合は、この投稿を参照してください。 https://tex.stackexchange.com/a/687480/298255

このソリューションは Windows ユーザーにも役立つ可能性があります。

関連情報