目录有问题,包括章节/小节

目录有问题,包括章节/小节

我正在尝试使用为我拥有的所有章节和小节创建文档索引\tableofcontents,但我不明白为什么我遇到两个问题......

我的索引页中有此代码

\newpage 
\tableofcontents

第一个问题)但是这只显示了关系的标题和作者姓名,我不希望这些信息出现在我的索引中,我该如何解决这个问题?

在此处输入图片描述

我不想看到红圈里的文字(标题和作者)......


固定的第二个问题)我想将我的章节和小节添加到索引中,我读到我必须在每个章节/小节下使用

\addcontentsline{toc}{section/subsection}{name of section/subsection}

因此,我将其添加到我的简介部分下,如下所示

\newpage
\section{Intro}
\labelsec{Intro}
\addcontentsline{toc}{section}{Intro}

但是我的\tableofcontents没有改变,它只显示我的关系的标题...我阅读了有关这些问题的各种问题,但没有解决方案解决我的问题。

第二个问题的解决方法:我\setcounter{secnumdepth}{3}\setcounter{tocdepth}{3}\begin{document}

这是完整的代码(不包含部分文字)

\documentclass{llncs}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% package sillabazione italiana e uso lettere accentate
\usepackage[T1]{fontenc}
\usepackage[italian]{babel}
\usepackage[utf8]{inputenc}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{url}
\usepackage{xspace}

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage{manifest}

\makeatother

\usepackage{enumitem} %%per elenchi puntati

\usepackage{fancyhdr} %%per numero di pagina

%%%%%%%%%%%%%%%%% NUMERO DI PAGINA
\pagestyle{fancy}
\usepackage{lastpage}
\fancyhf{}
\rhead{Relazione progetto di "Ingegneria dei Sistemi Software"}
\rfoot{Page \thepage\ of \pageref{LastPage}}

%%%%%%%
 \newif\ifpdf
 \ifx\pdfoutput\undefined
 \pdffalse % we are not running PDFLaTeX
 \else
 \pdfoutput=1 % we are running PDFLaTeX
 \pdftrue
 \fi
%%%%%%%
 \ifpdf
 \usepackage[pdftex]{graphicx}
 \graphicspath{ {img/} } 
 \else
 \usepackage{graphicx}
 \graphicspath{ {img/} } 
 \fi
%%%%%%%%%%%%%%%
 \ifpdf
 \DeclareGraphicsExtensions{.pdf, .jpg, .tif}
 \else
 \DeclareGraphicsExtensions{.eps, .jpg}
 \fi
%%%%%%%%%%%%%%%

\newcommand{\java}{\textsf{Java}}
\newcommand{\contact}{\emph{Contact}}
\newcommand{\corecl}{\texttt{corecl}}
\newcommand{\medcl}{\texttt{medcl}}
\newcommand{\msgcl}{\texttt{msgcl}}
\newcommand{\android}{\texttt{Android}}
\newcommand{\dsl}{\texttt{DSL}}
\newcommand{\jazz}{\texttt{Jazz}}
\newcommand{\rtc}{\texttt{RTC}}
\newcommand{\ide}{\texttt{Contact-ide}}
\newcommand{\xtext}{\texttt{XText}}
\newcommand{\xpand}{\texttt{Xpand}}
\newcommand{\xtend}{\texttt{Xtend}}
\newcommand{\pojo}{\texttt{POJO}}
\newcommand{\junit}{\texttt{JUnit}}

