2

I have a figure, containing three subfigures with captions and a caption for the whole figure, that all together takes more than a whole page.

I can change the geometry for the particular page where the figure appears to make it fit, but then LaTex leaves white spaces, as the geometry change seems to create a page break where it is inserted. I tried to put the geometry changes inside the float, so LaTex could treat it like a float and just change the size of the page on which the figure happens to appear, but this just gave me a bunch of errors.

I also tried to put the figure exactly where I want it in the document, but that is inside a paragraph, which is broken by the figure. To visually make it appear is if the paragraph continues after the figure, I have tried \newline to extend the last line of the page before the figure and \noindent on the next to make it appear at if there is no new paragraph, but then I think \newline starts a new line which results in an entire blank page before my figure, which is very much not what I want.

I have also tried to use the \makebox command. This works if I insert each subfigure inside a box, but then I don't know how to decrease the top margin, which is needed to make it fit. I also need to make the caption for the whole figure wider, but when creating a box wider than \textwidth things are no longer centered, and when I try to put the entire figure inside the makebox, it won't compile.

Is there a way to either make a float bigger than a page to behave nicely, or stretch a line to fit \textwidth without starting a new line, as \newline seems to do?

As it seems my question is somewhat unclear, I believe I should provide an example code. I am sorry about the length of it, but if you compile it I think it's rather easy to understand what my problem is. If not, please tell me and I will try to ask better. I do not know how to add the compiled document to the question, or I would.

\documentclass[twocolumn]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{sectsty}
\usepackage[margin=1in]{geometry}
\usepackage{braket}
\usepackage{amsmath}
\usepackage[demo]{graphicx}
\usepackage{subcaption}
\usepackage{float}

\usepackage{tikz}
\usepackage{lipsum}



