[Tex/LaTex] How to align all the molecules, the + sign and arrow at the same level

chemfig

I use the chemfig package to draw molecules in a chemical reaction. However, I cannot align the molecules, the + sign and arrow at the base line. I have tried the \vphantom command, like in this question. But it does not work. I cannot use the \chemfig{} command to shift the molecules up or down. How could I handle this type of problem when using chemfig? Any tricks for new chemfig learners?
Here's my output so far:
enter image description here

My code:

\documentclass{article}
\usepackage{chemfig}
\begin{document}
\setatomsep{3em}
\schemestart
\chemname{\chemfig{O=[:-90](-[:-150]H)-[:-30]OH}}{Formic acid} 
\+{2em, 2em, -3em} 
\vphantom{\+{,, -3em}}%
\chemname{\chemfig{CH_3OH}}{Methanol}
\arrow{<=>}
\chemname{\chemfig{O=[:-90](-[:-150]H)-[:-30]O-[:30]}}{Methyl formiate} 
\+{2em, 2em, -3em} 
\chemname{\chemfig{H_2O}}{Water}
\schemestop

\end{document}

Best Answer

chemfig always places the first atom of the molecule on the baseline, so if you write

\chemfig{O=[:-90](-[:-150]H)-[:-30]OH}

the oxygen will be on the baseline. To put the carbon on the baseline it has to be the first atom:

\chemfig{(-[:-150]H)(=[:90]O)-[:-30]OH}

In other words, you must start from the atom you want to be on the baseline and treat the others like branchings. The code is therefore

\documentclass{article}
\usepackage{chemfig}
\begin{document}
\setatomsep{3em}
\schemestart
\chemname{\chemfig{(-[:-150]H)(=[:90]O)-[:-30]OH}}{Formic acid}
\+
\chemname{\chemfig{CH_3OH}}{Methanol}
\arrow{<=>}
\chemname{\chemfig{(-[:-150]H)(=[:90]O)-[:-30]O-[:30]}}{Methyl formiate}
\+
\chemname{\chemfig{H_2O}}{Water}
\schemestop
\end{document}
Related Question