我正在使用 TexShop 4.27。我对索引首页上的页码有疑问

我正在使用 TexShop 4.27。我对索引首页上的页码有疑问

我正在使用文档类 scrbook。我的书中有四个索引。我希望索引出现在目录中。因此我为此使用了 \chapter 命令。但是我在每个索引的第一页上都得到了页码,而这并不是我想要的。我该如何避免这个数字?

\documentclass[11pt,english]{scrbook}

\renewcommand*{\chaptermarkformat}{}
\renewcommand*\chapterpagestyle{empty}

\setkomafont{subsection}{\Large\bfseries}
\setkomafont{subsubsection}{\large\bfseries}

\addtokomafont{disposition}{\rmfamily}

\usepackage{xunicode}
\usepackage{xltxtra}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setmainfont{Gentium Plus}

\usepackage{imakeidx}
\makeindex[name=authors,title=Index of Authors]
\makeindex[name=texts,title=Index of Texts]
\makeindex[name=words,columns=3,title=Index of Words]
\makeindex[name=genres,title=Index of Genres]

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead{} % clear all header fields
\fancyhead[RO,LE]{\thepage}
\fancyhead[CE]{\textbf{Milking the Wish-fulfilling Cow}}
\fancyhead[CO]{\nouppercase{\leftmark}}
\renewcommand{\sectionmark}[1]{%
\markboth{#1}{}}
\fancyhead[RE,LO]{}
\fancyfoot{} % clear all footer fileds

\begin{document}

\chapter{Indexes}
\printindex[genres]
\thispagestyle{empty}
\printindex[authors]
\thispagestyle{empty}
\printindex[texts]
\thispagestyle{empty}
\printindex[words]
\thispagestyle{empty}

\end{document}

答案1

要将第一个索引页的页面样式更改为,empty您可以使用

\indexsetup{firstpagestyle=empty}

例子:

\documentclass{scrbook}
\usepackage{lipsum}% only for dummy text
%\renewcommand*{\chaptermarkformat}{}% does not have an affect if fancyhdr is used
\renewcommand*\chapterpagestyle{empty}

\setkomafont{subsection}{\Large\bfseries}
\setkomafont{subsubsection}{\large\bfseries}

\addtokomafont{disposition}{\rmfamily}

\usepackage{fontspec}% <- changed
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setmainfont{Gentium Plus}

\usepackage{imakeidx}
\indexsetup{firstpagestyle=empty}% <=== first page of an index should use page style empty
\makeindex[name=authors,title=Index of Authors]
\makeindex[name=texts,title=Index of Texts]
\makeindex[name=words,columns=3,title=Index of Words]
\makeindex[name=genres,title=Index of Genres]

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{} % clear all header and footer fields
\fancyhead[RO,LE]{\thepage}
\fancyhead[CE]{\textbf{Milking the Wish-fulfilling Cow}}
\fancyhead[CO]{\nouppercase{\leftmark}}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}% added
\renewcommand{\sectionmark}[1]{\markboth{#1}{}}


\begin{document}

\chapter{Foo}
\lipsum[1-20]% dummy text to get some pages in the chapter
\section{Bar}
\lipsum[21-30]% dummy text to get some pages in the section

% dummy index entries:
\index[authors]{Author}
\index[texts]{Text}
\index[words]{Word}
\index[genres]{Genre}

\chapter{Indexes}
\printindex[genres]
\lipsum% dummy text to get some pages in the index
\printindex[authors]
\lipsum% dummy text to get some pages in the index
\printindex[texts]
\lipsum% dummy text to get some pages in the index
\printindex[words]
\lipsum% dummy text to get some pages in the index
\end{document}

但我建议使用scrlayer-scrheadings带有 KOMA-Script 类的 KOMA-Script 包:

\documentclass{scrbook}
\usepackage{lipsum}% only for dummy text
\renewcommand*{\chaptermarkformat}{}
\renewcommand*{\sectionmarkformat}{}
\renewcommand*\chapterpagestyle{empty}

\setkomafont{subsection}{\Large\bfseries}
\setkomafont{subsubsection}{\large\bfseries}

\addtokomafont{disposition}{\rmfamily}

\usepackage{fontspec}% <- changed
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setmainfont{Gentium Plus}

\usepackage{imakeidx}
\indexsetup{firstpagestyle=empty}% <=== first page of an index should use page style empty
\makeindex[name=authors,title=Index of Authors]
\makeindex[name=texts,title=Index of Texts]
\makeindex[name=words,columns=3,title=Index of Words]
\makeindex[name=genres,title=Index of Genres]

\usepackage[headsepline]{scrlayer-scrpage}% sets page style scrheadings automatically
\automark{chapter}
\automark*{section}
\clearmainofpairofpagestyles % clear all header and footer fields for scrheadings
\ohead{\pagemark}
\cehead{\textbf{Milking the Wish-fulfilling Cow}}
\cohead{\leftmark}

\begin{document}

\chapter{Foo}
\lipsum[1-20]% dummy text to get some pages in the chapter
\section{Bar}
\lipsum[21-30]% dummy text to get some pages in the section

% dummy index entries:
\index[authors]{Author}
\index[texts]{Text}
\index[words]{Word}
\index[genres]{Genre}

\chapter{Indexes}
\printindex[genres]
\lipsum% dummy text to get some pages in the index
\printindex[authors]
\lipsum% dummy text to get some pages in the index
\printindex[texts]
\lipsum% dummy text to get some pages in the index
\printindex[words]
\lipsum% dummy text to get some pages in the index
\end{document}

但您也可以将plain样式重新定义为空:

\documentclass{scrbook}
\usepackage{lipsum}% only for dummy text
\renewcommand*{\chaptermarkformat}{}
\renewcommand*{\sectionmarkformat}{}

\setkomafont{subsection}{\Large\bfseries}
\setkomafont{subsubsection}{\large\bfseries}

\addtokomafont{disposition}{\rmfamily}

\usepackage{fontspec}% <- changed
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setmainfont{Gentium Plus}

\usepackage{imakeidx}
\makeindex[name=authors,title=Index of Authors]
\makeindex[name=texts,title=Index of Texts]
\makeindex[name=words,columns=3,title=Index of Words]
\makeindex[name=genres,title=Index of Genres]

\usepackage[headsepline]{scrlayer-scrpage}% sets page style scrheadings automatically
\automark{chapter}
\automark*{section}
\clearpairofpagestyles % clear all header and footer fields for scrheadings and plain
\ohead{\pagemark}
\cehead{\textbf{Milking the Wish-fulfilling Cow}}
\cohead{\leftmark}

\begin{document}

\chapter{Foo}
\lipsum[1-20]% dummy text to get some pages in the chapter
\section{Bar}
\lipsum[21-30]% dummy text to get some pages in the section

% dummy index entries:
\index[authors]{Author}
\index[texts]{Text}
\index[words]{Word}
\index[genres]{Genre}

\chapter{Indexes}
\printindex[genres]
\lipsum% dummy text to get some pages in the index
\printindex[authors]
\lipsum% dummy text to get some pages in the index
\printindex[texts]
\lipsum% dummy text to get some pages in the index
\printindex[words]
\lipsum% dummy text to get some pages in the index
\end{document}

相关内容