s5paper.sty

s5paper.sty

我有一个旧软件包,可以设置瑞典纸张格式 (S5),页面布局带有边距等。据我了解它只能使用 pdflatex 正确设置媒体框

对我来说,这似乎是使用geometry\marginparpush包。但我尝试将代码转换为包选项,但没有成功。另外,我在文档中也找不到geometry

你能帮我吗?

s5paper.sty

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{s5paper}[2006/08/28 author: Pedher Johansson]
\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}          %Modified by Ettore from 238
\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

我的尝试

\documentclass{book}
% \usepackage{s5paper}
\usepackage{calc}
\usepackage[
  paperheight=242mm+0pt*2,
  paperwidth=165mm+0pt*2,
  layouthoffset=0mm,
  layoutvoffset=0mm,
  top=8mm-1in-0pt,
  inner=24mm-1in-0pt,
  outer=21mm-1in-0pt,
  headheight=10mm,
  headsep=8mm,
  footskip=9mm,
  marginparwidth=17mm,
  marginparsep=2mm,
  height=190mm,
  width=120mm,
]{geometry}
\usepackage{blindtext}
\begin{document}
  \chapter{Test}
  \blindtext[2]
\end{document}

s5paper 的结果

由于我的几何设置有缺陷而导致的结果

答案1

作为@cabohah 指出

  • “自动geometry计算-1inTeX 纸张原点的偏移量”
  • \marginparpush不是页面布局的一部分,因此需要单独设置

最后,神奇数字 0.709in只是\headheight+\headsep因为这包含在geometry标题的定义中(根据图1在文档中)。

\documentclass{book}
\usepackage{calc}
\newdimen\extramargin% Take care of the `s5paper` package's option `margin`
\extramargin0pt
\usepackage[
  paperheight=242mm+2\extramargin,
  paperwidth=165mm+2\extramargin,
  layouthoffset=0mm,
  layoutvoffset=0mm,
  top=8mm+10mm+8mm+\extramargin,% Add \headheight and \headsep
  inner=24mm+\extramargin,
  outer=21mm+\extramargin,
  headheight=10mm,
  headsep=8mm,
  footskip=9mm,
  marginparwidth=17mm,
  marginparsep=2mm,
  height=190mm,
  width=120mm,
]{geometry}
\setlength{\marginparpush}{1em}
\usepackage{blindtext}
\begin{document}
  \chapter{Test}
  \blindtext[2]
\end{document}

相关内容