![抑制词汇表首页上的运行(花式)标题](https://linux22.com/image/286021/%E6%8A%91%E5%88%B6%E8%AF%8D%E6%B1%87%E8%A1%A8%E9%A6%96%E9%A1%B5%E4%B8%8A%E7%9A%84%E8%BF%90%E8%A1%8C%EF%BC%88%E8%8A%B1%E5%BC%8F%EF%BC%89%E6%A0%87%E9%A2%98.png)
在之前的一个问题中,我要求将词汇表标题格式化为与章节标题相匹配,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}