
我是乳膠新手,但真的很想用它來寫我的論文(顯然是化學)。實驗室工作即將完成,但這似乎是目前較低的障礙:D
現在,我正在嘗試使用 chemnum 套件為所有化合物獲得漂亮的標籤。理論上,它應該用自動編號取代「TMP」標記(在 chemdraw 軟體建立的外部 eps 檔案中給出)。但是,我什至無法使用 TeXstudio 運行範例檔案:
就我而言,標記沒有被替換,而是在所有六個示例性化合物下寫入文字“TMP1”或“TMP2”。另外,圖片內的字體相對於上面的模型 pdf 來說是搞砸的。
我究竟做錯了什麼?當我們討論這個問題時:我該如何製作自己的 TMP 標籤?在 chemdraw 中將「TMP」寫為文字區塊可以嗎?
先致謝!
答案1
所以,我得到了一些額外的線索:這可能與編譯設定有關。
如前所述,編譯確實可以使用背頁 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/Mac,EPS/ChemDraw/chemnum,正確的 Textstudio 配置,
我將嘗試在下面列出最常見的錯誤來源:
編譯:需要
pdflatex -synctex=1 -interaction=nonstopmode --shell-escape %.tex
在TexStudio使用Texstudio PATH:根據您的作業系統,將您的 PATH 設定為類似的內容
/usr/local/texlive/2019/bin/x86_64-darwin:/Library/TeX/texbin
(您必須根據您的作業系統進行調整)。Auto-pst-pdf:您需要
\usepackage[crop=off,runs=2]{auto-pst-pdf}
在序言中儘早加載。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 作為編譯器,我建議重命名“\jobname”,就像 Ulrike Fischer 在這個答案中所做的那樣這裡。
使用您引用的背頁範例並添加行來重命名,\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 用戶也有幫助。