0

So I have this relatively simple-coded book document.
When I try to compile it, I get a lot of Underfull \vbox (badness 10000) has occurred while \output is active warnings (though there's only one in provided MWE). The structure of the book is simple: just headings and text.
For instance, the page starts with Part Number, Chapter Number and text (yes I also have an images both between Part Number and Chapter Number, and Chapter Number and text added with \includegraphics command). But even if I delete those images, the warnings still pop up with even more warnings!
I had a problem with the bottom line of the text being hung above the frame before, but that was solved with adding heightrounded to the geometry of the book.
I understand that book class uses \flushbottom by default to literally flush the text to the bottom of the frame. So I tried to use \raggedbottom as many had suggested but that, while having solved the warning occurrence, introduced another problem: now on some pages the bottom line's baseline is getting hung above the frame, sometimes as high as almost a full line (unfortunately it's not that noticeable in MWE but you can still see it on Page 1)!
So I am puzzled with what causes those warnings to pop up, since my document is fairly simple-coded?!
I noticed though that it's somehow connected to the way my headings (Part Number and Chapter Number, and probably images too) are spaced. Because when I remove all the \part and \chapter commands and leave only bare text, the warnings disappear. Has it got anything to do with titlesec package?
I left all the packages used in my document intact, so you could easily spot if one of them is the issue.
P.S: Don't mind those Overfull \hbox warnings, I don't have them in my text. They only appear when \lipsum is used.

% !TEX TS-program = LuaLaTeX
\documentclass[11pt,twoside,openany]{book}
\pagestyle{plain}
\usepackage[english, russian]{babel}
\usepackage{fontspec}
\setmainfont{EB Garamond}[
]
\usepackage{microtype}
\usepackage[shortcuts]{extdash}
\usepackage[pagewise]{lineno} 
\usepackage[
  paperwidth=6in,
  paperheight=9in,
  inner=13mm,
  top=15mm,
  outer=20mm,
  bottom=24mm, showframe,
  heightrounded,
]{geometry} 

\usepackage{lettrine}
\setcounter{DefaultLines}{3}
\renewcommand{\DefaultLoversize}{0.1} 
\renewcommand{\DefaultLraise}{0} 
\renewcommand{\LettrineTextFont}{}
\setlength{\DefaultFindent}{\fontdimen2\font}

\usepackage{lipsum}
\setlength{\parskip}{0pt} 
\usepackage{graphicx}
\usepackage[dvipsnames]{xcolor}
\usepackage[pages=some]{background}

\usepackage{fancyhdr}
\fancyhf{} 
\renewcommand{\headrulewidth}{0ex} 
\fancyfoot[LE,RO]{\thepage} 
\pagestyle{fancy}
\fancypagestyle{plain}{%
  \fancyhf{}%
  \renewcommand{\headrulewidth}{0ex}%
  \fancyhf[lef,rof]{\thepage}%
}
 
\usepackage{etoolbox}
\makeatletter
\patchcmd{\chapter}{\if@openright\cleardoublepage\else\clearpage\fi}{\par}{}{}
\makeatother

%\raggedbottom % If used, it messes up the bottom line the way that its baseline hangs above the frame on some pages

\usepackage{titlesec}
\titleclass{\part}{top}
\titleformat{\part}{\centering\normalfont\large}{\thepart.}{4ex}{\LARGE\centering}
\titlespacing*{\part}{0ex}{2ex}{0ex} 
\titleclass{\chapter}{straight}
\titleformat{\chapter}{\centering\normalfont\large}{\thechapter.}{4ex}{\large\centering}
\titlespacing*{\chapter} {0ex}{6ex}{02ex} 

\setcounter{secnumdepth}{0}
\usepackage{tocloft}

\begin{document} 
\pagestyle{plain}
\pagenumbering{gobble}
\addtocounter{page}{0}

\begin{titlepage}
    \centering
    {\large TITLE\par}
    \vfill
    \title{SOME TITLE}
    \author{SOME AUTHOR}
    \date{}
\end{titlepage}
\clearpage
\frontmatter

\mainmatter

\pagenumbering{arabic}

\part{PART ONE}
\begin{center}
    \includegraphics[height=15ex,keepaspectratio]{example-image-a}
  \end{center} 
