3

lately I've been having trouble with chemical equations in the reaction-environment. To be specific, neither reaction arrows nor hyphens are displayed after compiling the pdf. Instead, a blank space is inserted where the arrow/hyphen should be. Molecular formulas are depicted correctly, though. I'm using TeX Live with the TeXstudio editor, the installed version of my chemmacros-package is 5.8b. Note that upon changing \chemsetup{formula=chemformula} to \chemsetup{formula=mhchem} in the following MWE the reaction arrow as well as the hyphen between Ph and CHO get depicted correctly, so I figure there must be something wrong regarding the chemformula-package.

MWE:

\documentclass[a4paper,12pt]{scrreprt}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage[dvips]{graphics}
\usepackage{siunitx}

\usepackage{chemmacros}
\chemsetup{modules=all}
\chemsetup{formula=chemformula}

\begin{document}

    \begin{reaction*}
        2 H2 + O2 -> 2 H2O
    \end{reaction*}

    \begin{reaction*}
        Ph-CHO
    \end{reaction*}

\end{document}

Any ideas?

Kind regards,
shulgin

4

While I can't give you the details of what happens, I can tell you that this works fine if you remove the dvips option for graphics, or if you actually use latex + dvips + ps2pdf to generate the PDF. I assume you have been using pdflatex (?), so you've specified in the code one particular compilation sequence (involving dvips), but using a different one. This can cause various problems.

In general you shouldn't be specifying the driver (dvips in this case) for packages like graphics and hyperref, they figure out the correct one on their own. And you would probably want to load graphicx (with an x), most recent documentation use the syntax specified by that, and not the older graphics.

code output

\documentclass[a4paper,12pt]{scrreprt}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{graphicx}
\usepackage{siunitx}

\usepackage{chemmacros}
\chemsetup{modules=all}
\chemsetup{formula=chemformula}

\begin{document}

    \begin{reaction*}
        2 H2 + O2 -> 2 H2O
    \end{reaction*}

    \begin{reaction*}
        Ph-CHO
    \end{reaction*}

\end{document}
  • Awesome, that did the trick, thank you! I know there must have been a reason for me to specify [dvips] as the driver for the graphics package, although I haven't noticed anything unusual in my document after using graphicx without further options. Anyways, muchas gracias! – shulgin Sep 6 '17 at 15:11
0

It is possible to realize, also, your reaction with arrows displayed using \usepackage[version=4]{mhchem}. In fact you have with this MWE:

\documentclass[a4paper,12pt]{scrreprt}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{graphicx}
\usepackage{siunitx}
\usepackage[version=4]{mhchem}
\begin{document}
\[\ce{2 H2 + O2 -> 2 H2O}\]
\[\ce{Ph-CHO}\]

\end{document}

this output:

enter image description here

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.