GeneralUnderfull \hbox warning produced by \section*{}

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
bgreen
Posts: 38
Joined: Wed Nov 22, 2023 11:02 am

Underfull \hbox warning produced by \section*{}

Post by bgreen »

I have 12 warnings, type “Badbox”:
Underfull \hbox (badness 10000) in paragraph at lines 442—442
They all pertain to instances where this code is found: \section*{}

Here is the preamble:

Code: Select all

\documentclass{article}
\usepackage{xcolor}
\usepackage{titlesec}
 \usepackage[a4paper, total={7in, 10in}]{geometry}
\usepackage{graphicx} 
\usepackage[english] {babel}
\usepackage{blindtext}
\usepackage[section]{placeins}
\usepackage{subcaption}
\usepackage[colorlinks]{hyperref}
\pagestyle {empty}
\usepackage[labelformat=empty]{caption}
\usepackage {wrapfig}
\usepackage{microtype}
\usepackage{parskip}
\usepackage{geometry}
\titleformat*{\section}{\fontsize{12}{14}\selectfont}
\graphicspath{ {D:/a_surf/BB/bgpage/} }
\begin{document}
\pagecolor{yellow!30}
\section*{New South Wales: Tweed Heads to the Central Coast} 
{\centering
\hrulefill
I've fixed warnings in 10 other documents of the same class and type., which include "\section*{}" code. This document only employs blank sections to manage floats, with one initial section heading listed above.

Advice how to fix this is appreciated.
Last edited by bgreen on Mon Mar 18, 2024 2:21 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
Stefan Kottwitz
Site Admin
Posts: 10319
Joined: Mon Mar 10, 2008 9:44 pm

Underfull \hbox warning produced by \section*{{}

Post by Stefan Kottwitz »

This code cannot be tested, if a reader clicks on "Run LaTeX here" it only brings an error. You could edit the post above and simply add something as amall as \end{document} or something else that's relevant from your code here (ensuring that this warning occurs to be able to fix it) to have a higher chance that somebody tests it and sees a solution. Just to know that, for readers and supporters, a compilable code is much better than looking at the theory in a preamble.

Stefan
LaTeX.org admin
bgreen
Posts: 38
Joined: Wed Nov 22, 2023 11:02 am

Underfull \hbox warning produced by \section*{{}

Post by bgreen »

Thanks Stefan. I was surprised that removing most of the file, still produces the error at line 26.
I'm not sure if running this online will produce the error.

Code: Select all

\documentclass{article}
\usepackage{xcolor}
\usepackage{titlesec}
 \usepackage[a4paper, total={7in, 10in}]{geometry}
\usepackage{graphicx} 
\usepackage[english] {babel}
\usepackage{blindtext}
\usepackage[section]{placeins}
\usepackage{subcaption}
\usepackage[colorlinks]{hyperref}
\pagestyle {empty}
\usepackage[labelformat=empty]{caption}
\usepackage {wrapfig}
\usepackage{microtype}
\usepackage{parskip}
\usepackage{geometry}
\titleformat*{\section}{\fontsize{12}{14}\selectfont}
\graphicspath{ {D:/a_surf/BB/bgpage/} }
\begin{document}
\pagecolor{yellow!30}
\section*{New South Wales: Tweed Heads to the Central Coast} 
{\centering
\hrulefill


\section*{}
From here we found that using the upright front fin as a pivot point with a smaller trailer behind gave the best combination of turning ability and drive.
\end{document}
User avatar
Stefan Kottwitz
Site Admin
Posts: 10319
Joined: Mon Mar 10, 2008 9:44 pm

Underfull \hbox warning produced by \section*{}

Post by Stefan Kottwitz »

Hallo Bob,

the \section*{} command is missing a heading text, Why would you need an empty heading? Also there should not be a heading nested in some (centered) group in braces, the command should be at top level. like the first \section command with heading text. Additionally, there's a closing brace missing near the end, the \centering group was not closed. if you need centered section headings, you can make it like suggested here.

Stefan
LaTeX.org admin
bgreen
Posts: 38
Joined: Wed Nov 22, 2023 11:02 am

Underfull \hbox warning produced by \section*{}

Post by bgreen »

Thanks again Stefan. The missing brace was the issue. The 14 files were supposed to have common premables.

Regarding the \section*{} without text. There no doubt are better ways to do this, but I have been using this method to prevent text and images floating beyond a certain point.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10319
Joined: Mon Mar 10, 2008 9:44 pm

Underfull \hbox warning produced by \section*{}

Post by Stefan Kottwitz »

Hi Bob,
bgreen wrote:I have been using this method to prevent text and images floating beyond a certain point
just use the \FloatBarrier command instead.

Stefan
LaTeX.org admin
bgreen
Posts: 38
Joined: Wed Nov 22, 2023 11:02 am

Underfull \hbox warning produced by \section*{}

Post by bgreen »

Thanks Stefan. I now see that I added the code

Code: Select all

 \usepackage[section]{placeins}
in some premables and not others (a problem associated with creating a number of files).

However, I think I also misunderstood your book. On page 126, it says the above code causes an implicit float barrier. I assumed implicit meant this happened without my having to add the specific floatbarrier command. Should I therefore (a) ensure the above code is listed in each preamble and (b) replace instances of \section*{} with \FloatBarrier?
User avatar
Stefan Kottwitz
Site Admin
Posts: 10319
Joined: Mon Mar 10, 2008 9:44 pm

Underfull \hbox warning produced by \section*{}

Post by Stefan Kottwitz »

Hi Bob!
bgreen wrote:However, I think I also misunderstood your book.
Which one, I wrote three books with several second editions :-)
bgreen wrote:\usepackage[section]{placeins}
On page 126, it says the above code causes an implicit float barrier.
It does, it causes an implicit float barrier for sections, so you don't need the \FloatBarrier command for each section. But if you like, you can use additional \FloatBarrier commands when you think it makes sense, without doing simulated sections.
bgreen wrote:Should I therefore (a) ensure the above code is listed in each preamble and (b) replace instances of \section*{} with \FloatBarrier?
Yes and yes,

Stefan
LaTeX.org admin
bgreen
Posts: 38
Joined: Wed Nov 22, 2023 11:02 am

Underfull \hbox warning produced by \section*{}

Post by bgreen »

Thanks Stefan.

I've been using LaTeX Beginners Guide 2nd edition. Probably the only computer book I have actually read and re-read. There were a couple of chapters that I didn't need, but overall a very useful book.

Regards

Bob
Post Reply