How can I shift the subfigure (j) to the left such that the horizontal space x between subfigure (i) and (j) is equal to all subfigures like in the first or second row.
My Code:
\documentclass{article}
\usepackage{subcaption}
\usepackage{graphicx}
\begin{document}
\begin{figure}[h!]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% first row
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{subfigure}{0.22\textwidth}
\includegraphics[width=\textwidth]{example-image}
\caption{First subf}
\end{subfigure}
\hfill %%
\begin{subfigure}{0.22\textwidth}
\includegraphics[width=\textwidth]{example-image}
\caption{Second subf}
\end{subfigure}
\hfill %%
\begin{subfigure}{0.22\textwidth}
\includegraphics[width=\textwidth]{example-image}
\caption{Third subf}
\end{subfigure}
\hfill %%
\begin{subfigure}{0.22\textwidth}
\includegraphics[width=\textwidth]{example-image}
\caption{Fourth subf}
\end{subfigure}
\hfill %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% second row
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{subfigure}{0.22\textwidth}
\vspace{10pt}
\includegraphics[width=\textwidth]{example-image}
\caption{Fifth subf}
\end{subfigure}
\hfill %%
\begin{subfigure}{0.22\textwidth}
\vspace{10pt}
\includegraphics[width=\textwidth]{example-image}
\caption{Sixth subf}
\end{subfigure}
\hfill %%
\begin{subfigure}{0.22\textwidth}
\vspace{10pt}
\includegraphics[width=\textwidth]{example-image}
\caption{Seventh subf}
\end{subfigure}
\hfill %%
\begin{subfigure}{0.22\textwidth}
\vspace{10pt}
\includegraphics[width=\textwidth]{example-image}
\caption{Eighth subf}
\end{subfigure}
\hfill %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% third row
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{subfigure}{0.39333333333\textwidth}
\vspace{10pt}
\includegraphics[width=\textwidth]{example-image}
\caption{Tenth subf}
\end{subfigure}
\hfill %%
\begin{subfigure}{0.39333333333\textwidth}
\vspace{10pt}
\includegraphics[width=\textwidth]{example-image}
\caption{Eleventh subf}
\end{subfigure}
\hfill %%
\caption{Subreferences in \LaTeX.}
\label{fig:figures}
\end{figure}
\end{document}
Solution (thanks to egreg):
Calculating the horizontal space x between two subfigures in the first or second row like this:
x = ( 1 - 4 * 0.22 ) / 3 = 0.04
And add this code with the calculated value x after tenth subfigure (i):
\hspace{0.04\textwidth}
\documentclass{article}
\usepackage{subcaption}
\usepackage{graphicx}
\begin{document}
\begin{figure}[!htp]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% first row
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{subfigure}{0.22\textwidth}
\includegraphics[width=\textwidth]{example-image}
\caption{First subf}
\end{subfigure}\hfill
%%
\begin{subfigure}{0.22\textwidth}
\includegraphics[width=\textwidth]{example-image}
\caption{Second subf}
\end{subfigure}\hfill
%%
\begin{subfigure}{0.22\textwidth}
\includegraphics[width=\textwidth]{example-image}
\caption{Third subf}
\end{subfigure}\hfill
%%
\begin{subfigure}{0.22\textwidth}
\includegraphics[width=\textwidth]{example-image}
\caption{Fourth subf}
\end{subfigure}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% second row
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{subfigure}{0.22\textwidth}
\vspace{10pt}
\includegraphics[width=\textwidth]{example-image}
\caption{Fifth subf}
\end{subfigure}\hfill
%%
\begin{subfigure}{0.22\textwidth}
\vspace{10pt}
\includegraphics[width=\textwidth]{example-image}
\caption{Sixth subf}
\end{subfigure}\hfill
%%
\begin{subfigure}{0.22\textwidth}
\vspace{10pt}
\includegraphics[width=\textwidth]{example-image}
\caption{Seventh subf}
\end{subfigure}\hfill
%%
\begin{subfigure}{0.22\textwidth}
\vspace{10pt}
\includegraphics[width=\textwidth]{example-image}
\caption{Eighth subf}
\end{subfigure}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% third row
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{subfigure}{0.35\textwidth}
\vspace{10pt}
\includegraphics[width=\textwidth]{example-image}
\caption{Tenth subf}
\end{subfigure}\hspace{0.04\textwidth}% (1-4*0.22)/3
\begin{subfigure}{0.35\textwidth}
\vspace{10pt}
\includegraphics[width=\textwidth]{example-image}
\caption{Eleventh subf}
\end{subfigure}
\caption{Subreferences in \LaTeX.}
\label{fig:figures}
\end{figure}
\end{document}









0.39333333333\textwidthas the width of the final two charts? Why not, say,0.4\textwidthor\0.48\textwidth? – Mico Feb 11 '23 at 10:58