Debian Codegraph @

texmf-dist/doc/otherformats/lollipop/manual/head.tex

raw
1 % head.tex copyright 1992 Victor Eijkhout
2 % copyright 2014--2016 Vafa Khalighi
3 %
4 %
5 % This program is free software: you can redistribute it and/or modify
6 % it under the terms of the GNU General Public License as published by
7 % the Free Software Foundation, either version 3 of the License, or
8 % (at your option) any later version.
9 %
10 % This program is distributed in the hope that it will be useful,
11 % but WITHOUT ANY WARRANTY; without even the implied warranty of
12 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 % GNU General Public License for more details.
14 %
15 % You should have received a copy of the GNU General Public License
16 % along with this program. If not, see <http://www.gnu.org/licenses/>.
17 %
18 %
19 \Chapter Headings
20
21 Headings for sections, chapters, and such, are an essential part of
22 any \TeX\ macro package. In Lollipop they are maybe a bit less
23 special: all options for headings are general options, meaning that
24 they also apply to text blocks and lists. There are only two things
25 that distinguish headings:
26
27 \Enumerate
28 \item there will be no page break after a heading;
29 \item there is no closing command for a heading.
30 \>
31
32 \Section[sec:head:examples] Examples
33
34 Headings are defined by \refcs{DefineHeading}.
35 The most obvious element in a heading is the title, marked by the
36 option \refopt{title}. The title is anything that follows the heading
37 command, upto the first empty line.
38
39 \Ver>\SomeHeading Some title
40
41 And some text following it.<Rev
42
43 \ImpNote
44 Titles can also be terminated by \cs{par}, but knowledge of this is
45 not encouraged. See further~\ref[imp:title:delimiting].
46 \ImpNoteStop
47
48 The title has to be
49 included in a line or a textcolumn for proper handling (see
50 also section~\ref[sec:opt:traps]). For titles that do not exceed one
51 line, the \opt{line} option suffices (section~\ref[sec:opt:line]); if a
52 title is possibly more than one line long, the \opt{textcolumn} option
53 has to be used (section~\ref[sec:opt:textcolumn].
54
55 \Example
56 \DefineHeading:TestSection Style:bold
57 line:start TestSectionCounter Spaces:2 title line:stop
58 Stop
59 \TestSection The Title
60
61 The text after the heading.
62 \ExampleStop
63
64 By default, the text after a heading is indented. Overriding this
65 default behaviour is done with the option \refopt{indentafter}.
66
67 \Example
68 \AlwaysIndent:no % as a default, don't indent paragraphs
69 \DefineHeading:TestSection Style:bold
70 line:start TestSectionCounter Spaces:2 title line:stop
71 indentafter:yes Stop
72 \TestSection The Title
73
74 The text after the heading.\par
75 The second paragraph after the heading
76 \ExampleStop
77
78 Usually headings come in a hierarchy, where the counter of one type,
79 for instance a subsection, is reset everytime the counter of a higer
80 level is stepped. In \Lollipop, this subordinating of headings is
81 done by declaring one counter to be governed by another (counters
82 are explained in full detail in section~\ref[sec:counters]).
83
84 \Example
85 \DefineHeading:TestChapter Style:bold
86 line:start TestChapterCounter Spaces:1 title line:stop
87 Stop
88 \DefineHeading:TestSection Style:italic
89 line:start TestChapterCounter : TestSectionCounter . Spaces:1
90 title line:stop Stop
91 \GoverningCounter:TestSection=TestChapter
92
93 \TestChapter Level One Heading\par
94 \TestSection Level Two Heading\par
95 Some text.
96 \TestSection Level Two again\par
97 More text.
98 \TestChapter Level One is Stepped\par
99 \TestSection Level Two\par
100 Again text.
101 \ExampleStop
102
103 Headings will often wind up in a table of contents. For this, the
104 table of contents will have to be declared:
105 \Ver>\DefineExternalFile:contents=toc<Rev
106 and its formatting will have to be specified, but also every
107 construct that writes to this file has to be declared as such.
108
109 \Ver>\DefineHeading:TestSection
110 [...]
111 external:contents title external:stop
112 Stop<Rev
113
114 Usually, the title is all that has to be written out (the counter
115 value is written by default), but the possibility exists for writing
116 out other information as well. See section~\ref[sec:ext-option].
117
118 \endinput