4

I just realized there is a big problem with the spacing before and after the section titles. I'd like more space before a section title and a small space between the section title and the subsection title. In the following MWE, I tried to have no blank at all, but there is still a larger blank before than after the section title.

I guess I just didn't find the right parameters in the \setuphead command, so can someone explain me please ? And would it be possible to have a clear explanation on what the before and after keywords do, since they appear in nearly all \setupthing commands ?

\setuphead[section][before={\blank[big]}, after={\nowhitespace}]
\setuphead[subsection][before={\blank}, after={\nowhitespace}]

\starttext
\section{First section}
\subsection{First subsection}
\input ward
\section{Second section}
\subsection{First subsection}
\input ward
\stoptext

enter image description here

  • The before and after keys in most cases just store a set of commands which are placed in the input stream before and after the command. This does not always hold true and has sometimes strange implications as you can infer from this question of yours. – Henri Menke Aug 2 '16 at 14:10
3

For no blank you have to call \blank[none]. If you call \blank without an argument it will default to \blank[\currentvspacing] where \currentvspacing defaults to big. As usual you can of course set up what the default \currentvspacing is using \setupblank, e.g.

\setupblank[small]

Your corrected example reads

\setuphead[section][before={\blank[big]}, after={\nowhitespace}]
\setuphead[subsection][before={\blank[none]}, after={\nowhitespace}]

\starttext
\section{First section}
\subsection{First subsection}
\input ward
\section{Second section}
\subsection{First subsection}
\input ward
\stoptext

enter image description here

  • 1
    BTW, \nowhitespace is equivalent to \blank[nowhite]. However, I have no idea what's the difference between \blank[none] and \blank[nowhite]. – Henri Menke Aug 2 '16 at 15:40
  • 2
    It is more common (and easier to remember) to use \setupblank instead of \setupvspacing . \blank[nowhite] also ignores whitespace (i.e., \parskip). Consider: \setupwhitespace[big] \starttext A \blank[none] \par B \par A \blank[nowhite] \par B \stoptext – Aditya Aug 3 '16 at 3:26
  • 1
    @Aditya Indeed \setupblank sounds better (it is a synonym of \setupvspacing). I tried a similar example to find out about the difference between none and nowhite but didn't set a non-zero parskip, which means that for zero parskip they are actually equivalent. – Henri Menke Aug 3 '16 at 7:28

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.