我有一个不是我写的包s5paper
(见下文),它设置了瑞典纸质格式 S5,页面布局带有边距等。但是当我使用 XeLaTeX 或 LuaLaTex 构建时,页面布局会根据是否mathtools
包含而发生变化。你能帮我弄清楚发生了什么吗?
最小工作示例
\documentclass{book}
\usepackage{s5paper}
\usepackage{mathtools}
\usepackage{blindtext}
\begin{document}
\chapter{Test}
\blindtext[2]
\end{document}
s5paper.sty
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{s5paper}[2006/08/28]
\RequirePackage{calc}
\RequirePackage{keyval}
% Paper size
\newdimen\extra@margin
\extra@margin0pt
\define@key{s5paper}{margin}{\setlength{\extra@margin}{#1}}
\def\ProcessOptionsWithKV#1{%
\let\@tempc\relax
\let\@tempa\@empty
\@for\CurrentOption:=\@classoptionslist\do{%
\@ifundefined{KV@#1@\CurrentOption}%
{}%
{%
\edef\@tempa{\@tempa,\CurrentOption,}%
\@expandtwoargs\@removeelement\CurrentOption
\@unusedoptionlist\@unusedoptionlist
}%
}%
\edef\@tempa{%
\noexpand\setkeys{#1}{%
\@tempa\@ptionlist{\@currname.\@currext}%
}%
}%
\@tempa
\let\CurrentOption\@empty
\AtEndOfPackage{\let\@unprocessedoptions\relax}}
\ProcessOptionsWithKV{s5paper}
\setlength\paperheight {242mm}
\setlength\paperwidth {165mm}%
\advance\paperheight2\extra@margin
\advance\paperwidth2\extra@margin
\hoffset 0in
\voffset 0in
\topmargin 8mm
\advance\topmargin -1in
\advance\topmargin\extra@margin
\oddsidemargin 24mm
\advance\oddsidemargin -1in
\advance\oddsidemargin\extra@margin
\evensidemargin 21mm
\advance\evensidemargin-1in
\advance\evensidemargin\extra@margin
\headheight 10mm
\headsep 8mm
\footskip 9mm
\marginparwidth 17mm
\marginparsep 2mm
\marginparpush 1em
\setlength{\textheight}{190mm}
\setlength{\textwidth}{\paperwidth-2in-\hoffset-\oddsidemargin-\evensidemargin}%
\ifx\pdftexversion\undefined\else
\setlength{\pdfpagewidth}{\paperwidth}
\setlength{\pdfpageheight}{\paperheight}
\fi