Document Classes[memoir] Eliminate aftersecskip

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
mudd1
Posts: 2
Joined: Mon Apr 26, 2010 6:38 pm

[memoir] Eliminate aftersecskip

Post by mudd1 »

I'm trying to create a document class based on memoir that adheres to guidelines stating that text after section headings (and subsection etc. for that matter) has to follow after a mere line break. No additional vertical separation is allowed. Furthermore, the style has to use no indentation and a blank line to separate paragraphs.

My take on this, demonstrated using a minimal example (and not the whole mess that is my .cls):

Code: Select all

\documentclass{memoir}
\nonzeroparskip
\setlength{\parindent}{0pt}

\setbeforesecskip{0pt}
\setaftersecskip{0.1pt} % curiously enough I can't use 0pt here

\begin{document}
Text before heading.
\section*{foobar}
Text after heading.
\end{document}
When compiling this, there is clearly a vertical space between heading and paragraph. Looking at the memoir documentation this isn't really surprising:

beforeskip + \parskip (of text font) + \baselineskip (of heading font)
3.5 Heading Title
afterskip + \parskip (of heading font) + \baselineskip (of text font)

The question though then is this: How do I get rid of this \parskip that gets added automatically? I couldn't even find a hook after the heading title that would allow for the dirty solution of automatically adding a \vspace{-\parskip} after every title. My search which command to redefine to get this right without creating even more side-effects didn't get me anywhere so far so I'd be very glad if anybody here could help me out.

Many thanks in advance!

Recommended reading 2024:

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

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

percep
Posts: 5
Joined: Fri Sep 25, 2009 6:10 pm

[memoir] Eliminate aftersecskip

Post by percep »

How about using \setsecheadstyle as follows:

Code: Select all

\documentclass{memoir}
\nonzeroparskip
\setlength{\parindent}{0pt}
\setbeforesecskip{0pt}
\setaftersecskip{0.1pt} % curiously enough I can't use 0pt here
\newcommand{\headhook}[1]{#1\vspace{-\parskip}}
\setsecheadstyle{\bfseries\headhook}
\begin{document}
Text before heading.
\section*{foobar}
Text after heading.
\end{document}
Seems to do the trick, but maybe someone else can come up with a more elegant solution.
mudd1
Posts: 2
Joined: Mon Apr 26, 2010 6:38 pm

[memoir] Eliminate aftersecskip

Post by mudd1 »

percep wrote:

Code: Select all

\newcommand{\headhook}[1]{#1\vspace{-\parskip}}
\setsecheadstyle{\bfseries\headhook}
Seems to do the trick, but maybe someone else can come up with a more elegant solution.
Great, works like a charm! I could have thought of that myself. Thanks a lot! :)
Post Reply