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

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
Stefan Kottwitz
Site Admin
Posts: 10360
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