1

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

2

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}
10
  • For me the Figures are aligned at their top not at the bottom.
    – JohnnyS
    Jul 22 '16 at 16:13
  • Sorry, I do not understand your comment. Do you like to have, that images are aligned with their top sides? Or you can't reproduce showed result? Please, elaborate.
    – Zarko
    Jul 22 '16 at 16:27
  • Sorry, i mean c and d should be aligned at their top!
    – JohnnyS
    Jul 22 '16 at 16:41
  • @jonastrautmann, see addendum to my answer. Is this what you looking for?
    – Zarko
    Jul 22 '16 at 17:31
  • YeS1 yout solved it! Congratulation and thank you very much
    – JohnnyS
    Jul 23 '16 at 6:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.