当更改文档中的纸张尺寸时,软件包fancyhdr
无法识别布局宽度的改变。
这一页详细说明如何在文档中间更改页面大小。
已给出答案,使用\pdfpagewidth
。
已给出答案,使用\KOMAoptions
。
两者都无法解决fancyhdr
水平对齐问题。
平均能量损失
\documentclass{scrartcl}
\usepackage{geometry}
\usepackage{fancyhdr}
\usepackage{lipsum}
% Margin Settings:
\geometry{letterpaper}
\geometry{vmargin = 0.50in,
hmargin = 0.50in,
headheight = 0.50in,
headsep = 0.15in,
footskip = 0.60in}
\usepackage{showframe}
%Initialize headers and footers
\pagestyle{fancy}
\fancyhf{} % Clears out artifacts from default header
\fancyhead[C]{Header}
\fancyfoot[C]{Footer}
\fancyfoot[R]{ Page \thepage} % Begin footer page number
\renewcommand{\headrulewidth}{0pt} % Removes default horizontal line
\begin{document}
{\Huge \textbf{Original}}
\lipsum[1]
\clearpage
\newgeometry{layoutwidth = 04.25in,
layoutheight = 11.00in}
\pdfpagewidth = 04.25in
\pdfpageheight = 11.00in
\lipsum[1]
\clearpage
\newgeometry{layoutwidth = 04.25in,
layoutheight = 11.00in,
vmargin = 00.50in,
hmargin = 00.50in,
headheight = 00.50in,
headsep = 00.15in,
footskip = 00.60in}
\pdfpagewidth = 04.25in
\pdfpageheight = 11.00in
\lipsum[1]
\clearpage
\newgeometry{layoutwidth = 11.00in,
layoutheight = 04.25in,
vmargin = 00.50in,
hmargin = 00.50in,
headheight = 00.50in,
headsep = 00.15in,
footskip = 00.60in}
\pdfpagewidth = 11.00in
\pdfpageheight = 04.25in
\lipsum[1]
\clearpage
\newgeometry{layoutwidth = 17.00in,
layoutheight = 11.00in,
vmargin = 00.50in,
hmargin = 00.50in,
headheight = 00.50in,
headsep = 00.15in,
footskip = 00.60in}
\pdfpagewidth = 17.00in
\pdfpageheight = 11.00in
\lipsum[1]
\clearpage
\newgeometry{layoutwidth = 08.50in,
layoutheight = 11.00in,
vmargin = 00.50in,
hmargin = 00.50in,
headheight = 00.50in,
headsep = 00.15in,
footskip = 00.60in}
\pdfpagewidth = 08.50in
\pdfpageheight = 11.00in
{\Huge \textbf{Original}}
\lipsum[1]
\clearpage
\KOMAoptions{paper=17in:11in,pagesize}
\recalctypearea
\lipsum[1]
\clearpage
\KOMAoptions{paper=17in:11in,pagesize}
\recalctypearea
\newgeometry{layoutwidth = 17.00in,
layoutheight = 11.00in,
vmargin = 00.50in,
hmargin = 00.50in,
headheight = 00.50in,
headsep = 00.15in,
footskip = 00.60in}
\lipsum[1]
\end{document}
另外:用户可以创建并附加标签吗mid-document
?我觉得有些用户在寻求文档内建议时会收到序言建议。
答案1
我将替换fancyhdr
并使用为与 KOMA 类(和标准类)配合使用而开发的名为 的包scrlayer-scrpage
。该包于去年正式取代了旧包scrpage2
。目前,KOMA-script 的作者会定期添加功能,因此建议使用相当最新的发行版。
\documentclass{scrartcl}
\usepackage{geometry}
\usepackage{lipsum}
% Margin Settings:
\geometry{letterpaper}
\geometry{vmargin = 0.50in,
hmargin = 0.50in,
headheight = 0.50in,
headsep = 0.15in,
footskip = 0.60in}
\usepackage{showframe}
\usepackage{scrlayer-scrpage}
\clearpairofpagestyles
\chead{Header}
\cfoot{footer}
\ofoot{\pagemark}
\begin{document}
{\Huge \textbf{Original}}\par
\lipsum[1]
\clearpage
\newgeometry{layoutwidth = 04.25in,
layoutheight = 11.00in}
\pdfpagewidth = 04.25in
\pdfpageheight = 11.00in
\lipsum[1]
\clearpage
\newgeometry{layoutwidth = 04.25in,
layoutheight = 11.00in,
vmargin = 00.50in,
hmargin = 00.50in,
headheight = 00.50in,
headsep = 00.15in,
footskip = 00.60in}
\pdfpagewidth = 04.25in
\pdfpageheight = 11.00in
\lipsum[1]
\clearpage
\newgeometry{layoutwidth = 11.00in,
layoutheight = 04.25in,
vmargin = 00.50in,
hmargin = 00.50in,
headheight = 00.50in,
headsep = 00.15in,
footskip = 00.60in}
\pdfpagewidth = 11.00in
\pdfpageheight = 04.25in
\lipsum[1]
\clearpage
\newgeometry{layoutwidth = 17.00in,
layoutheight = 11.00in,
vmargin = 00.50in,
hmargin = 00.50in,
headheight = 00.50in,
headsep = 00.15in,
footskip = 00.60in}
\pdfpagewidth = 17.00in
\pdfpageheight = 11.00in
\lipsum[1]
\clearpage
\newgeometry{layoutwidth = 08.50in,
layoutheight = 11.00in,
vmargin = 00.50in,
hmargin = 00.50in,
headheight = 00.50in,
headsep = 00.15in,
footskip = 00.60in}
\pdfpagewidth = 08.50in
\pdfpageheight = 11.00in
{\Huge \textbf{Original}}
\lipsum[1]
\clearpage
\KOMAoptions{paper=17in:11in,pagesize}
\recalctypearea
\lipsum[1]
\clearpage
\KOMAoptions{paper=17in:11in,pagesize}
\recalctypearea
\newgeometry{layoutwidth = 17.00in,
layoutheight = 11.00in,
vmargin = 00.50in,
hmargin = 00.50in,
headheight = 00.50in,
headsep = 00.15in,
footskip = 00.60in}
\lipsum[1]
\end{document}
正如您所见,标题位于其应在的位置。