我想设置一个带有自定义标题的 Latex 文档,但在执行过程中遇到了一些问题。我尝试了许多代码设置变体,但无法产生我想要的结果。
我希望找到一个可能遇到过相同问题并解决了这些问题或更了解底层情况的人来帮助我解决问题。
当前状态
下面我描述并说明我的文档的当前状态,从光学效果开始:
第一页
第二页
最小示例:
\documentclass[a4paper,fontsize=8pt,pdftex,landscape]{scrbook}
\usepackage[inner=1cm,outer=1cm,top=1cm,bottom=1cm,showframe]{geometry}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\renewcommand*\oldstylenums[1]{\carlitoOsF #1}
\usepackage[sfdefault,lf]{carlito}
\usepackage{multicol}
\usepackage[most]{tcolorbox}
\usepackage{MnSymbol}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead{} % clear all fields
\renewcommand{\headrulewidth}{0pt}
\fancyhead[CO,CE]{\begin{tcbraster}[raster columns=1]
\end{tcbraster}
\begin{tcbraster}[raster columns=3]
\begin{tcolorbox}[halign=center, center title, valign=center, equal height group=A, , adjusted title=Placeholder]
Placeholder box
\end{tcolorbox}
\begin{tcolorbox}[halign=center, center title, valign=center, equal height group=A, , adjusted title=Placeholder]
Placeholder box
\end{tcolorbox}
\begin{tcolorbox}[halign=center, center title, valign=center, equal height group=A, , adjusted title=Placeholder]
Placeholder box
\end{tcolorbox}
\end{tcbraster}
}
\begin{document}
\Large
\begin{multicols*}{5}
\begin{tcolorbox}[halign=center, center title, valign=center, equal height group=A, , adjusted title=Placeholder]
Placeholder box
\end{tcolorbox}
\begin{tcolorbox}[halign=center, center title, valign=center, equal height group=A, , adjusted title=Placeholder]
Placeholder box
\end{tcolorbox}
\begin{tcolorbox}[halign=center, center title, valign=center, equal height group=A, , adjusted title=Placeholder]
Placeholder box
\end{tcolorbox}
\begin{tcolorbox}[halign=center, center title, valign=center, equal height group=A, , adjusted title=Placeholder]
Placeholder box
\end{tcolorbox}
\columnbreak
\begin{tcolorbox}[halign=center, center title, valign=center, equal height group=A, , adjusted title=Placeholder, height=9.2cm]
Placeholder box
\end{tcolorbox}
\begin{tcolorbox}[halign=center, center title, valign=center, equal height group=A, , adjusted title=Placeholder, height=9.2cm]
Placeholder box
\end{tcolorbox}
\newpage
\begin{tcolorbox}[halign=center, center title, valign=center, equal height group=A, , adjusted title=Placeholder, height=9.2cm]
Placeholder box
\end{tcolorbox}
\begin{tcolorbox}[halign=center, center title, valign=center, equal height group=A, , adjusted title=Placeholder, height=9.2cm]
Placeholder box
\end{tcolorbox}
\begin{tcolorbox}[halign=center, center title, valign=center, equal height group=A, , adjusted title=Placeholder, height=9.2cm]
Placeholder box
\end{tcolorbox}
\end{multicols*}
\end{document}
问题
所示文档/最小示例中遇到的问题如下:
- 第一页的内容没有在定义的文本边框内开始(但在第二页上它神奇地开始了),我该如何解决这个问题?
- 尽管我使用的是 multicol 的“不平衡列”版本,即
begin{multicols*} [...] \end{multicols*}
- 它平衡了(第一)列的内容和它的高度,我该如何做呢?不是去做?\columnbreak
旁注:仅当我根据文档内容使用我确实想要使用的命令时,它才会这样做。 - 页面内容底部边框超出了实际页面尺寸 A4(可能是因为页眉比“预期”的要大),我怎样才能使它成为我在“几何”包中包含声明的那样?
答案1
headheight
您的标题比正常标题高,因此您必须使用几何选项设置高度。该
multicols*
环境仅启用最后一页的不平衡列。但是,您可以\vspace*{\fill}
在之前添加\columnbreak
以使列不平衡。通常,页眉和页脚位于页边距中。但由于页边距较小,并且页眉很高,因此它们不再适合。您可以相应地调整顶部和底部边距,或者只需将选项添加
includeheadfoot
到geometry
。这里我选择了后者。
另外,不建议将fancyhdr
包与 Koma Script 类一起使用。相反,您可以使用scrlayer-scrpage
包,它对于正常用例来说同样易于使用。
代码:
\documentclass[a4paper,fontsize=8pt,pdftex,landscape]{scrbook}
\usepackage[inner=1cm,outer=1cm,top=1cm,bottom=1cm,
includeheadfoot,% <-- added
headheight=76.86pt,% <-- added
showframe]{geometry}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
%\renewcommand*\oldstylenums[1]{\carlitoOsF #1}
%\usepackage[sfdefault,lf]{carlito}
\usepackage{multicol}
\usepackage[most]{tcolorbox}
%\usepackage{MnSymbol}
% changed to scrlayer-scrpage
\usepackage{scrlayer-scrpage}
\pagestyle{scrheadings}
% header
\ohead{}
\ihead{}
\chead{\begin{tcbraster}[raster columns=3]
\begin{tcolorbox}[halign=center, center title, valign=center, equal height group=A, adjusted title=Placeholder]
Placeholder box
\end{tcolorbox}
\begin{tcolorbox}[halign=center, center title, valign=center, equal height group=A, adjusted title=Placeholder]
Placeholder box
\end{tcolorbox}
\begin{tcolorbox}[halign=center, center title, valign=center, equal height group=A, adjusted title=Placeholder]
Placeholder box
\end{tcolorbox}
\end{tcbraster}
}
% footer
\ofoot{}
\ifoot{}
\cfoot{\pagemark}
\begin{document}
\Large
\begin{multicols*}{5}
\begin{tcolorbox}[halign=center, center title, valign=center, equal height group=A, , adjusted title=Placeholder]
Placeholder box
\end{tcolorbox}
\begin{tcolorbox}[halign=center, center title, valign=center, equal height group=A, , adjusted title=Placeholder]
Placeholder box
\end{tcolorbox}
\begin{tcolorbox}[halign=center, center title, valign=center, equal height group=A, , adjusted title=Placeholder]
Placeholder box
\end{tcolorbox}
\begin{tcolorbox}[halign=center, center title, valign=center, equal height group=A, , adjusted title=Placeholder]
Placeholder box
\end{tcolorbox}
\vspace*{\fill}% <-- added
\columnbreak
\begin{tcolorbox}[halign=center, center title, valign=center, equal height group=A, , adjusted title=Placeholder, height=7.2cm]
Placeholder box
\end{tcolorbox}
\begin{tcolorbox}[halign=center, center title, valign=center, equal height group=A, , adjusted title=Placeholder, height=7.2cm]
Placeholder box
\end{tcolorbox}
\newpage
\begin{tcolorbox}[halign=center, center title, valign=center, equal height group=A, , adjusted title=Placeholder, height=7.2cm]
Placeholder box
\end{tcolorbox}
\begin{tcolorbox}[halign=center, center title, valign=center, equal height group=A, , adjusted title=Placeholder, height=7.2cm]
Placeholder box
\end{tcolorbox}
\begin{tcolorbox}[halign=center, center title, valign=center, equal height group=A, , adjusted title=Placeholder, height=7.2cm]
Placeholder box
\end{tcolorbox}
\end{multicols*}
\end{document}
结果: