You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

LaTeX中landscape环境导致页面缩小的问题如何解决?

修复exam文档类中pdflscape导致后续页面尺寸异常的问题

这个问题出在exam文档类和pdflscape包的兼容性上——pdflscape的landscape环境切换回纵向时,没有正确恢复exam类自定义的页面布局参数,导致后续页面的尺寸、边距和页码位置全部跑偏。

下面给两种可行的修复方法:

方法一:改用lscape包替代pdflscape

lscape包对自定义页面布局的文档类兼容性更好,替换后无需额外调整:

修改代码中包的引入部分,把\usepackage{pdflscape}换成\usepackage{lscape},完整代码如下:

\documentclass{exam}
\usepackage{lscape} % 替换pdflscape
\usepackage{pdfpages}
\usepackage{lipsum}

\printanswers
\begin{document}
Page1
\newpage
Page2
\begin{landscape}
    \begin{solution}
        \includegraphics{example-image-a}
     \end{solution}
\end{landscape}
\lipsum
\end{document}

编译后,landscape环境后的页面会自动恢复exam类的原始布局,页码位置也会回到正常的90%左右位置。

方法二:手动恢复exam类的页面设置(保留pdflscape)

如果必须使用pdflscape,可以在landscape环境结束后手动重置页面样式和参数:

在\end{landscape}之后添加重置命令,强制恢复exam类的原始页面布局:

\documentclass{exam}
\usepackage{pdflscape}
\usepackage{pdfpages}
\usepackage{lipsum}

\printanswers
\begin{document}
Page1
\newpage
Page2
\begin{landscape}
    \begin{solution}
        \includegraphics{example-image-a}
     \end{solution}
\end{landscape}
% 手动恢复exam类的页面设置
\makeatletter
\@resetperpage % 调用exam内部的页面重置命令
\makeatother
\pagestyle{headandfoot} % 恢复默认页码样式
\lipsum
\end{document}

这段代码会修正后续页面的尺寸和页码位置异常问题。

内容的提问来源于stack exchange,提问作者Sir Falk

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.18 17:10:16