summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/sectionbreak/sectionbreak.sty
blob: b8f306519ee11289f1e00948a43491d8ceb26a15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
\ProvidesPackage{sectionbreak}
\usepackage{kvoptions}
\DeclareStringOption[2em]{preskip}
\DeclareStringOption[2em]{postskip}
\DeclareStringOption[\relax]{style}
\DeclareStringOption[~]{mark}
\DeclareBoolOption{asterism}

\ProcessKeyvalOptions*

\newdimen\asterism@width
% asterism is character which consists of three asterisks layed out as a triangel
\newcommand\asterism{%
  \settowidth{\asterism@width}{*}%
  % these values were found by trial and error
  \raise-0.6\asterism@width\hbox{*\kern-.6\asterism@width\raise.7\asterism@width\hbox{*}\kern-.6\asterism@width*}%
}

\newcommand\pre@sectionbreak{\par\vskip\sectionbreak@preskip\relax}
\newcommand\post@sectionbreak{\par\vskip\sectionbreak@postskip\relax}
% print centered section break mark
\newcommand\print@sectionbreak[1]{%
  \bgroup%
  \noindent\null\hfill\sectionbreak@style\hbox{#1}\hfill\null\par%
  \egroup%
}
% default section break mark is an unbreakable space

\newcommand\sectionbreak[1][\sectionbreak@mark]{%
  \pre@sectionbreak%
  \print@sectionbreak{#1}%
  \post@sectionbreak%
}

\newcommand\sectionbreakmark[1]{%
  \gdef\sectionbreak@mark{#1}%
}

% test the asterism option and set the section mark accordingly
\ifsectionbreak@asterism
  \sectionbreakmark{\asterism}
\fi

\endinput