cleanthesis 中 \section 后的分页符

cleanthesis 中 \section 后的分页符

我正在使用Cleanthesis LaTeX 风格,它本身基于 Koma-Script 的“报告”类,有时我会在\section或之后直接看到分页符\subsection。如果不使用 Cleanthesis,我无法重现这种情况,但使用 Cleanthesis 重现这种情况相当容易。

为了重现它,请创建一个包含以下内容的 example.tex 文件:

\chapter{Chapter}

\section{Section}

\subsection{Subsection}

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

\section{Section 2}

\subsection{Subsection 2}

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

然后编辑默认的 my-thesis.tex 以仅包含此文件:

[...]
%\input{content/chapter-introduction}   % INCLUDE: introduction
%\input{content/chapter-related-work}   % INCLUDE: related work
%\input{content/chapter-system}         % INCLUDE: system
%\input{content/chapter-concepts}       % INCLUDE: concepts
%\input{content/chapter-conclusion}     % INCLUDE: conclusion
\input{example}
[....]

结果如下:

在此处输入图片描述

关于为什么会发生这种情况或如何解决它有什么提示吗?

答案1

如果在加载后添加以下代码cleanthesis,KOMA-Script 将再次控制章节和小节标题。

\RedeclareSectionCommand[
  beforeskip=-.75em,
  afterskip=.2em%
]{section}
\addtokomafont{section}{\mdseries}
\renewcommand\sectionformat{\textcolor{ctcolorblack}{\thesection}\hspace*{10pt}}
\RedeclareSectionCommand[
  beforeskip=-.5em,
  afterskip=1sp%
]{subsection}
\addtokomafont{subsection}{\mdseries}
\renewcommand\subsectionformat{\textcolor{ctcolorblack}{\thesubsection}\hspace*{10pt}}

在此处输入图片描述

代码:

\documentclass[%
  paper=A4,                 % paper size --> A4 is default in Germany
  twoside=true,             % onesite or twoside printing
  openright,                    % doublepage cleaning ends up right side
  parskip=full,             % spacing value / method for paragraphs
  chapterprefix=true,           % prefix for chapter marks
  11pt,                     % font size
  headings=normal,          % size of headings
  bibliography=totoc,           % include bib in toc
  listof=totoc,             % include listof entries in toc
  titlepage=on,             % own page for each title page
  captions=tableabove,      % display table captions above the float env
  draft=false,              % value for draft version
]{scrreprt}%

\usepackage[utf8]{inputenc}     % defines file's character encoding
\usepackage[english]{babel} % babel system, adjust the language of the content
\usepackage[                    % clean thesis style
  figuresep=colon,%
  sansserif=false,%
  hangfigurecaption=false,%
  hangsection=true,%
  hangsubsection=true,%
  colorize=full,%
  colortheme=bluemagenta,%
  bibsys=bibtex,%
  bibfile=bib-refs,%
  bibstyle=alphabetic,%
]{cleanthesis}

\RedeclareSectionCommand[
  beforeskip=-.75em,
  afterskip=.2em%
]{section}
\addtokomafont{section}{\mdseries}
\renewcommand\sectionformat{\textcolor{ctcolorblack}{\thesection}\hspace*{10pt}}
\RedeclareSectionCommand[
  beforeskip=-.5em,
  afterskip=1sp%
]{subsection}
\addtokomafont{subsection}{\mdseries}
\renewcommand\subsectionformat{\textcolor{ctcolorblack}{\thesubsection}\hspace*{10pt}}

\begin{document}
\pagestyle{maincontentstyle}    % fancy header and footer
\chapter{Chapter}

\section{Section}

\subsection{Subsection}

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

\section{Section 2}

\subsection{Subsection 2}

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
\end{document}

答案2

好的,看起来这是由于在 Cleanthesis 中使用\colorwith引起的\setkomafont。此处描述了类似的问题:

我已经能够通过在 cleanthesis.sty 中添加\nobreak以下内容来修复此问题\color。以下是包含修复程序的 Github 拉取请求:

https://github.com/derric/cleanthesis/pull/89

更新:上述拉取请求现已合并到 cleanthesis 的 Github 仓库中。

相关内容