标题后的宏不允许分页。

标题后的宏不允许分页。

在之前的一个问题中,我需要解决以下问题:我已使用包定义了一个命令,用于在文档中插入特殊自定义注释fixme,并且如果这些注释位于章节标题之后,则可能在标题后直接出现分页符:页面底部的标题

\mbox一个可行的解决方案是在命令中 添加一个,例如:\newcommand{\N}[1]{\mbox{}\fxfatal*[inline=true,nomargin]{/#1/}{}}

不幸的是,现在我发现了一个不想要的效果:当我在“最终”模式下排版我的文档时(当包fixme应该自动从 pdf 中删除所有注释时,这些命令 \N{...} 需要页面上的空间,因此会创建大跳跃

如果我删除了\mbox,那就好了。

问题: 我如何修改命令,使其不允许标题和后续文本之间分页,但也不会在最终模式下产生空段落?

\documentclass[11pt, a4paper%,  halfparskip
twoside, autooneside, %doppelseitiges Layout, automatische Anpassung der Kopfzeile bei einseitigem Layout
headinclude, footexclude, %Parameter für Satzspiegelberechnung: Kopfzeile miteinbeziehen, Fußzeile ausschließen
%tocleft, listsleft, % Verzeichnisse ohne Einzug
liststotoc, bibtotoc, %TOC enthält Abb.- und Tab.-Verz. und Literaturverz.
tablecaptionabove, noonelinecaption, headsepline, halfparskip %Tabellenüberschrift über Tabellen, Trennlinine unter Kopfzeile, (halber) Abstand zwischen Absätzen
]{scrreprt}

\usepackage[ngerman]{babel}

\usepackage{showkeys}

\usepackage[final]{fixme} %Ueberarbeitungsmarkierungen im Dokument
\fxsetup{theme=color, inline, targetlayout=color, author=} %Optionen für fixme-Package
\newcommand{\N}[1]{\mbox{}\fxfatal*[inline=true,nomargin]{/#1/}{}}
\newcommand{\Nmod}[1]{\fxfatal*[inline=true,nomargin]{/#1/}{}}

\raggedbottom

\begin{document}

\chapter{Chapter one}\label{chapp1}
\section{Section one in chapter one}
\N{my fatal note is here}
\subsection{Subsection one of section one in chapter one}
\subsubsection{Subsubsec}
\N{my fatal note is here}
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur.


\section{Section two in chapter one}
\Nmod{my fatal note is here}
\subsection{Subsection one of section two in chapter one}
\subsubsection{Subsubsec}
\Nmod{my fatal note is here}
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur.

\end{document}

答案1

如果给出了“final”选项,为什么不直接定义\N来删除自身及其参数?或者使用自己的宏,而不是在 final 模式下为空的宏。\renewcommand\N[1]{}\mbox{}

只需使用您自己的微型软件包即可轻松完成此操作,该软件包具有draftfinal选项,如下所示。clsguide有关软件包创建的更多信息,请参阅。

% My own package
\ProvidesPackage{mynotes}[2011/04/07 My own note macros]
\DeclareOption{draft}{%
    \newcommand{\N}[1]{\mbox{}\fxfatal*[inline=true,nomargin]{/#1/}{}}%
    \newcommand{\Nmod}[1]{\fxfatal*[inline=true,nomargin]{/#1/}{}}%
}
\DeclareOption{final}{%
    \newcommand{\N}[1]{}%
    \newcommand{\Nmod}[1]{}%
}
\ProcessOptions\relax
%
\RequirePackage[final]{fixme} %Ueberarbeitungsmarkierungen im Dokument
\fxsetup{theme=color, inline, targetlayout=color, author=}
%
\endinput

相关内容