1

I am getting Underfull \vbox on almost every page of the book, so i guess it's not a duplicate, but rather something in my preamble. It was previously solved with \raggedbottom, but I dont like how the page looks.

\documentclass[12pt]{book}
\usepackage[paperwidth=140mm,paperheight=210mm,top=25mm,bottom=20mm,left=20mm,right=20mm]{geometry}
\usepackage{fancyhdr} %%
\usepackage{graphicx} %%
\usepackage{adjustbox}%%
\usepackage{caption}  %%
\usepackage{float}    %%
\usepackage{tocloft}  %%
\usepackage{polyglossia} %%
\usepackage{enumitem} %% 
\usepackage[xindy]{imakeidx}
\usepackage{kantlipsum}


%% --- \chapters\ --- %%              <- problem is probably here
\makeatletter
\renewcommand*{\@makechapterhead}[1]{
  \vspace*{50\p@}
  {%
    \parindent \z@ \raggedright
    \setmainfont{Book Antiqua}
    \ifnum \c@secnumdepth >\m@ne
      \if@mainmatter
        \large \normalfont \@chapapp \space \thechapter \par
        \nobreak \vskip 2\p@
        \setmainfont{Cambria}
      \fi
    \fi
    \interlinepenalty \@M \fontsize{34}{38}\selectfont \normalfont #1\par
    \nobreak \vskip 40\p@
  }}
\makeatother

\makeatletter %
\renewcommand*{\@makeschapterhead}[1]{
  \vspace*{50\p@}
  {%
    \parindent \z@ \raggedright
    \setmainfont{Cambria}
    \interlinepenalty \@M \fontsize{34}{38}\selectfont \normalfont #1\par
    \nobreak \vskip 40\p@
  }}
\makeatother



%% --- \footnotes\ ---%%
\setlength{\skip\footins}{5mm} %
\def\footnoterule{\kern-3mm \hrule width 2in \kern -.4pt \kern 3mm} %



\newcommand{\footnoteB}[2][*]% for second footnote set
{\bgroup
  \edef\thempfn{$#1$}%
  \footnote[0]{#2}%
\egroup}


%% --- \fonts\ --- %%
\setmainfont{Arial}


%% ---\Autre\--- %%
%\raggedbottom %
\brokenpenalty 10000\relax % 
\widowpenalty 10000 %
\clubpenalty 10000 %
\sloppy %


\begin{document}

\setlength{\parindent}{1em} %
\setlength{\parskip}{0em plus 0.1em} %


\chapter*{intro}
\addcontentsline{toc}{chapter}{intro}

\kant[1-10] \footnote{Example of footnote for this example}


\chapter{Chapter}

\kant[10-20] \footnoteB{\kant[1]}


\end{document}

Also sometimes LaTeX stretches space between paragraphs. Is it possible to avoid this :

enter image description here

  • 1
    you have set impossible constraints, you could add \raggedbottom to give latex a chance. – David Carlisle Nov 28 '17 at 14:40
  • I tried taking off \widowpenalty and \clubpenalty, but nothing. Honestly I dont know what it is anymore; only the page dimensions remain. – alfred Nov 28 '17 at 14:58
  • welll the page dimensions are the main problem, you have set them but they are not a multiple of baselineskip+topskip, and you have removed most stretch from the white space, but again parskip etc are not a multiple of \baselineskip. then using book you are defaulting to \flushbottom` which says the last baseline on each page should be at the bottom. This is not an achievable constraint so better to say \raggedbottom – David Carlisle Nov 28 '17 at 15:26
  • But \raggedbottom doesnt give you a 'squared' page. I'd rather try to change all that in multiples of \baselineskip but idk how. – alfred Nov 28 '17 at 15:37
  • sure but if you want the last baselineskip to reach the bottom of your page you have to make that possible. Each of your settings is making that harder, the combination of them all makes that impossible. your baselines don't fit the page, and if you have any headings or footnotes things are even harder as you have added skips of 40pt and 50pt or 3mm and 5mm. none of these will make lines fit the page naturally so you need to stretch space somewhere, the only place latex has is between paragraphs, but you ask to stop that so I suggested to add stretch space at the bottom. – David Carlisle Nov 28 '17 at 15:57
1

I only get two underfull boxes of that kind as soon as I add the heightrounded option to geometry. The problem is that the height you set does not fit an integral number of lines; with the option geometry rounds the height to fit the purpose.

\usepackage[
  paperwidth=140mm,
  paperheight=210mm,
  top=25mm,
  bottom=20mm,
  left=20mm,
  right=20mm,
  heightrounded,
]{geometry}

One remaining underfull box is due to the space for the unnumbered chapter title again not being an integral number of lines. The next is because of a huge footnote.

By the way, you shouldn't be resetting the main font. It's much better to use an indirect way:

\setmainfont{Arial}
\newfontfamily{\chapterintro}{Book Antiqua}
\newfontfamily{\chaptermain}{Cambria}

and use \chapterintro where you have \setmainfont{Book Antiqua} and \chaptermain where you have \setmainfont{Cambria}. However, I doubt this is a nice font setup.

  • Absolutely not. It was just for this example. I'm using Book Antiqua/Adine Kinberg for the title, and Linux Libertine as main font. Ok I'll try this and get back – alfred Nov 28 '17 at 15:19
  • @alfred Well, the method I suggested is independent on the actual fonts. On the other hand, mixing Book Antiqua and Libertine doesn't seem a good combination. – egreg Nov 28 '17 at 15:26
  • I know, I tried it but for some reason it is not yet working. Back to the problem. heightrounded eliminated the \vboxes in the mwe, but not in my main code. My text does have huge footnotes, but not so many. I'll check if I forgot something. – alfred Nov 28 '17 at 15:34

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.