\begin{document}
\section{See last part of this section}
\lipsum[1-8]
\noindent\makebox[\linewidth]{\rule{0.5\textwidth}{1pt}}
\textbf{\large{And then there is some more text which I made large and bold here so you wont miss is. The important thing is that there is a paragraph right before the figure, and I don't what that to leave a pretty much empty page as it has here.}} 

\onecolumn
\begin{figure}
\centering
    \makebox[1\textwidth][c]{
        \begin{subfigure}{1.2\textwidth}
        \begin{tikzpicture}
            \node at(0,0) {\includegraphics[width=0.5\textwidth]{x}};
            \node at(0.5\textwidth,0) {\includegraphics[width=0.5\textwidth]{x}};
        \end{tikzpicture}
        \caption{\textbf{\large{All captions to this figure are really long, and at you can see they don't fit into the page.}} Readout spectra of the transitions from $\ket{\pm 5/2 g}$ to all three excited states and the transition $\ket{\pm 1/2 g} \rightarrow \ket{\pm 5/2 e}$ at 4 MHz in the spectra. (left) The three peaks corresponding to the transitions $\ket{\pm 5/2 g} \rightarrow \ket{\pm 1/2 e}$, $\ket{\pm 5/2 g} \rightarrow \ket{\pm 3/2 e}$ and $\ket{\pm 5/2 g} \rightarrow \ket{\pm 5/2 e}$, positioned at 0, 2 and 6 MHz respectively, are present as expected. However, there is also a peak at $\ket{\pm 1/2 g} \rightarrow \ket{\pm 5/2 e}$ at 4 MHz. This comes from some unwanted ion class, and must therefore be some other transition than $\ket{\pm 5/2 g} \rightarrow \ket{\pm 1/2 e}$. (right) After burning at  $\ket{\pm 5/2 g} \rightarrow \ket{\pm 1/2 e}$ the two first peaks disappear. The last one, corresponding to $\ket{\pm 5/2 g} \rightarrow \ket{\pm 5/2 e}$ is still there, although somewhat smaller. This means that also in this peak there are unwanted ions from some other ions class. The peak at $\ket{\pm 5/2 g} \rightarrow \ket{\pm 1/2 e}$ is still there and has become bigger, as expected.}
    \end{subfigure}}
\makebox[1\textwidth][c]{
    \begin{subfigure}{1.2\textwidth}
        \begin{tikzpicture}
            \node at(0,0) {\includegraphics[width=0.5\textwidth]{x}};
            \node at(0.5\textwidth,0) {\includegraphics[width=0.5\textwidth]{x}};
    \end{tikzpicture}
    \caption{Another really long caption. Readout spectra of the transitions from $\ket{\pm 5/2 g}$ to all three excited states and the transition $\ket{\pm 1/2 g} \rightarrow \ket{\pm 5/2 e}$ at 4 MHz in the spectra. (left) The three peaks corresponding to the transitions $\ket{\pm 5/2 g} \rightarrow \ket{\pm 1/2 e}$, $\ket{\pm 5/2 g} \rightarrow \ket{\pm 3/2 e}$ and $\ket{\pm 5/2 g} \rightarrow \ket{\pm 5/2 e}$, positioned at 0, 2 and 6 MHz respectively, are present as expected. However, there is also a peak at $\ket{\pm 1/2 g} \rightarrow \ket{\pm 5/2 e}$ at 4 MHz. This comes from some unwanted ion class, and must therefore be some other transition than $\ket{\pm 5/2 g} \rightarrow \ket{\pm 1/2 e}$. (right) After burning at  $\ket{\pm 5/2 g} \rightarrow \ket{\pm 1/2 e}$ the two first peaks disappear. The last one, corresponding to $\ket{\pm 5/2 g} \rightarrow \ket{\pm 5/2 e}$ is still there, although somewhat smaller. This means that also in this peak there are unwanted ions from some other ions class. The peak at $\ket{\pm 5/2 g} \rightarrow \ket{\pm 1/2 e}$ is still there and has become bigger, as expected.}
        \end{subfigure}}
    \makebox[1\textwidth][c]{
        \begin{subfigure}{1.2\textwidth}
            \begin{tikzpicture}
                \node at(0,0) {\includegraphics[width=0.5\textwidth]{x}};
                \node at(0.5\textwidth,0) {\includegraphics[width=0.5\textwidth]{x}};
        \end{tikzpicture}
        \caption{A this really long caption. Readout spectra of the transitions from $\ket{\pm 5/2 g}$ to all three excited states and the transition $\ket{\pm 1/2 g} \rightarrow \ket{\pm 5/2 e}$ at 4 MHz in the spectra. (left) The three peaks corresponding to the transitions $\ket{\pm 5/2 g} \rightarrow \ket{\pm 1/2 e}$, $\ket{\pm 5/2 g} \rightarrow \ket{\pm 3/2 e}$ and $\ket{\pm 5/2 g} \rightarrow \ket{\pm 5/2 e}$, positioned at 0, 2 and 6 MHz respectively, are present as expected. However, there is also a peak at $\ket{\pm 1/2 g} \rightarrow \ket{\pm 5/2 e}$ at 4 MHz. This comes from some unwanted ion class, and must therefore be some other transition than $\ket{\pm 5/2 g} \rightarrow \ket{\pm 1/2 e}$. (right) After burning at  $\ket{\pm 5/2 g} \rightarrow \ket{\pm 1/2 e}$ the two first peaks disappear. The last one, corresponding to $\ket{\pm 5/2 g} \rightarrow \ket{\pm 5/2 e}$ is still there, although somewhat smaller. This means that also in this peak there are unwanted ions from some other ions class. The peak at $\ket{\pm 5/2 g} \rightarrow \ket{\pm 1/2 e}$ is still there and has become bigger, as expected.}
    \end{subfigure}}
    \onecolumn
    \caption{And a caption for the whole figure. Readout spectra of the transitions from $\ket{\pm 5/2 g}$ to all three excited states and the transition $\ket{\pm 1/2 g} \rightarrow \ket{\pm 5/2 e}$ at 4 MHz in the spectra. (left) The three peaks corresponding to the transitions $\ket{\pm 5/2 g} \rightarrow \ket{\pm 1/2 e}$, $\ket{\pm 5/2 g} \rightarrow \ket{\pm 3/2 e}$ and $\ket{\pm 5/2 g} \rightarrow \ket{\pm 5/2 e}$, positioned at 0, 2 and 6 MHz respectively, are present as expected. However, there is also a peak at $\ket{\pm 1/2 g} \rightarrow \ket{\pm 5/2 e}$ at 4 MHz. This comes from some unwanted ion class, and must therefore be some other transition than $\ket{\pm 5/2 g} \rightarrow \ket{\pm 1/2 e}$. (right) After burning at  $\ket{\pm 5/2 g} \rightarrow \ket{\pm 1/2 e}$ the two first peaks disappear. The last one, corresponding to $\ket{\pm 5/2 g} \rightarrow \ket{\pm 5/2 e}$ is still there, although somewhat smaller. This means that also in this peak there are unwanted ions from some other ions class. The peak at $\ket{\pm 5/2 g} \rightarrow \ket{\pm 1/2 e}$ is still there and has become bigger, as expected.}
\twocolumn
\end{figure}
\twocolumn

\section{Then I tried the geometry package, please read the last paragraph also here}

\lipsum[1-7]
\vspace{100pt}

\noindent\makebox[\linewidth]{\rule{0.5\textwidth}{1pt}}

\textbf{\large{The geometry package has worked best so far.}} Then I can make the figure fit by changing the top margin. However I still have the 

\newgeometry{textwidth=19.5cm,textheight=29cm,top=1.5cm, bottom=3cm}
\begin{figure*}
\centering
\includegraphics[scale=1]{x}
    \caption{Let's skip the figure as you now know why it is too big.}
\end{figure*}
\restoregeometry

problem that the figure does not fit nicely within the paragraph, but a lot of white space appears. I tried to avoid this by placing the figure exactly where I wanted it within the paragraph. As you can see, the paragraph is broken by the figure, which does not seem to be allowed to float and just change the geometry of the page it happens to appear on. Do you see my problem?

\section{Then I tried to avoid the breaking of the paragraph, at least visually}

\lipsum[1-6]
\vspace{120pt}

\noindent\makebox[\linewidth]{\rule{0.5\textwidth}{1pt}}
So I tried to visually make it seem as there was not break in the paragraph by using the          \textbackslash newline and \textbackslash noindent commands, but as you can see, this gave me an entire blank page before the figure which I \newline 

\newgeometry{textwidth=19.5cm,textheight=29cm,top=1.5cm, bottom=3cm}
\begin{figure*}
\centering
\includegraphics[scale=1]{x}
    \caption{I've been using the starred figure because I want the figure to span the entire page, as I have a twocolumn environment otherwise.}
\end{figure*}
\restoregeometry

\noindent don't know how to get rid of! 

I hope my question(s) are more clear now. And I am sorry for all the messy code, but I do think it is essential for understanding my problem. I hope you can help me. :)

\end{document}
5
  • This answer of mine tex.stackexchange.com/questions/162579/… shows how to insert an oversized-width figure, while retaining centering. Do you need to extend vertical margins too? If you want the oversize to spill out the right, then this answer: tex.stackexchange.com/questions/98971/… Dec 22 '14 at 18:46
  • Thanks, but neither of these are what I'm looking for. I have managed to find ways to produce output similar to your first suggestion, but the figure is higher than the page, so yes, I need to extend the vertical margins too, preferrably the top margin to let the page number stay where it should.
    – Pernilla
    Dec 22 '14 at 20:09
  • Your verbal description leaves a lot of potentially important parameters undetermined. Please post some code, preferably in the form on an MWE, that generates the problem behavior you're looking to fix.
    – Mico
    Dec 22 '14 at 20:50
  • The example produces multiple errors (and not the spacing you intend to show) as the images are not available. replace each \includegraphics by \rule{3cm}{2cm}` or whatever size is appropriate to show the problem. Dec 22 '14 at 22:39
  • Of course, I am sorry. I think it should work now.
    – Pernilla
    Dec 22 '14 at 22:47
2

the blank page after your bold paragraph is simply because you forced a pagebreak with \onecolumn. I'm not sure quite the layout you want but you want to avoid forced breaks and use the * form to allow page wide floats, something like

\documentclass[twocolumn]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{sectsty}
\usepackage[margin=1in]{geometry}
\usepackage{braket}
\usepackage{amsmath}
\usepackage[demo]{graphicx}
\usepackage{subcaption}
\usepackage{float}

\usepackage{tikz}
\usepackage{lipsum}

\newenvironment{outdent}
               {\list{}{\leftmargin-1cm
\rightmargin\leftmargin}%
                \item\relax}
               {\endlist}


\begin{document}
\section{See last part of this section}
\lipsum[1-8]
\noindent\makebox[\linewidth]{\rule{0.5\textwidth}{1pt}}
\textbf{\large{And then there is some more text which I made large and bold here so you wont miss is. The important thing is that there is a paragraph right before the figure, and I don't what that to leave a pretty much empty page as it has here.}} 


\begin{figure*}
\vspace*{-50pt}
\begin{outdent}
\centering
    \makebox[1\textwidth][c]{
        \begin{subfigure}{1.2\textwidth}
        \begin{tikzpicture}
            \node at(0,0) {\includegraphics[width=0.5\textwidth]{x}};
            \node at(0.5\textwidth,0) {\includegraphics[width=0.5\textwidth]{x}};
        \end{tikzpicture}
        \caption{\textbf{\large{All captions to this figure are really long, and at you can see they don't fit into the page.}} Readout spectra of the transitions from $\ket{\pm 5/2 g}$ to all three excited states and the transition $\ket{\pm 1/2 g} \rightarrow \ket{\pm 5/2 e}$ at 4 MHz in the spectra. (left) The three peaks corresponding to the transitions $\ket{\pm 5/2 g} \rightarrow \ket{\pm 1/2 e}$, $\ket{\pm 5/2 g} \rightarrow \ket{\pm 3/2 e}$ and $\ket{\pm 5/2 g} \rightarrow \ket{\pm 5/2 e}$, positioned at 0, 2 and 6 MHz respectively, are present as expected. However, there is also a peak at $\ket{\pm 1/2 g} \rightarrow \ket{\pm 5/2 e}$ at 4 MHz. This comes from some unwanted ion class, and must therefore be some other transition than $\ket{\pm 5/2 g} \rightarrow \ket{\pm 1/2 e}$. (right) After burning at  $\ket{\pm 5/2 g} \rightarrow \ket{\pm 1/2 e}$ the two first peaks disappear. The last one, corresponding to $\ket{\pm 5/2 g} \rightarrow \ket{\pm 5/2 e}$ is still there, although somewhat smaller. This means that also in this peak there are unwanted ions from some other ions class. The peak at $\ket{\pm 5/2 g} \rightarrow \ket{\pm 1/2 e}$ is still there and has become bigger, as expected.}
    \end{subfigure}}
\makebox[1\textwidth][c]{
    \begin{subfigure}{1.2\textwidth}
        \begin{tikzpicture}
            \node at(0,0) {\includegraphics[width=0.5\textwidth]{x}};
            \node at(0.5\textwidth,0) {\includegraphics[width=0.5\textwidth]{x}};
    \end{tikzpicture}
    \caption{Another really long caption. Readout spectra of the transitions from $\ket{\pm 5/2 g}$ to all three excited states and the transition $\ket{\pm 1/2 g} \rightarrow \ket{\pm 5/2 e}$ at 4 MHz in the spectra. (left) The three peaks corresponding to the transitions $\ket{\pm 5/2 g} \rightarrow \ket{\pm 1/2 e}$, $\ket{\pm 5/2 g} \rightarrow \ket{\pm 3/2 e}$ and $\ket{\pm 5/2 g} \rightarrow \ket{\pm 5/2 e}$, positioned at 0, 2 and 6 MHz respectively, are present as expected. However, there is also a peak at $\ket{\pm 1/2 g} \rightarrow \ket{\pm 5/2 e}$ at 4 MHz. This comes from some unwanted ion class, and must therefore be some other transition than $\ket{\pm 5/2 g} \rightarrow \ket{\pm 1/2 e}$. (right) After burning at  $\ket{\pm 5/2 g} \rightarrow \ket{\pm 1/2 e}$ the two first peaks disappear. The last one, corresponding to $\ket{\pm 5/2 g} \rightarrow \ket{\pm 5/2 e}$ is still there, although somewhat smaller. This means that also in this peak there are unwanted ions from some other ions class. The peak at $\ket{\pm 5/2 g} \rightarrow \ket{\pm 1/2 e}$ is still there and has become bigger, as expected.}
        \end{subfigure}}
    \makebox[1\textwidth][c]{
        \begin{subfigure}{1.2\textwidth}
            \begin{tikzpicture}
                \node at(0,0) {\includegraphics[width=0.5\textwidth]{x}};
                \node at(0.5\textwidth,0) {\includegraphics[width=0.5\textwidth]{x}};
        \end{tikzpicture}
        \caption{A this really long caption. Readout spectra of the transitions from $\ket{\pm 5/2 g}$ to all three excited states and the transition $\ket{\pm 1/2 g} \rightarrow \ket{\pm 5/2 e}$ at 4 MHz in the spectra. (left) The three peaks corresponding to the transitions $\ket{\pm 5/2 g} \rightarrow \ket{\pm 1/2 e}$, $\ket{\pm 5/2 g} \rightarrow \ket{\pm 3/2 e}$ and $\ket{\pm 5/2 g} \rightarrow \ket{\pm 5/2 e}$, positioned at 0, 2 and 6 MHz respectively, are present as expected. However, there is also a peak at $\ket{\pm 1/2 g} \rightarrow \ket{\pm 5/2 e}$ at 4 MHz. This comes from some unwanted ion class, and must therefore be some other transition than $\ket{\pm 5/2 g} \rightarrow \ket{\pm 1/2 e}$. (right) After burning at  $\ket{\pm 5/2 g} \rightarrow \ket{\pm 1/2 e}$ the two first peaks disappear. The last one, corresponding to $\ket{\pm 5/2 g} \rightarrow \ket{\pm 5/2 e}$ is still there, although somewhat smaller. This means that also in this peak there are unwanted ions from some other ions class. The peak at $\ket{\pm 5/2 g} \rightarrow \ket{\pm 1/2 e}$ is still there and has become bigger, as expected.}
    \end{subfigure}}

    \caption{And a caption for the whole figure. Readout spectra of the transitions from $\ket{\pm 5/2 g}$ to all three excited states and the transition $\ket{\pm 1/2 g} \rightarrow \ket{\pm 5/2 e}$ at 4 MHz in the spectra. (left) The three peaks corresponding to the transitions $\ket{\pm 5/2 g} \rightarrow \ket{\pm 1/2 e}$, $\ket{\pm 5/2 g} \rightarrow \ket{\pm 3/2 e}$ and $\ket{\pm 5/2 g} \rightarrow \ket{\pm 5/2 e}$, positioned at 0, 2 and 6 MHz respectively, are present as expected. However, there is also a peak at $\ket{\pm 1/2 g} \rightarrow \ket{\pm 5/2 e}$ at 4 MHz. This comes from some unwanted ion class, and must therefore be some other transition than $\ket{\pm 5/2 g} \rightarrow \ket{\pm 1/2 e}$. (right) After burning at  $\ket{\pm 5/2 g} \rightarrow \ket{\pm 1/2 e}$ the two first peaks disappear. The last one, corresponding to $\ket{\pm 5/2 g} \rightarrow \ket{\pm 5/2 e}$ is still there, although somewhat smaller. This means that also in this peak there are unwanted ions from some other ions class. The peak at $\ket{\pm 5/2 g} \rightarrow \ket{\pm 1/2 e}$ is still there and has become bigger, as expected.}

\vspace*{-5pt}
\end{outdent}
\end{figure*}


\section{Then I tried the geometry package, please read the last paragraph also here}

\lipsum[1-7]
\vspace{100pt}

\noindent\makebox[\linewidth]{\rule{0.5\textwidth}{1pt}}

\textbf{\large{The geometry package has worked best so far.}} Then I can make the figure fit by changing the top margin. However I still have the 

\begin{figure*}
\begin{outdent}
\centering
\includegraphics[scale=1]{x}
    \caption{Let's skip the figure as you now know why it is too big.}
\end{outdent}
\end{figure*}


problem that the figure does not fit nicely within the paragraph, but a lot of white space appears. I tried to avoid this by placing the figure exactly where I wanted it within the paragraph. As you can see, the paragraph is broken by the figure, which does not seem to be allowed to float and just change the geometry of the page it happens to appear on. Do you see my problem?

\section{Then I tried to avoid the breaking of the paragraph, at least visually}

\lipsum[1-6]
\vspace{120pt}

\noindent\makebox[\linewidth]{\rule{0.5\textwidth}{1pt}}
So I tried to visually make it seem as there was not break in the paragraph by using the          \textbackslash newline and \textbackslash noindent commands, but as you can see, this gave me an entire blank page before the figure which I \newline 


\begin{figure*}
\centering
\includegraphics[scale=1]{x}
    \caption{I've been using the starred figure because I want the figure to span the entire page, as I have a twocolumn environment otherwise.}
\end{figure*}


\noindent don't know how to get rid of! 

I hope my question(s) are more clear now. And I am sorry for all the messy code, but I do think it is essential for understanding my problem. I hope you can help me. :)

\end{document}
4
  • Yes! This works! Thank you! :D I don't really understand what it is you have done though. Would you like to explain?
    – Pernilla
    Dec 23 '14 at 12:06
  • @Pernilla I didn't really do anything other than remove complicated markup that seemed not to be working and removed your forced page breaks. Dec 23 '14 at 18:06
  • @Pernilla incidentally I never understood how the title related to the text or code in your question, it certainly doesn't relate to this answer:-) Dec 23 '14 at 18:08
  • I thought I had almost solved the problem in a less elegant way and was wonering if there was a way to use the newline command (or something similar) without causing a new line but just stretch the previous to span the whole textwidth. I did however also present the initial and more over all problem with the too large picture, in case anyone had a better solution than my clumsy one which was the last example, see section three. I still think the title of my question relates to what I was trying to get an answer to when I first posted this question.
    – Pernilla
    Dec 25 '14 at 10:06
0

In the MWE, the text of \lipsum[4] picks up on page 1, thus avoiding the empty space at page bottom to which the OP made reference.

I used a \makebox[\textwidth]{} to extend an extra wide picture past the horizontal margins. I used a \smash to collapse the vertical extent of the image. However, just this would leave the caption mid-page vertically, so I had to add a \rule to the image minipage, to push the caption downward, the extent of the rule being less than \textheight and governing the final location of the caption.

\documentclass[11pt]{report}
\usepackage[demo]{graphicx}
\usepackage{lipsum}
\begin{document} 
\lipsum[1-3]
\begin{figure}[p]
\begin{minipage}{\textwidth}
  \rule{0pt}{7.5in}%
  \smash{\makebox[\textwidth]{\includegraphics[width=7in,height=8.5in]{x}}}
\end{minipage}
\caption{this is my figure caption}
\end{figure}
\lipsum[4-9]
\end{document}

enter image description here

enter image description here

4
  • This seems to have some potential, but I need to be able to add subfigures, and when I try to do so I gives me errors. How could I insert subfigured with this solution?
    – Pernilla
    Dec 22 '14 at 22:15
  • @Pernilla I don't use subfigures, but I could look into it. What layout do you want subfigures to have? above/below or side by side? how many subfigures per figure? Do the subfigures need to be able to be individually labeled and referenced or is referencing the overall figure sufficient? Dec 22 '14 at 22:20
  • The layout of my document has been added to my initial question. If you compile if I believe you will understand my problem. As you can see I want three subfigures, and I want captions and labels, the latter I did not include in the example, on each of the subfigures as well as on the complete figure. I also want to keep my twocolumn environment.
    – Pernilla
    Dec 22 '14 at 22:34
  • @Pernilla The issue of transitioning from two to one column and back again, without introducing dead space, seems a difficult challenge. Dec 22 '14 at 23:00

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.