0

I want to get rid of some annoying warnings that showed up when changing how chapters look in TOC (institutional requirements).

From the log:

Overfull \hbox (58.08pt too wide) detected at line 3 \TU/lmr/bx/n/12 CHAPTER I []

Underfull \hbox (badness 10000) in paragraph at lines 3--3 [][] []
[]

Overfull \hbox (63.48pt too wide) detected at line 5 \TU/lmr/bx/n/12 CHAPTER II []

Underfull \hbox (badness 10000) in paragraph at lines 5--5 [][] []
[]

Overfull \hbox (68.88pt too wide) detected at line 8 \TU/lmr/bx/n/12 CHAPTER III []

Underfull \hbox (badness 10000) in paragraph at lines 8--8 [][] []
[]

I'm pretty sure the issue isn't related to package conflicts, but mainly to inexperience with LaTeX code (actually, added some TeX code in there). Since the document is now in final stages, i'm not willing to switch packages or classes at this point :\.

The MWE:

\documentclass[12pt,oneside,notitlepage,letterpaper,openany]{book}
\usepackage{fontspec}
\usepackage{polyglossia}
\usepackage{tocloft}
\defaultfontfeatures{Ligatures=TeX}
\setmainlanguage{english}

%% https://tex.stackexchange.com/questions/231302/change-number-after-chapter-in-table-of-contents
\newcommand*{\Romannumeral}[1]{\uppercase\expandafter{\romannumeral#1}}

%% "Head" with roman numbers
\renewcommand{\cftchappresnum}{CHAPTER~\Romannumeral}

%% Remove blank space before chapter titles (where chapter number was)
\setlength{\cftchapnumwidth}{0pt}

%% Chapter titles in a new line
\makeatletter
\renewcommand{\cftchapaftersnumb}{\par\nobreak\vskip 6\p@}
\makeatother

\begin{document}
\frontmatter
\tableofcontents
\newpage
\mainmatter
\chapter*{Introduction}
\addcontentsline{toc}{chapter}{Introduction}
\chapter{The problem}
\section{Why is it important?}
\chapter{Some background information}
\section{These people cared about this before}
\section{Someone's theory}
\chapter{Conclusions}
\end{document}

Looks like this:

Introduction

CHAPTER I

The problem
  1.1  Why is it important? .......

CHAPTER II

Some background information
  2.1  These people .......
  2.2  Someone's theory .......

CHAPTER III

Conclusions
  • They aren't errors but warnings. If the output looks OK then ignore them. I have tried, but so far failed, to eliminate the warnings but perhaps someone else will do better. – Peter Wilson Jun 24 '18 at 18:06
  • @PeterWilson I see, thank you. I was afraid it would mess up other things eventually. – undostres Jun 24 '18 at 19:07
  • I get different warnings. I also get different output: I have page numbers, whereas your code says you shouldn't. – cfr Jun 30 '18 at 2:25
  • If I comment \setlength{\cftchapnumwidth}{0pt}, I get the same warnings as you, but I still get page numbers. – cfr Jun 30 '18 at 2:26
  • @cfr confused "chapter number" with "page number", sorry. Fixed it in the MWE – undostres Jul 3 '18 at 14:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.