I am trying to write a chemical reaction in which I want to include a chemical structure. I am having some trouble regarding alignment and bond length. Here is a minimal working example:
\documentclass[a4paper,article]{memoir}
\usepackage[version=3]{mhchem}
\usepackage{chemfig}
\begin{document}
\ce{3CH3CHOHCH3 + Cr2O7^{2-} -> 3\chemfig{C(-[:0]CH_3)(-[:180]CH_3)(=[:270]O)} + 2Cr^{3+} + 7H2O}
\end{document}
Which produces the following output:
The problems I'm having are:
- Bond length: Despite the two CH3 groups being identical, the bond lengths are not the same. Scaling each bond individually would be somewhat of a hassle (this is one of the simpler structures I'm working with), so I would prefer if there were some way to ensure constant bond length.
- Alignment with the rest of the reaction: It seems like the bottom of the subscript "3" aligns with the baseline of the rest of the reaction, which I would like to avoid. Is there any way to (preferably automatically, but I'll take what I can get) align the baseline of the upper row of the structure with the baseline of the rest?
- Height of subscripts: The subscripts created by the mhchem package are different in height to the ones created by the chemfig package. I have tried including \ce commands in the \chemfig command, but it seems like chemfig treats the formulas produced this way as images, which gets in the way of aligning bonds to specific atoms. This also messes with the vertical location of the bonds relative to the CH3 groups.
I know that chemfig can also be used to typeset reactions, but looking at things like this, it seems that mhchem is much more user-friendly in this regard.
Any help with this would be much appreciated.
Best Answer
Bundling my comments into an answer:
I wrote »There is no way to make
chemfig
s bonds all the same length. Quoting part II section 4 Length of a bond ofchemfig
's manual:«While this was true at the time I wrote my comment meanwhile there has been an update to
chemfig
. Since version 1.1 the following is possible:Regarding your second point part III section 4 Vertical alignment has some information. It will not be immediately helpful, though, I guess. Nonetheless it is important information. The solution for the formula in your question is simple, though: write your formula in a different way:
Keep in mind that the first atom in a formula determines the baseline of the whole formula.
As for your third point I recommend reading the blog post “Exploring ChemFig: Customising appearance” of our own @JosephWright which explains a method of how to use mhchem's
\cf
inside chemfig's\printatom
. The crucial part is a redefinition of\CF@node@content
which then allows
\renewcommand*{\printatom}[1]{{\sffamily\cf{#1}}}
for example.