我想使用不同的布局\indexname
\documentclass[8pt,b5paper,twocolumn]{extbook}
\usepackage[top=2cm, headsep=0.4cm, bottom=1.5cm, left=1.5cm, right=1.5cm]{geometry}
\usepackage{fancyhdr}
\usepackage[icelandic, czech, english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[scaled]{helvet}
\usepackage{hanging}
\usepackage{makeidx}
\newcommand\entry[3][]{\hangpara{2em}{1}{\fontfamily{phv}\selectfont{\textbf{{#2}}}}\
#3\ifx\relax#1\relax\markboth{#2}{#2}\else\markboth{#1}{#1}\fi
\par}\nopagebreak[4]
\fancypagestyle{indexstyle}{%
\fancyhf{}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0pt}
\fancyhead[LE,RO]{\indexname}
\fancyhead[C]{\textbf{\thepage}}
}
\fancypagestyle{dictstyle}{%
\renewcommand{\headrulewidth}{0.4pt}
\fancyhf{}
\fancyhead[LE,LO]{{\fontfamily{phv}\selectfont{\textbf{\rightmark}}}}
\fancyhead[CO,CE]{\thepage}
\fancyhead[RE,RO]{{\fontfamily{phv}\selectfont{\textbf{\leftmark}}}}}
\addto{\captionsenglish}{%
\renewcommand{\indexname}{Seznam autorů fotografií}
}
\makeindex
\begin{document}
\pagestyle{dictstyle}
\entry[headword]{headword}{translation}
\entry[headword]{headword}{translation}
\thispagestyle{indexstyle}
\clearpage
\printindex
\end{document}
我如何更改\indexname
(在此示例中为“Seznam autorů fotografií”)值的布局(参见下图)
并将其放置在标题规则下,与放置第一个和最后一个标题词的方式相同(见下图)
并将其置于头部规则之下?
答案1
如果您想\indexname
向下移动,可以尝试:
\smash{\raisebox{-2.5em}{\indexname}}
这会\indexname
向下推2.5em
(在标题规则下方)并通过 消除任何垂直高度/深度扭曲\smash
。
以下是 MWE 的缩小版:
\documentclass[8pt,b5paper,twocolumn]{extbook}
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\patchcmd{\theindex}% <cmd>
{\thispagestyle{plain}}% <search>
{\pagestyle{indexstyle}}% <replace>
{}{}% <success><failure>
\usepackage[top=2cm, headsep=0.4cm, bottom=1.5cm, left=1.5cm, right=1.5cm]{geometry}% http://ctan.org/pkg/geometry
\usepackage{fancyhdr}% http://ctan.org/pkg/fancyhdr
\usepackage{makeidx}% http://ctan.org/pkg/makeidx
\fancypagestyle{indexstyle}{%
\fancyhf{}% Clear header/footer
\renewcommand{\headrulewidth}{0.4pt}% 0.4pt header rule
\renewcommand{\footrulewidth}{0pt}% No footer rule
\fancyhead[LE,RO]{\smash{\raisebox{-2.5em}{\indexname}}}% Index name below header rule
\fancyhead[C]{\textbf{\thepage}}% Page in footer, centred
}
\renewcommand{\indexname}{Index}%
\makeindex
\begin{document}
\index{abcdefgh} \index{ijklmnop} \index{qrstuvwx} \index{yzabcdef}
\index{ghijklmn} \index{opqrstuv} \index{wxyzabcd} \index{efghijkl}
\index{mnopqrst} \index{uvwxyzab} \index{cdefghij} \index{klmnopqr}
\index{stuvwxyz}
\printindex
\end{document}
添加etoolbox
是“修复”theindex
环境。它会创建整个索引,并且不允许修改首页样式或其他内容。etoolbox
用于修补环境并修复indexstyle
首页和后续页面的页面样式。