0

I am getting the following error while using figure and subfigure to create a 2 x 1 environment for my figures (i.e. one figure on top and two figures on the bottom) in an unexpected situation.

The document is generated successfully and my figures clearly fit on a single page and I can confirm this even visually, i.e. the page still has a lot of empty space left! But I still want to understand why this error is generated.

Float too large for page by 14.86864pt on input line 58.

This is the block of code I am using:

\documentclass[12pt,a4paper,oneside,pdftex]{report}
\usepackage[demo]{graphicx}
\usepackage{subcaption}

\begin{document}
\begin{figure}[htbp!]
  \centering
  \begin{subfigure}[b]{1\linewidth}
    \includegraphics[width=\linewidth]{files/Feb1.pdf}
     \caption{No. 1 }
  \end{subfigure}
  \begin{subfigure}[b]{0.4\linewidth}
    \includegraphics[width=\linewidth]{files/Feb2.pdf}
    \caption{No. 2 }
  \end{subfigure}
    \begin{subfigure}[b]{0.4\linewidth}
    \includegraphics[width=\linewidth]{files/Feb3.pdf}
    \caption{No. 3 }
  \end{subfigure}
  \caption{\textit{40 characters here in the original version} 544 characters here}
  \label{fig:thesefiguresdonotmatter}
\end{figure}
\end{document}

I have already tried:

  1. Remove \centering
  2. Remove [htbp!] (in the first line)
  3. Remove [b] (those next to subfigure commands)
  • 1
    with test of your code i can't confirm your findings. compilation not gives any warning nor bad boxes. please provide complete small document, which demonstrate your problem. welcome to tex.se! – Zarko Feb 22 '18 at 18:54
  • i took liberty and complete your code snippet to compilable document. please test it and show us results. i'm convinced, that this code cannot produce what you claim. btw, figure position not influence on image size. please clarify what is your problem. – Zarko Feb 22 '18 at 19:09
  • in editing i forgot to add package subcaption. please add it yourself! – Zarko Feb 22 '18 at 19:22
3

If the float extends to the footer area, then the float is still too large.

The page layout can be made visible by option showframe of package geometry. Add this option or if the package is not used add:

\usepackage[pass, showframe]{geometry}% pass does not change the layout

The macro \DebugBox, defined below, prints the dimensions to the console and the .log file and adds borders. The border lines are put inside the box to prevent that the box with border becomes larger.

\newcommand*{\DebugBox}[1]{%
  \begingroup
    \sbox0{#1}%
    \typeout{\string\DebugBox: wd=\the\wd0, ht=\the\ht0, dp=\the\dp0}%
    \setlength{\fboxrule}{.1pt}% thin border line
    \setlength{\fboxsep}{-\fboxrule}% border line inside
    \fbox{\box0}%
  \endgroup
}

Macro \DebugBox can be used like \mbox, example:

\DebugBox{\includegraphics[width=\linewidth]{files/Feb1.pdf}}
| improve this answer | |

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.