6

I am writing a report using lncs package. In my table of contents, the title of the page and author's name is also appearing. How do i remove this?

\title{Evaluation of xyz}
\author{Alina}
\institute{University}
\setcounter{tocdepth}{3}
\begin{document}
\maketitle
\begin{abstract}
\end{abstract}
\tableofcontents

Above is the code I have written and in the picture you could see the result. I want to remove the title & author from table of contents and start it from introduction. enter image description here

Arash Esbati
  • 7,416
Alina
  • 115
  • Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – Runar Jul 06 '16 at 07:02
  • 2
    When publishing with Springer, changing the layout is not your decision. If not publishing with Springer, why use their style at all? It will just give you troubles. – Johannes_B Jul 06 '16 at 08:58

1 Answers1

4

This will do the job:

\documentclass{llncs}
\usepackage{lipsum}

\title{Evaluation of xyz}
\author{Alina}
\institute{University}
\setcounter{tocdepth}{3}
\begin{document}
\let\oldaddcontentsline\addcontentsline
\def\addcontentsline#1#2#3{}
\maketitle
\def\addcontentsline#1#2#3{\oldaddcontentsline{#1}{#2}{#3}}

\begin{abstract}
\end{abstract}
\tableofcontents
\section{Introduction}
\lipsum
\end{document}

Note: The title is added to table of contents via \addcontentsline{}{}{} command in the definition of \maketitle of llncs class file. Hence, if you need to remove it, I have stored the definition of \addcontentsline to a temporary control sequence \oldaddcontentsline using \let. After \maketitle, the original definition is restored.

Edit: An easy alternative solution is to redefine \addcontentsline within a group for \maketitle:

\documentclass{llncs}
\usepackage{lipsum}

\title{Evaluation of xyz}
\author{Alina}
\institute{University}
\setcounter{tocdepth}{3}
\begin{document}
{\def\addcontentsline#1#2#3{}\maketitle}

\begin{abstract}
\end{abstract}
\tableofcontents
\section{Introduction}
\lipsum
\end{document}
Jagath
  • 4,287
  • 1
    I don't think you need to store and restore the command. Just put it within {} and it will keep it local. like this: {\let\addcontentsline\relax \maketitle} – Runar Jul 06 '16 at 07:16
  • @RunarTrollet Yea. I missed that :-) Will that work if it is relaxed? You need to \@gobble it. – Jagath Jul 06 '16 at 07:19
  • @JagathAR No, \relax will work just fine. \@gobble I think would be dangerous here, as it only throws away one argument. I am not quite sure, though. see http://tex.stackexchange.com/questions/85796/why-does-gobble-take-one-argument – Runar Jul 06 '16 at 07:29
  • @RunarTrollet It should not be {\let\addcontentsline\relax \maketitle} instead {\def\addcontentsline#1#2#3{}\maketitle}. Sorry \@gobble will also cause problem. – Jagath Jul 06 '16 at 08:19
  • 1
    @Jagath: The scoped solution given here in your final comment is much neater than the one you present in your answer. Would you consider updating the answer accordingly? – Cryptographeur Nov 10 '16 at 11:22
  • 1
    @figlesquidge: Updated the answer. – Jagath Nov 11 '16 at 06:07