2

The vertical offset used to position the body text on the first page of a chapter:

\documentclass[chapterprefix = true]{scrbook}

\usepackage{blindtext}

\begin{document}

\chapter{Test Chapter}
\blindtext[5]

\end{document}

gives

enter image description here

Apparently it's not \topmargin: using the layout package gives me this description of the page layout, which applies to the following pages, not the opening page.

enter image description here

I haven't been able to find it documented in the KOMA-Script manual. All help is appreciated.

Edit: I want to use this value to place a block of text (an epigraph, specifically) on the preceding page so that it lines up nicely, like so:

enter image description here

I just need to get the vertical offset; changing it is not necessary at this point.

7
  • 1
    This is controlled by multiple spaces, everything up to the type block, the chapterheadstartvskip, chapterheadmidvskip and chapterheadendvskip` (IIRC). The last mentioned can easily be changed using \RedeclareSectionCommand. Load package showframe to see what is going on int the margin part of the page.
    – Johannes_B
    Commented Feb 25, 2015 at 19:40
  • @Manuel Sure, why not? Well, to be honest, i don't know of any problems so far.
    – Johannes_B
    Commented Feb 25, 2015 at 19:50
  • Depending on what content you have on the page, the actual start of the text won't be fixed. For example, a multiline chapter title, or the raggedbottom/flushbottom business. KOMA itself has a mechanismm for epigrapphs (on the same page as the chapter title).
    – Johannes_B
    Commented Feb 25, 2015 at 20:07
  • I'm using KOMA's dictum command to place the epigraph, but I need it to be on a page by itself. Commented Feb 25, 2015 at 20:09
  • 1
    Are there any news here? Did you resolve the issue and can even provide a self answer?
    – Johannes_B
    Commented Apr 23, 2015 at 20:56

1 Answer 1

2

There is not a single length, that describes this distance, but several lengths and some are also depending on font sizes:

  • The top margin. This is \topmargin + 1 inch, because the origin is not at the top left edge but 1 inch from the top and left edge of the paper. If you are using something like crop also \voffset can be involved. But in this case you would also have to device whether or not the length should be measured from the physical paper edge or the logical one. So in the following I will omit the potential influence of \voffset.
  • The height of the page head. This is \headheight.
  • The distance between the page head and the text area. This is \headsep.
  • The distance between the to edge of the text area and the first base line. This is \topsep.
  • The distance above the chapter heading. This what you can set by option beforeskip of command \RedeclareSectionCommand. As long as you do not change the style of \chapter this is stored in the internal macro \scr@chapter@beforeskip. The glue value of this macro can also be negative. With KOMA-Script <= 3.25 instead of the negative value always the absolute value has to be used. Since KOMA-Script 3.25 this is more complicate but I omit this in the following.
  • The size of the prefix line. This is \baselineskip, but you have to setup the font before using the value of \baselineskip.
  • The distance between the prefix line and the main title line. This what you can set by option midkip of command \RedeclareSectionCommand. As long as you do not change the style of \chapter this is stored in the internal macro \scr@chapter@innerskip. This can also be a glue.
  • The size of the main title of the chapter. This is \baselineskip, but you have to setup the font before using the value of \baselineskip. This is correct as long a the heading does not need line breaks.
  • The distance below the chapter heading. This what you can set by option afterskip of command \RedeclareSectionCommand. As long as you do not change the style of \chapter This is stored in the internal macro \scr@chapter@belowskip. However, the glue value of this command also can be negative. With KOMA-Script <= 3.25 instead of the negative value always the absolute value has to be used. Since KOMA-Script 3.25 this is more complicate but I omit this in the following.

With this knowledge we can do the calculation, but we should delay it until \begin{document}.

\documentclass[chapterprefix = true]{scrbook}

\usepackage{blindtext}

\usepackage{eso-pic,picture,xcolor}

\newlength{\topedgetotextbelowchapter}
\makeatletter
\AtBeginDocument{%
  \setlength{\topedgetotextbelowchapter}{%
    \dimexpr \topmargin+1in% the top margin
            +\headheight% the head height
            +\headsep% distance from head to text area
            +\topsep% distance to the first base-line
            +\glueexpr\scr@chapter@innerskip\relax% distance between the prefix and the title
    \relax
    \addtolength{\topedgetotextbelowchapter}{%
      % distance before the heading
      \ifdim \glueexpr\scr@chapter@beforeskip\relax<\z@
        -\glueexpr\scr@chapter@beforeskip\relax
      \else
        \glueexpr\scr@chapter@beforeskip\relax
      \fi
    }
    \addtolength{\topedgetotextbelowchapter}{%
      % distance after the heading
      \ifdim \glueexpr\scr@chapter@afterskip\relax<\z@
        -\glueexpr\scr@chapter@afterskip\relax
      \else
        \glueexpr\scr@chapter@afterskip\relax
      \fi
    }
  }%
  {\usekomafont{disposition}\usekomafont{chapter}{%
      \global\advance\topedgetotextbelowchapter
      \baselineskip
      \usekomafont{chapterprefix}{%
        \global\advance\topedgetotextbelowchapter
        \baselineskip
      }}}%
}
\makeatother
\usepackage{showframe}
\begin{document}
\AddToShipoutPictureBG*{%
  \AtPageUpperLeft{%
    \thicklines\color{red}%
    \put(.5\paperwidth,0){\vector(0,-1){\topedgetotextbelowchapter}}%
  }%
}
\chapter{Test Chapter}
\blindtext[3]

\end{document}

enter image description here

You should note, that this is a hacker solution, because it uses internal macros that are not documented to be used by package authors or users.

You must log in to answer this question.

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