\chapter{CHAPTER ONE}
\begin{center}
    \includegraphics[height=35ex,keepaspectratio]{example-image-b}
  \end{center} 
\lipsum[1-12]
\chapter{CHAPTER TWO}
\begin{center}
    \includegraphics[height=35ex,keepaspectratio]{example-image-b}
  \end{center} 
\lipsum[1-12]
\chapter{CHAPTER THREE}
\begin{center}
    \includegraphics[height=35ex,keepaspectratio]{example-image-b}
  \end{center} 
\lipsum[1-12]  
\end{document}
6
  • you are removing all flexibility with commands such as titlespacing*{\chapter} {0ex}{6ex}{02ex} so tex has no way to meet the \flushbottom constraint that you have specified. Use \raggdbottom or allow some stretch around section headings Apr 16, 2022 at 14:24
  • raggedbottom messes up the bottom line as I described in my question. How else can I control the spacing before and after \part and \chapter if not with titlespacing command without removing all flexibility of book class default \flushbottom? Direct me to some manuals I can read if you don’t have time to explain.
    – tryingout
    Apr 16, 2022 at 14:47
  • You are setting inconsistent unachievable constraints, so you need to change the constraints so they are possible to achieve, or ignore the warnings that TeX failed to achieve them. You don't really need a manual, it is simple math, you are specifying the bottom baseline should be at a fixed position. but from the top of the page you are stacking text with no flexibiliy, and heading size not a muliple of baselineskip, so at the bottom of the page the last baseline is not where it is specified to be but TeX has no way to move it, so the page is always short and infinitely underfull Apr 16, 2022 at 15:43
  • I do understand the idea but the question remains: 1) How do I control the spacing before and after the heading (either part or chapter) so the values would not be fixed? If not ex, what would it be? Or titlespacing command is not an option at all? I understand that having the ex values for the spacing means having fixed values on a page which block flexibility; and 2) How do I set the heading size in multiple of baselineskip? What unit of measure should I use?
    – tryingout
    Apr 16, 2022 at 16:02
  • use values like 1ex plus 1ex minus .5ex so it tries to be between .5 and 2ex look a any documn class, repor for example which has {-3.5ex \@plus -1ex \@minus -.2ex} for section Apr 16, 2022 at 16:06

1 Answer 1

1

You need some flexibility around headings so that flushbottom may be achieved

perhaps

\titlespacing*{\chapter} {0ex}{6ex plus 4ex minus 1ex}{2ex} 

But the underfull warning from the page before chapter 3 is because you removed the normal \clearpage but the heading and image do not fit and there is no glue to fill the page, you could perhaps add \filbreak like this to allow pages before chapters to be short.

\titleformat{\chapter}{\filbreak\centering\normalfont\large}{\thechapter.}{4ex}{\large\centering}
3
  • Adding values like {6ex plus 4ex minus 1ex} along with adding \filbreak to \titleformat eliminates the warnings but it also adds up empty pages and starts both part and chapter on a new page. And my intent is to have part and chapter on the same page as it was in the original code. Is there a way to fix that? Also what do you mean by "glue"? I understand that as my heading font size, image size and heading spacing are all in fixed values, I need to either measure them in some unit multiple of baselineskip or compensate the difference with some "glue", correct?
    – tryingout
    Apr 16, 2022 at 17:17
  • @tryingout glue is what gets added by \vspace etc. But you can discourage a page break before chapters with \titleformat{\chapter}{\vfil\penalty500\vfilneg\centering\normalfont\large}{\thechapter.}{4ex}{\large\centering} insead of \filbreak Apr 16, 2022 at 17:30
  • I don't really know where and how you got all that expertise but your suggestions worked! I obviously lack some basic knowledge to work on a book thus a few questions: 1) and the main, what would you recommend to start with to compile a perfect book-class fiction book? What to read? (this one probably deserves a separate post) 2) in values like {6ex plus 4ex minus 1ex} I noticed that only first value matters, so how do you come up with the 2nd and 3rd? 3) do I still need to measure the images after the chapter name in some unit multiple of baselineskip? If yes, what unit that would be?
    – tryingout
    Apr 16, 2022 at 20:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .