![在自己的类文件中设置 koma 脚本选项](https://linux22.com/image/420761/%E5%9C%A8%E8%87%AA%E5%B7%B1%E7%9A%84%E7%B1%BB%E6%96%87%E4%BB%B6%E4%B8%AD%E8%AE%BE%E7%BD%AE%20koma%20%E8%84%9A%E6%9C%AC%E9%80%89%E9%A1%B9.png)
我问了一个问题,关于如何使用 scrlayer-scrpage 在 koma 脚本中设置页脚,以便获得页码和文本之间的正确距离(https://tex.stackexchange.com/a/559567/18561)。如果直接加载 komascript,则解决方案有效,但如果我在单独的类文件中加载 komascript,则无法使其工作。
% \documentclass[footlines=1]{scrbook}
\documentclass{debug-langscibook}
% \usepackage{scrlayer-scrpage}
%\usepackage{scrpage2}
\usepackage{showframe}
\usepackage{lipsum}% only for dummy text
\begin{document}
\lipsum[1-20]
\end{document}
这是自定义的类:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Class
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\LoadClass[
footlines=1,
]{scrbook}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Header and footer
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{datetime}
\usepackage{scrlayer-scrpage}
%\usepackage{scrpage2}
footline=1 选项被忽略。
答案1
Optionfootline
和 optionfootheight
是包的选项typearea
,由 KOMA-Script 类自动加载。但如果在 的参数中使用这些选项\LoadClass
,包typearea
将看不到它们。
您可以使用
\PassOptionsToPackage{footlines=1}{typearea}
\LoadClass{scrbook}
\RequirePackage{scrlayer-scrpage}
或者
\LoadClass{scrbook}
\KOMAoptions{footlines=1}
\recalctypearea
\RequirePackage{scrlayer-scrpage}