使用 \newgeometry 在文档中途更改页面大小

使用 \newgeometry 在文档中途更改页面大小

我正在研究https://latex.org/forum/viewtopic.php?t=12244

\documentclass{book}

\usepackage[driver=pdftex]{geometry}
%\usepackage[driver=pdftex, paperwidth=10in]{geometry}                                                                                                                           

\begin{document}
This is a standard page.
\newpage
\newgeometry{paperwidth=17in,paperheight=11in}
This is a big landscape page.
\restoregeometry
\newpage
Back to a standard page
\end{document}

看起来是个不错的解决方案,但是在编译过程中出现了一个问题:

Package geometry Warning: `paperwidth': not available in `\newgeometry'; skippe
d.
Package geometry Warning: `paperheight': not available in `\newgeometry'; skipp
ed.

为什么这个例子不起作用?

有趣的是,paperwidth=10in如果以下代码行:

%\usepackage[driver=pdftex, paperwidth=10in]{geometry}                                                                                                                           

未注释。

答案1

你确实需要提供\newgeometry比我预期更多的帮助,但这似乎有效

在此处输入图片描述

\documentclass{article}

\usepackage[letterpaper]{geometry}

\begin{document}
This is a standard page.


\clearpage
\edef\hmm{\pdfpagewidth=\the\pdfpagewidth \pdfpageheight=\the\pdfpageheight\relax}
\pdfpagewidth=17in
\pdfpageheight=11in
\newgeometry{top=1in,left=1in,textwidth=15in,textheight=9in}

This is a big landscape page. This is a big landscape page. This is a big landscape page. This is a big landscape page. 
This is a big landscape page. This is a big landscape page. This is a big landscape page. This is a big landscape page. 
This is a big landscape page. This is a big landscape page. This is a big landscape page. This is a big landscape page. 
This is a big landscape page. This is a big landscape page. This is a big landscape page. This is a big landscape page. 
This is a big landscape page. This is a big landscape page. This is a big landscape page. This is a big landscape page. 
This is a big landscape page. This is a big landscape page. This is a big landscape page. This is a big landscape page. 
This is a big landscape page. This is a big landscape page. This is a big landscape page. This is a big landscape page.

\vspace*{\fill}

This is a big landscape page. This is a big landscape page. This is a big landscape page. This is a big landscape page. 
This is a big landscape page. This is a big landscape page. This is a big landscape page. This is a big landscape page. 
 
\restoregeometry
\hmm

Back to a standard page
\end{document}

相关内容