0

I want to make my table of contents as if I'm using \parts and \sections throughout my document, as in the following picture: ToC that I like.

It's neat and easy to read. However I don't like the way it looks throughout my document; it makes it look rather messy and space consuming as in the following picture: Document I do not like..

I prefer using \section and \subsection throughout my document, in my opinion it looks much nicer, as in this picture: Document that I like.

But this makes the table of contents look cluttered and difficult to read, like this: ToC I do not like.

How do I make my table of contents behave as if I have used \part and \section throughout my document, whilst having used only \section and \subsection, respectively, throughout?

That is, how can I make my ToC behave as in the first picture, and make my document look like the 3rd picture?

  • can you add a MWE please ? what class are you using? – touhami Apr 8 '18 at 19:55
0

How do I make my table of contents behave as if I have used \part and \section throughout my document, whilst having used only \section and \subsection, respectively, throughout?

To do exactly that, you can trick the table of contents into thinking that your section is a part, and your subsection is a section, by putting this into your preamble:

\makeatletter
\let\l@subsection\l@section
\let\l@section\l@part
\makeatother

Which results in this:

\documentclass{amsart}
\usepackage{lipsum}
\makeatletter
\let\l@subsection\l@section
\let\l@section\l@part
\makeatother
\begin{document}
  \tableofcontents
  \section{Looks like part}
  \lipsum[1]
  \subsection{Looks like section}
  \lipsum[2]
\end{document}

The output (mind that I might not have the same formatting options or document class as you do):

Output of TeX code above

Edit: Messed up the order. Fixed now!

  • Thanks, this had the intended effect. I forgot to add the document class I'm using, which is amsart. – Eliot Robinson Apr 8 '18 at 21:03
  • Updated the answer accordingly. – Andreas Storvik Strauman Apr 8 '18 at 21:04

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.