General ⇒ graphics trouble
graphics trouble
I'm struggling along with my 1st LaTex document. I'm trying to insert two figures on one page. The following seems to work quite nicely:
\begin{figure}[h]
\centering
\includegraphics[scale=0.75]{c:/ma50176/graph1.jpg}
\includegraphics[scale=0.75]{c:/ma50176/graph2.jpg}
\label{fig3}
\end{figure}
However, as soon as I try to insert a caption, it sends the figures (with caption) to the back of my document (instead of where they should be). There is plenty of room after the figures as they are the only things on the page in question. I have tried using the subfigure environment, but that has the same effect.
Any ideas on why this happens and what I can do?
Many thanks,
Lisa
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
graphics trouble
Code: Select all
\begin{figure}[!ht]
\centering
\includegraphics[scale=0.75]{c:/ma50176/graph1.jpg}
\includegraphics[scale=0.75]{c:/ma50176/graph2.jpg}
\caption{Two pictures\label{fig:two-pics}
\end{figure}
Typesetting two figures side by side (with own caption) is well supported by the subfig (and the floatrow) package . Your code then looks a little bit different.
Code: Select all
\begin{figure}[!ht]
\centering
\subfloat[First Picture\label{subfig-1:two-pics}]{
\includegraphics[scale=0.75]{c:/ma50176/graph1}
}
\hspace{5mm}
\subfloat[Second Picture\label{subfig-1:two-pics}]{
\includegraphics[scale=0.75]{c:/ma50176/graph2}
}
\caption{Two Pictures\label{fig:two-pics}
\end{figure}
Best regards
Thorsten¹
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10