0

I'm trying to declare a new section command in KOMA-Script which is formatted exactly like part.

According to the user guide the default for beforeskip is 0pt plus 1fil + \baselineskip. Unfortunately one can't just declare beforeskip=0pt plus 1fil + \baselineskip or beforeskip=0pt plus \dimexpr 1fil + \baselineskip\relax. It seems that this doesn't expand to a length.

Minimal example:

\documentclass{scrbook}
\usepackage[T1]{fontenc}

\DeclareNewSectionCommand[%
    beforeskip=0pt plus \dimexpr 1fil + \baselineskip\relax,% doesn't work: "unknown option value"
    afterskip=0pt plus 1fil,%
    style=part,%
    tocstyle=part,%
    level=-1,%
    tocindent=0em,%
    tocnumwidth=1.2em%
]{specialpart}

\begin{document}
\part{Part One}
\specialpart{Part Two}
\end{document}
  • 1
    to use an etex expression you would need \glueexpr not \dimexpr as the latter is for fixed lengths but it isn't needed here. – David Carlisle Jun 10 at 15:28
3

1\baselineskip is a dimen not a skip so you can do

\documentclass{scrbook}
\usepackage[T1]{fontenc}

\DeclareNewSectionCommand[%
    beforeskip=1\baselineskip plus 1fil,
    afterskip=0pt plus 1fil,%
    style=part,%
    tocstyle=part,%
    level=-1,%
    tocindent=0em,%
    tocnumwidth=1.2em%
]{specialpart}

\begin{document}

\part{Part One}
\specialpart{Part Two}
\end{document}
| improve this answer | |
  • Is there no difference between + and plus? – keth-tex Jun 10 at 15:37
  • @keth-tex classic tex has no + and in an etex expresion + is addition, like \advance, plus isn't addition at all it is the specification of the stretch component of a glue. – David Carlisle Jun 10 at 15:39
  • 1
    @keth-tex that is 5pt plus 2pt is not 7pt it is glue with natural length 5pt that can stretch a further 2pt. but the etex expression \dimexpr 5pt + 2pt is the fixed length, 7pt. – David Carlisle Jun 10 at 15:40
  • That is what I thought. That + is addition and plus a possible stretch. Yet, how then is 1\baselineskip plus 1fil the same as 0pt plus 1fil + \baselineskip? – keth-tex Jun 10 at 15:46
  • @keth-tex same way 1+2 is same as 3, I did the addition in my head. addition of glue adds the three components separately \baselineskip is (always in any sensible document) a fixed length, so the fixed component is 0pt+\baselineskip, the stretch component is 1fil plus 0 and the shrink component is 0 + 0. – David Carlisle Jun 10 at 15:49

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.