I'm using the chemfig package for some structural diagrams I'm preparing for a lab report, and I need to align five structural diagrams (with their own name captions) in a 2x3 column-and-row format. To this end, I chose to use chemfig within multiple subfigure environments, all within a figure.
I used this question as well as this one to begin to understand how to do the horizontal and vertical alignment within a figure environment, but I'm running into the issue where the figure environment "forgets" the row alignment after the first row.
The MWE is as follows:
\documentclass{article}
\usepackage{baskervald}
\usepackage{graphicx}
\usepackage{chemfig}
\usepackage{subcaption}
\begin{document}
\begin{figure*}[h]
\centering
\begin{subfigure}[b]{0.5\textwidth}
\centering
\scalebox{0.67}{
\chemfig{HO-[:30]*6(-=-(-\chemabove{N}{H}-[::-60](=[::-60]O)-)=-=)}
}
\caption{Acetaminophen}
\end{subfigure}%
~
\begin{subfigure}[b]{0.5\textwidth}
\centering
\scalebox{0.67}{
\chemfig{*6(-=-(-O-[::-60](=[::-60]O)-[::+60])=(-(=[::+60])-[::-60]OH)-=)}
}
\caption{Aspirin}
\end{subfigure}%
\\
\begin{subfigure}[b]{0.5\textwidth}
\centering
\scalebox{0.67}{
\chemfig{*6((=O)-N(-CH_3)-*5(-N=-N(-CH_3)-=)--(=O)-N(-H_3C)-)}
}
\caption{Caffeine}
\end{subfigure}
~
\begin{subfigure}[b]{0.5\textwidth}
\centering
\scalebox{0.67}{
\chemfig{H_3C-[::30](-[:90]CH_3)-[::-60]-[::60]*6(-=-(-(-[::60]CH_3)-[::-60](=[::-60]O)-OH)=-=)}
}
\caption{Ibuprofen}
\end{subfigure}%
\\
\begin{subfigure}[b]{0.5\textwidth}
\centering
\scalebox{0.67}{
\chemfig{*6(-=-(-OH)=(-(=[::60]O)-[::-60]NH_2)-=)}
}
\caption{Salicylamide}
\end{subfigure}%
\caption{Chemical structures of the analgesics being analyzed.}
\end{figure*}
\end{document}
This results in the following output:
Here, I need figures (a) and (b) to be aligned horizontally, as they are, with (c) and (d) aligned similarly beneath them, and (e) centered between the two (as it currently is) beneath that.
I've tried two routes to remedy this, neither of which have had any success in remedying the issue:
- Blocking each row in braces, then using
\\to separate rows - Placing each row within its own
subfigureenvironment.


tabularapproach, but I think I got too engrained in thesubfigureway of doing things and didn't think of this. – ecfedele Jan 18 '19 at 06:13