TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I added my BibTeX references following:

\cleardoublepage
\phantomsection

\nocite{*}
\bibliographystyle{plainnat} 
%\setlength{\bibsep}{3mm} 
\addcontentsline{toc}{chapter}{References}
\bibliography{bibliography}

but within my ToC the style is not adapted and the page numbering not aligned

The output looks like:

TOC excerpt

but References should be formated like Conclusion, including the chapter number and page number aligned right. How can I adjust the style of the added chapter to be formatted appropriate?

Here's a working example that illustrates it

\documentclass
[
a4paper,
english,
twoside,
11pt
]
{article}

\usepackage[pdftex]{graphicx}
\usepackage{float}           
\usepackage{amstext}         
\usepackage{enumerate}        
\usepackage[bottom]{footmisc} 
\usepackage{array}            
\usepackage{ntheorem}
\usepackage{theorem}
\usepackage{pdfpages}         
\usepackage{parskip}          
\usepackage{xcolor}           
\usepackage[hyphens]{url}     
\usepackage{makeidx}          
\usepackage{multicol}         
\usepackage[numbers, square]{natbib}  
\usepackage{listings}

\makeindex 

\begin{document}

\tableofcontents % ToC

% add odd sections to illustrate
\section{chapter 1}
\section{chapter 2}
\section{chapter 3}
\subsection{chapter 3.1}
\subsection{chapter 3.2}
\section{chapter 4}

\renewcommand{\bibsection}{\chapter{\bibname}}

% add chapter for references
\addcontentsline{toc}{chapter}{References}


\end{document}

The output in ToC is still References1, but the page number should be aligned right.

share|improve this question

migrated from stackoverflow.com Aug 21 '11 at 11:36

This question came from our site for professional and enthusiast programmers.

    
Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem so other users can reproduce the problem easily and accurately. – doncherry Aug 21 '11 at 12:59
up vote 8 down vote accepted

Since you are using natbib, which I guess from the style plainnat, I recommend redefining \bibsection in your preamble, instead of using \addcontentsline in the document:

\renewcommand{\bibsection}{\chapter{\bibname}}

Originally \bibsection uses \chapter* which doesn't create a TOC entry, in contrast to \chapter.

If you use a class without chapters, such as article, define it using \section and possibly \refname:

\renewcommand{\bibsection}{\section{\refname}}

With your minimal example, I got:

natbib section example

share|improve this answer
    
thats amazing! Thanks a lot! – 80leaves Aug 21 '11 at 14:24
2  
@80leaves The bibliography won't be numbered if it's put after \backmatter in the book class. – egreg Oct 30 '11 at 11:59
    
This makes the bibliography receive an appendix letter if it appears after an \appendix command. How can this be avoided? – oarfish Sep 18 '15 at 14:34
    
@oarfish That's the way \appendix works - following chapters get a letter instead of a number. But it depends on the class. Perhaps ask this as a new question. – Stefan Kottwitz Sep 18 '15 at 15:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.