TransWikia.com

Setting different title widths for Chapters and Sections in Table of Contents

TeX - LaTeX Asked on January 10, 2021

I am using the class files given in this repository for a thesis document. The class files seem to be incompatible with the tikz package. I get the Extra }, or forgotten endgroup. error. After digging into the template files I found the issue in a part of the code related to Table of Contents.

newcommand{uncctocformat}[4]{
  titlecontents{#1}[#2]{normalfontmdseriessinglespacing}
  {hspace*{2em}begin{tabular}[t]{@{}p{#3}}hspace*{-2em}#4}
  {hspace*{2em}begin{tabular}[t]{@{}p{#3}}hspace*{-2em}}
  {end{tabular}hfillcontentspage}
}

% TOC formatting for chapter, section levels
uncctocformat{chapter}{0pt}{350pt}{chaptertitlename~thecontentslabel:~}
uncctocformat{section}{48pt}{302pt}{contentslabel{2em}}
uncctocformat{subsection}{96pt}{254pt}{contentslabel{4em}}
uncctocformat{subsubsection}{144pt}{206pt}{contentslabel{4em}}


% TOC formatting for figure, table
uncctocformat{figure}{0pt}{350pt}{figuretitlename~thecontentslabel:~}
uncctocformat{table}{0pt}{350pt}{tabletitlename~thecontentslabel:~}

The Table of Contents (TOC) is generated as shown in the figure below.
TOC

I tried changing the command uncctocformat so that it is compatible with other packages. The change is given below. However, of course the TOC is generated in a different manner:

  1. The width of the names of Chapters and Sections have changed. The long titles are closer to the page numbers.
  2. The spacing of very long Chapter and section titles is not the same. New lines are not offset. Although, I prefer the way long Section title is produced in the modified code.
  3. Also, List of Abbreviation should have Roman page number. (Though this may be a separate question.)

Any ideas on how this can be fixed?

newcommand{uncctocformat}[4]{
  titlecontents{#1}[#2]{normalfontmdseriessinglespacing}
  {#4}
  {}
  {hfillcontentspage}
}

TOC modified

The command titlecontents is from titletoc package. The documentation is given in Page 15. However, I couldn’t figure out how to make the changes.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP