我在定义索引中的标题时遇到了问题。
在正文中,部分标题和章节标题交替出现在标题中。对于序言(“Vorwort”一章),我重新定义了此行为,只显示章节标题。这是通过添加
\clearpairofpagestyles
\chead{\headmark}
\automark[chapter]{chapter}
\lehead*{\pagemark}
\rohead*{\pagemark}
\setkomafont{pagehead}{\footnotesize\upshape}
在“内容”部分和章节的开始处,将其设置为:
\clearpairofpagestyles
\chead{\headmark}
\automark[chapter]{part}
\lehead*{\pagemark}
\rohead*{\pagemark}
\setkomafont{pagehead}{\footnotesize\upshape}
除索引外,运行完美。索引位于“Anhang”部分,因此不应该在每个索引页上都出现“Register”,而应该交替出现“Anhang”和“Register”。
索引的第一页是使用以下方式配置的
\newpairofpagestyles{IndexStyle}{%
\KOMAoptions{headsepline=false}
}
\renewcommand*{\indexpagestyle}{IndexStyle}
因此,我猜想对于我需要的行为,indexpagestyle 必须以另一种/额外的方式进行编辑,但我不知道如何让它工作......
梅威瑟:
\documentclass[a4paper,fontsize=10pt,numbers=noenddot]{scrbook}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{times}
\usepackage{blindtext}
\usepackage[papersize={210mm,297mm},text={113mm,180mm},inner=77mm,outer=20mm,top=34mm,bottom=83mm]{geometry}
\addtokomafont{disposition}{\rmfamily}
\KOMAoptions{toc=chapterentrydotfill}
\KOMAoptions{headings=optiontohead}
\usepackage[indentunit=0.5em]{idxlayout}
\usepackage{makeidx}
\makeindex
\usepackage{acronym}
\renewcommand*{\aclabelfont}[1]{\textrm{\textrm{\acsfont{#1}}}}
\setcounter{secnumdepth}{5}
\setcounter{tocdepth}{5}
\renewcommand*{\partpagestyle}{empty}
\renewcommand*{\chapterpagestyle}{empty}
\usepackage{scrlayer-scrpage}
\clearpairofpagestyles
\chead{\headmark}
\automark[chapter]{part}
\lehead*{\pagemark}
\rohead*{\pagemark}
\setkomafont{pagehead}{\footnotesize\upshape}
\newpairofpagestyles{IndexStyle}{%
\KOMAoptions{headsepline=false}
}
\renewcommand*{\indexpagestyle}{IndexStyle}
\begin{document}
\clearpairofpagestyles
\chead{\headmark}
\automark[chapter]{chapter}
\lehead*{\pagemark}
\rohead*{\pagemark}
\setkomafont{pagehead}{\footnotesize\upshape}
\addchap[tocentry={}]{Vorwort}
\blindtext
\newpage
\blindtext
\newpage
\blindtext
\newpage
\blindtext
\clearpairofpagestyles
\chead{\headmark}
\automark[chapter]{part}
\lehead*{\pagemark}
\rohead*{\pagemark}
\setkomafont{pagehead}{\footnotesize\upshape}
\renewcommand{\contentsname}{Inhalt}
\tableofcontents
\clearpairofpagestyles
\chead{\headmark}
\automark[chapter]{part}
\lehead*{\pagemark}
\rohead*{\pagemark}
\setkomafont{pagehead}{\footnotesize\upshape}
\part{Part I:lksdjklsdjfjkls...}
\chapter{first chapter}
\blindtext
\newpage
\blindtext
\newpage
\blindtext
\blindtext\index{Aaronsen, John} Other names to be indexed are Mike Arjonen\index{Arjonen, Mike} and Jim Azzz\index{Azzz, Jim}. For B, there are John Baily\index{Baily, John} and Jim Bronson\index{Bronson, Jim}a\index{Bronson, Jim2} b\index{Bronson, Jim3} c\index{Bronson, Jim4}n\index{Bronson, Jim5}k\index{Bronson, Jim6}b\index{Bronson, Jim7}n\index{Bronson, Jim8}b\index{Bronson, Jim9}b\index{Bronson, Jim10}.
\newpage
text Jim Bronson\index{Bronson, Jim11}a\index{Bronson, Jim12} b\index{Bronson, Jim13} c\index{Bronson, Jim14}n\index{Bronson, Jim15}k\index{Bronson, Jim16}b\index{Bronson, Jim17}n\index{Bronson, Jim18}b\index{Bronson, Jim19}b\index{Bronson, Jim20}
\newpage
text Jim Bronson\index{Bronson, Jim21}a\index{Bronson, Jim22} b\index{Bronson, Jim23} c\index{Bronson, Jim24}n\index{Bronson, Jim25}k\index{Bronson, Jim26}b\index{Bronson, Jim27}n\index{Bronson, Jim28}b\index{Bronson, Jim29}b\index{Bronson, Jim30}
\newpage
text Jim Bronson\index{Bronson, Jim31}a\index{Bronson, Jim32} b\index{Bronson, Jim33} c\index{Bronson, Jim34}n\index{Bronson, Jim13}k\index{Bronson, Jim36}b\index{Bronson, Jim37}n\index{Bronson, Jim38}b\index{Bronson, Jim39}b\index{Bronson, Jim40}
\newpage
text Jim Bronson\index{Bronson, Jim41}a\index{Bronson, Jim42} b\index{Bronson, Jim43} c\index{Bronson, Jim44}n\index{Bronson, Jim45}k\index{Bronson, Jim46}b\index{Bronson, Jim47}n\index{Bronson, Jim48}b\index{Bronson, Jim49}b\index{Bronson, Jim50}
\newpage
text Jim Bronson\index{Bronson, Jim51}a\index{Bronson, Jim52} b\index{Bronson, Jim53} c\index{Bronson, Jim54}n\index{Bronson, Jim55}k\index{Bronson, Jim56}b\index{Bronson, Jim57}n\index{Bronson, Jim58}b\index{Bronson, Jim59}b\index{Bronson, Jim60}
\newpage
text Jim Bronson\index{Bronson, Jim61}a\index{Bronson, Jim62} b\index{Bronson, Jim63} c\index{Bronson, Jim64}n\index{Bronson, Jim65}k\index{Bronson, Jim66}b\index{Bronson, Jim67}n\index{Bronson, Jim68}b\index{Bronson, Jim69}b\index{Bronson, Jim70}b\index{Cronson, Jim}b\index{Dronson, Jim}b\index{eronson, Jim}b\index{Fronson, Jim70}b\index{Gronson, Jim70}b\index{Hronson, Jim70}b\index{Ironson, Jim70}b\index{Jronson, Jim70}b\index{Kronson, Jim}\index{Lronson, Jim}\index{Mronson, Jim}\index{Nronson, Jim}\index{Oronson, Jim}\index{Pronson, Jim}\index{Qronson, Jim}\index{Rronson, Jim}\index{Sronson, Jim}\index{Tronson, Jim}\index{Uronson, Jim}\index{Vronson, Jim}\index{Wronson, Jim}\index{Xronson, Jim}\index{Yronson, Jim}\index{Zronson, Jim}\index{Zronson, Jim2}\index{Zronson, Jim3}\index{Zronson, Jim4}\index{Zronson, Jim5}\index{Zronson, Jim6}\index{Zronson, Jim7}\index{Zronson, Jim8}
\part{Anhang}
\renewcommand{\indexname}{Register}
\addcontentsline{toc}{chapter}{Register}
\printindex
\end{document}
注册.ist:
% sty.file for mkidx32.exe - redefines:
quote '+'
%headings_flag 0
headings_flag 1
heading_prefix "{\\textbf "
heading_suffix "}\\nopagebreak%\n \\indexspace\\nopagebreak%"
delim_0 ": "
delim_1 ": "
delim_2 ": "
%delim_r "~--~"
delim_r "-"
%delim_0 "\\dotfill "
%delim_1 "\\dotfill "
%delim_2 "\\dotfill "
%delim_r "~--~"
suffix_2p "\\,f."
suffix_3p "\\,ff."
答案1
不要在文档中设置。我认为不需要额外的页面样式\chead
。也许你想要\ohead*
IndexStyle
\renewcommand{\indexpagestyle}{empty}
使第一个索引页与文档中的部分和章节页面获得相同的页面样式。
对于索引,使用\@mkdouble{\MakeMarkcase{\indexname}}
(KOMA-Script 类)或\@mkboth{\MakeMarkcase{\indexname}}{\MakeMarkcase{\indexname}}
(包)。因此,对于索引,设置为if 选项已设置。请注意,也设置此选项。idxlayout
\leftmark
\rightmark
\indexname
automark
\automark
要改变这种行为,你可以在之前切换到manualmark
(\manualmark
或\KOMAoptions{manualmark}
)\printindex
:
{
\cleardoublepage
\manualmark
\markright{MakeMarkcase{\indexname}}%
\printindex
}
对于索引的 TOC 条目,index=totoc
应该使用 KOMA-Script 选项。
不含不相关的包和设置的示例:
\documentclass[a4paper,fontsize=10pt,numbers=noenddot]{scrbook}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{newtxtext,newtxmath}% <- changed
\usepackage{blindtext}% only for dummy text
\usepackage[inner=77mm,outer=20mm,top=34mm,bottom=83mm]{geometry}
\addtokomafont{disposition}{\rmfamily}
\KOMAoptions{toc=chapterentrydotfill}
\KOMAoptions{headings=optiontohead}
\renewcommand*{\partpagestyle}{empty}
\renewcommand*{\chapterpagestyle}{empty}
\renewcommand*{\indexpagestyle}{empty}
\usepackage{scrlayer-scrpage}
\automark[chapter]{part}
\clearpairofpagestyles
\chead{\headmark}
\ohead*{\pagemark}
\setkomafont{pagehead}{\footnotesize\upshape}
\KOMAoptions{index=totoc}% <- added: TOC entry for index
\usepackage[indentunit=0.5em]{idxlayout}
\usepackage{makeidx}
\makeindex
\renewcaptionname{ngerman}{\indexname}{Register}% <- added (changed and moved to preamble)
\renewcaptionname{ngerman}{\contentsname}{Inhalt}% <- added (changed and moved to preamble)
\begin{document}
{
\automark[chapter]{chapter}
\addchap[tocentry={}]{Vorwort}
\Blindtext[25]
}
\tableofcontents
\part{First part}
\Blinddocument
\blindtext\index{Aaronsen, John} Other names to be indexed are Mike Arjonen\index{Arjonen, Mike} and Jim Azzz\index{Azzz, Jim}. For B, there are John Baily\index{Baily, John} and Jim Bronson\index{Bronson, Jim}a\index{Bronson, Jim2} b\index{Bronson, Jim3} c\index{Bronson, Jim4}n\index{Bronson, Jim5}k\index{Bronson, Jim6}b\index{Bronson, Jim7}n\index{Bronson, Jim8}b\index{Bronson, Jim9}b\index{Bronson, Jim10}.
\newpage
text Jim Bronson\index{Bronson, Jim11}a\index{Bronson, Jim12} b\index{Bronson, Jim13} c\index{Bronson, Jim14}n\index{Bronson, Jim15}k\index{Bronson, Jim16}b\index{Bronson, Jim17}n\index{Bronson, Jim18}b\index{Bronson, Jim19}b\index{Bronson, Jim20}
\newpage
text Jim Bronson\index{Bronson, Jim21}a\index{Bronson, Jim22} b\index{Bronson, Jim23} c\index{Bronson, Jim24}n\index{Bronson, Jim25}k\index{Bronson, Jim26}b\index{Bronson, Jim27}n\index{Bronson, Jim28}b\index{Bronson, Jim29}b\index{Bronson, Jim30}
\newpage
text Jim Bronson\index{Bronson, Jim31}a\index{Bronson, Jim32} b\index{Bronson, Jim33} c\index{Bronson, Jim34}n\index{Bronson, Jim13}k\index{Bronson, Jim36}b\index{Bronson, Jim37}n\index{Bronson, Jim38}b\index{Bronson, Jim39}b\index{Bronson, Jim40}
\newpage
text Jim Bronson\index{Bronson, Jim41}a\index{Bronson, Jim42} b\index{Bronson, Jim43} c\index{Bronson, Jim44}n\index{Bronson, Jim45}k\index{Bronson, Jim46}b\index{Bronson, Jim47}n\index{Bronson, Jim48}b\index{Bronson, Jim49}b\index{Bronson, Jim50}
\newpage
text Jim Bronson\index{Bronson, Jim51}a\index{Bronson, Jim52} b\index{Bronson, Jim53} c\index{Bronson, Jim54}n\index{Bronson, Jim55}k\index{Bronson, Jim56}b\index{Bronson, Jim57}n\index{Bronson, Jim58}b\index{Bronson, Jim59}b\index{Bronson, Jim60}
\newpage
text Jim Bronson\index{Bronson, Jim61}a\index{Bronson, Jim62} b\index{Bronson, Jim63} c\index{Bronson, Jim64}n\index{Bronson, Jim65}k\index{Bronson, Jim66}b\index{Bronson, Jim67}n\index{Bronson, Jim68}b\index{Bronson, Jim69}b\index{Bronson, Jim70}b\index{Cronson, Jim}b\index{Dronson, Jim}b\index{eronson, Jim}b\index{Fronson, Jim70}b\index{Gronson, Jim70}b\index{Hronson, Jim70}b\index{Ironson, Jim70}b\index{Jronson, Jim70}b\index{Kronson, Jim}\index{Lronson, Jim}\index{Mronson, Jim}\index{Nronson, Jim}\index{Oronson, Jim}\index{Pronson, Jim}\index{Qronson, Jim}\index{Rronson, Jim}\index{Sronson, Jim}\index{Tronson, Jim}\index{Uronson, Jim}\index{Vronson, Jim}\index{Wronson, Jim}\index{Xronson, Jim}\index{Yronson, Jim}\index{Zronson, Jim}\index{Zronson, Jim2}\index{Zronson, Jim3}\index{Zronson, Jim4}\index{Zronson, Jim5}\index{Zronson, Jim6}\index{Zronson, Jim7}\index{Zronson, Jim8}
\part{Anhang}
{
\cleardoublepage
\manualmark
\markright{\indexname}%
\printindex
}
\Blinddocument
\end{document}
或者你可以修补\printindex
:
\documentclass[a4paper,fontsize=10pt,numbers=noenddot]{scrbook}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{newtxtext,newtxmath}% <- changed
\usepackage{blindtext}% only for dummy text
\usepackage[inner=77mm,outer=20mm,top=34mm,bottom=83mm]{geometry}
\addtokomafont{disposition}{\rmfamily}
\KOMAoptions{toc=chapterentrydotfill}
\KOMAoptions{headings=optiontohead}
\renewcommand*{\partpagestyle}{empty}
\renewcommand*{\chapterpagestyle}{empty}
\renewcommand*{\indexpagestyle}{empty}
\usepackage{scrlayer-scrpage}
\automark[chapter]{part}
\clearpairofpagestyles
\chead{\headmark}
\ohead*{\pagemark}
\setkomafont{pagehead}{\footnotesize\upshape}
\KOMAoptions{index=totoc}% <- added: TOC entry for index
\usepackage[indentunit=0.5em]{idxlayout}
\usepackage{makeidx}
\makeindex
% patch for \printindex:
\usepackage{xpatch}
\xpretocmd\printindex{\cleardoubleoddpage\manualmark\markright{\MakeMarkcase{\indexname}}}
{}{\piIPatchFaled}
\xapptocmd\printindex{\automark[chapter]{part}}
{}{\piIIPatchFailed}
\renewcaptionname{ngerman}{\indexname}{Register}% <- added (changed and moved to preamble)
\renewcaptionname{ngerman}{\contentsname}{Inhalt}% <- added (changed and moved to preamble)
\begin{document}
{
\automark[chapter]{chapter}
\addchap[tocentry={}]{Vorwort}
\Blindtext[25]
}
\tableofcontents
\part{First part}
\Blinddocument
\blindtext\index{Aaronsen, John} Other names to be indexed are Mike Arjonen\index{Arjonen, Mike} and Jim Azzz\index{Azzz, Jim}. For B, there are John Baily\index{Baily, John} and Jim Bronson\index{Bronson, Jim}a\index{Bronson, Jim2} b\index{Bronson, Jim3} c\index{Bronson, Jim4}n\index{Bronson, Jim5}k\index{Bronson, Jim6}b\index{Bronson, Jim7}n\index{Bronson, Jim8}b\index{Bronson, Jim9}b\index{Bronson, Jim10}.
\newpage
text Jim Bronson\index{Bronson, Jim11}a\index{Bronson, Jim12} b\index{Bronson, Jim13} c\index{Bronson, Jim14}n\index{Bronson, Jim15}k\index{Bronson, Jim16}b\index{Bronson, Jim17}n\index{Bronson, Jim18}b\index{Bronson, Jim19}b\index{Bronson, Jim20}
\newpage
text Jim Bronson\index{Bronson, Jim21}a\index{Bronson, Jim22} b\index{Bronson, Jim23} c\index{Bronson, Jim24}n\index{Bronson, Jim25}k\index{Bronson, Jim26}b\index{Bronson, Jim27}n\index{Bronson, Jim28}b\index{Bronson, Jim29}b\index{Bronson, Jim30}
\newpage
text Jim Bronson\index{Bronson, Jim31}a\index{Bronson, Jim32} b\index{Bronson, Jim33} c\index{Bronson, Jim34}n\index{Bronson, Jim13}k\index{Bronson, Jim36}b\index{Bronson, Jim37}n\index{Bronson, Jim38}b\index{Bronson, Jim39}b\index{Bronson, Jim40}
\newpage
text Jim Bronson\index{Bronson, Jim41}a\index{Bronson, Jim42} b\index{Bronson, Jim43} c\index{Bronson, Jim44}n\index{Bronson, Jim45}k\index{Bronson, Jim46}b\index{Bronson, Jim47}n\index{Bronson, Jim48}b\index{Bronson, Jim49}b\index{Bronson, Jim50}
\newpage
text Jim Bronson\index{Bronson, Jim51}a\index{Bronson, Jim52} b\index{Bronson, Jim53} c\index{Bronson, Jim54}n\index{Bronson, Jim55}k\index{Bronson, Jim56}b\index{Bronson, Jim57}n\index{Bronson, Jim58}b\index{Bronson, Jim59}b\index{Bronson, Jim60}
\newpage
text Jim Bronson\index{Bronson, Jim61}a\index{Bronson, Jim62} b\index{Bronson, Jim63} c\index{Bronson, Jim64}n\index{Bronson, Jim65}k\index{Bronson, Jim66}b\index{Bronson, Jim67}n\index{Bronson, Jim68}b\index{Bronson, Jim69}b\index{Bronson, Jim70}b\index{Cronson, Jim}b\index{Dronson, Jim}b\index{eronson, Jim}b\index{Fronson, Jim70}b\index{Gronson, Jim70}b\index{Hronson, Jim70}b\index{Ironson, Jim70}b\index{Jronson, Jim70}b\index{Kronson, Jim}\index{Lronson, Jim}\index{Mronson, Jim}\index{Nronson, Jim}\index{Oronson, Jim}\index{Pronson, Jim}\index{Qronson, Jim}\index{Rronson, Jim}\index{Sronson, Jim}\index{Tronson, Jim}\index{Uronson, Jim}\index{Vronson, Jim}\index{Wronson, Jim}\index{Xronson, Jim}\index{Yronson, Jim}\index{Zronson, Jim}\index{Zronson, Jim2}\index{Zronson, Jim3}\index{Zronson, Jim4}\index{Zronson, Jim5}\index{Zronson, Jim6}\index{Zronson, Jim7}\index{Zronson, Jim8}
\part{Anhang}
\printindex
\Blinddocument
\end{document}
结果和上面一样。