I'm struggeling a little bit with the display of table of contents. I had previously a problem using natbib , and now the same issue with listings. Maybe I'm mixing something up with documentclass article and how to reat it.

That's a sample stating the issue:

\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}
\usepackage{hyperref}
\hypersetup{%
pdfborder = {0 0 0}
}
%\usepackage{url}
\sloppy

\makeindex

\setlength{\unitlength}{1cm}
\setlength{\oddsidemargin}{0.3cm}
\setlength{\evensidemargin}{0.3cm}
\setlength{\textwidth}{15.5cm}
\setlength{\topmargin}{-1.2cm}
\setlength{\textheight}{23cm}
\columnsep 0.5cm

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

\begin{document}

%%%%%%%%%%

\normalsize

%%%%%%%%%%
\pagestyle{plain}
\pagenumbering{arabic}
\setcounter{page}{3}
\tableofcontents
\cleardoublepage

%%%%%%%%%%%

\cleardoublepage
%\phantomsection

%\nocite{*}
%\bibliographystyle{plainnat}
%\setlength{\bibsep}{3mm}

\lstset{language=[Objective]C, breakindent=20pt, breaklines, tabsize=1,
caption={Change Identifiers}}
\small
\begin{lstlisting}

- (void) myMethod
{
NSLog(@"Hello there");
}

\end{lstlisting}

\cleardoublepage
\lstlistoflistings
%\interlinepenalty=100

%%%%%%%%%%%
\newpage
\pagestyle{empty}
\centering

\

\end{document}


The Listings is dipslayed as Listings1, but the pagenumber should be right aligned. Can someone point me to the solution, or what I'm doing wrong?

-
Your example is using the report documentclass. Also, compiling your example as-is shows Contents with an entry for the (List of) Listings. T he provided listing has the appropriate page number (5) right aligned, similar to the Contents. Perhaps the above example does not duplicate your problem? –  Werner Aug 23 '11 at 19:51
Hey Werner, I'm sorry I was messing around figuring out the problem, indee changing the document to report, the listing is displayed correct in the TOC, but my actual document uses article sorry for the confusion! –  80leaves Aug 23 '11 at 20:20

\addcontentsline{toc}{chapter}{Listings}


you can use

\addcontentsline{toc}{section}{\protect\numberline{1}{Listings}}


to produce a section-like entry with the listing number and the page number, or

\addcontentsline{toc}{section}{\protect\numberline{}{Listings}}


if you don't want the listing number to appear, but you want to preserve the indentation of an section-like entry, or

\addcontentsline{toc}{section}{Listings}


if you don't want the listing number nor the indentation. A little example showing the three options:

\documentclass{article}

\begin{document}
\tableofcontents

P.S.: note that the article document class doesn't support chapter-like sectional units.