ToC 和 fancyhdr 的标题

ToC 和 fancyhdr 的标题

请考虑以下代码:

\documentclass[a4paper,twoside,11pt]{report}
\usepackage{fontspec}
\setmainfont[Ligatures=TeX,Numbers=OldStyle]{EB Garamond}
\usepackage{polyglossia}
\setmainlanguage[babelshorthands=true]{italian}

\usepackage{emptypage}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\setlength{\headheight}{13.59999pt}
\renewcommand{\chaptermark}[1]{\markboth{\footnotesize\textsc{#1}}{\footnotesize\textsc{#1}}}
\renewcommand{\sectionmark}[1]{\markright{\footnotesize\textsc{#1}}}
\renewcommand{\headrulewidth}{0pt}
\fancyhead[LE]{\MakeLowercase{\rightmark}}
\fancyhead[RO]{\MakeLowercase{\leftmark}}
\fancyhead[LO,RE]{\thepage}

\usepackage{lipsum}

\begin{document}
\tableofcontents

\chapter{La questione degli universali}
\section{Il realismo: l'universale come sostanza}
\lipsum[1-5]
\subsection{Gli universali come sostanze in Eriugena}
\lipsum[1-5]
\subsection{Gli universali come sostanze in Eriugena}
\lipsum[1-5]
\subsection{Realismo e teologia nella Scuola di Chartres}
\section{Il realismo: l'universale come sostanza}
\subsection{Gli universali come sostanze in Eriugena}
\subsection{Realismo e teologia nella Scuola di Chartres}
\subsection{Realismo e teologia nella Scuola di Chartres}
\section{Il realismo: l'universale come sostanza}
\subsection{Gli universali come sostanze in Eriugena}
\subsection{Realismo e teologia nella Scuola di Chartres}
\subsection{Realismo e teologia nella Scuola di Chartres}
\chapter{La questione degli universali}
\section{Il realismo: l'universale come sostanza}
\subsection{Gli universali come sostanze in Eriugena}
\subsection{Gli universali come sostanze in Eriugena}
\subsection{Realismo e teologia nella Scuola di Chartres}
\section{Il realismo: l'universale come sostanza}
\subsection{Gli universali come sostanze in Eriugena}
\subsection{Gli universali come sostanze in Eriugena}
\subsection{Realismo e teologia nella Scuola di Chartres}
\section{Il realismo: l'universale come sostanza}
\subsection{Gli universali come sostanze in Eriugena}
\subsection{Gli universali come sostanze in Eriugena}
\subsection{Realismo e teologia nella Scuola di Chartres}
\chapter{La questione degli universali}
\section{Il realismo: l'universale come sostanza}
\subsection{Gli universali come sostanze in Eriugena}
\subsection{Gli universali come sostanze in Eriugena}
\subsection{Realismo e teologia nella Scuola di Chartres}
\section{Il realismo: l'universale come sostanza}
\subsection{Gli universali come sostanze in Eriugena}
\subsection{Realismo e teologia nella Scuola di Chartres}
\subsection{Realismo e teologia nella Scuola di Chartres}
\section{Il realismo: l'universale come sostanza}
\subsection{Gli universali come sostanze in Eriugena}
\subsection{Realismo e teologia nella Scuola di Chartres}
\subsection{Realismo e teologia nella Scuola di Chartres}
\chapter{La questione degli universali}
\section{Il realismo: l'universale come sostanza}
\subsection{Gli universali come sostanze in Eriugena}
\subsection{Gli universali come sostanze in Eriugena}
\subsection{Realismo e teologia nella Scuola di Chartres}
\section{Il realismo: l'universale come sostanza}
\subsection{Gli universali come sostanze in Eriugena}
\subsection{Gli universali come sostanze in Eriugena}
\subsection{Realismo e teologia nella Scuola di Chartres}
\section{Il realismo: l'universale come sostanza}
\subsection{Gli universali come sostanze in Eriugena}
\subsection{Gli universali come sostanze in Eriugena}
\subsection{Realismo e teologia nella Scuola di Chartres}
\chapter{La questione degli universali}
\section{Il realismo: l'universale come sostanza}
\subsection{Gli universali come sostanze in Eriugena}
\subsection{Gli universali come sostanze in Eriugena}
\subsection{Realismo e teologia nella Scuola di Chartres}
\section{Il realismo: l'universale come sostanza}
\subsection{Gli universali come sostanze in Eriugena}
\subsection{Realismo e teologia nella Scuola di Chartres}
\subsection{Realismo e teologia nella Scuola di Chartres}
\section{Il realismo: l'universale come sostanza}
\subsection{Gli universali come sostanze in Eriugena}
\subsection{Realismo e teologia nella Scuola di Chartres}
\subsection{Realismo e teologia nella Scuola di Chartres}
\chapter{La questione degli universali}
\section{Il realismo: l'universale come sostanza}
\subsection{Gli universali come sostanze in Eriugena}
\subsection{Gli universali come sostanze in Eriugena}
\subsection{Realismo e teologia nella Scuola di Chartres}
\section{Il realismo: l'universale come sostanza}
\subsection{Gli universali come sostanze in Eriugena}
\subsection{Gli universali come sostanze in Eriugena}
\subsection{Realismo e teologia nella Scuola di Chartres}
\section{Il realismo: l'universale come sostanza}
\subsection{Gli universali come sostanze in Eriugena}
\subsection{Gli universali come sostanze in Eriugena}
\subsection{Realismo e teologia nella Scuola di Chartres}

\end{document}

在所有文档中,标题都是 scshape,但在目录中则是大写。似乎 fancyhdr 对此不起作用。我尝试了一些解决方案来本地更改目录标题的外观,使标题标题“Indice”也采用 scshape,但没有结果。我如何获得它?谢谢!

答案1

宏观\tableofcontents问题

\@mkboth{\MakeUppercase\contentsname}{\MakeUppercase\contentsname}

这就是导致您出现问题的原因。这是在编写类时做出的一个非常不幸的决定。

此外\listoftables\listoffigures和 也thebibliography存在同样的问题。无法使用\nouppercase的技巧fancyhdr,因为您想将所有内容都小写。

因此,修补似乎是最安全的做法(或memoir代替使用report):

\documentclass[a4paper,twoside,11pt]{report}
\usepackage{fontspec}
\setmainfont[Ligatures=TeX,Numbers=OldStyle]{EB Garamond}
\usepackage{polyglossia}
\setmainlanguage[babelshorthands=true]{italian}

\usepackage{etoolbox}
\usepackage{emptypage}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\setlength{\headheight}{13.59999pt}
\renewcommand{\chaptermark}[1]{\markboth{#1}{#1}}
\renewcommand{\sectionmark}[1]{\markright{#1}}
\renewcommand{\headrulewidth}{0pt}
\fancyhead[LE]{\footnotesize\scshape\MakeLowercase{\rightmark}}
\fancyhead[RO]{\footnotesize\scshape\MakeLowercase{\leftmark}} 
\fancyhead[LO,RE]{\thepage}

\patchcmd{\tableofcontents}
  {\MakeUppercase}
  {}
  {}{}
\patchcmd{\tableofcontents}
  {\MakeUppercase}
  {}
  {}{}

不要在\chaptermark或中使用格式指令\sectionmark:最好在定义标题时说明它们。

在此处输入图片描述

相关内容