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

1 Answer 1

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
    Commented Jul 22, 2016 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
    Commented Jul 22, 2016 at 16:27
  • Sorry, i mean c and d should be aligned at their top!
    – JohnnyS
    Commented Jul 22, 2016 at 16:41
  • @jonastrautmann, see addendum to my answer. Is this what you looking for?
    – Zarko
    Commented Jul 22, 2016 at 17:31
  • YeS1 yout solved it! Congratulation and thank you very much
    – JohnnyS
    Commented Jul 23, 2016 at 6:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .