[Tex/LaTex] Placing of subfigures with different widths

floatssubcaptionsubfloats

MWE:

\documentclass{scrbook}

\usepackage[showframe]{geometry}
\usepackage[draft]{graphicx}
\usepackage{blindtext}
\usepackage{subcaption}

\begin{document}

\begin{figure}
\begin{subfigure}{.5\textwidth}
    \centering
    \includegraphics[height=175px, width=200px]{dummy.png}
    \caption{left}
\end{subfigure}%
\begin{subfigure}{.5\textwidth}
    \centering
    \includegraphics[height=175px, width=150px]{dummy.png}
    \caption{right}
\end{subfigure}
\caption{\blindtext}
\end{figure}

\end{document}

and a picture:

a busy cat

How can I arrange the subfigures so that the space between the right fig and the right border equals the space between the left fig and the left border? I marked the space with red lines.

Any help is appreciated.

Best Answer

Use \subcaptionbox, so you don't have to guess.

In the example I added the width, but probably your code will just set the height. Don't use px units, because the size of 1px is not predetermined.

Instead of \hfil between the images you can use \hspace{<length>} (don't forget a % if it comes last in a line).

\documentclass{scrbook}

\usepackage[showframe]{geometry}
\usepackage{graphicx}
\usepackage{blindtext}
\usepackage{subcaption}

\begin{document}

\begin{figure}
\centering

\subcaptionbox{left\label{sub-left}}{%
  \includegraphics[height=175bp,width=.6\textwidth]{example-image}%
}\hfil
\subcaptionbox{right\label{sub-right}}{%
  \includegraphics[height=175bp,width=.2\textwidth]{example-image}%
}

\caption{\blindtext}
\end{figure}

\end{document}

enter image description here