3

I am using package tocstyle package to format my ToC/LoF/LoT lists. I saw already some answers using other packages, but none with tocstyle. And the use of tocstyle is "mandatory". I want to have a dot after chapter and section/figure/table number in ToC/LoF/LoT, but I was not able to achieve that trying to use \settocfeature{}{}. For example (notice the dot after the number and before the text itself).

ToC
1. Chapter 1 ............................................................ 4

LoF
1.1. Figure 1 ........................................................... 7

LoT
1.1. Table 1 ............................................................ 8

My MWE is below:

\documentclass{report}

\usepackage{tocstyle}


\begin{document}

\tableofcontents

\chapter{Chapter 1}

\end{document}
4

You can add

\newcommand{\autodot}{.}

to your preamble, which will insert a . after all numbers in the ToC.

enter image description here

\documentclass{report}

\usepackage{tocstyle}
\newcommand{\autodot}{.}

\begin{document}

\tableofcontents

\chapter{Chapter 1}

\end{document}
  • I wasn't unable to get this to compile...is \autodot defined in report or tocstyle? – Guho Oct 21 '15 at 17:30
  • 1
    The \renewcommand{\autodot} does not work because \autodot was not defined. But \newcommand{\autodot}{.} works! – cacamailg Oct 21 '15 at 17:36
  • @Guho: Sorry, fixed. – Werner Oct 21 '15 at 17:40
  • @cacamailg: Thanks; I blame it on my debugging skills. – Werner Oct 21 '15 at 17:40
  • 1
    Now I'm confused. Setting \autodot to . results in the dot being included in the TOC output/formatting, hence, \autodot is already used in the respective command. However, \autodot is not defined until \newcommand{autodot}{.}. How does the unmodified code not throw an Undefined control sequence error? I didn't see anything in tocstyle that checked if \autodot was defined. – Guho Oct 21 '15 at 17:56
2

You can redefine tocstyle's version of \numberline to add the dot:

\makeatletter
    \let\oldtocstyle@numberline\tocstyle@numberline
    \def\tocstyle@numberline#1{\oldtocstyle@numberline{#1.}}
\makeatother

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.