包裹geometry
:
包装长度不保存为长度。
- 例子:
layoutheight, tmargin
以下仅影响完整布局:
\savegeometry
\loadgeometry
\restoregeometry
问题 1
是否可以设置包,以便
可以调用非 Latex 原生的长度?
- 例子:
\layoutheight, \tmargin
问题2
是否可以优雅地仅保存/加载/恢复特定的几何选项?
类似于\newgeometry{<options>}
?
\savegeometry[<options>]{name}
\loadgeometry[<options>]{name}
\restoregeometry[<options>]
选择:[ \newlength
-->setlength
方法]
存在创建长度的方法和递归地使用它们。
我在下面的 MWE 中演示了这一点。
它并不十分优雅。
我希望我可以在序言中这样说:
\savegeometry{original}
% or
\savegeometry[vmargin, hmargin]{originalMargins}
然后,在文档中间更改页面大小后,
\loadgeometry[vmargin, hmargin]{original}
% or
\loadgeometry{originalMargins}
% or especially (without the need to \save):
\restoregeometry[vmargin, hmargin]
平均能量损失
\documentclass{scrartcl}
\usepackage{geometry} % margin/page layout settings
\usepackage{scrlayer-scrpage} % improved header commands. [supercedes `fancyhdr' package].
\usepackage{lipsum}
% Margin Settings:
\newlength{\xhmargin } \setlength{\xhmargin }{0.750in}
\newlength{\xtmargin } \setlength{\xtmargin }{0.750in}
\newlength{\xbmargin } \setlength{\xbmargin }{1.000in}
\newlength{\xheadheight} \setlength{\xheadheight}{2.700em}
\newlength{\xheadsep } \setlength{\xheadsep }{0.150in}
\newlength{\xfootheight} \setlength{\xfootheight}{2.700em}
\newlength{\xfootskip } \setlength{\xfootskip }{0.800in}
\KOMAoptions{headheight = \xheadheight ,
footheight = \xfootheight ,
DIV = current }
\geometry{letterpaper ,
hmargin = \xhmargin ,
tmargin = \xtmargin ,
bmargin = \xbmargin ,
headsep = \xheadsep ,
footskip = \xfootskip }
%\usepackage{showframe}
\savegeometry{default}
%Initialize headers and footers
\chead{\normalfont Header 1 \\ Header 2}
\cfoot{\normalfont Footer 1 \\ Footer 2}
\ofoot{\normalfont Page \thepage}
\begin{document}
Original
\lipsum
\clearpage
%\pdfpagewidth = 11.0in % [\pdfpagewidth and \pdfpageheight are superceded by KOMAoptions].
%\pdfpageheight = 17.0in
\KOMAoptions{paper = 11in:17in ,
pagesize ,
headheight = \xheadheight ,
footheight = \xfootheight ,
DIV = current }
%\restoregeometry % [cannot be used: restores letterpaper also.]
\newgeometry{layoutwidth = 11.00in,
layoutheight = 17.00in,
hmargin = \xhmargin ,
tmargin = \xtmargin ,
bmargin = \xbmargin ,
headsep = \xheadsep ,
footskip = \xfootskip }
Altered
\lipsum
\vspace{+4em}
\lipsum
\clearpage
%\pdfpagewidth = 08.5in % [\pdfpagewidth and \pdfpageheight are superceded by KOMAoptions].
%\pdfpageheight = 11.0in
\KOMAoptions{paper = 8.5in:11in,
pagesize ,
DIV=current }
\restoregeometry
Original
\lipsum
\end{document}