GeneralHaving Problems to Number Setions in Table of Content

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
wtiff3
Posts: 1
Joined: Mon Jun 18, 2007 6:48 pm

Having Problems to Number Setions in Table of Content

Post by wtiff3 »

Hi, I have put the following in my latex file; however, after I add the table of content, the chapters and subsections are all numbered but just the sections are not. Is there anyone who knows what is going on here? Thank you!
The following is my code in the file before \begin{document} which is from a website http://zoonek.free.fr/LaTeX/LaTeX_sampl ... ter/0.html :

\documentclass{sample}
\makeatletter
\def\thickhrulefill{\leavevmode \leaders \hrule height 1ex \hfill \kern \z@}
\def\@makechapterhead#1{%
{\parindent \z@ \raggedright
\reset@font
\hrule
\vspace*{10\p@}%
\par
\Large \scshape \@chapapp{} \Huge\bfseries \thechapter
\par\nobreak
\vspace*{10\p@}%
\hrule
\par
\vspace*{1\p@}%
\hrule
%\vskip 40\p@
\vspace*{20\p@}
\Huge \bfseries #1\par\nobreak
\vskip 70\p@
}}

\def\section#1{%
\par\bigskip\bigskip
\hrule\par\nobreak\noindent
\refstepcounter{section}%
\addcontentsline{toc}{chapter}{#1}%
\reset@font
{ \Large \bfseries
\strut\S \thesection \quad
#1}%
\par
\medskip
}

Recommended reading 2024:

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

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

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Having Problems to Number Setions in Table of Content

Post by localghost »

Looking at the examples, I suggest to use packages like fncychap, sectsty or titlesec (and maybe titletoc) instead.
Post Reply