在 Mac 上的 ChemDraw eps 中,无法用 chemnum 替换临时标签

在 Mac 上的 ChemDraw eps 中,无法用 chemnum 替换临时标签

我尝试使用该软件包在 Mac OSX Mojave 上用 ChemDraw v18 制作的 .eps 文件中替换临时标签 TMP1、TMP2 和 TMP3 chemnum,以便对化合物进行自动编号,但这对我来说不起作用。

我尝试在 .eps 文件中为标签使用不同的字体或其他选项,但auto-pst-pdf没有结果。

最初在 TexLive 2014 for Mac 上出现的问题仍然存在于 Mac OSX 10.14 和 TexLive 2019 中,并使用pdflatex -synctex=1 -interaction=nonstopmode --shell-escape %.tex(我使用 TexStudio)进行编译。

对于以下 MWE 和以下eps 文件

\documentclass[a4paper,12pt]{article}
\usepackage{graphicx}
\usepackage[crop=off,runs=2]{auto-pst-pdf}
\usepackage{chemnum}
\usepackage{chemstyle}

\begin{document}

\begin{scheme}
    \replacecmpd[tag=TMP1]{cmpd:nucleophile1}
    \replacecmpd[tag=TMP2]{cmpd:nucleophile2}
    \replacecmpd[tag=TMP3]{cmpd:nucleophile3}
    \includegraphics[scale=0.8]{test_cmpd_numbering.eps}
    \caption[test]{A test to make the numbering work}
\end{scheme}

\end{document}

图片已正确插入,文件test_cmpd_numbering-pics.pdf已生成(这是之前的进展),但 TMP1、TMP2 等标签未被替换。以下是日志档案。它出现了错误“忽略非 PDF 特殊字符!”,这通常与 MacOSX 上的 PdfLaTex 问题有关。

有人知道为什么这段代码会在 Mac 上产生问题吗?

答案1

事实证明,有两个与此相关的问题。

  1. 需要更改 TexStudio 中的 PATH。此问题与.eps 文件和 pdflatex并按照说明重新配置 texstudio这里解决了,这里有一张图片来澄清: TexStudio 更改路径

  2. Mac 上的 ChemDraw 18 无法正确生成 .eps 文件,即无法正确定义文本。此问题已为人所知,并在Mac OSX 版 Chemdraw 16 无法使用 psfrag 和标签替换/自动编号 我的解决方案是在运行 ChemDraw 16 的 Windows 计算机上生成 .eps 文件...

两者的结合解决了上述 MWE 的问题。我编辑了上述问题,以更好地反映问题的本质。

答案2

问题是(与 Chemdraw 版本无关:我使用了 v16.0.0 和 v22.0.0)因为 MacOS 上的 Chemdraw 在创建 .eps 文件时出现错误,因此字符串不会出现在文本编辑器(又名:Ghostscript)上。我找到的解决方案是:

  1. 将裁剪的文件保存为 PDF(取消选中复选框:“分页”[v.22.0.0]。我在 v.16.0 上没有找到该选项)。
  2. 然后使用转换器将 File.pdf 转换为 File.eps。
  3. (可选)使用文本编辑器打开 .eps 文件,您将找到带有临时标记的脚本(例如:TMP1)。

我个人使用 Texmaker 作为编译器,因此如果你转到首选项,在“命令”部分下粘贴以下内容:pdflatex -synctex=1 -interaction=nonstopmode --shell-escape %.tex

还可以使用以下方法编译文件:PDF Latex 以查看 PDF,然后使用 Quick Build 再次编译以查看 PDF。

这是我的 LaTeX 代码:

\documentclass[11pt]{scrartcl}

\usepackage[T1]{fontenc}
\usepackage{epstopdf}
\usepackage[scaled=0.92]{helvet}
    \renewcommand\familydefault{\sfdefault}
\usepackage{titleps}
\usepackage{graphicx,auto-pst-pdf}
\renewcommand*\sectionformat{\thesection\autodot\hspace{1cm}}
\usepackage{amsmath}
\usepackage[ngerman]{babel}
\usepackage[a4paper,total={7in,10in}]{geometry}
\usepackage{siunitx}
\usepackage{hyphenat}
\usepackage{amssymb}
\usepackage{physics}
\usepackage{braket}
\usepackage{graphicx}


\usepackage[hidelinks]{hyperref}
\usepackage{tcolorbox}
\usepackage{titleps}
\usepackage{multicol}
\usepackage{multirow}
\usepackage{ghsystem}
\usepackage{pifont}
\usepackage{tabularx}
\usepackage{array}

\usepackage{chemstyle}
\usepackage{chemscheme}
\usepackage{chemschemex}
\usepackage{chemnum}



\setcounter{secnumdepth}{4}
\setcounter{tocdepth}{4}


\newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}}
\newtcolorbox{mybox}[3][]
{
  colframe = #2!50,
  colback  = #2!0,
  coltitle = #2!20!black,  
  title    = {#3},
  #1,
}

\newpagestyle{ruled}

{\sethead{}{}{ \sectiontitle}\headrule 
\setfoot{}{\thepage}{}\footrule}
\pagestyle{ruled}




\begin{document}
\section{TEST}


 \begin{scheme}[H]
   \replacecmpd{CompoundX}
     \replacecmpd{CompoundY}
      \centering
       \includegraphics[scale=1]{Filename.eps}
       \caption{Random Stuff you want to write here}
       \label{Your Label}
 \end{scheme}
 
Hier \cmpd{CompoundX} und \cmpd{CompundY}.
\end{document} 

附加信息:我使用 macOS Catalina v.10.15.7。我的 texmaker 版本是:5.1.3。

相关内容