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.

I'm typesetting a large document (phdthesis) with pdflatex and I'm using KOMAscriptand the scrreprtdocument class.

I was very surprised as I saw a heading (\subsubsection) standing at the bottom of a page without any text below! This is really bad style and it seems to happen to others also (see How can one keep a \section{} from being at the end of a page in LaTeX? and Avoiding page breaks shortly after section/subsection headings), but in my case the pagebreak is directly after the heading - there are not even 2 lines of text attached...

It seems to have to do with the many and big floats in this chapter and I think I'll have to adjust that manually, when the text is complete and editing is finished.

However, I wonder if pdflatex should not at least print a warning about that in the log file (I could not find any warnings concerning that), if it feels impelled to do such ugly things... And I use the \raggedbottom-option (as I also had problems with very big spacing between large paragraphs), so I had hoped that this would avoid such "orphans".

setting the penalties to 1000 did not change anything:

\widowpenalty=1000
\clubpenalty=1000

---------- edit:

I now know where it comes from, but not how to avoid it:
I have defined a command to quickly add fixmenotes to the document with \N{Note}
It is defined as \newcommand{\N}[1]{\fxfatal*[inline=true,nomargin]{/#1/}{}}

... and I used it directly after the problematic section command like:

\subsubsection{Title of the section}
\N{note about what to change in that section later} And now starts the normal text of the section...

If I move the note \N{...} to another place, e. g. after the first sentence of the section, the pagebreak is before the section title.

Question: Is there anything I can do to redefine the \N{} command to avoid that behavior?


It would be difficult to construct a minimal example in this case, so my question is:
1) why is there no warning? 2) I would consider a lonely heading much worse than a page which has some empty white space at the bottom - how can I make pdflatex "know" that?

My preamble has become quite complex with the time - I have left out all "simple" newcommands etc. and tried only to keep things which might interfere with my questions:

\documentclass[11pt, a4paper,  
twoside, autooneside,
headinclude, footexclude, 
liststotoc, bibtotoc,
tablecaptionabove, noonelinecaption, headsepline, halfparskip 
]{scrreprt}

\usepackage{svn-multi}
\svnidlong
%(...)

\areaset[8mm]{15.5cm}{25.2cm} 

\setkomafont{sectioning}{\normalfont\normalcolor\bfseries} 
\addtokomafont{captionlabel}{\bfseries} 

\usepackage[UKenglish, ngerman]{babel} 
\usepackage[latin1]{inputenc}
\usepackage[TS1, T1]{fontenc}
\usepackage{aecompl}
\usepackage[ngerman, iso]{isodate}
\isodate
\usepackage{datetime} 
\usepackage[version=3]{mhchem} 
\usepackage[caption=false, format=hang]{subfig} 
\usepackage{pdflscape} 
\usepackage[stable]{footmisc} 

\usepackage[automark]{scrpage2} 
\pagestyle{scrheadings}
\automark[section]{chapter}
\cfoot{\footnotesize Rev.~\svnrev{} (\svnfilerev) \\vom \svnyear-\svnmonth-\svnday \ \svnhour:\svnminute:\svnsecond} 
\ifoot{\footnotesize erstellt:\\\today{} \currenttime} 


\usepackage{hyperref} 
\usepackage[pdftex]{graphicx} 
\usepackage{color} 

\usepackage{amsmath} 
 \usepackage{amstext} 
\usepackage{amssymb} 


\usepackage{array} 
\usepackage{tabularx} 
\usepackage{longtable}
\usepackage{booktabs} 


\usepackage[numbers, sort&compress]{natbib} 
\usepackage[]{rotating} 
\usepackage{url} 
\usepackage[tight]{units} 

\usepackage[color]{showkeys} 
\renewcommand*\showkeyslabelformat[1]{\fbox{\normalfont\tiny\ttfamily#1}} 
\definecolor{refkey}{cmyk}{0.26,0,0.76,0}%{gray}{0.5} 
\definecolor{labelkey}{cmyk}{0.26,0,0.76,0}%{gray}{0.5}

\usepackage[draft]{fixme} 
\fxsetup{theme=color, inline, targetlayout=color, author=} 



\usepackage{paralist}

\deffootnote[1em]{1em}{1em} {\textsuperscript{\thefootnotemark} }


\setcapindent{1cm}

\makeatletter
\setlength{\@fptop}{0pt}
\makeatother

% Alter some LaTeX defaults for better treatment of figures:
%Quelle: http://mintaka.sdsu.edu/GF/bibliog/latex/floats.html
    % See p.105 of "TeX Unbound" for suggested values.
    % See pp. 199-200 of Lamport's "LaTeX" book for details.
    %   General parameters, for ALL pages:
    \renewcommand{\topfraction}{0.9}    % max fraction of floats at top
    \renewcommand{\bottomfraction}{0.8} % max fraction of floats at bottom
    %   Parameters for TEXT pages (not float pages):
    \setcounter{topnumber}{3}
    \setcounter{bottomnumber}{2}
    \setcounter{totalnumber}{4}     % 2 may work better
    \setcounter{dbltopnumber}{2}    % for 2-column pages
    \renewcommand{\dbltopfraction}{0.9} % fit big float above 2-col. text
    \renewcommand{\textfraction}{0.07}  % allow minimal text w. figs
    %   Parameters for FLOAT pages (not text pages):
    \renewcommand{\floatpagefraction}{0.8}  % require fuller float pages
    % N.B.: floatpagefraction MUST be less than topfraction !!
    \renewcommand{\dblfloatpagefraction}{0.8}   % require fuller float pages
    % remember to use [htp] or [htpb] for placement
share|improve this question
    
@Martin: I have shorten the title. I hope you don't mind. Please keep title short and meaningful. –  Martin Scharrer Mar 30 '11 at 9:43
    
@ Martin Scharrer: you're the expert. :-) IMHO meaning also has to do with detail. Should we add a hint to the problem in the title like "caused by command after section", now that its solved? –  Martin Mar 30 '11 at 10:04

1 Answer 1

up vote 3 down vote accepted

If there is a page break in your document this means that something in your code allows or asks for it. So why should pdflatex complain? It is only executing your code.

Last time that I saw this problem it was due to color commands in the section title (but it shouldn't happen in new KOMA versions). So try at first to remove the color commands from your \setkomafont{sectioning}.

Another possibility is that the text behind the title allows the page break. E.g. longtables could be a problem. In this case the package needspace can help.

share|improve this answer
    
wow, thanks for your quick reply! I removed the color command (that left: \setkomafont{sectioning}{\normalfont\bfseries}) and even commented out the complete line, but no change. –  Martin Mar 30 '11 at 9:36
    
@ Ulrike: "the text behind the title allows the page break" good point -> see my edit in the question. How can I avoid that by changing the command \N{}? –  Martin Mar 30 '11 at 9:47
2  
You could try to put text and so start the paragraph before the fixme command. E.g. \newcommand{\N}[1]{\mbox{}\fxfatal*[inline=true,nomargin]{/#1/}{}} –  Ulrike Fischer Mar 30 '11 at 9:50
    
thanks - that seems to do the trick! Interestingly, by "adding text" the number of pages in my document decreased by one (to 196). ;-) This change also seems to affect other pages, as I have lots of those notes –  Martin Mar 30 '11 at 10:00
    
unfortunately I found a side effect with the '\mbox'-solution: tex.stackexchange.com/questions/15240/… Can you help? –  Martin Apr 7 '11 at 14:46

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.