2

In a previous question I needed a solution for the following problem: I had defined a command for inserting special custom notes in my document with the fixme package and if those notes followed a section heading, it was possible that there was a page break directly after the heading: Heading at the bottom of the page.

A working solution was to add an \mbox to the command, like: \newcommand{\N}[1]{\mbox{}\fxfatal*[inline=true,nomargin]{/#1/}{}}

Unfortunately, now I found an unwanted effect of that: When I typeset my document in "final" mode (when the fixme package should automatically remove all notes from the pdf, these commands \N{...} require space on the page and therefore create big skips.

If I remove the \mbox, that's fine.

Question: How can I modify the command, that it does not allow a page break between heading and the following text, but also does not produce empty paragraphs in final mode?

\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}
2
  • 1
    I suggest the obvious: Remove the \mbox in final mode. Apr 7, 2011 at 15:32
  • @Ulrike: Thanks for your suggestions. That's really obvious and came to my mind also. However it is not as easy, as I have several different note commands defined which now all have the mbox inside. Martin Scharrer's solution seems to do (I did not test it yet) the same, but in a much more elegant way which I would prefer. :-) (I sometimes want to see my document in "final mode", although it is absolutely not finished, e. g. for seeing the "real" page count without all those annotations. Apr 8, 2011 at 4:45

1 Answer 1

2

Why you not just define \N to \renewcommand\N[1]{} to remove itself and its argument if the 'final' option is given? Alternatively use an own macro instead of \mbox{} which is empty in final mode.

This can be simply done with your own tiny package which has the draft and final options as shown below. See the clsguide for further information about package creation.

% 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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .