summaryrefslogtreecommitdiff
path: root/macros/lollipop/doc/manual/head.tex
blob: 2053c58c635c07019b8cad182c6a68d499cbe81d (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
% head.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/>.
%
%
\Chapter Headings

Headings for sections, chapters, and such, are an essential part of
any \TeX\ macro package. In Lollipop they are maybe a bit less
special: all options for headings are general options, meaning that
they also apply to text blocks and lists. There are only two things
that distinguish headings:

\Enumerate
\item there will be no page break after a heading;
\item there is no closing command for a heading.
\>

\Section[sec:head:examples] Examples

Headings are defined by \refcs{DefineHeading}.
The most obvious element in a heading is the title, marked by the
option \refopt{title}. The title is anything that follows the heading
command, upto the first empty line.

\Ver>\SomeHeading Some title

And some text following it.<Rev

\ImpNote
Titles can also be terminated by \cs{par}, but knowledge of this is
not encouraged. See further~\ref[imp:title:delimiting].
\ImpNoteStop

The title has to be
included in a line or a textcolumn for proper handling (see
also section~\ref[sec:opt:traps]). For titles that do not exceed one
line, the \opt{line} option suffices (section~\ref[sec:opt:line]); if a
title is possibly more than one line long, the \opt{textcolumn} option
has to be used (section~\ref[sec:opt:textcolumn].

\Example 
\DefineHeading:TestSection Style:bold
    line:start TestSectionCounter Spaces:2 title line:stop
    Stop
\TestSection The Title

The text after the heading.
\ExampleStop

By default, the text after a heading is indented. Overriding this
default behaviour is done with the option \refopt{indentafter}.

\Example
\AlwaysIndent:no % as a default, don't indent paragraphs
\DefineHeading:TestSection Style:bold
    line:start TestSectionCounter Spaces:2 title line:stop
    indentafter:yes Stop
\TestSection The Title

The text after the heading.\par
The second paragraph after the heading
\ExampleStop

Usually headings come in a hierarchy, where the counter of one type,
for instance a subsection, is reset everytime the counter of a higer
level  is stepped. In \Lollipop, this subordinating of headings is
done by declaring one counter to be governed by another (counters
are explained in full detail in section~\ref[sec:counters]). 

\Example
\DefineHeading:TestChapter Style:bold
    line:start TestChapterCounter Spaces:1 title line:stop
    Stop
\DefineHeading:TestSection Style:italic
    line:start TestChapterCounter : TestSectionCounter . Spaces:1
        title line:stop Stop
\GoverningCounter:TestSection=TestChapter

\TestChapter Level One Heading\par
\TestSection Level Two Heading\par
Some text.
\TestSection Level Two again\par
More text.
\TestChapter Level One is Stepped\par
\TestSection Level Two\par
Again text.
\ExampleStop

Headings will often wind up in a table of contents. For this, the
table of contents will have to be declared:
\Ver>\DefineExternalFile:contents=toc<Rev
and its formatting will have to be specified, but also every
construct that writes to this file has to be declared as such.

\Ver>\DefineHeading:TestSection
    [...]
    external:contents title external:stop
    Stop<Rev

Usually, the title is all that has to be written out (the counter
value is written by default), but the possibility exists for writing
out other information as well. See section~\ref[sec:ext-option].

\endinput