summaryrefslogtreecommitdiff
path: root/macros/lollipop/tex/lollipop-heading.tex
blob: 02f0a23596054bb832bf1a76996b93113dea0084 (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
45
46
47
48
49
% lollipop-heading.tex copyright 1992 Victor Eijkhout
%                     copyright 2014--2016 Vafa Khalighi
%
%
%    This program is free software: you can redistribute it and/or modify
%    it under the terms of the GNU General Public License as published by
%    the Free Software Foundation, either version 3 of the License, or
%    (at your option) any later version.
%
%    This program is distributed in the hope that it will be useful,
%    but WITHOUT ANY WARRANTY; without even the implied warranty of
%    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%    GNU General Public License for more details.
%
%    You should have received a copy of the GNU General Public License
%    along with this program.  If not, see <http://www.gnu.org/licenses/>.
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%% H E A D I N G S %%%%%%%%%%%%
\@GenericConstruct{Heading}

\newif\if@headed
\add@generic@default{\add@after@command{\@headedno}}
\add@Heading@default{\add@after@command{\@headedyes}}

\add@Heading@default{\def\@afterpenalty{\penalty\@M}
    \default@break@afterno}
\add@Heading@default{\has@marksyes}

\def\@DefineHeading{
    \@DefineStopCommand{\relax}
    \csarg\edef{\@name}%
       {\@gen@open % this contains: \let\CSname{\@name Title}\nxp\tmp@title
        \the\@main@options@list
        \@gen@close}
    }

\@HeadingOption{TwoLines}{\switch {\if\EqualString{#1}}
    {yes} {\add@after@command{\next@paragraph{\clubpenalty\M@
                \next@paragraph{\global\clubpenalty\default@clubpenalty}}}}
    {no}  {\add@after@command{\clubpenalty\default@clubpenalty}}
    {default} {\edef\cs@e{\nxp\add@after@command{\nxp\next@paragraph
                {\clubpenalty\@w@w{#1}\relax\nxp\next@paragraph
                            	{\global\clubpenalty\default@clubpenalty}}}}
            \cs@e}
    \endswitch}

\endinput