如何将整个文档的页码设置为相同大小?

如何将整个文档的页码设置为相同大小?
\documentclass{book}

\usepackage{kantlipsum}
\usepackage{appendix}

\usepackage{fontspec} % compile w/XeLaTeX
\setmainfont{Perpetua}

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{} % clear all header and footer fields
\renewcommand{\headrule}{} % Remove the horizontal line from the header
\fancyfoot[C]{\fontfamily{ppl}\fontsize{11}{13}\selectfont\thepage} % set the footer centred and using Perpetua 11 font

\newcommand{\appendixchapter}{% https://tex.stackexchange.com/a/681868/269662
  \cleardoublepage
  \fancyfoot[C]{\fontfamily{ppl}\fontsize{11}{13}\selectfont\thepage}
  \pagenumbering{arabic}
  \setcounter{page}{1}%
  \renewcommand{\thepage}{\thechapter\arabic{page}}%
  \chapter
}

\begin{document}
  \fontsize{13pt}{15.6pt}\selectfont
  \chapter{A chapter}
  \kant[1]
  \appendix
    \appendixchapter{An appendix}
    \kant
    \appendixchapter{Another appendix}
    \kant
\end{document}

页码设置为 Perpetua 11,编译时就是这样的。但是,它似乎只在(附录)章节的第一页上这样做。然后,数字又变大了。如何将整个文档的页码设置为 Perpetua 11?

答案1

您不应该使用\fontsize{13.5}{15.6}\selectfont。而应该使用fontsize

使用\usepackage[fontsize=13.5pt]{fontsize},基线跳过将被设置为16.19995pt,因此很容易修复\baselinestretch以获得15.6pt:只需除以即可找到

15.6/16.19995 = 0.96296593508004654335

并确实发出

\linespread{0.96297}

生成\baselineskip=15.6pt。我还设置了\topskip字体大小。

这就是说,您的代码中有一些\fontfamily{ppl}需要删除的神秘指令。

现在文本高度设置为 550pt,但是

(550-13.5)/15.6 = 34.39102564102564102564

因此您的页面行数不为整数。您需要稍微降低文本高度:

13.5+34*15.6 = 543.9

但舍入会累积,因此最好使用543.91pt

\documentclass{book}
\usepackage[fontsize=13.5pt]{fontsize}
\usepackage{fontspec} % compile w/XeLaTeX
\usepackage{appendix}

\usepackage{kantlipsum}
\usepackage{fancyhdr}

\setmainfont{Perpetua}[
  Path=/Applications/Microsoft Word.app/Contents/Resources/DFonts/,
  BoldFont=* Bold,
  ItalicFont=* Italic,
  BoldItalicFont=* Bold Italic,
]

\pagestyle{fancy}
\fancyhf{} % clear all header and footer fields
\renewcommand{\headrulewidth}{0pt} % Remove the horizontal line from the header

\fancyfoot[C]{%
  \fontsize{11}{13}\selectfont\thepage
} % set the footer centred and using Perpetua 11 font
% fix also the plain page style
\fancypagestyle{plain}{%
  \fancyhf{}%
  \renewcommand{\headrulewidth}{0pt}%
  \fancyfoot[C]{\fontsize{11}{13}\selectfont\thepage}%
}

\newcommand{\appendixchapter}{% https://tex.stackexchange.com/a/681868/269662
  \cleardoublepage
  \pagenumbering{arabic}%
  \renewcommand{\thepage}{\thechapter\arabic{page}}%
  \chapter
}

% final setting: fix the baseline skip
\linespread{0.96297}
\setlength{\topskip}{13.5pt}
\setlength{\textheight}{543.91pt}

\begin{document}

\chapter{A chapter}

\kant[1]

\appendix

\appendixchapter{An appendix}

\kant

\appendixchapter{Another appendix}

\kant

\end{document}

相关内容