General ⇒ Writing Author's Name in the TableofContents
Writing 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!
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
- Stefan Kottwitz
- Site Admin
- Posts: 10335
- Joined: Mon Mar 10, 2008 9:44 pm
Writing Author's Name in the TableofContents
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}