11

enter image description here

I am trying to put two figures in the same page of my paper, but although there is still enough space for the second figure in the first page, the second picture won't appear in the first page. Anybody can help?

Meanwhile, we also generate figures about the distribution of debris based on size (\textbf{Figure 5}, \textbf{Figure 6}). 
\begin{figure}
    \centering
    \includegraphics[width=0.8\textwidth]{1cm-10cm.png}
    \centering
    \caption{Spatial density of space debris ranging from 1cm to 10cm.}
\end{figure} 
\begin{figure}
    \centering
    \includegraphics[width=0.8\textwidth]{10cm.png}
    \centering
    \caption{Spatial density of space debris larger than 10cm.} 
\end{figure} 
1
  • Did you try setting \textfraction (default is 0.2) to a lower value, say 0.1 or 0.05?
    – Bernard
    Jan 30, 2016 at 10:41

2 Answers 2

11

Some notes:

  • To solve your issue, to each figure add \begin{figure}[!htb]
  • Only one \centering is enough inside a figure/table environment, so you can remove the second one in each.
  • The "Figure 5 and Figure 6" you manually added can be done automatically by Latex, by adding \label{<your label>} inside of each figure then writing \ref{<your label>} or \cref{<your label>} (with the cleveref package) in the text. The label is of course, arbitrary.

cleveref offers some ways to customize your labels. For example

  • \cref{} = fig.
  • \Cref{} = Fig.

If you want to make all of them capitalized, then add capitalise to the package options. With a couple of additional commands we can make all of that bold, but I strongly suggest you don't use this because it will be too highlighted compared to the text.

Here's an example:

enter image description here

\documentclass{article}
\usepackage{graphicx}
\usepackage[capitalise]{cleveref}

\crefdefaultlabelformat{\textbf{#2#1#3}}
\crefname{figure}{\textbf{Fig.}}{\textbf{Figures}} 

\begin{document}  
Meanwhile, we also generate figures about the distribution of debris based on size (\cref{top}, \cref{bottom}). 
\begin{figure}[!htb]
    \centering
    \includegraphics[width=0.8\textwidth]{example-image-a}
    \caption{Spatial density of space debris ranging from 1cm to 10cm.}
    \label{top}
\end{figure} 
\begin{figure}[!htb]
    \centering
    \includegraphics[width=0.8\textwidth]{example-image-b}
    \caption{Spatial density of space debris larger than 10cm.} 
    \label{bottom}
\end{figure} 
\end{document} 
4
  • 1
    @Vinnton No problem! I thought of using \subfigure but that would make the automatic reference write fig. 1a and fig. 1b (instead of 1 and 2) which I thought was not your intention.
    – Alenanno
    Jan 30, 2016 at 10:41
  • Yes I have tried \subfigure but that's not what I want. And now I have a new problem: I have tried your method of \cref{} but it will generate lower case citation, while I wish to get upper class and bold citation (like Fig.1 rather than fig.1). Do you have any ideas about this?
    – Vinnton
    Jan 30, 2016 at 16:29
  • @Vinnton Yes, but the bold is not really advisable because all your references will stand out.
    – Alenanno
    Jan 30, 2016 at 17:14
  • But I found quite a lot of papers using bold citation~
    – Vinnton
    Jan 30, 2016 at 18:04
9

If you want the figures to be on the same page no matter what, use a single figure environment.

\documentclass{article}
\usepackage{graphicx}

\begin{document}

Meanwhile, we also generate figures about the distribution of debris based
on size (figures \ref{top}~and~\ref{bottom}).

\begin{figure}[htbp]
\centering

\includegraphics[width=0.8\textwidth,height=5cm]{example-image-a}
\caption{Spatial density of space debris ranging from 1cm to 10cm.}\label{top}

\bigskip

\includegraphics[width=0.8\textwidth,height=5cm]{example-image-b}
\caption{Spatial density of space debris larger than 10cm.}\label{bottom}

\end{figure}

\end{document}

Remember the p position specifier.

enter image description here

2
  • Thanks a lot! Would this method change the sizes of figures? It seems that figure B is a little bit distorted.
    – Vinnton
    Jan 30, 2016 at 18:02
  • @Vinnton I used height=5cm in order to fit both figures in the current page. That's the reason why they're distorted.
    – egreg
    Jan 30, 2016 at 18:28

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.