0

I hope that I can make use of your valuable crowd intelligence. I am trying to place two images next to each other. However, I am not sure what the best way would be to achieve that. I have tried using minipage. However, I did not manage to get the desired output. Can someone of you help me? Thank you :)

The code that I have used so far is:

\documentclass[paper=a4, pagesize, fontsize=11pt]{scrartcl} 
 \usepackage[latin1]{inputenc}  
  \usepackage[T1]{fontenc}      
  \usepackage[ngerman]{babel} 
\usepackage{float}
\usepackage{geometry}

\begin{document}

\begin{figure}[H]
\centering
\includegraphics[scale=0.25]{modell1}
\includegraphics[scale=0.25]{modell_SF36}
\caption{Messmodelle: Vereinfachte Darstellung für Modell 1}
\label{fig:mod1}
\end{figure}

 \begin{figure}[H]
    \centering
    \includegraphics[scale=0.25]{modell1}
    \includegraphics[scale=0.25]{modell2_SF36}
    \caption{Messmodelle: Vereinfachte Darstellung für Modell 2}
    \label{fig:mod2}
\end{figure}

    \end{document}

Right now, the two images are one after the other instead of being next to each other. At the moment, it looks like this: Right now

What would you suggest, how can I place the next to each other?

6
  • 3
    you have two figure environments so they always stack vertically. \includegraphics is positioned like a letter so they come next to each other by default, \includegraphics{a}\includegraphics{b} will put image b next to image a, but it isn't clear what you want. May 24, 2020 at 17:32
  • your example produces the error ! LaTeX Error: Unknown float option `H'. also please try to demonstrate the problem using example-image so everyone can run the same test document May 24, 2020 at 17:36
  • Are you sure all 4 images will fit side by side into the textwidth? From the screenshot they look too wide. Please also clarify: Do you want each pair of images to keep an individual caption (e.g. figure 1 and figure 2) or do you want subcaptions (e.g. figure 1a and figure 1b)?
    – leandriis
    May 24, 2020 at 17:54
  • 1
    If you know the width, you can use mnipage (figure caption) or subfigure (subcaption). If you don't know the width, you can use subfloat (subcaption) or measure the width with a savebox. May 24, 2020 at 18:08
  • @Milkoneva please see the answer
    – js bibra
    May 25, 2020 at 2:19

1 Answer 1

2

enter image description here

\documentclass[paper=a4, pagesize, fontsize=11pt]{scrartcl} 
\usepackage[latin1]{inputenc}  
\usepackage[T1]{fontenc}      
\usepackage[ngerman]{babel} 
\usepackage{float}
\usepackage{geometry}
\usepackage[demo]{graphicx}%<------remove demo option in actuals
\usepackage{subfig}%<--------- add or alternatively subfloat and subcaption
\begin{document}
    \begin{figure}[H]%
        \centering
        \subfloat[label1a]{{\includegraphics[width=4cm]{example-image-a} }}%
        \subfloat[label1b]{{\includegraphics[width=4cm]{example-image-a} }}%
        \subfloat[label1c]{{\includegraphics[width=4cm]{example-image-a} }}%
        \subfloat[label1d]{{\includegraphics[width=4cm]{example-image-a} }}%
        \caption{four side by side}
        \label{fig:4_models}
    \end{figure} 
\end{document}

You must log in to answer this question.

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