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:



\ce{3CH3CHOHCH3 + Cr2O7^{2-} -> 3\chemfig{C(-[:0]CH_3)(-[:180]CH_3)(=[:270]O)} + 2Cr^{3+} + 7H2O}

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.

  • That seems to work nicely, thank you. There is one issue, though, which I suppose was masked by the long bonds. It seems that, while the second and third carbon atoms are aligned vertically, they are positioned a bit lower than the first one. Using @JosephWright's method (I don't pretend to understand it, exactly), the second and third atoms are also misaligned. You wouldn't happen to know why this is the case (and perhaps what to do about it)?
    – Danny
    Commented Nov 25, 2014 at 20:48
  • @clemens Wanna make your comments into an answer?
    – Johannes_B
    Commented Feb 12, 2015 at 14:43

1 Answer 1


Bundling my comments into an answer:

  • I wrote »There is no way to make chemfigs bonds all the same length. Quoting part II section 4 Length of a bond of chemfig's manual:«

    Rather than speaking of length of a bond, we should use the term interatomic spacing. If effect, only the interatomic spacing is adjustable with \setatomsep as we have seen on page 6. Once this parameter is set, the length of a bond depends on the content of atoms and, to a lesser extent, the angle the bond makes with the horizontal. It should be obvious that two “slimmer” atoms will have larger edge separations than two which are larger.

    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:

    When a star follows the macro \chemfig*, the bonds have a fixed length and therefore, the distance between center to center atoms becomes variable. The macro \enablefixedbondlength makes this behavior valid for all macros (starred or not) while \disablefixedbondlength goes back to the default behavior. [...] In rings, even with starred \chemfig*, the default behaviour is restored in order to draw regular polygons.

  • 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

          {\csname atom@\number\CF@cnt@atomnumber\endcsname}%

    which then allows \renewcommand*{\printatom}[1]{{\sffamily\cf{#1}}} for example.

You must log in to answer this question.

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