# How to properly code a TeX file, or at least avoid badness 10000

I'm coding a TeX file and although the .pdf is correctly rendered, I'm using "stone age" tools to code it. As some examples, I use \\ to leave a line space between two paragraphs, or \noindent in every paragraph I start. Basically, I'm just using the basic TeX data I have to code a paper, but I'm sure there are things that can be replaced with much better and appropriate codes, since I get badness 10000. This is the console:

*geometry* detected driver: pdftex
("C:\Archivos de programa\MiKTeX 2.9\tex\latex\amsfonts\umsa.fd")
("C:\Archivos de programa\MiKTeX 2.9\tex\latex\amsfonts\umsb.fd")
Underfull \hbox (badness 10000) in paragraph at lines 10--11
[1{C:/Documents and Settings/All Users/Datos de programa/MiKTeX/2.9/pdftex/conf
ig/pdftex.map}]
Overfull \hbox (10.8009pt too wide) detected at line 49
\OML/cmm/m/it/14.4  [] \OT1/cmr/m/n/14.4 + 1 = [] [] \OML/cmm/m/it/14.4 x \OT1
/cmr/m/n/14.4 + [] [] \OML/cmm/m/it/14.4 x
[2]
Overfull \hbox (26.66542pt too wide) in alignment at lines 80--82
[][][] []
[3]
Overfull \hbox (23.60692pt too wide) detected at line 90
\OML/cmm/m/it/14.4  [] \OMS/cmsy/m/n/14.4 ><C:/Archivos de programa/MiKTeX 2
.9/fonts/type1/public/amsfonts/symbols/msbm10.pfb>


How could I clean up these errors, which I'm guessing are basic?

-
Given log shows that overful boxes occured in math equations. Check your equations and use multline environment from amsmath package to typeset long eqs. amsmath also has many other environments for math materials. –  Igor Kotelnikov Apr 13 '12 at 6:02
add comment

## 1 Answer

Never use \\ to add space between paragraphs. This simple code:

\documentclass{article}

\begin{document}

text\\

text
\end{document}


produces the message

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


If you want to suppress indentation and increase the vertical separation between paragraphs, you have, at least, three options:

1. Set \parindent to 0pt (to suppress indentation) and use \smallskip, \medskip or \bigskip to increase the vertical skip between paragraphs; an example:

\documentclass{article}
\usepackage[nopar]{lipsum}

\setlength\parindent{0pt}% globally suppress indentation

\begin{document}

\lipsum[2]\medskip

\lipsum[2]

\end{document}


gives

1. Load the parskip package. For example:

\documentclass{article}
\usepackage{parskip}
\usepackage[nopar]{lipsum}

\begin{document}

\lipsum[2]

\lipsum[2]

\end{document}


produces:

1. Use one of the KOMA-Script document clases and one of the options of the parskip= or halfparskip= family (see the documentation for details). An example:

\documentclass[parskip=full+]{scrartcl}
\usepackage[nopar]{lipsum}

\begin{document}

\lipsum[2]

\lipsum[2]

\end{document}


produces:

Just to explain why using \\ followed by a blank line (or a \par command) produces the warning:

when TeX ends a paragraph, it inserts something like

\unskip \penalty10000 \hskip\parfillskip


doing \\\par will result in

\\ \unskip \penalty10000 \hskip\parfillskip


The \unskip has no effect since it finds no preceding glue, so \\ is followed by a penalty and a glue which will disappear after the line break; however, TeX was already expecting an extra line but there is nothing to fill it with, so an underfull box results.

-
add comment