How to number \addcontentsline?

5,400 views
Skip to first unread message

PanDemic

unread,
Apr 16, 2007, 8:52:25 AM4/16/07
to LaTeX Users Group
Hi,

I am using the article documentclass, and have used the following to
have the list of references added to the toc:

\clearpage
\bibliography{../Artikler/cite}
\addcontentsline{toc}{section}{Referanser}

The references is placed after the \appendix. However, even if placed
before it, the entry is not numbered. Why is that? And what can I do
about it?

I feel it is kinda strange that the list of references is not numbered
as everything else in the toc either has a roman or a arabic index
number.

Hope someone can help, as all help files I have come across for
\addcontentsline does not mention numbering at all.

Regards,
Pan

Message has been deleted
Message has been deleted

Werner Grundlingh

unread,
Apr 16, 2007, 12:15:22 PM4/16/07
to LaTeX Users Group
Try using
\addcontentsline{toc}{section}{%
\protect\numberline{\thesection}%
Referanser}%
which should add the appropriate sectional number to your References
in the Table of Contents.

PanDemic

unread,
Apr 19, 2007, 11:03:09 AM4/19/07
to LaTeX Users Group
Thanks for you suggestion, but still no number there - not in the toc,
nor in the section headline itself.

Anyone have any other suggestion? This has got be an issue solved
hundreds of times.. right?

Pan

shamot

unread,
May 20, 2007, 12:09:33 PM5/20/07
to LaTeX Users Group
Hi,

I had the same problem. I manage to solve it by adding
\section{Referenser} just after \begin{thebibliography}{77}.

Regards, shamot

Werner

unread,
May 20, 2007, 7:16:11 PM5/20/07
to LaTeX Users Group
If you wish to have BOTH the section headline AND the table of
contents entry to have a number, the following worked for me:

\def\thebibliography#1{\section{References}%
\markboth{References}{References}
\list{[\arabic{enumi}]}{\settowidth\labelwidth{[#1]}\leftmargin
\labelwidth
\advance\leftmargin\labelsep
\usecounter{enumi}}
\def\newblock{\hskip .11em plus .33em minus .07em}
\sloppy\clubpenalty4000\widowpenalty4000
\sfcode`\.=1000\relax}

Thereby you redefine the 'thebibliography' environment to actually act
just like a section. And because sections are included with the
appropriate sectional numbers in the table of contents, there should
be no problem. My minimal example that worked with this new definition
of 'thebibliography' environment is:

\documentclass{article}

\def\thebibliography#1{\section{References}%
\markboth{References}{References}
\list{[\arabic{enumi}]}{\settowidth\labelwidth{[#1]}\leftmargin
\labelwidth
\advance\leftmargin\labelsep
\usecounter{enumi}}
\def\newblock{\hskip .11em plus .33em minus .07em}
\sloppy\clubpenalty4000\widowpenalty4000
\sfcode`\.=1000\relax}

\pagestyle{myheadings}

\begin{document}
\tableofcontents
\section{Introduction}
\section{Another section}

\clearpage

\begin{thebibliography}{x}
\bibitem{ref1} reference 1
\bibitem{ref2} reference 2
\bibitem{ref3} reference 3
\end{thebibliography}

\end{document}

Werner

Reply all
Reply to author
Forward
0 new messages