我有以下乳胶代码来获取“普通”页面顶部和章节开头底部的页码。
\documentclass[pdftex,a4paper,11pt,parskip=half,twoside,headings=normal, headsepline,numbers=noenddot,openright, BCOR=5mm, toc=bibliography]{scrbook}
\usepackage{makeidx}
\makeindex
\usepackage{lipsum}
\usepackage{scrpage2}
\pagestyle{scrheadings}
\clearscrheadfoot
\ohead{\pagemark}
\ihead{\headmark}
\deftripstyle{ChapterStyle}{}{}{}{}{\pagemark}{}
\renewcommand*{\chapterpagestyle}{ChapterStyle}
\begin{document}
\chapter{one}
\lipsum
\index{first}\index{second}
\cleardoublepage
\chapter{two}
\lipsum\index{third}
\cleardoublepage
\printindex
\end{document}
问题出在第一个索引页上。在那里,我没有在底部看到页码。我该如何解决这个问题?
答案1
您还必须重新定义\indexpagestyle
。使用
\renewcommand*{\indexpagestyle}{ChapterStyle}
请注意,该包scrpage2
已弃用。后继者是包scrlayer-scrpage
\documentclass[pdftex,a4paper,11pt,parskip=half,twoside,
headings=normal, headsepline,numbers=noenddot,open=right,
BCOR=5mm, toc=bibliography]{scrbook}
\usepackage{makeidx}
\makeindex
\usepackage{lipsum}
\usepackage{scrlayer-scrpage}
\clearpairofpagestyles
\ohead{\pagemark}
\ihead{\headmark}
\newpairofpagestyles{ChapterStyle}{%
\KOMAoptions{headsepline=false}
\cfoot{\pagemark}
}
\renewcommand*{\chapterpagestyle}{ChapterStyle}
\renewcommand*{\indexpagestyle}{ChapterStyle}
\begin{document}
\chapter{one}
\lipsum
\index{first}\index{second}
\cleardoublepage
\chapter{two}
\lipsum\index{third}
\cleardoublepage
\printindex
\end{document}
在您的 MWE 中,没有其他页面使用 pagestyle ,这是和plain
的默认设置。在这种情况下,您也可以使用\chapterpagestyle
\indexpagestyle
\documentclass[pdftex,a4paper,11pt,parskip=half,twoside,
headings=normal, headsepline,numbers=noenddot,open=right,
BCOR=5mm, toc=bibliography]{scrbook}
\usepackage{makeidx}
\makeindex
\usepackage{lipsum}
\usepackage{scrlayer-scrpage}
\clearpairofpagestyles
\ohead{\pagemark}
\ihead{\headmark}
\cfoot[\pagemark]{}% pagenumber in the foot on plain pages
\begin{document}
\chapter{one}
\lipsum
\index{first}\index{second}
\cleardoublepage
\chapter{two}
\lipsum\index{third}
\cleardoublepage
\printindex
\end{document}