3

I'm trying to reproduce the following equation using the chemfig package :

goal equation

I've been at this for a few hours, trying out different approaches but as soon as one thing works, something else seems to go wrong.

The main issue is either the brackets or the charges (or having something come after the brackets).

It doesn't need to be identical to the example. It just has to work and convey the same information.

Here are my best two attempts (there are probably errors, but it seems to partially work on Overleaf):

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{chemfig}
\usepackage[version=3]{mhchem}      


\begin{document}

2 \chemfig{R-C(-[:0]\chemabove{O}{-})=[:90]O}\chemabove{Na}{+}}
+
\chemfig{Ca^{2+}}(aq)
\ce{->}
\chemfig{{(}R-C(-[:0]O)=[:90]O}{)_2}Ca}(s)
+

\vspace{2cm}

\schemestart
\chemname{\chemfig{2 R-C(-[:0]\chemabove{O}{-})=[:90]O}\chemabove{Na}{+}}{}(aq)
\+
\chemfig{Ca^{2+}}(aq)
\arrow(.mid east--.mid west)
\chemname{\chemfig{{(}R-C(-[:0]O)=[:90]O}{)}Ca}
    {}(aq)
\+
\chemname{\chemfig{H_2O}}{}
\schemestop
\chemnameinit{}

\end{document}

Here's the output:

output

2
  • 1
    Welcome to TeX.SX! Is there a special reason for not simply using something like \documentclass{article} \usepackage[version=3]{mhchem} \begin{document} \ce{2 RCOO^-Na^+_{(aq)} + Ca^{2+}_{(aq)} -> (RCOO)_2Ca{(s)} + 2 Na^+} \end{document}?
    – leandriis
    Jul 2, 2019 at 18:07
  • I guess I wanted to highlight the double bond... I could always write it out RC(=O)O. It's a document for a class that's not very advanced, so I guess I didn't want to give them too much to figure out on their own. It's a good idea, though! Jul 2, 2019 at 20:29

1 Answer 1

6

The following code is a simplified and tweaked MWE that you've posted. In order to mimic sans font (likely Arial, as guidelines of ACS and most other publishers suggest) easier, I switched to XeLaTeX and enabled Fira (free alternative) typeface. Also, I use chemmacros package with all modules enabled as it offers many useful shortcuts, also for the states of aggregation (which, according to IUPAC, shouldn't be subscripts).

Screenshot

% !TEX program = xelatex

\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{mathtools}
\usepackage{fontspec}
    \setmainfont{Fira Sans}
\usepackage[math-style = ISO]{unicode-math}
    \setmathfont{Fira Math}
\usepackage{siunitx}
\usepackage{chemmacros}
    \chemsetup{
        modules = all,
    }
\usepackage{chemfig}
    \setchemfig{
        atom sep = 1.75em,
        bond join = true,
        bond style = {
            line width = 0.6pt
        },
    }

\begin{document}

\schemestart
2\,\chemfig{R-C(=[:90]O)-O\rlap{${}^-$}}\; \ch{Na+ \aq}
\+
\ch{Ca^2+ \aq}
\arrow(.mid east--.mid west)
\chemleft{[}
    \chemfig{R-C(=[:90]O)-O}
\chemright{]_2}
\ch{Ca \sld}
\+
2\,\ch{Na+ \aq}
\schemestop

\end{document}
6
  • 2
    +1, "chemformula instead of chemfig" should most likely be "chemformula instead of mhchem"
    – leandriis
    Jul 2, 2019 at 21:34
  • 2
    @leandriis I have no idea what I was thinking about at that moment when I mixed those two packages (just edited). Thank you for pointing this out!
    – andselisk
    Jul 2, 2019 at 21:45
  • 1
    Thanks so much! It game me errors relating to fonts, but after commenting out ``` \usepackage{fontspec} \setmainfont{Fira Sans} \usepackage[math-style = ISO]{unicode-math} \setmathfont{Fira Math} ``` it worked! Jul 3, 2019 at 11:58
  • 1
    Re: »I use chemformula […] as it has […] shortcuts/macros, e.g. for the states of aggregation« – that is not true. \aq is defined in chemmacros and chemmacros can well be used with mhchem instead of chemformula ;)
    – cgnieder
    Oct 19, 2019 at 8:48
  • 1
    @andselisk quite understandable :) chemformula used to be part of chemmacros before it got a package of itself. And per default chemmacros loads it instead of mhchem.
    – cgnieder
    Oct 19, 2019 at 8:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .