# My section titles got weird spaces

The title has become like this for almost every \subsubsection and \section.

\section{Statics of a particle}

\subsection{equilibrium and solving equation}


Here's what i use for package and renew command. (if you need more information and at which area please tell me)

This is the error message:

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

\documentclass[14pt,a4paper,twoside]{book}
\usepackage{graphicx}
\usepackage{fancyhdr}
\usepackage{geometry}
\usepackage{xcolor}
\definecolor{ocre}{RGB}{52,177,201} % Define the orange color used for highlighting throughout the book
\usepackage{avant}
\usepackage{grffile}
\usepackage{eso-pic}
\usepackage{microtype} % Slightly tweak font spacing for aesthetics
\usepackage[utf8]{inputenc} % Required for including letters with accents
\usepackage[T1]{fontenc} % Use 8-bit encoding that has 256 glyphs
\usepackage{amsmath}
\usepackage{pgfplots}
\usepackage{tikz}
\usepackage{float}
\usepackage{amssymb}
\usepackage{tocloft}
\usepackage{titlesec}
\usepackage{multicol}
\usepackage[english]{babel}
\setlength{\columnsep}{1cm}

\renewcommand{\thesection}{\arabic{section}}
\renewcommand{\contentsname}{Mechanics 1 Content}
\renewcommand{\cftsecfont}{\bfseries}


The required file: tex\latex\arabi\bblopts.cfg

which is uninstallable. Is this a part of the problem? I'm not sure why its trying to install that package every time.

Here is my full code.... I just think it's easier for you to see the whole picture;

https://www.sharelatex.com/project/57a8479fee5936ac58848ea6

• Please don't post code as an image, simply copy and paste the code into the website. Then you can highlight it all and hit ctrl + k (or use the code sample button, which looks like {}) to apply the correct markdown – Au101 Aug 10 '16 at 2:27
• Ok gotcha Sorry I'm new to this – Mew Leenutaphong Aug 10 '16 at 3:41
• No problem that's much better. You might also find it helpful to check out our page about how to build a minimal working example (MWE) – Au101 Aug 10 '16 at 4:47
• This is not an answer to your first question, but to your second one. I've seen that error before, you can check for solutions there (multiple listed). – JiyuuSensei Aug 10 '16 at 8:37

if the only complaint i had about the formatting of the (sub)section headings was the dreadful spacing, i'd simply add \raggedright to the basic definitions:

\makeatletter
\renewcommand\section{\@startsection {section}{1}{\z@}%
{-3.5ex \@plus -1ex \@minus -.2ex}%
{2.3ex \@plus.2ex}%
{\normalfont\Large\bfseries\raggedright}}
\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
{-3.25ex\@plus -1ex \@minus -.2ex}%
{1.5ex \@plus .2ex}%
{\normalfont\large\bfseries\raggedright}}
\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
{-3.25ex\@plus -1ex \@minus -.2ex}%
{1.5ex \@plus .2ex}%
{\normalfont\normalsize\bfseries\raggedright}}
\makeatother



• just to be sure after adding these to my commands I just use section, subsection and subsubsection normally with the commands \section, \subsection and \subsubsection respecively right? I tried that,but it again issued error message.. undefined controlled sequence \section, you cant use\spacefactor in maths mode and missing $inserted – Mew Leenutaphong Aug 11 '16 at 1:34 • @MewLeenutaphong -- yes. you don't need to change your input. these definitions are direct replacements. – barbara beeton Aug 11 '16 at 13:59 • I tried to add \section{name} and \subsection{name}, but it says "spacefactor error" and missing$\$ sign.. Thanks again – Mew Leenutaphong Aug 12 '16 at 2:23
• @MewLeenutaphong: Use a \makeatletter...\makeatother pair around the code provided by Barbara. The \@startsection etc. commands are at-letter commands and can't be used directly in a document. – user31729 Aug 12 '16 at 7:05
• Thanks man it worked, but I have one more issue.... The chapter number said 0.5.1 and i wanted it to be something like 5.1 . i want to get rid of the "0" . I dont want to use \chapter because it creates an unessary page.. what should I do .. THANks a lot man! – Mew Leenutaphong Aug 13 '16 at 8:37

I compiled this code and it looks fine:

\documentclass[14pt,a4paper,twoside]{book}
\usepackage{graphicx}
\usepackage{fancyhdr}
\usepackage{geometry}
\usepackage{xcolor}
\definecolor{ocre}{RGB}{52,177,201} % Define the orange color used for highlighting throughout the book
\usepackage{avant}
\usepackage{grffile}
\usepackage{eso-pic}
\usepackage{microtype} % Slightly tweak font spacing for aesthetics
\usepackage[utf8]{inputenc} % Required for including letters with accents
\usepackage[T1]{fontenc} % Use 8-bit encoding that has 256 glyphs
\usepackage{amsmath}
\usepackage{pgfplots}
\usepackage{tikz}
\usepackage{float}
\usepackage{amssymb}
\usepackage{tocloft}
\usepackage{titlesec}
\usepackage{multicol}
\usepackage[english]{babel}
\setlength{\columnsep}{1cm}

\renewcommand{\thesection}{\arabic{section}}
\renewcommand{\contentsname}{Mechanics 1 Content}
\renewcommand{\cftsecfont}{\bfseries}

\begin{document}

\section{Statics of a particle}

\subsection{equilibrium and solving equation}
\end{document}


• I'll send you the whole code tonight and let you compile it. – Mew Leenutaphong Aug 10 '16 at 12:13
• This is the error message that pops up as I press compile .... Underfull \hbox (badness 10000) in paragraph at lines 422--422 – Mew Leenutaphong Aug 10 '16 at 13:18
• I have 6 sections in my work, the first two had no error message, but the last four had this \hbox (badness 10000) at each sections and subsection. It makes no sense why that should happen to the last ones, but not the first... – Mew Leenutaphong Aug 10 '16 at 13:48
• Please kindly crop your embedded image. – Matsmath Aug 10 '16 at 21:30
• I'm not sure which embedded image you meant ... the one existing in the forum of my post? .. Thankyou – Mew Leenutaphong Aug 11 '16 at 1:40