我正在使用 格式化页眉和页脚,出于某种原因,除了文档的部分,所有格式都很好。我尝试过使用和不使用,\fancyhdr
并想出了各种自定义定义,但到目前为止,我还没有找到将页眉中的(目录)从全大写更改为小写的神奇公式。该定义在部分中运行良好。\leftmark
toc
\frontmatter
\fancyhdr
EFNISYFIRLIT
Author
toc
以下是 MWE:
\documentclass[12pt,a4paper,openany]{book}
\usepackage{lipsum}
\usepackage[LY1,T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[icelandic]{babel}
\usepackage{lmodern}
\usepackage{textcomp}
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{%
\markboth{%
\thechapter.\ #1}{}}
% author definition for fancyhdr
\makeatletter
\newcommand\Author{Þórhalla Guðmundsdóttir Beck}
\let\Title\@title
\makeatother
\fancyhead{}
\renewcommand{\headrulewidth}{0pt}
\fancyhead[LO]{\footnotesize\scshape\Author}
\fancyhead[RE]{\footnotesize\scshape\leftmark}
\fancyfoot{}
\fancyfoot[CO,CE]{\textendash\ \thepage\ \textendash}
% redefinition of pagestyle{plain} for consistency in page number formatting
\fancypagestyle{plain}{%
\renewcommand{\headrulewidth}{0pt}%
\fancyhf{}%
\fancyfoot[CO,CE]{\textendash\ \thepage\ \textendash}%
}
\usepackage[toctitles]{titlesec}
\titleformat{\chapter}
{\normalfont\Huge}
{\scshape \oldstylenums{\thechapter}{.}}
{1ex minus .1ex}
{\normalfont\Huge}
\titlespacing*{\chapter}
{0pt}{30pt}{16pt}
\usepackage{appendix}
\begin{document}
\frontmatter
\tableofcontents
\mainmatter
\chapter{One} \lipsum[1-15] \section{Another} bla \section{Extra} bla \section{Section} bla
\chapter{Two} bla \section{Another} bla \section{Extra} bla \section{Section} bla
\chapter{Three} bla \section{Stuff} bla
\chapter{Four} bla \section{Blather} bla
\chapter{Five} bla \section{Another} bla \section{Extra} bla \section{Section} bla
\chapter{This} bla \section{Another} bla \section{Extra} bla \section{Section} bla
\chapter{Is} bla \section{Another} bla \section{Extra} bla \section{Section} bla
\chapter{Getting} bla \section{Stuff} bla
\chapter{Ridiculous} bla \section{Blather} bla
\chapter{Really} bla \section{Another} bla \section{Extra} bla \section{Section} bla
\chapter{Eitthvað} bla \section{One} bla \section{Extra} bla \section{Section} bla
\chapter{Meira} bla \section{Another} bla \section{Extra} bla \section{Section} bla
\chapter{Kjaftæði} bla \section{Stuff} bla
\chapter{Hér} bla \section{Blather} bla
\chapter{Fyrir} bla \section{Another} bla \section{Extra} bla \section{Section} bla
\chapter{Efnis} bla \section{Another} bla \section{Extra} bla \section{Section} bla
\chapter{Yfir} bla \section{Another} bla \section{Extra} bla \section{Section} bla
\chapter{Lit} bla \section{Stuff} bla
\chapter{Andvarp} bla \section{Blather} bla
\chapter{Stuna} bla \section{Another} bla \section{Extra} bla \section{Section} bla
\begin{appendices}
\providecommand{\appendixname}{Viðauki}{\thechapter}
\titleformat{\chapter}{\itshape\huge}{\appendixname{} \thechapter.}{20pt}{\normalfont\huge}
\chapter{Alpha} bla
\chapter{Beta} bla
\end{appendices}
\end{document}
答案1
的定义\tableofcontents
必然使用来设置左标记和右标记\MakeUppercase
;以下是来自的正式定义book.cls
:
\newcommand\tableofcontents{%
\if@twocolumn
\@restonecoltrue\onecolumn
\else
\@restonecolfalse
\fi
\chapter*{\contentsname
\@mkboth{%
\MakeUppercase\contentsname}{\MakeUppercase\contentsname}}%
\@starttoc{toc}%
\if@restonecol\twocolumn\fi
}
最简单的解决方案是\MakeUppercase
暂时重新定义为\scshape
(假设它未在 ToC 中的其他地方使用):
\begingroup
\renewcommand{\MakeUppercase}{\scshape}
\tableofcontents
\endgroup