problem with alignment of subfigures

Neal Becker ndbecker2 at gmail.com
Fri Oct 11 17:32:30 UTC 2019

I'm using lyx-2.3.3 and having a problem with subfigures.

I'm placing 4 subfigures in an IEEE 2-column document.  Lyx produces this
latex code:

---------
\begin{figure}

\subfloat[ASCMA 12UE]{

\includegraphics[width=0.4\columnwidth]{fig_ascma_abst_12ue-cropped}

}\subfloat[ASCMA 6UE]{

\includegraphics[width=0.4\columnwidth]{fig_ascma_abst_6ue-cropped}

}

\subfloat[ASCMA 12UE]{\includegraphics[width=0.4\columnwidth]
{fig_ascma_abst_12ue-cropped}

}\subfloat[ASCMA 6UE]{\includegraphics[width=0.4\columnwidth]
{fig_ascma_abst_6ue-cropped}

}\caption{Abstraction Performance}

\end{figure}
---------

This results in 4 figures in 2x2 grid, but 2nd row of figures is a bit to
the left of the 1st row of figures.

I've manually edited the latex to this:

----------------
\begin{figure}%
\subfloat[ASCMA 12UE]{%
\includegraphics[width=0.4\columnwidth]{fig_ascma_abst_12ue-cropped}%
}\subfloat[ASCMA 6UE]{%
\includegraphics[width=0.4\columnwidth]{fig_ascma_abst_6ue-cropped}%
}%
\\
\subfloat[ASCMA 12UE]{\includegraphics[width=0.4\columnwidth]
{fig_ascma_abst_12ue-cropped}%
}\subfloat[ASCMA 6UE]{\includegraphics[width=0.4\columnwidth]
{fig_ascma_abst_6ue-cropped}%
}\caption{Abstraction Performance}%
\end{figure}
-----------------

This version works correctly, the 2 rows are aligned.

Is there any way to get lyx to produce a working version with the 2 rows
aligned?

Oh, but wait!  I tried to make a minimal test case with only these 4
figures.  When I do that, the original code works correctly, the figures on
the 2 rows are aligned correctly.  So now I have no clue.  Any advice?