0

I want to indent some sections in the TOC but leave the fact that they're unnumbered and not indented in the body unchanged. Example follows.

In the example below I would want "Test" in the TOC to be aligned with "1.1 Section Foo" so that the "T" is right under the "S", while leaving the formatting of the body unchanged and still no numbering of "Test" in the TOC.

\documentclass{book}

\usepackage{bookman}
\usepackage{tocstyle}
\usetocstyle{standard}
\renewcommand{\numberline}[1]{#1~}
\setcounter{tocdepth}{1}
\newenvironment{test}[1]{%
  \subsection*{#1}}

\begin{document}

\tableofcontents

\chapter{Chapter Foo}
\section{Section Foo}
\subsection{Subsection Foo}
\begin{test}{Test}
\addcontentsline{toc}{section}{Test}
\subsubsection*{Subsection Foo Star}
\end{test}

\end{document}
2
  • In fact it's aligned. If you think it's not you can just try with \addcontentsline{toc}{section}{ Test} i.e. with additional space in { Test}.
    – touhami
    Feb 14, 2020 at 19:58
  • You are right. I apologize. I meant aligning the "T" with the "S". I'm editing my question.
    – E2R0NS
    Feb 14, 2020 at 20:00

1 Answer 1

0

I figured it out. Here are the changes to make to my original example:

  1. Change tocdepth argument from 1 to 2 to show subsections.
  2. Change subsections I do want in the TOC from \subsection to \subsection*.
  3. Change the addcontentsline argument from section to subsection.

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.