GeneralWriting Author's Name in the TableofContents

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
tacio
Posts: 2
Joined: Fri Apr 18, 2008 11:50 pm

Writing Author's Name in the TableofContents

Post by tacio »

Please, Anybody knows how to Write the Author's Name in the TableofContents?

I was trying to do something like that is showed bellow...

\def\@chapter[#1]#2{%
\ifnum \c@secnumdepth >\m@ne
\refstepcounter{chapter}
\typeout{\@chapapp\space\thechapter.} %
\addcontentsline{toc}{chapter}{\protect\numberline{\thechapter}#1}%
%%% \addcontentsline{toc}{chapter}{\@author} (the author's name enter here, would be something like that?)
\else

\fi
\chaptermark{#1}%
\addtocontents{lof}{\protect\addvspace{10pt}}%
\addtocontents{lot}{\protect\addvspace{10pt}}%
\if@twocolumn
\@topnewpage[\@makechapterhead{#2}]%
\else
\@makechapterhead{#2}\@afterheading
\fi

Thanks in advance!

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

Writing Author's Name in the TableofContents

Post by Stefan Kottwitz »

Hi tacio,

welcome to the LaTeX Community board!
Why not this way or similar. Try this example:

Code: Select all

\documentclass[a4paper,10pt]{report}
\title{Test}
\author{Anonymous}
\begin{document}
\makeatletter
\addtocontents{toc}{\protect\contentsline{chapter}{\@author}{}}
\makeatother
\maketitle
\tableofcontents
\chapter{Test}
\section{Section}
\end{document}
Stefan
tacio
Posts: 2
Joined: Fri Apr 18, 2008 11:50 pm

Re: Writing Author's Name in the TableofContents

Post by tacio »

It worked, thanks a lot!
Post Reply