I am using the memoir class and I have two subfigures of different width that I would like to lay out vertically. Ideally, these two subfigures should be aligned so that
- The widest subfigure is centered (to
\textwidth
). - Other subfigures have their right edge aligned to the right edge of the widest subfigure.
How can I achieve this? The code below can work as a starting point.
\documentclass{memoir}
\usepackage{lipsum}
\newsubfloat{figure}
\begin{document}
\lipsum[1]
\begin{figure}
\centering
\subbottom[]{\framebox{Narrow subfig}}
\\
\subbottom[]{\framebox{Wide subfigure with lots of stuff}}
\end{figure}
\end{document}
I first tried using a minipage inside the figure environment, where content inside the minipage was right justified. The problem was setting the width of the minipage to exactly the width of the widest subfigure; if that problem has a solution, I think that would work.
One solution would be to compile the figure as a separate file using standalone
. I wish to avoid that.