1

enter image description hereI am facing problem for spacing for number and text in TOC.

The are very close after second digit. Help Please... Sharelatex link is https://www.sharelatex.com/2743925469dskrfjrbsyzc

\documentclass[a4paper,12pt,openany]{book}  %openany is for removing blank page between two chapter
\usepackage[a4paper, top=1 in, bottom=1 in,textwidth=6.52in]{geometry} %to get normal margin, remove textwith length

%###############----FONT----#########################


\usepackage[T1]{fontenc}
\usepackage[adobe-utopia]{mathdesign}%% ADDED
\usepackage[utf8]{inputenc}

%--------------------------------------------
%-----------THIS SECTION IS ADDED FROM IIT-------------------

\usepackage{booktabs}
\usepackage{amsmath}%, amsfonts, amssymb
\usepackage{amsfonts}
\usepackage{amsthm}

\usepackage{xcolor}
\usepackage{fancyhdr}
\setlength{\headheight}{15pt} % related to fancyhdr
%------------------------------------------------------------------
\usepackage[bookmarks,%
            breaklinks,%
            backref=false,%
            pdfhighlight=/I,%
            pdffitwindow=true,%
            pdfstartview=Fit,%
            pdfcenterwindow=true,%
            linkbordercolor={1 0 1},%
            pdfusetitle]
            {hyperref}

\RequirePackage{graphicx}
\usepackage{multicol} % For multiple column
\usepackage{siunitx} %for SI units

%%%%%%%%%%%%%%%%%%%%ADDED BY ME%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{pifont} %for symbols in text mode
\usepackage{enumitem}
\setlist[itemize,enumerate]{noitemsep,topsep=0pt}%http://tex.stackexchange.com/questions/43743/how-to-reduce-line-space-leading-within-an-enumerate-environment
\renewcommand{\labelitemi}{\ding{70}}%https://en.wikibooks.org/wiki/LaTeX/Special_Characters
\renewcommand{\labelitemii}{\ding{118}}
\usepackage{tcolorbox} %%for coloured boxex

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Source: http://en.wikibooks.org/wiki/LaTeX/Hyperlinks %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{hyperref}
\usepackage{graphicx} 
\usepackage{caption}
\usepackage{subcaption}
\usepackage[english]{babel}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 'dedication' environment: To add a dedication paragraph at the start of book %
% Source: http://www.tug.org/pipermail/texhax/2010-June/015184.html            %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newenvironment{dedication}
{
   \cleardoublepage
   \thispagestyle{empty}
   \vspace*{\stretch{1}}
   \hfill\begin{minipage}[t]{0.66\textwidth}
   \raggedright
}
{
   \end{minipage}
   \vspace*{\stretch{3}}
   \clearpage
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Chapter quote at the start of chapter        %
% Source: http://tex.stackexchange.com/a/53380 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
\renewcommand{\@chapapp}{}% Not necessary...
\newenvironment{chapquote}[2][2em]
  {\setlength{\@tempdima}{#1}%
   \def\chapquote@author{#2}%
   \parshape 1 \@tempdima \dimexpr\textwidth-2\@tempdima\relax%
   \itshape}
  {\par\normalfont\hfill...\ \chapquote@author\hspace*{\@tempdima}\par\bigskip}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%       Colour font of Chapters and sections %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
\usepackage{xcolor}
\usepackage{sectsty} 
\usepackage{titlecaps} %http://tex.stackexchange.com/questions/129677/automatic-capitalization-of-sectioning-headings
\chapterfont{\color{blue}}  % sets colour of chapters
\sectionfont{\color{blue}\titlecap}  % sets colour of sections and each letter of word capital
\Addlcwords{to the of or at in and for from is} % make words in title/section small
\subsectionfont{\color{black}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% First page of book which contains 'stuff' like: %
%  - Book title, subtitle                         %
%  - Book author name                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Book's title and subtitle
\title{\Huge \textbf{Chemical Engineering Notes}}
% Author
\author{\textsc{Dr. XYZ}}


\begin{document}

\frontmatter
\maketitle
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Add a dedication paragraph to dedicate your book to someone %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{dedication}
Dedicated to All Chemical Engineers
\end{dedication}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Auto-generated table of contents, list of figures and list of tables %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\tableofcontents
\listoffigures
\listoftables

\mainmatter

%%%%%%%%%%%


%%%%%%%%%%%%%%%%
% NEW CHAPTER! %

\chapter{Fluid Flow} \section{Drag reduction is found generally} \section{Drag reduction is found generally} \section{Drag reduction is found generally} \section{Drag reduction is found generally} \section{Drag reduction is found generally} \section{Drag reduction is found generally} \section{Drag reduction is found generally} \section{Drag reduction is found generally} \section{Drag reduction is found generally} \section{Drag reduction is found generally} \section{Drag reduction is found generally} \section{Drag reduction is found generally} \section{Drag reduction is found generally}

\end{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  • Your MWE is neither minimal nor working. Anyway, there are two ways to adjust this. First, modify \l@section of \l@subsection or whatever it is that is giving you the problem. Second, use a package like titletoc to do the same thing using a totally different user interface. – John Kormylo Jun 12 '18 at 4:18
  • Your code can not be compiled, but you can use the following macro in the preamble to control the identation in TOC \cftsetindents{part_structure}{identation_from_left_margin_in_cm}{identation_from_number_or_icon_in_cm}, examples: \cftsetindents{section}{2cm}{2cm}, \cftsetindents{subsection}{2cm}{2cm}, \cftsetindents{subsubsection}{2.5cm}{1cm} – J Leon V. Jun 12 '18 at 4:43
  • Share Latex Link is sharelatex.com/2743925469dskrfjrbsyzc – Raj Jun 12 '18 at 7:42
  • 1
1

This is well-known limitation of standard classes TOCs. It depends a bit on fonts used (because narrower fonts will be less likely to show the problem).

Simplest workaround is to add something like this to your preamble

\usepackage{tocloft}

\advance\cftsecnumwidth 0.5em\relax
\advance\cftsubsecindent 0.5em\relax
\advance\cftsubsecnumwidth 0.5em\relax

For example:

\documentclass{book}
\usepackage{tocloft}

\advance\cftsecnumwidth 0.5em\relax
\advance\cftsubsecindent 0.5em\relax
\advance\cftsubsecnumwidth 0.5em\relax
\begin{document}

\tableofcontents

\setcounter{chapter}{11}
\setcounter{section}{8}

\section{Enthalpy Concentration Diagram}

\section{Single stage flash vaporization}

\section{Reflux Ratio}

\subsection{Minimum reflux ratio}
\subsection{Optimum reflux ratio}

\end{document}

Without the added lines:

enter image description here

With the fix:

enter image description here

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.