3

I'm puzzled why Koma-script in certain situations doesn't honor vertical skip before heading if the heading is after longtable

Consider the following example:

\documentclass[12pt, paper = B5]{scrbook}

\usepackage{fontspec}
\usepackage{longtable}
\usepackage{lipsum}

\setmainfont{EB Garamond}
\setsansfont{Libertinus Sans}

\begin{document}

\LTpre  = 0pt
\LTpost = 0pt

\chapter{Nam dui ligula}

\section{Curabitur auctor semper nulla}

\begin{longtable}{ll}
    Lorem ipsum dolor sit amet & consectetuer adipiscing elit\\
    Ut purus elit, vestibulum ut & placerat ac, adipiscing vitae, felis.\\
\end{longtable}

\subsection{Morbi auctor lorem}

\lipsum[3]

\end{document}

The resulting subsection heading will be just after the table:

enter image description here

Now if I remove chapter and section, suddenly the skip is honored:

enter image description here

Where is the logic? How to force Koma-script always perform the skip?

6

This is not related to koma-script, you would see the same with book.

The problem is that you have only a longtable between \section and \subsection and this doesn't trigger the change of the \if@nobreak conditional.

\documentclass[12pt, paper = B5]{scrbook}

\usepackage{fontspec}
\usepackage{longtable}
\usepackage{lipsum}

\setmainfont{EB Garamond}
\setsansfont{Libertinus Sans}

\begin{document}

\LTpre  = 0pt
\LTpost = 0pt

\chapter{Nam dui ligula}

\section{Curabitur auctor semper nulla}

\begin{longtable}{ll}
    Lorem ipsum dolor sit amet & consectetuer adipiscing elit\\
    Ut purus elit, vestibulum ut & placerat ac, adipiscing vitae, felis.\\
\end{longtable}

\makeatletter \@nobreakfalse \makeatother %added
\subsection{Morbi auctor lorem}

\lipsum[3]

\end{document}

enter image description here

2
  • 2
    I guess I should fix that.... longtable doesn't start a paragraph.... Mar 23 at 11:58
  • Wow... I wouldn't have guessed it myself. Thanks!
    – facetus
    Mar 23 at 18:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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