\newcommand{\action}[1]{\texttt{#1}\xspace}
\newcommand{\code}[1]{{\small{\texttt{#1}}}\xspace}
\newcommand{\codescript}[1]{{\scriptsize{\texttt{#1}}}\xspace}

% Cross-referencing
\newcommand{\labelsec}[1]{\label{sec:#1}}
\newcommand{\xs}[1]{\sectionname~\ref{sec:#1}}
\newcommand{\xsp}[1]{\sectionname~\ref{sec:#1} \onpagename~\pageref{sec:#1}}
\newcommand{\labelssec}[1]{\label{ssec:#1}}
\newcommand{\xss}[1]{\subsectionname~\ref{ssec:#1}}
\newcommand{\xssp}[1]{\subsectionname~\ref{ssec:#1} \onpagename~\pageref{ssec:#1}}
\newcommand{\labelsssec}[1]{\label{sssec:#1}}
\newcommand{\xsss}[1]{\subsectionname~\ref{sssec:#1}}
\newcommand{\xsssp}[1]{\subsectionname~\ref{sssec:#1} \onpagename~\pageref{sssec:#1}}
\newcommand{\labelfig}[1]{\label{fig:#1}}
\newcommand{\xf}[1]{\figurename~\ref{fig:#1}}
\newcommand{\xfp}[1]{\figurename~\ref{fig:#1} \onpagename~\pageref{fig:#1}}
\newcommand{\labeltab}[1]{\label{tab:#1}}
\newcommand{\xt}[1]{\tablename~\ref{tab:#1}}
\newcommand{\xtp}[1]{\tablename~\ref{tab:#1} \onpagename~\pageref{tab:#1}}
% Category Names
\newcommand{\sectionname}{Section}
\newcommand{\subsectionname}{Subsection}
\newcommand{\sectionsname}{Sections}
\newcommand{\subsectionsname}{Subsections}
\newcommand{\secname}{\sectionname}
\newcommand{\ssecname}{\subsectionname}
\newcommand{\secsname}{\sectionsname}
\newcommand{\ssecsname}{\subsectionsname}
\newcommand{\onpagename}{on page}

\newcommand{\xauthA}{Nicola Casadei}
\newcommand{\xauthB}{Marco Benedetti}
\newcommand{\xauthC}{Erica Marchi}
\newcommand{\xauthD}{Mattia Ricci}
\newcommand{\xfaculty}{II Faculty Engineering and Informatic Science}
\newcommand{\xunibo}{Alma Mater Studiorum -- University of Bologna}
\newcommand{\xaddrCE}{via Sacchi 3}
\newcommand{\xcityCE}{47023 Cesena, Italy}

%
% Comments
%

%%% \newcommand{\todo}[1]{\bf{TODO:}\emph{#1}}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}


     \begin{document}

        \title{Esame finale A.A. 2016/2017\\
         Ingegneria dei Sistemi Software}

        %%% \author{\xauthA \and \xauthB}
        \author{\xauthA \\ \xauthB \\ \xauthC \\ \xauthD}

        \institute{%
        %%%  \xunibo\\\xaddrCE, \xcityCE\\\email{\{nameA.studentA, nameB.studentB\}@studio.unibo.it}
          \xunibo\\\xaddrCE, \xcityCE\\\email\ [email protected]
        }

        \maketitle

        %==================INDEX
        \newpage 
        \tableofcontents

        \newpage
        \setcounter{page}{1}
        \section{Intro}
        \labelsec{Intro}

        \section{Vision}
        \labelsec{Vision}

        ..... other sections

        \end{document}

如果我必须添加更多代码,请告诉我。提前谢谢!

答案1

\maketitle来自llncs课程自动添加标题和作者姓名ToC

\maketitle可以通过重新定义(这里太长)或修补来防止这种情况:

\usepackage{xpatch}



\makeatletter
\xpatchcmd{\maketitle}{%
  \addtocontents{toc}{\noexpand\protect\noexpand\authcount{\the\c@auco}}%
  \addcontentsline{toc}{author}{\toc@uthor}%
}{% Replace by 'nothing'
}{\typeout{success}}{\typeout{failed}}

\xpatchcmd{\maketitle}{%
  \if!\the\toctitle!\addcontentsline{toc}{title}{\@title}\else
  \addcontentsline{toc}{title}{\the\toctitle}\fi
}{%
  % Replace by nothing
}{\typeout{Success}}{\typeout{Failed patching!}}
\makeatother

代码\addcontentsline从命令中删除...等等\maketitle

此处的\makeatletter...\makeatother配对至关重要,否则修补将失败。

此外,“模板”的设计并不是很好,就像“模板”通常的情况一样。

\documentclass{llncs}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% package sillabazione italiana e uso lettere accentate
\usepackage[T1]{fontenc}
\usepackage[italian]{babel}
\usepackage[utf8]{inputenc}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{url}
\usepackage{xspace}

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
%\usepackage{manifest}

\makeatother

\usepackage{enumitem} %%per elenchi puntati

\usepackage{fancyhdr} %%per numero di pagina

%%%%%%%%%%%%%%%%% NUMERO DI PAGINA
\pagestyle{fancy}
\usepackage{lastpage}
\fancyhf{}
\rhead{Relazione progetto di "Ingegneria dei Sistemi Software"}
\rfoot{Page \thepage\ of \pageref{LastPage}}

%%%%%%%
 \newif\ifpdf
 \ifx\pdfoutput\undefined
 \pdffalse % we are not running PDFLaTeX
 \else
 \pdfoutput=1 % we are running PDFLaTeX
 \pdftrue
 \fi
%%%%%%%
 \ifpdf
 \usepackage[pdftex]{graphicx}
 \graphicspath{ {img/} } 
 \else
 \usepackage{graphicx}
 \graphicspath{ {img/} } 
 \fi
%%%%%%%%%%%%%%%
 \ifpdf
 \DeclareGraphicsExtensions{.pdf, .jpg, .tif}
 \else
 \DeclareGraphicsExtensions{.eps, .jpg}
 \fi
%%%%%%%%%%%%%%%

\newcommand{\java}{\textsf{Java}}
\newcommand{\contact}{\emph{Contact}}
\newcommand{\corecl}{\texttt{corecl}}
\newcommand{\medcl}{\texttt{medcl}}
\newcommand{\msgcl}{\texttt{msgcl}}
\newcommand{\android}{\texttt{Android}}
\newcommand{\dsl}{\texttt{DSL}}
\newcommand{\jazz}{\texttt{Jazz}}
\newcommand{\rtc}{\texttt{RTC}}
\newcommand{\ide}{\texttt{Contact-ide}}
\newcommand{\xtext}{\texttt{XText}}
\newcommand{\xpand}{\texttt{Xpand}}
\newcommand{\xtend}{\texttt{Xtend}}
\newcommand{\pojo}{\texttt{POJO}}
\newcommand{\junit}{\texttt{JUnit}}

\newcommand{\action}[1]{\texttt{#1}\xspace}
\newcommand{\code}[1]{{\small{\texttt{#1}}}\xspace}
\newcommand{\codescript}[1]{{\scriptsize{\texttt{#1}}}\xspace}

% Cross-referencing
\newcommand{\labelsec}[1]{\label{sec:#1}}
\newcommand{\xs}[1]{\sectionname~\ref{sec:#1}}
\newcommand{\xsp}[1]{\sectionname~\ref{sec:#1} \onpagename~\pageref{sec:#1}}
\newcommand{\labelssec}[1]{\label{ssec:#1}}
\newcommand{\xss}[1]{\subsectionname~\ref{ssec:#1}}
\newcommand{\xssp}[1]{\subsectionname~\ref{ssec:#1} \onpagename~\pageref{ssec:#1}}
\newcommand{\labelsssec}[1]{\label{sssec:#1}}
\newcommand{\xsss}[1]{\subsectionname~\ref{sssec:#1}}
\newcommand{\xsssp}[1]{\subsectionname~\ref{sssec:#1} \onpagename~\pageref{sssec:#1}}
\newcommand{\labelfig}[1]{\label{fig:#1}}
\newcommand{\xf}[1]{\figurename~\ref{fig:#1}}
\newcommand{\xfp}[1]{\figurename~\ref{fig:#1} \onpagename~\pageref{fig:#1}}
\newcommand{\labeltab}[1]{\label{tab:#1}}
\newcommand{\xt}[1]{\tablename~\ref{tab:#1}}
\newcommand{\xtp}[1]{\tablename~\ref{tab:#1} \onpagename~\pageref{tab:#1}}
% Category Names
\newcommand{\sectionname}{Section}
\newcommand{\subsectionname}{Subsection}
\newcommand{\sectionsname}{Sections}
\newcommand{\subsectionsname}{Subsections}
\newcommand{\secname}{\sectionname}
\newcommand{\ssecname}{\subsectionname}
\newcommand{\secsname}{\sectionsname}
\newcommand{\ssecsname}{\subsectionsname}
\newcommand{\onpagename}{on page}

\newcommand{\xauthA}{Nicola Casadei}
\newcommand{\xauthB}{Marco Benedetti}
\newcommand{\xauthC}{Erica Marchi}
\newcommand{\xauthD}{Mattia Ricci}
\newcommand{\xfaculty}{II Faculty Engineering and Informatic Science}
\newcommand{\xunibo}{Alma Mater Studiorum -- University of Bologna}
\newcommand{\xaddrCE}{via Sacchi 3}
\newcommand{\xcityCE}{47023 Cesena, Italy}

%
% Comments
%

%%% \newcommand{\todo}[1]{\bf{TODO:}\emph{#1}}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}

\usepackage{xpatch}



\makeatletter
\xpatchcmd{\maketitle}{%
  \addtocontents{toc}{\noexpand\protect\noexpand\authcount{\the\c@auco}}%
  \addcontentsline{toc}{author}{\toc@uthor}%
}{% Replace by 'nothing'
}{\typeout{success}}{\typeout{failed}}

\xpatchcmd{\maketitle}{%
  \if!\the\toctitle!\addcontentsline{toc}{title}{\@title}\else
  \addcontentsline{toc}{title}{\the\toctitle}\fi
}{%
  % Replace by nothing
}{\typeout{Success}}{\typeout{Failed patching!}}
\makeatother

\begin{document}

\title{Esame finale A.A. 2016/2017\\
  Ingegneria dei Sistemi Software}

%%% \author{\xauthA \and \xauthB}
\author{\xauthA \\ \xauthB \\ \xauthC \\ \xauthD}

\institute{%
  %%% \xunibo\\\xaddrCE, \xcityCE\\\email{\{nameA.studentA, nameB.studentB\}@studio.unibo.it}
  \xunibo\\\xaddrCE, \xcityCE\\\email\ [email protected]
}

\maketitle

% ==================INDEX
\newpage 
\tableofcontents

\newpage
\setcounter{page}{1}
\section{Intro}
\labelsec{Intro}

\section{Vision}
\labelsec{Vision}

..... other sections

\end{document}

相关内容