GeneralAdd Stuff to ToC

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
xiaodang
Posts: 2
Joined: Sat Feb 04, 2012 8:06 am

Add Stuff to ToC

Post by xiaodang »

Hi all,

I have a problem when making the table of contents. I want to add the author below the section title, but it doesn't work.

Code: Select all

\documentclass[12pt]{article}

\begin{document}
\tableofcontents
\addcontentsline{toc}{section}{This Is the First Section}
\addtocontents{toc}{\textit{the author}}   % error here

\section{Anther Section}
\end{document}
Thanks in advance for any suggestions.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Stefan Kottwitz
Site Admin
Posts: 10348
Joined: Mon Mar 10, 2008 9:44 pm

Add Stuff to ToC

Post by Stefan Kottwitz »

Hi xiaodang,

welcome to the board!

Nice complete minimal example. You can fix it by adding \par:

Code: Select all

\addtocontents{toc}{\textit{the author}\par}
Stefan
LaTeX.org admin
xiaodang
Posts: 2
Joined: Sat Feb 04, 2012 8:06 am

Add Stuff to ToC

Post by xiaodang »

Thanks so much! It works well now.
Stefan_K wrote:Hi xiaodang,

welcome to the board!

Nice complete minimal example. You can fix it by adding \par:

Code: Select all

\addtocontents{toc}{\textit{the author}\par}
Stefan
Post Reply