Help with Putting Figures Side-by-Side in LaTeX

  • LaTeX
  • Thread starter Clausius2
  • Start date
  • Tags
    Latex
In summary, the conversation is about how to place figures correctly in LaTeX documents. The person is struggling with getting figures to appear side by side, without automatically creating a new line between them. They mention using the [h] position argument, but are not sure if it will work. Another person suggests using the "minipage" command to create a layout for the figures. It is also mentioned that figures are "floats" and may require additional packages or methods to be placed in a specific location.
  • #1
Clausius2
Science Advisor
Gold Member
1,440
7
Hi,

I don't really know how to put a figure aside to another. I mean, If "X" is a figure, what can I do to make:

X X

in the same line.

Thanks.
 
Physics news on Phys.org
  • #2
LaTeX is very picky about figures. Even if you specify where you'd like the figure on the page, sometimes, it'll move it just because it wants to. You can try setting the position to argument to [h], which means "here." LaTeX will then try to place the figure where you want it.

I'm not sure if figure automatically does newlines, in that case you'll be screwed. But, try it. Make sure you don't newline between the figures.
 
  • #3
Thanks. I've been googling and finally I've found how to do about that.

Yes, LaTex has an automatic newline between figures.

Here it is what I found:

\begin{figure}
\begin{minipage}[t]{8cm}
\begin{center}
\includegraphics[width=8cm,clip]{figure1.eps}
\caption[Short caption for figure 1]{\label{labelFig1} Long caption figure 1}
\end{center}
\end{minipage}
\hfill
\begin{minipage}[t]{7.5cm}
\begin{center}
\includegraphics[width=7.5cm,clip]{figure2.eps}
\caption[Short caption for figure 2]{\label{labelFig2} Long caption figure 2.}
\end{center}
\end{minipage}
\end{figure}

And it works!
 
  • #4
try checking into various packages such as placeins.

Figures are "floats" so you really have to force it to go somewhere using tables or whatever.
 

1. How do I put figures side-by-side in LaTeX?

To put figures side-by-side in LaTeX, you can use the "subfigure" package. First, load the package in your document's preamble by using the command \usepackage{subfigure}. Then, use the \begin{figure} command to start the figure and the \end{figure} command to end it. Within the figure, use the \subfigure command to insert each individual figure. You can specify the size, alignment, and caption of each figure using the \subfigure command's optional arguments.

2. Can I adjust the spacing between the figures?

Yes, you can adjust the spacing between figures by using the \hfill command between each \subfigure command. This adds horizontal space between the figures and allows them to be placed side-by-side. You can also use the \hspace command to manually adjust the spacing between figures.

3. What if my figures are different sizes?

If your figures are different sizes, you can use the \includegraphics command within the \subfigure command to specify the size of each figure. You can also use the \resizebox command to resize the figure to a specific width or height.

4. How do I add a caption to each figure?

To add a caption to each figure, use the \caption command within the \subfigure command. You can also use the optional argument to specify a different caption for the figure's entry in the list of figures.

5. Can I refer to the figures in my document?

Yes, you can refer to the figures in your document by using the \label and \ref commands. Place the \label command within the \caption command to label each figure. Then, use the \ref command to refer to the figure in your text. This will automatically number the figures and update their numbers if the order changes.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
12
Views
797
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
394
  • MATLAB, Maple, Mathematica, LaTeX
Replies
11
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
854
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
2K
Back
Top