Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question
1  
I suggest the obvious: Remove the \mbox in final mode. –  Ulrike Fischer Apr 7 '11 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. –  Martin Apr 8 '11 at 4:45

1 Answer 1

up vote 2 down vote accepted

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
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.