2

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

enter image description here

\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}

Also I have another question about latex telling me to download a package ;

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

2 Answers2

2

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

(these are lifted directly from book.cls, with \newcommand changed to \renewcommand, and \raggedright added at the end of the content specification.)

  • 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 01: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 02: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. –  Aug 12 '16 at 07: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 08:37
  • you're using \documentclass{book} but you don't use \chapter. that's why you're getting the zero. if you just want to get rid of blank pages between chapters, use the documentclass option [openany] and do use \chapter. (each chapter will start on a new page, but there won't be any blanks between.) – barbara beeton Aug 13 '16 at 20:35
  • @barbarabeeton: There was nothing to correct actually. The problem is the LaTeX source actually. While \@... commands are nice to hide some implementation as soon as some user-request about changing parameters/settings increases the level of difficulty for unexperienced users...and you know that I don't like editing answers. –  Aug 14 '16 at 00:13
  • OK THanks a lot!!!! You saved me... I have no more problem left :) – Mew Leenutaphong Aug 14 '16 at 03:40
0

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}

enter image description here

JPi
  • 13,595