
我正在使用該chemscheme
包,為了替換文件中這些方案中的編號,我需要使用 Latex 編譯這些 eps 文件,然後使用 dvips,最後使用 ps2pdf。
然而,我有大量的圖像(最多 100 個,而且只會增加),這些圖像非常適合用作它們所在的 png 或預編譯的 pdf 文件。由於我需要 Latex 編譯來進行chemscheme
編號,因此所有這些 png 或 pdf 圖像都需要採用 eps 形式,這會增加 2-3 分鐘的編譯時間。
對於這種情況有什麼解決辦法嗎?
我在這裡閱讀了一些關於像standalone
和 之類的包的解決方案externalize
,但我承認沒有完全理解如何應用這些解決方案,或者它們是否適用於這種情況。
我想我應該補充一點,如果沒有這些額外的圖像,我的乳膠文件編譯時間約為 30 秒,有了圖像,現在編譯時間幾乎為 4 分鐘:(
以下是該套件如何運作的範例chemscheme
(它作為套件的一部分包含在內chemstyle
。檔案「reaction.eps」可以在以下連結下載。zip 檔案還包括 png 的外觀,如果您只在它是自己的(那些TMP 標籤在轉換過程中被替換),\CNlabel
並且\CNlabelsub
它們散佈在整個文件中,並且它們增加與用於替換TMP
圖像中的標籤的複合編號相關的計數器TMP
。並且可以在外部編譯而不會出現問題,latex
必須在呼叫之前執行兩次dvips
。
eps 和 pdf 檔: http://www.filedropper.com/reaction_1
\documentclass{article}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage{bpchem}
\usepackage[tracking=bpchem]{chemstyle}
\begin{document}
I am a document about methanol (\CNlabelsub{alcohol}{Me}), and the related alcohol isoamyl %
alcohol (\CNlabelsub{alcohol}{isoamy}). \CNlabelsub{alcohol}{Me} can be converted to an alkyl %
halide with \BPChem{HCl} to give chloromethane (\CNlabel{MeCl}, \ref{sch:reaction}).
\begin{scheme}
\caption{I am a scheme}\label{sch:reaction}
\schemerefsub{alcohol}{Me}
\schemerefsub{alcohol}{isoamy}
\schemeref{MeCl}
\includegraphics{reaction}
\end{scheme}
\end{document}
更新,可能的解決方案,但尚未完成
從垃圾收集器的回答來看,我確實想到了這一點。我可以使用命令\CNlabelnoref
和提供文件中所有化合物的預製清單\CNlabelsubnoref
。我已經做到了,以下是使用獨立包的 MWE。但是,我現在收到一個錯誤,從該行開始的整個錯誤列表\begin{figure}
,第一個是
LaTeX 錯誤:出了點問題-可能缺少 \item。
\documentclass[border=0pt]{standalone}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage{bpchem}
\usepackage[journal=rsc,tracking=bpchem]{chemstyle}
\renewcommand*{\schemerefformat}{\small\fontfamily{cmr}}
\newcommand{\chemdrawgraphic}[1]{\includegraphics[scale=1]{#1}}
\setcounter{BPCno}{200}
\CNlabelsubnoref{alcohol}{Me}
\CNlabelsubnoref{alcohol}{isoamy}
\CNlabelnoref{MeCl}
\begin{document}
\begin{figure}
\schemerefsub{alcohol}{Me}
\schemerefsub{alcohol}{isoamy}
\schemeref{MeCl}
\chemdrawgraphic{reaction}
\end{figure}
\end{document}
答案1
編譯每個diagram.tex
檔案以latex-dvips-pspdf
獲得diagram.pdf
.
% diagram.tex
\documentclass[border=0pt]{standalone}
\usepackage{chemscheme}
\begin{document}
% do your drawing
\end{document}
從主輸入檔中,匯入 .pngdiagram.pdf
和其他 PNG、JPG、PDF 影像\includegraphics
。編譯主輸入檔pdflatex
。
答案2
您可以在使用時替換臨時文字持有者pdfLatex
。例如,請參閱這個問題:Chemnum/PS-Frag 與 EPS 檔案和 PNG 文件
據我所知,原則上,當涉及到文字和方案或圖中的化合物編號時,chemscheme
做chemnum
同樣的事情,所以上述問題中所說的內容也應該適用於您的情況。
我已經使用pdfLatex
eps 和 png 圖形有一段時間了,如果你不大幅改變字體大小,它工作得很好。
這裡我來自上面的連結的 MWE,但是 - 使用chemnum
:
\documentclass[a4paper]{article}
\usepackage[T1]{fontenc} % Modern font encoding
%\usepackage{pstool}
\usepackage{psfrag}
\usepackage[crop=off]{auto-pst-pdf} % Use EPS graphics with pdfLaTeX
\usepackage{booktabs} % Better table layouts
\usepackage[journal=rsc]{chemstyle} % Of course!
\usepackage{geometry} % Easy page layout
\usepackage{lmodern} % Use Latin Modern fonts
\usepackage[version=3]{mhchem} % Formula subscripts using \ce{}
\usepackage{xkeyval}
\usepackage{pst-pdf}
\usepackage{ifplatform}
\begin{document}
Test Test
\begin{figure} %% eps
\centering
\psfrag{goldhydrid}{test}
\includegraphics[scale=1.0]{./someeps}
\caption{A Caption}
\label{fig:someeps}
\end{figure}
\begin{figure} %% pngfile
\centering
\psfrag{goldhydrid}{test}
\includegraphics[scale=1.0]{./pngfile}
\caption{A Caption}
\label{fig:pngfile}
\end{figure}
\end{document}