2

I want to use xelatex to draw a chemistry equation which contained a horizontal benzene. But it counld not be placed well, like this: bad position

And I want this, except the unpleasant blank: good position, but with blank

Here is my code:

Bad:

\documentclass{article}
\usepackage{chemfig}
\usepackage[version=4,arrows=pgf]{mhchem}

\begin{document}

$$
\ce{\chemfig{[:-30]*6(-=-=-=)} + Br2 ->[Fe / FeBr3] \chemfig{[:-30]*6(-=-(-Br)=-=)} + HBr}
$$

\end{document}

Good:

\documentclass{article}
\usepackage{chemfig}
\usepackage[version=4,arrows=pgf]{mhchem}

\begin{document}

$$
\ce{\chemfig{\vphantom{C}([:-30]*6(-=-=-=))} + Br2 ->[Fe / FeBr3] \chemfig{\vphantom{C}([:-30]*6(-=-(-Br)=-=))} + HBr}
$$

\end{document}

What should I do?

Leo Jacob
  • 75
  • 6

1 Answers1

2

First of all please avoid using $$ ... $$ in a LaTeX document. See Why is \[ ... \] preferable to $$ ... $$? for reasons why.

You need to understand that the first atom in a chemfig formula determines the baseline of the formula. If you know this you'll see that the first atom of the first benzene (which is just a point: the left-most edge) aligns with the Br2. The same holds for the second benzene and the HBr.

In case of the second benzene this can easily be changed by placing Br first in the formula:

\chemfig{Br-[4]*6(=-=-=-)}

One way for the first formula is to draw the whole reaction with chemfig's own \schemestart ... \schemestop mechanism (see part IV of the manual) and insert an invisible arrow of length 0 after the first benzene:

\documentclass{article}
\usepackage{chemfig}
\usepackage[version=4,arrows=pgf]{mhchem}

\begin{document}

\begin{center}
\schemestart
  \chemfig{[:-30]*6(-=-=-=)}
  \arrow{0}[,0]
  \+
  \ce{Br2}
  \arrow{->[Fe / \ce{FeBr3}]}[,1.5]
  \chemfig{Br-[4]*6(=-=-=-)}
  \+
  HBr
\schemestop
\end{center}

\end{document}

enter image description here

cgnieder
  • 66,645