# Horizontal alignment of chemfig structures

I'd like to align these two chemfig structures, seen below, horizontally but I cannot get my head around how.

\documentclass{article}
\usepackage{chemfig}

\begin{document}
\begingroup

\centering
\setatomsep{3em}\chemname{\chemfig{C(-[:180]H)*6(-C(-H)=C(-H)-C(-H)=C(-H)-C(-H)=)}}{Lewis
structure\\of benzene}
\setatomsep{3em}\chemname{\chemfig{**6(------)}}{Cyclic compound\\of benzene}

\endgroup
\end{document}


Example output:

Putting the chemfigs into \raisebox{\depth-\totalheight/2}{...} centres them vertically by moving the box reference point to the half of the totalheight. Requires the calc LaTeX package:

\documentclass{article}
\usepackage{chemfig}
\usepackage{calc}

\begin{document}
\begingroup

\centering
\setatomsep{3em}\chemname{\raisebox{\depth-\totalheight/2}{\chemfig{C(-[:180]H)*6(-C(-H)=C(-H)-C(-H)=C(-H)-C(-H)=)}}}{Lewis
structure\\of benzene}

• Yes, it is an old trick. For boxes with zero depth it is simply \raisebox{-0.5\height}{...}. Jan 23 '17 at 8:49
• Had to remove \setatomsep{3em} and use \setchemfig{atom sep=3em} in the preamble, then it worked!