1

Pay attention to the first code that represents the numbering of molecules in a scheme that is imported into LaTeX from the ".eps" file and by the command

pdflatex -shell-escape file1.tex

runs without any problems.

\documentclass{book}

\usepackage{graphicx}       
\usepackage{hyperref}   
\usepackage{chemnum}
\usepackage{auto-pst-pdf}
\begin{document}

\begin{figure}
    \centering
    \replacecmpd{cmpd:1}
    \replacecmpd{cmpd:2}
    \replacecmpd{cmpd:3}
    \includegraphics[width=1\textwidth]{CyAZIDES.eps}
\end{figure}

\begin{figure}
    \centering
    \replacecmpd{cmpd:1}
    \replacecmpd{cmpd:2}
    \replacecmpd{cmpd:3}
    \replacecmpd{cmpd:4}
    \includegraphics[width=1\textwidth]{CyAZIDES2.eps}
\end{figure}
\end{document}

The second code that was created using xepersian and by command

xelatex --shell-escape file2.tex

has been created that does not replace numbers correctly.

\documentclass{book}

\usepackage{graphicx}       
\usepackage{hyperref}   
\usepackage{chemnum}
\usepackage{auto-pst-pdf}
\usepackage{xepersian}
\settextfont{Zar}

\begin{document}

\begin{figure}
    \centering
    \replacecmpd{cmpd:1}
    \replacecmpd{cmpd:2}
    \replacecmpd{cmpd:3}
    \includegraphics[width=1\textwidth]{CyAZIDES.eps}
\end{figure}

\begin{figure}
    \centering
    \replacecmpd{cmpd:1}
    \replacecmpd{cmpd:2}
    \replacecmpd{cmpd:3}
    \replacecmpd{cmpd:4}
    \includegraphics[width=1\textwidth]{CyAZIDES2.eps}
\end{figure}
\end{document}
3
  • please attach CyAZIDES2.eps and CyAZIDES.eps. – SH.Madadpour Dec 25 '19 at 19:43
  • Excuse me! would you help me how to upload "CyAZIDES.eps" and "CyAZIDES2.eps" files? – mohammad taqi jafari Dec 25 '19 at 20:07
  • Excuse me. I thought this site has this ability. You can send them to me if you want. (See my profile) – SH.Madadpour Dec 26 '19 at 10:30
0

The problem is not related to the xepersian package. I think (but I am not sure) this problem related to xelatex compiler (at least in texstudio for me). I saw this problem here and other place too. even without xepersian package you get this problem.
I find a trick for solve it. open 0-2.eps with notepad++ and change it as the below:

enter image description here So your codes will change to this structure:

\documentclass[a4paper]{scrreprt}
\usepackage{float}
\usepackage{graphicx}       
\usepackage{hyperref}   
\usepackage{chemnum}
\usepackage{auto-pst-pdf}
\usepackage[localise,Kashida,computeautoilg]{xepersian}
\settextfont[Scale=1.5]{XB Niloofar}
\setlatintextfont[Scale=4.4]{Times New Roman}
\begin{document}
    \begin{latin}\centering
        Test
    \end{latin}
    \begin{latin}
        \begin{figure}[H]
            \centering
            \includegraphics[width=1\textwidth]
        \end{figure}
        \begin{figure}[H]
            \includegraphics[width=1\textwidth]{0-2.eps}
        \end{figure}
    \end{latin}
\end{document}

Where your compiler set as the below:

xelatex.exe -synctex=1 -interaction=nonstopmode %.tex

Otput:

enter image description here Good luck.

1
  • It is a "tricky trick" for solving this problem! The aim of label replacement is dynamic numbering of chemical compounds in latex run-time. Otherwise, the numbering of these compounds in chemdraw is much more easier than this tricks. – mohammad taqi jafari Dec 27 '19 at 20:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.