5

The issue is my formatting is set up in a way to state "Chapter [#]: [Section Title]", however because I do not want my abstract, table of contents, etc, to be "Chapter 1: Abstract", I used \section*{Abstract}. The issue with this is now the Abstract won't show up in my table of contents.

Is there any command I can use to just add the abstract (and other \section*{}'s) to my table of contents without removing the *?

  • 3
    One of the most often asked questions ;-) \section*{foo}\addcontentsline{toc}{section}{foo} or use a specialized package for this – user31729 Oct 12 '15 at 20:48
  • Thanks! Guess I didn't google deep enough. Worked like a charm! – Conor Oct 12 '15 at 20:50
  • Alright -- if you have more than just a few \section* this will become tedious however – user31729 Oct 12 '15 at 20:52
  • 1
    If you are issuing frontmatter, then sections are not numbered and their titles will appear in the toc – daleif Oct 12 '15 at 20:53
  • @daleif: That's true for memoir, but not for book etc. – user31729 Oct 12 '15 at 20:59
6

Assuming that you use report or book, you can set \setcounter{secnumdepth}{-1} so that no chapters, sections, etc are numbered, but they are included in toc. If you want roman page numbering too, add \pagenumbering{roman} additionally.

\documentclass{report}
%\documentclass{book}
\begin{document}
  %\frontmatter                  % for book class only
  %\setcounter{secnumdepth}{0}   % for book class only
  %\pagenumbering{roman}  
\setcounter{secnumdepth}{-1}
  \tableofcontents

  \chapter{Some}
  \section{some section}
\end{document}

enter image description here

When you are done, you have to restore numbering by issuing, \setcounter{secnumdepth}{3} say. From that point onwards the numbers come back up to subsubsection. For the levels here is a screen shot from memoir manual

enter image description here

(Ignore \book if not using memoir).

Or use memoir that has many built in facilities.

3

The usual way to add something to the ToC is to use -- attention -- \addcontentsline ;-)

Depending on the desired indentation in the ToC, use either

\addcontentsline{toc}{chapter}{\abstractname} 

or

\addcontentsline{toc}{section}{\abstractname}

If an 'outstanding' abstract should be typeset with a \section* or \chapter* structuring unit, it might look better to use chapter formatting for the ToC instead of the indented section usage.

\documentclass{book}

\usepackage{blindtext}
\usepackage{hyperref}

\newcommand{\abstractname}{Abstract}

\begin{document}
\tableofcontents
\blindtext[5]


\section*{\abstractname}
\addcontentsline{toc}{chapter}{\abstractname} % Or use \addcontentsline{toc}{section}{\abstractname} for section indentation in ToC!
\blindtext[5]

\chapter{Real chapter}
\blindtext[5]




\end{document}

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.