Document Classeskoma scrartcl with parskip - section spacing

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
thrope
Posts: 9
Joined: Tue Jun 03, 2008 10:41 pm

koma scrartcl with parskip - section spacing

Post by thrope »

Hi,

I am using KOMA script scratcl to typeset a document.

Due to journal requirements I need to use the 'parskip' option to have
paragraphs seperated by a blank line.

When I do this, the spacing between (sub)section headings and the body
text becomes very big.

At the moment the only solution I have is to wrap the \section and
first paragraph as below:

"""
{\setlength{\parskip}{0pt}
\section{A Section}
this is the first paragraph.
}

This is the second paragraph (with 1 line parskip)
"""

but this seems very messy. Is there anyway to define this in a nice
way? Alternatively is there something like \aftersectionskip that I
could redefine to remove the section spacing and just have the
paragraph spacing? (It is having both that seems to cause the
problem). I had a pretty good look through the koma script manual but
couldn't find anything about setting spacing after section headers.

I also thought of defining my own section command to do the above -
but I didn't know how I could restrict the reset of parskip to just
the first paragraph.

Any help greatfully received...

Thanks

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
Stefan Kottwitz
Site Admin
Posts: 10323
Joined: Mon Mar 10, 2008 9:44 pm

koma scrartcl with parskip - section spacing

Post by Stefan Kottwitz »

Hi thrope,

you could redefine the \section command. \section calls \@startsection with some parameters containing also values concerning the spacing before and after. Have a look into scrartcl.cls, especially at the 4th and 5th parameter of \@startsection.
Alternatively you could use the titlesec package to customize section format and spacing.

Stefan
LaTeX.org admin
thrope
Posts: 9
Joined: Tue Jun 03, 2008 10:41 pm

Re: koma scrartcl with parskip - section spacing

Post by thrope »

Thanks for the prompt reply!

I wasn't sure titlesec was compatible with koma script. I had seen in the FAQ that koma script was supposed to provide the same functionality itself, but having looked at the .cls file as you suggest it seems those spacings are hard coded.

titlesec with the \titlespacing command seemed to work well. I have another question though - I wanted to leave the before skip unchanged and just change the after skip to zero. Looking up the \section definition it seems that the before skip argument (to \@startsection) is:
-3.5ex\@plus -1ex \@minus -.2ex

Why are these negative?

When I put the same value in the before skip of \titlespacing the sections start far to close to the previous text, almost overlapping.
Thats just for interest though,
\titlespacing{\section}{0pt}{*1}{*0}
is working fine for me.

Thanks again,
User avatar
Stefan Kottwitz
Site Admin
Posts: 10323
Joined: Mon Mar 10, 2008 9:44 pm

koma scrartcl with parskip - section spacing

Post by Stefan Kottwitz »

thrope wrote:Looking up the \section definition it seems that the before skip argument (to \@startsection) is:
-3.5ex\@plus -1ex \@minus -.2ex
Why are these negative?
The absolute value specifies the skip before, the sign determines the indentation: if the value is negative then the paragraph indent of text following the heading will be suppressed.

Stefan
LaTeX.org admin
Post Reply