目录中的页码

目录中的页码

我写论文时遇到了几个问题。表格和形状列表的页码不正确。例如,如果表格列表包含两页,目录中会出现第二个页码,但我不知道原因。我使用

\tableofcontents
\addcontentsline{toc}{chapter}{\numberline{}Contents}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\thispagestyle{plain}
\begin{flushleft}
\textbf{\LARGE List of Symbols} 
\end{flushleft}
\addcontentsline{toc}{chapter}{\numberline{}List of Symbols}
\begin{tabular}{l}
nbm;lkhj\\
ghjkkllkl\\
\end{flushleft}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newpage
\thispagestyle{plain}
\begin{flushleft}
\textbf{\LARGE Abbreviations}
\end{flushleft}
\addcontentsline{toc}{chapter}{\numberline{}List of Abbreviations}
\begin{tabular}{l}
ghjkllllll\\
fdfghjkllll\\
ffghjkjkkkkk
\end{tabular}

\listoftables
\addcontentsline{toc}{chapter}{\numberline{}List of Tables}
\listoffigures
\addcontentsline{toc}{chapter}{\numberline{}List of Figures}
\clearpage

The other problem appears in the header of the list of icons (consisting of two or more pages) the name of the table of contents. I use

\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markright{\chaptername\ \thechapter.\ #1}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}{}}
\lhead[\fancyplain{}{}]%
      {\fancyplain{}{\bfseries\rightmark}}
\chead[\fancyplain{}{}]%
      {\fancyplain{}{}}
\rhead[\fancyplain{}{}]%
     {\fancyplain{}{}}
\cfoot[\fancyplain{}{}]%
      {\fancyplain{}{}}
\cfoot[\fancyplain{}{}]
      {\fancyplain{}{\bfseries\thepage}}

我需要帮助

答案1

正如我向您承诺的那样,这是一个完整的最小工作示例,可以满足您的愿望。请记住,它可能与您想要的略有不同,但您可以非常轻松地进行更改。

请注意,您必须编译两次在查看文档之前。

我已经使用该glossaries包来帮助解决缩写问题。

输出

\documentclass{book}

\usepackage{graphicx}   % For sample images
\usepackage{fancyhdr}
\usepackage[colorlinks]{hyperref}
\usepackage[acronym, toc, section = section]{glossaries}

% Add the abbreviations:
\newacronym{ny}{NY}{New York}
\newacronym{la}{LA}{Los Angeles}

\makenoidxglossaries % Need this!

\let\cleardoublepage\clearpage % Removes the empty page between chapters

% fancy header stuff:
\renewcommand{\chaptermark}[1]{\markright{\chaptername\ \thechapter.\ #1}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}{}}

\lhead[\fancyplain{}{}]%
      {\fancyplain{}{\bfseries\rightmark}}
\chead[\fancyplain{}{}]%
      {\fancyplain{}{}}
\rhead[\fancyplain{}{}]%
     {\fancyplain{}{}}
\cfoot[\fancyplain{}{}]%
      {\fancyplain{}{}}
\cfoot[\fancyplain{}{}]
      {\fancyplain{}{\bfseries\thepage}}

\begin{document}
    \tableofcontents
    \clearpage
    % Add the abstract here
    \addcontentsline{toc}{chapter}{Abstract}
    \chapter*{Abstract}
    Abstract here!!!
    \clearpage
    % Add the declaration here
    \addcontentsline{toc}{chapter}{Declaration}
    \chapter*{Declaration}
    Declaration here!!!
    \clearpage

    % Add the list of symbols
    \chapter*{List of Symbols}
    \addcontentsline{toc}{chapter}{List of Symbols}
    \begin{tabular}{cp{0.75\textwidth}}
        $x$ & x variable \\
        $y$ & y variable \\
        $z$ & z variable \\
    \end{tabular}

    % Add the list of abbreviations
    \setglossarysection{chapter}
    \printnoidxglossary[title={Abbreviations}, type = acronym]%

    % Add the list of figures
    \addcontentsline{toc}{chapter}{\listfigurename}
    \listoffigures
    \clearpage

    % Add the list of tables
    \addcontentsline{toc}{chapter}{\listtablename}
    \listoftables
    \clearpage


    % Start actual content.
    \pagestyle{fancy}
    \chapter{Introdution}
    Here are the abbreviations we have: \gls{ny}, \gls{la}.
    Now, they will be used again: \gls{ny}, \gls{la}.\\
    Next we have the first table:
    \begin{table}[!htb]
        \centering
        \begin{tabular}{|ccc|}\hline
            1 & 2 & 3\\\hline
            4 & 5 & 6\\\hline
            7 & 8 & 9\\\hline
        \end{tabular}
        \caption{Our first table in the book.}
    \end{table}
    Then, our first figure:
    \begin{figure}[!htb]
        \centering
        \includegraphics[scale=0.1]{example-image-a}
        \caption{Our first figure in the book.}
    \end{figure}

    We add our second table:
    \begin{table}[!htb]
        \centering
        \begin{tabular}{|ccc|}\hline
            11 & 22 & 33\\\hline
            44 & 55 & 66\\\hline
            77 & 88 & 99\\\hline
        \end{tabular}
        \caption{Our second table in the book.}
    \end{table}

    Finally, we add the second figure:
    \begin{figure}[!htb]
        \centering
        \includegraphics[scale=0.1]{example-image-b}
        \caption{Our second figure in the book.}
    \end{figure}
\end{document}

相关内容