我有以下脚本(第一页和第三页相同。但它显示的纸张尺寸不同)
\documentclass{scrartcl}
\usepackage{pdfpages}
\usepackage{geometry}
\usepackage[automark]{scrlayer-scrpage}
\begin{document}
\KOMAoptions{paper=432pt:566.36717pt,DIV=calc}
\recalctypearea
\newgeometry{layoutwidth = 432pt,layoutheight = 566.36717pt,left=0mm,right=0mm,top=0mm, bottom=0mm,footskip=1mm}
POTRAIT
\KOMAoptions{paper=432pt:226.15027pt,DIV=calc,paper=landscape}
\recalctypearea
\newgeometry{layoutwidth = 432pt,layoutheight = 226.15027pt,left=0mm,right=0mm,top=0mm, bottom=0mm,footskip=1mm}
LANDSCAPE
\KOMAoptions{paper=432pt:566.36717pt,DIV=calc}
\recalctypearea
\newgeometry{layoutwidth = 432pt,layoutheight = 566.36717pt,left=0mm,right=0mm,top=0mm, bottom=0mm,footskip=1mm}
EXPECTING SAME SIZE AND ORIENTATION (POTRAIT) AS FIRST PAGE, BUT DOES NOT WORK
\end{document}
此代码不起作用。第一个和最后一个代码相同。它显示不同的页面大小
输出
现在我尝试使用verions=3.21
按照https://tex.stackexchange.com/a/556997/221200
\documentclass[version=3.21]{scrartcl}
\usepackage{pdfpages}
\usepackage{geometry}
\usepackage[automark]{scrlayer-scrpage}
\begin{document}
\KOMAoptions{paper=432pt:566.36717pt,DIV=calc}
\recalctypearea
\newgeometry{layoutwidth = 432pt,layoutheight = 566.36717pt,left=0mm,right=0mm,top=0mm, bottom=0mm,footskip=1mm}
POTRAIT
\KOMAoptions{paper=432pt:226.15027pt,DIV=calc}
%removed paper=landscape
\recalctypearea
\newgeometry{layoutwidth = 432pt,layoutheight = 226.15027pt,left=0mm,right=0mm,top=0mm, bottom=0mm,footskip=1mm}
LANDSCAPE
\KOMAoptions{paper=432pt:566.36717pt,DIV=calc}
\recalctypearea
\newgeometry{layoutwidth = 432pt,layoutheight = 566.36717pt,left=0mm,right=0mm,top=0mm, bottom=0mm,footskip=1mm}
EXPECTING SAME SIZE AND ORIENTATION (POTRAIT) AS FIRST PAGE AND IT WORKS
\end{document}
它的工作方式与预期的方式相同
输出
为什么第一个脚本运行不佳。
编辑
对于以下代码,我收到错误! Package scrbase Error: unknown option
paper=potrait'.`。此代码有什么问题。它看起来与 @esdd 的答案相同
%%%%%%% NOT WORKING
\documentclass[usegeometry]{scrartcl}
\usepackage{pdfpages}
\usepackage{geometry}
\usepackage[automark]{scrlayer-scrpage}
\begin{document}
\KOMAoptions{paper=432pt:566.36717pt,paper=potrait}
\recalctypearea
\newgeometry{layoutwidth = 432pt,layoutheight = 566.36717pt,left=0mm,right=0mm,top=0mm, bottom=0mm,footskip=1mm}
POTRAIT
\KOMAoptions{paper=432pt:226.15027pt,paper=landscape}
\recalctypearea
\newgeometry{layoutwidth = 432pt,layoutheight = 226.15027pt,left=0mm,right=0mm,top=0mm, bottom=0mm,footskip=1mm}
LANDSCAPE
\KOMAoptions{paper=432pt:566.36717pt,paper=potrait}
\recalctypearea
\newgeometry{layoutwidth = 432pt,layoutheight = 566.36717pt,left=0mm,right=0mm,top=0mm, bottom=0mm,footskip=1mm}
EXPECTING SAME POTRAIT
\end{document}
答案1
关于选项,paper
KOMA-Script 版本 3.22 中有一个变化:现在取决于方向(portrait
或landscape
)哪个值作为高度,哪个值作为宽度。
使用 时paper = landscape
,paper=566.36717pt:432pt
和 paper=432pt:566.36717pt
都会使页面高度为 432pt,宽度为 566.36717pt。如果要切换到纵向,则必须paper=portrait
明确添加:
\documentclass[usegeometry]{scrartcl}
\usepackage{pdfpages}
\usepackage{geometry}
\usepackage[automark]{scrlayer-scrpage}
\begin{document}
\KOMAoptions{paper=432pt:566.36717pt}
\recalctypearea
\newgeometry{margin=0mm,footskip=1mm}
POTRAIT
\KOMAoptions{paper=432pt:226.15027pt,paper=landscape}
\recalctypearea
\newgeometry{margin=0mm,footskip=1mm}
LANDSCAPE
\KOMAoptions{paper=432pt:566.36717pt,
paper=portrait% <- added
}
\recalctypearea
\newgeometry{margin=0pt,footskip=1mm}
EXPECTING SAME SIZE AND ORIENTATION (POTRAIT) AS FIRST PAGE, BUT DOES NOT WORK
\end{document}
补充说明:我建议使用类选项usegeometry
。