LatinModern 弄乱了我的目录

LatinModern 弄乱了我的目录

今天我问了一个问题目录格式我想出了一个非常独特的宏来解决我所有的问题,但是当我刚刚开始享受给出的“答案”时,另一个问题又把我带到了起点:添加这一行

\usepackage{lmodern}

将页码恢复为直立格式,而不是小写字母。

在此处输入图片描述

以下是 MWE:

\documentclass[11pt,a4paper,twoside,british,italian]{article}
%
\usepackage[T1]{fontenc}
%
\usepackage{lmodern}  % inserting this line messes up evwrything but I'd like to use the same font.
%
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{babel}
\usepackage{lipsum}
%
\usepackage[unicode=true,
 bookmarks=true,bookmarksnumbered=true,bookmarksopen=false,
 breaklinks=false,pdfborder={0 0 1},backref=false,colorlinks=true]
{hyperref}
%
\makeatletter
% Newly defined command for Hyperref/Correct symbols
\@ifpackageloaded{hyperref}{%
 \newcounter{forfunnysections}% 
 \newcommand{\addtoMYcontents}[3]{% 
  \addtocontents{#1}{%
   \protect\contentsline{#2}{#3}{{\bfseries\scshape\thepage}}{\@currentHref}%
  }\stepcounter{forfunnysections}\pdfbookmark[1]{#3}{funny.\arabic{forfunnysections}}%
 }%
}{%
 \newcommand{\addtoMYcontents}[3]{% 
  \addtocontents{#1}{%
   \protect\contentsline{#2}{#3}{{\bfseries\scshape\thepage}}%
  }%
 }%  
}
%
% define the page style, note \pagestyle{fancy} already in the preamble
\renewcommand{\sectionmark}[1]{\markboth{Sezione\ \thesection.\ #1}{}}
\renewcommand{\subsectionmark}[1]{\markright{#1}}
\fancyhf{}
\fancyhead[RE]{\nouppercase{\slshape \leftmark}}
\fancyhead[LO]{\nouppercase{\slshape \lastrightmark}}
\fancyhead[LE,RO]{\itshape \thepage}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0pt}
%
% create new \fancypagestyles in respect to short sections
\usepackage{slantsc}
\usepackage{extramarks} 
%
\fancypagestyle{plain}{%
\fancyhf{} 
\fancyfoot[CE,CO]{\slshape{\scshape \thepage}}  % Page numbers with my defined style
\renewcommand{\headrulewidth}{0pt}%
}
\fancypagestyle{nonTOCplain}{%
\fancyhf{} 
\fancyhead[LE,RO]{\itshape \thepage}
\renewcommand{\headrulewidth}{0pt}%
}
\fancypagestyle{TOCplain}{%
\fancyhf{} 
\fancyhead[RE]{\nouppercase{\slshape \leftmark}}
\fancyhead[LO]{\nouppercase{\slshape \lastrightmark}}
\fancyhead[LE,RO]{\slshape{\scshape \thepage}}  % Page numbers with my defined style
\renewcommand{\headrulewidth}{0.4pt}%
} 
%  
% the pages of the ToC/LoF/LoT are numbered Lowercase Roman 
\let\myTOC\tableofcontents
\renewcommand\tableofcontents{%
 \pagenumbering{roman}   % I don't want "Roman" because there are too big letters!
 \thispagestyle{plain}
 \myTOC%
}
%
\makeatother
%
\begin{document}
%
\thispagestyle{plain}
\addtoMYcontents{toc}{section}{Indice Generale}
\tableofcontents{}
\clearpage{}
%
\thispagestyle{TOCplain}
\cleardoublepage{}
%
\thispagestyle{TOCplain}
\addtoMYcontents{toc}{section}{Elenco delle Figure}
\listoffigures
\clearpage{}
%
\thispagestyle{TOCplain}
\cleardoublepage{}
\pagenumbering{arabic}
%
\thispagestyle{nonTOCplain}
\section{Introduzione}
\lipsum[1]
%
\cleardoublepage{}
%
\thispagestyle{nonTOCplain}
\section{Prima sezione }
\lipsum[3]
\subsection{Prima sottosezione }
\lipsum[3]
%
\end{document}

主要问题是我不知道一个简单的字体如何与上面的命令交互,就像 SmallCaps 的定义会产生这个问题,但我不确定,所以我想知道有一个解决方案可以让我继续使用,lmodern但没有直立的页码

答案1

Latin Modern 似乎没有提供小写字母的粗体变体。因此,请尝试替换

\bfseries\scshape

经过

\usefont{T1}{cmr}{bx}{sc}

在您的宏中获取目录中的页码。(修改 MWE 后编译两次,因为 toc 文件需要先更新)。

答案2

为了彻底解决这个问题,现在可以显示我编写的最终代码了;注意到我本可以在宏中添加,并通过首先\footnotesize\thepage插入来定义花式页面样式;所以最终的代码如下:\pagenumbering{Roman}

\documentclass[11pt,a4paper,twoside,british,italian]{article}
%
\usepackage[T1]{fontenc}
%
\usepackage{lmodern}  % inserting this line messes up evwrything but I'd like to use the same font.
%
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{babel}
\usepackage{lipsum}
%
\usepackage[unicode=true,
 bookmarks=true,bookmarksnumbered=true,bookmarksopen=false,
 breaklinks=false,pdfborder={0 0 1},backref=false,colorlinks=true]
{hyperref}
%
\makeatletter
% Newly defined command for Hyperref/Correct symbols
\@ifpackageloaded{hyperref}{%
 \newcounter{forfunnysections}% 
 \newcommand{\addtoMYcontents}[3]{% 
  \addtocontents{#1}{%
   \protect\contentsline{#2}{#3}{{\footnotesize\thepage}}{\@currentHref}%
  }\stepcounter{forfunnysections}\pdfbookmark[1]{#3}{funny.\arabic{forfunnysections}}%
 }%
}{%
 \newcommand{\addtoMYcontents}[3]{% 
  \addtocontents{#1}{%
   \protect\contentsline{#2}{#3}{{\footnotesize\thepage}}%
  }%
 }%  
}
%
% define the page style, note \pagestyle{fancy} already in the preamble
\renewcommand{\sectionmark}[1]{\markboth{Sezione\ \thesection.\ #1}{}}
\renewcommand{\subsectionmark}[1]{\markright{#1}}
\fancyhf{}
\fancyhead[RE]{\nouppercase{\slshape \leftmark}}
\fancyhead[LO]{\nouppercase{\slshape \lastrightmark}}
\fancyhead[LE,RO]{\itshape \thepage}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0pt}
%
% create new \fancypagestyles in respect to short sections
\usepackage{slantsc}
\usepackage{extramarks} 
%
\fancypagestyle{plain}{%
\fancyhf{} 
\fancyfoot[CE,CO]{\footnotesize{\slshape\thepage}}  % Page numbers with my defined style
\renewcommand{\headrulewidth}{0pt}%
}
\fancypagestyle{nonTOCplain}{%
\fancyhf{} 
\fancyhead[LE,RO]{\itshape \thepage}
\renewcommand{\headrulewidth}{0pt}%
}
\fancypagestyle{TOCplain}{%
\fancyhf{} 
\fancyhead[RE]{\nouppercase{\slshape \leftmark}}
\fancyhead[LO]{\nouppercase{\slshape \lastrightmark}}
\fancyhead[LE,RO]{\footnotesize{\slshape\thepage}}  % Page numbers with my defined style
\renewcommand{\headrulewidth}{0.4pt}%
} 
%  
% the pages of the ToC/LoF/LoT are numbered Lowercase Roman 
\let\myTOC\tableofcontents
\renewcommand\tableofcontents{%
 \pagenumbering{Roman}
 \thispagestyle{plain}
 \myTOC%
}
%
\makeatother
%
\begin{document}
%
\thispagestyle{plain}
\addtoMYcontents{toc}{section}{Indice Generale}
\tableofcontents{}
\clearpage{}
%
\thispagestyle{TOCplain}
\cleardoublepage{}
%
\thispagestyle{TOCplain}
\addtoMYcontents{toc}{section}{Elenco delle Figure}
\listoffigures
\clearpage{}
%
\thispagestyle{TOCplain}
\cleardoublepage{}
\pagenumbering{arabic}
%
\thispagestyle{nonTOCplain}
\section{Introduzione}
\lipsum[1]
%
\cleardoublepage{}
%
\thispagestyle{nonTOCplain}
\section{Prima sezione }
\lipsum[3]
\subsection{Prima sottosezione }
\lipsum[3]
%
\end{document}

用这种方法,所谓的粗体小写字母就不再被考虑了(我希望这种行为现在能让我成为一个“理性”的人,而不是这种变态行为的追随者,根据埃格尔 :-)

相关内容