1

I am writing my Master thesis in Latex (Texstudio). I need to draw a lot of molecules and want to number them throughout the whole thesis. For some strange reason, the package chemnum isn't working. The commands are highlighted in red when I compile the file and the output isn't the right one.

enter image description here

I really need that package. I have even checked the chemnum.cwl in the autocompletion list in the settings to get recognized in every document but that doesn't help either.

\documentclass[12 pt,a4 paper,oneside,openright,titlepage]{book}
%\usepackage{mathptmx} se vuoi usare times new roman
\usepackage{graphicx}
\usepackage{longtable,booktabs}
\usepackage[hyphens,spaces]{url}
\usepackage{chemnum}
\usepackage{chemscheme,chemfig,chemformula,epstopdf}
\usepackage{upgreek} 
\usepackage{chemmacros} 
\usepackage{textgreek} 
\chemsetup{greek=textgreek} 

\begin{document}
The first-line therapy for drug-susceptible TB consists in two months of isoniazid \refcmpd{isoniazid}, rifampicin \refcmpd{rifampicin}, pyrazinamide \refcmpd{pyrazinamide} , and ethambutol \refcmpd{ethambutol} following with four months of rifampicin and isoniazid (2HRZE/4HR).(figure \ref{first-line})
\begin{figure}[ht]
    \centering
    \replacecmpd[TMP1]{isoniazid}
    \replacecmpd[TMP2]{rifampicin}
    \replacecmpd[TMP3]{pyrazinamide}
    \replacecmpd[TMP4]{ethambutol}
    \includegraphics[scale=0.8]{first-line-treatment}
    \caption{First-line drugs}
    \label{first-line}
\end{figure}
\end{document}

Link to the eps file https://www.dropbox.com/s/ordl0cjj2z004h4/first-line-treatment.eps?dl=0

Output of the figure 1.1 enter image description here

  • Welcome to TeX.SE! Have you installed chemnum correctly (i.e. you can use it in other document)? Does it throw an error when you load it without using it? Have you loaded chemnum in your preamble? – JouleV Mar 24 at 16:41
  • 1
    Does it throw errors like "chemnum.sty not found"? – JouleV Mar 24 at 16:43
  • 2
    it is impossible to debug a screenshot, please show a small test file and show the exact error message that you get in the log file. – David Carlisle Mar 24 at 17:20
  • 1
    @Sebastiano crepi – Vittoria Nanna Mar 25 at 10:36
  • 1
    Vittoria Thanks for file & update that allows us to do a test run as if on your setup. I confirm that having placed eps in the same folder as the mwe & removing the folder/name It runs well. That is on first pass there are ?? but change on second pass to read as 1 2 3 4 the unresolved item is the last one \cite but thats understandable with just a snippet So If you have that part working the remaining issue is 1st Are you getting TWO successful runs so as to resolve cross-refs. Subfolders can interfere with processing refs (that is why to avoid). Try with eps bib & tex in fresh folder (NO aux) – KJO Mar 25 at 12:18

Your Answer

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

Browse other questions tagged or ask your own question.