3

I am having trouble formatting the ToC for a book. I have long chapter titles which wrap onto two lines of ToC text. The problem is that the second line of a single chapter title is aligned with the chapter number, but I need it to align with the beginning of the title text on the first line:

enter image description here

I am using the titletoc package.

\documentclass[twoside,openany,10pt]{book}  
\usepackage[paperwidth=5in, paperheight=8in, bindingoffset=0.375in, top=0.7in, bottom=0.7in, left=0.5in, right=0.5in]{geometry}
\renewcommand{\baselinestretch}{1.3}
\usepackage{titlesec}
\usepackage {setspace}
\usepackage{librebaskerville}
\usepackage[T1]{fontenc}
\usepackage{anyfontsize}
\usepackage{letterspace}
\usepackage{fancyhdr}
\usepackage{titletoc}%
\usepackage{graphicx}
\usepackage{float}
\usepackage[overload]{textcase}
\usepackage{microtype}
\usepackage[symbol]{footmisc}
\usepackage{enumerate}


\renewcommand{\thefootnote}{\fnsymbol{footnote}}

\titlecontents{chapter}% <section-type>
  [0pt]% <left>
  {\small}% <above-code>
  {\thecontentslabel . \quad}% <numbered-entry-format>
  {}% <numberless-entry-format>
  {\hfill\contentspage}% <filler-page-format>

%Begin Document
\begin{document} 

\tableofcontents

\chapter{Order Of Visualization}

\chapter{How To Attract To Yourself The Things You Desire}

\end{document}
4

Use the argument for the <left> margin in \titleformat:

enter image description here

\documentclass{book}  

\usepackage{titletoc,xpatch}%

\titlecontents{chapter}% <section-type>
  [1.5em]% [0pt]% <left>
  {\small}% <above-code>
  {\hspace*{-1.5em}\makebox[1.5em][l]{\thecontentslabel.}}% <numbered-entry-format>
  {}% <numberless-entry-format>
  {\hfill\contentspage}% <filler-page-format>

\begin{document} 

\tableofcontents

\chapter{Lorem ipsum dolor sit amet, consectetur adipiscing elit.}

\chapter{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut mattis sapien id purus tincidunt imperdiet.}

\end{document}

You can adjust 1.5em to suit your needs. It's the default used by the book document class.

  • Thank you for your help. It worked well. However, I just saw that some page numbers are not aligned right. Do you know how I could force them to be on the right? – Lisa Nov 11 '18 at 0:49
  • @Lisa: You need to be more specific. All the page numbers in a minimal example ToC are right aligned. – Werner Nov 11 '18 at 3:11
0

Here there is a solution to this problem. I tried it on your MWE and it looks like it's working. I hope it solves your problem too.

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.