在之前的一个问题中,我要求将词汇表标题格式化为与章节标题相匹配,Nicola Talbot 已经通过以下方式解决了这个问题标题“词汇表”的格式与章节和索引标题相匹配链接,对此我非常感激。然而,另一个小问题出现了,当它完成后,现在运行标题在第一页也显示“词汇表”,而这不应该显示任何内容(就像章节第一页一样)。我已经发布了此代码的 MWE。我需要尽快提交我的论文,这是我正在解决的最后一个问题,非常感谢您的帮助。
\documentclass[12pt]{report}
%%%%%%%%%%%%%% For page header/footer
\usepackage{fancyhdr}
\pagestyle{fancyplain}
\fancyhf{}
\setlength{\headheight}{15pt}
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0pt}
\lhead{\bfseries{\rightmark}}
\rhead{\bfseries{\thepage}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{makeidx}
\usepackage{sectsty}
\allsectionsfont{\bfseries}
\chapterfont{\centering\Large}
\sectionfont{\normalsize}
\subsectionfont{\normalsize}
\usepackage[subfigure]{tocloft}
\usepackage{tocloft}
\renewcommand{\cftchappresnum}{Chapter }
\renewcommand{\cftchapaftersnum}{:}
\renewcommand{\cftchapnumwidth}{7em}
\newcommand*\updatechaptername{%
\addtocontents{toc}{\protect\renewcommand*\protect\cftchappresnum{Appendix }}
}
\makeindex
\usepackage[nogroupskip,nonumberlist,acronym]{glossaries}
\newglossary[slg]{symbolslist}{syi}{syg}{List of Symbols}
\makeglossaries
% Code provided by Nicola Talbot to make heading of List of Acronyms and
% List of Symbols same as heading of List of Tables.
\renewcommand{\glossarysection}[2][\theglstoctitle]{%
\def\theglstoctitle{#2}%
\vspace{\cftbeforelottitleskip}%
\par\noindent
{\cftlottitlefont #2}{\cftafterlottitle}%
\vskip\cftafterlottitleskip
}
% % % % % % % % % % % % Glossary Entries % % % % % % % % % % % %
\newacronym{sa}{SA}{sample acronym}
\newglossaryentry{Pi}{
name=$\pi$,
description={A mathematical constant whose value is the ratio of any circle's circumference to its diameter.},
sort=symbpi, type=symbolslist
}
\newglossaryentry{glos:ia}{
name=Integer Ambiguity,
description={The unknown number of whole carrier phase cycles between the user and the satellite at the start of tracking (Sometimes ambiguity for short).}
}
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
\usepackage{subfigure}
\begin{document}
\tableofcontents
\clearpage
\listoftables
\clearpage
\printglossary[type=\acronymtype,style=long,title=List of Acronyms \& Initialisms]
\clearpage
\printglossary[type=symbolslist,style=long] %Print list of symbols
\include{Sample}
\chapter{Sample}
This is my \gls{sa} and I can use it again. This is a symbol \gls{Pi}. This document\index{document} also has an index\index{index}.
\begin{table}
\caption{Sample Table}
\end{table}
\updatechaptername
\clearpage
\glsaddall
\printglossary[] % Print list of symbols
\clearpage
\printindex
\end{document}
答案1
代码中的注释
\documentclass[12pt]{report}
\usepackage{fancyhdr}
%\pagestyle{fancyplain} %Removed
\pagestyle{fancy} %Added
\fancyhf{}
\setlength{\headheight}{15pt}
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0pt}
\lhead{\bfseries{\rightmark}}
\rhead{\bfseries{\thepage}}
\usepackage{makeidx}
\usepackage{sectsty}
\allsectionsfont{\bfseries}
\chapterfont{\centering\Large}
\sectionfont{\normalsize}
\subsectionfont{\normalsize}
\usepackage[subfigure]{tocloft}
\usepackage{tocloft}
\renewcommand{\cftchappresnum}{Chapter }
\renewcommand{\cftchapaftersnum}{:}
\renewcommand{\cftchapnumwidth}{7em}
\newcommand*\updatechaptername{%
\addtocontents{toc}{\protect\renewcommand*\protect\cftchappresnum{Appendix }}
}
\makeindex
\usepackage[nogroupskip,nonumberlist,acronym]{glossaries}
\newglossary[slg]{symbolslist}{syi}{syg}{List of Symbols}
\makeglossaries
% Code provided by Nicola Talbot to make heading of List of Acronyms and
% List of Symbols same as heading of List of Tables.
\renewcommand{\glossarysection}[2][\theglstoctitle]{%
\def\theglstoctitle{#2}%
\vspace*{\cftbeforelottitleskip}% JB Added an asterisk
\thispagestyle{plain}% Added
\markboth{\MakeUppercase{#2}}{\MakeUppercase{#2}}% Added
\par\noindent%
{\cftlottitlefont #2}{\cftafterlottitle}%
\vskip\cftafterlottitleskip
}
% % % % % % % % % % % % Glossary Entries % % % % % % % % % % % %
\newacronym{sa}{SA}{sample acronym}
\newglossaryentry{Pi}{
name=$\pi$,
description={A mathematical constant whose value is the ratio of any circle's circumference to its diameter.},
sort=symbpi, type=symbolslist
}
\newglossaryentry{glos:ia}{
name=Integer Ambiguity,
description={The unknown number of whole carrier phase cycles between the user and the satellite at the start of tracking (Sometimes ambiguity for short).}
}
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
\usepackage{subfigure}
\begin{document}
\tableofcontents
\clearpage
\listoftables
\clearpage
\printglossary[type=\acronymtype,style=long,title=List of Acronyms \& Initialisms]
\clearpage
\printglossary[type=symbolslist,style=long] %Print list of symbols
\include{Sample}
\chapter{Sample}
This is my \gls{sa} and I can use it again. This is a symbol \gls{Pi}. This document\index{document} also has an index\index{index}.
\begin{table}
\caption{Sample Table}
\end{table}
\updatechaptername
\clearpage
\glsaddall
\printglossary[] % Print list of symbols
\clearpage
\printindex
\end{document}