[Tex/LaTex] How to align 4 subfloats of different size

floatssubfloats

I want to control the image positioning that way that the space between the images is always a straight cross. But for unequal image width it doesn't work. I want to use subfloat and textwidth to. How can i solve this?

enter image description here

\begin{figure}[!hbtp]
\centering
\subfloat[]{\label{}\includegraphics[width=0.3\textwidth]{1.png}}\quad%
\subfloat[]{\label{}\includegraphics[width=0.2\textwidth]{1.png}}\\%
\subfloat[]{\label{}\includegraphics[width=0.2\textwidth]{1.png}}\quad%
\subfloat[]{\label{}\includegraphics[width=0.22\textwidth]{1.png}}%
\caption{}%
\label{}
\end{figure}

Addendum:

enter image description here

Best Answer

enter image description here

\documentclass{article}
\usepackage{tabularx}
\usepackage{subfig}
\usepackage{graphicx}

\begin{document}
\begin{figure}[hbt]
\begin{tabularx}{\textwidth}{>{\raggedleft \arraybackslash}X
                             >{\raggedright\arraybackslash}X}
\subfloat[]{\label{fig-a}\includegraphics[width=0.3\textwidth]{example-image}}
    &   \subfloat[]{\label{fig-b}\includegraphics[width=0.2\textwidth]{example-image}}
    \\%
\subfloat[]{\label{fig-c}\includegraphics[width=0.2\textwidth]{example-image}}
    &   \subfloat[]{\label{fig-d}\includegraphics[width=0.22\textwidth]{example-image}}
\end{tabularx}
\caption{}%
\label{}
\end{figure}
\end{document}

Next time please provide complete document, not only code fragment.

Addendum: From your comment I guess that you wish the following:

enter image description here

For this figure layout you need to ad package adjustbox:

\documentclass{article}
\usepackage{tabularx}
\usepackage{subfig}
\usepackage{graphicx}
\usepackage[export]{adjustbox}

\begin{document}
\begin{figure}[hbt]
\begin{tabularx}{\textwidth}{>{\raggedleft \arraybackslash}X
                             >{\raggedright\arraybackslash}X}
\subfloat[\label{fig-a}]{\includegraphics[width=0.3\textwidth]{example-image}}
    &   \subfloat[\label{fig-b}]{\includegraphics[width=0.2\textwidth]{example-image}}
    \\%
\subfloat[\label{fig-c}]{\includegraphics[width=0.2\textwidth,valign=T]{example-image}}
    &   \subfloat[\label{fig-d}]{\includegraphics[width=0.22\textwidth,valign=T]{example-image}}
\end{tabularx}
\caption{}%
\label{}
\end{figure}
\end{document}

Addendum (2): According to addendum to your question, you probably like to arrange sub images as follows:

enter image description here

For this arrangement I add option valign=T also to images in the first row. adjustbox:

\documentclass{article}
\usepackage{tabularx}
\usepackage{subfig}
\usepackage{graphicx}
\usepackage[export]{adjustbox}

\begin{document}
\begin{figure}[hbt]
\begin{tabularx}{\textwidth}{>{\raggedleft \arraybackslash}X
                             >{\raggedright\arraybackslash}X}
\subfloat[\label{fig-a}]{\includegraphics[width=0.3\textwidth,valign=T]{example-image}}
    &   \subfloat[\label{fig-b}]{\includegraphics[width=0.2\textwidth,valign=T]{example-image}}
    \\%
\subfloat[\label{fig-c}]{\includegraphics[width=0.2\textwidth,valign=T]{example-image}}
    &   \subfloat[\label{fig-d}]{\includegraphics[width=0.22\textwidth,valign=T]{example-image}}
\end{tabularx}
\caption{}%
\label{}
\end{figure}
\end{document}
Related Question