Searching this forum, there are many similar questions but I haven't found any addressing my particular issue. Is there an elegant way to centre two horizontally aligned floats(figures) of different widths, so that the distances between the borders of the document and the images are the same? In the picture below I've marked the three distances by "x", "y" and "z". Two acceptable solutions to this would be:
- x = y = z,
- x = z and y is arbitrarily defined (for ex. with
\quad).
The above figure is produced using the code:
\usepackage[inner=25mm,
outer=25mm,
top=30mm,
bottom=25mm]{geometry}
\usepackage{caption}
\usepackage{subcaption}
----------------------------------------------------------
\begin{figure}[H]
\label{fig:two_figs}
\begin{subfigure}[b]{0.5\linewidth}
\centering
\includegraphics[width=4cm]{example-image-a}
\caption{}
\label{subfig:image_a}
\end{subfigure}%
\begin{subfigure}[b]{0.5\linewidth}
\centering
\includegraphics[width=8cm]{example-image-b}
\caption{}
\label{subfig:image_b}
\end{subfigure}%
\caption{Complete caption}
\end{figure}
Granted, this can be approximately centred, for example, by changing the first subfigure width to 0.41\linewidth and the second to 0.3\linewidth. However, this seems rather unprecise and can be tedious if one has many such "double-figures" in the document.
Also please keep in mind that the \includegraphics width should not be changed in any way as I always import my figures with scale=1 to assure figure text size compliance with that of the document. In the above example, I used an arbitrary width to get my point across.



\labelshould be after the\caption. As reference, see Why does an environment's label have to appear after the caption? – Werner Jan 03 '21 at 18:34