Clarify the section about backend-generic config options to make it
[sgt/halibut] / doc / input.but
CommitLineData
0929484e 1\versionid $Id$
2
11f2edfa 3\C{input} Halibut input format
4
5This chapter describes the format in which you should write
6documents to be processed by Halibut.
7
8\H{input-basics} The basics
9
10Halibut's input files mostly look like ordinary ASCII text files;
11you can edit them with any text editor you like.
12
339cbe09 13Writing \i{paragraphs of ordinary text} is very simple: you just
14write ordinary text in the ordinary way. You can wrap a paragraph
15across more than one line using \i{line breaks} in the text file,
16and Halibut will ignore this when it \I{wrapping paragraphs}rewraps
17the paragraph for each output format. To separate paragraphs, use a
18\i{blank line} (i.e. two consecutive line breaks). For example, a
19fragment of Halibut input looking like this:
11f2edfa 20
21\c This is a line of text.
22\c This is another line of text.
23\c
24\c This line is separated from the previous one by a blank line.
25
26will produce two paragraphs looking like this:
27
28\quote{
29This is a line of text.
30This is another line of text.
31
32This line is separated from the previous one by a blank line.
33}
34
35The first two lines of the input have been merged together into a
36single paragraph, and the line break in the input file was treated
37identically to the spaces between the individual words.
38
339cbe09 39Halibut is designed to have very few \I{escaping, special
40characters}\i{special characters}. The only printable characters in
41Halibut input which will not be treated exactly literally in the
42output are the \i{backslash} (\c{\\}) and the \i{braces} (\c{\{} and
43\c{\}}). If you do not use these characters, \e{everything} else you
44might type in normal ASCII text is perfectly safe. If you do need to
45use any of those three characters in your document, you will have to
46precede each one with a backslash. Hence, for example, you could
47write
11f2edfa 48
49\c This \\ is a backslash, and these are \{braces\}.
50
51and Halibut would generate the text
52
53\quote{
54This \\ is a backslash, and these are \{braces\}.
55}
56
e34ba5c3 57If you want to write your input file in a character set other than
58ASCII, you can do so by using the \c{\\cfg\{input-charset\}}
59command. See \k{input-config} for details of this.
60
339cbe09 61\H{input-inline} Simple \i{inline formatting commands}
11f2edfa 62
63Halibut formatting commands all begin with a backslash, followed by
64a word or character identifying the command. Some of them then use
65braces to surround one or more pieces of text acted on by the
66command. (In fact, the \c{\\\\}, \c{\\\{} and \c{\\\}} sequences you
67met in \k{input-basics} are themselves formatting commands.)
68
69This section describes some simple formatting commands you can use
70in Halibut documents. The commands in this section are \e{inline}
71commands, which means you can use them in the middle of a paragraph.
72\K{input-para} describes some \e{paragraph} commands, which affect a
73whole paragraph at a time.
74
c63ce2c7 75Many of these commands are followed by a pair of braces surrounding
339cbe09 76some text. In all cases, it is perfectly safe to have a \i{line break}
c63ce2c7 77(in the input file) within those braces; Halibut will treat that
78exactly the same as a space. For example, these two paragraphs will
79be treated identically:
80
81\c Here is some \e{emphasised
82\c text}.
83\c
84\c Here is some \e{emphasised text}.
85
11f2edfa 86\S{input-emph} \c{\\e}: Emphasising text
87
fc8e7adb 88Possibly the most obvious piece of formatting you might want
89to use in a document is \i\e{emphasis}.
90To emphasise text, you use the \i\c{\\e} command, and follow it up
91with the text to be emphasised in braces. For example, the first
92sentence in this paragraph was generated using the Halibut input
11f2edfa 93
fc8e7adb 94\c Possibly the most obvious piece of formatting you might want
95\c to use in a document is \e{emphasis}.
11f2edfa 96
339cbe09 97\S{input-code} \c{\\c} and \c{\\cw}: Displaying \i{computer code} inline
11f2edfa 98
99Halibut was primarily designed to produce software manuals. It can
100be used for other types of document as well, but software manuals
101are its speciality.
102
103In software manuals, you often want to format text in a way that
339cbe09 104indicates that it is something you might see displayed \i{verbatim}
105on a computer screen. In printed manuals, this is typically done by
106setting that text in a font which is obviously \I{fixed-width
107font}fixed-width. This provides a visual cue that the text being
108displayed is code, and it also ensures that punctuation marks are
109clearly separated and shown individually (so that a user can copy
110the text accurately and conveniently).
11f2edfa 111
112Halibut provides \e{two} commands for this, which are subtly
339cbe09 113different. The names of those commands are \i\c{\\c} (\q{code}) and
114\i\c{\\cw} (\q{\i{weak code}}). You use them just like \c{\\e}, by
11f2edfa 115following them with some text in braces. For example, this...
116
117\c This sentence contains some \c{code} and some \cw{weak code}.
118
119... produces this:
120
121\quote{
122This sentence contains some \c{code} and some \cw{weak code}.
123}
124
125The distinction between code and weak code is mainly important when
126producing plain text output. Plain text output is typically viewed
127in a fixed-width font, so there is no need (and no way) to change
128font in order to make the order of punctuation marks clear. However,
129marking text as code is also \e{sometimes} done to provide a visual
130distinction between it and the text around it, so that the reader
131knows where the literal computer text starts and stops; and in plain
132text, this cannot be done by changing font, so there needs to be an
133alternative way.
134
e21ccf73 135So in the plain text output format, things marked as code (\c{\\c})
136will be surrounded by quote marks, so that it's obvious where they
137start and finish. Things marked as weak code (\c{\\cw}) will not
138look any different from normal text.
11f2edfa 139
140I recommend using weak code for any application where it is
141\e{obvious} that the text is literal computer input or output. For
142example, if the text is capitalised, that's usually good enough. If
143I talk about the Pentium's \cw{EAX} and \cw{EDX} registers, for
144example, you don't need quotes to notice that those are special; so
b7747050 145I would write that in Halibut as \cq{the Pentium's \\cw\{EAX\} and
146\\cw\{EDX\} registers}. But if I'm talking about the Unix command
11f2edfa 147\c{man}, which is an ordinary English word in its own right, a reader
148might be slightly confused if it appeared in the middle of a
b7747050 149sentence undecorated; so I would write that as \cq{the Unix command
150\\c\{man\}}.
11f2edfa 151
152In summary:
153
154\b \c{\\c} means \q{this text \e{must} be visually distinct from the
155text around it}. Halibut's various output formats will do this by
156changing the font if possible, or by using quotes if not.
157
158\b \c{\\cw} means \q{it would be nice to display this text in a
159fixed-width font if possible, but it's not essential}.
160
fc8e7adb 161In really extreme cases, you might want Halibut to use \i{quotation
162marks} even in output formats which can change font. In
163\k{input-date}, for example, I mention the special formatting
b7747050 164command \cq{\\.}. If that appeared at the end of a sentence
fc8e7adb 165\e{without} the quotes, then the two adjacent full stops would look
b7747050 166pretty strange even if they were obviously in different fonts.
167
168For this, Halibut supports the \i\c{\\cq} command, which is exactly
169equivalent to using \c{\\q} to provide quotes and then using
170\c{\\cw} inside the quotes. So in the paragraph above, for example,
171I wrote
172
173\c the special formatting command \cq{\\.}.
174
175and I could equivalently have written
fc8e7adb 176
177\c the special formatting command \q{\cw{\\.}}.
178
11f2edfa 179There is a separate mechanism for displaying computer code in an
180entire paragraph; see \k{input-codepara} for that one.
181
339cbe09 182\S{input-quotes} \c{\\q}: \ii{Quotation marks}
11f2edfa 183
184Halibut's various output formats don't all use the same conventions
185for displaying text in ordinary quotation marks (\q{like these}).
186Some output formats have access to proper matched quote characters,
187whereas others are restricted to using plain ASCII. Therefore, it is
188not ideal to use the ordinary ASCII double quote character in your
189document (although you can if you like).
190
339cbe09 191Halibut provides the formatting command \i\c{\\q} to indicate quoted
11f2edfa 192text. If you write
193
194\c Here is some \q{text in quotes}.
195
196then Halibut will print
197
198\quote{
199Here is some \q{text in quotes}.
200}
201
202and in every output format Halibut generates, it will choose the
d87cb8ae 203best quote characters available to it in that format. (The quote
204characters to use can be configured with the \c{\\cfg} command.)
11f2edfa 205
e34ba5c3 206You can still use the ordinary quote characters of your choice if
207you prefer; or you could even use the \c{\\u} command (see
208\k{input-unicode}) to generate \i{Unicode matched quotes} (single or
209double) in a way which will automatically fall back to the normal
210ASCII one if they aren't available. But I recommend using the
211built-in \c{\\q} command in most cases, because it's simple and does
212the best it can everywhere.
11f2edfa 213
ed5c261f 214If you're using the \c{\\c} or \c{\\cw} commands to display literal
215computer code, you will probably want to use literal \i{ASCII quote
216characters}, because it is likely to matter precisely which quote
217character you use. In fact, Halibut actually \e{disallows} the use
218of \c{\\q} within either of \c{\\c} and \c{\\cw}, since this
219simplifies some of the output formats.
11f2edfa 220
339cbe09 221\S{input-nonbreaking} \c{\\-} and \c{\\_}: \ii{Non-breaking hyphens}
222and \I{non-breaking spaces}spaces
11f2edfa 223
224If you use an ordinary hyphen in the middle of a word (such as
225\q{built-in}), Halibut's output formats will feel free to break a
339cbe09 226line after that hyphen when \i{wrapping paragraphs}. This is fine
227for a word like \q{built-in}, but if you were displaying some
228literal computer code such as the Emacs command
11f2edfa 229\c{M\-x\_psychoanalyze\-pinhead}, you might prefer to see the whole
230hyphenated word treated as an unbreakable block. In some cases, you
231might even want to prevent the \e{space} in that command from
232becoming a line break.
233
339cbe09 234For these purposes, Halibut provides the commands \i\c{\\-} and
235\i\c{\\_}, which generate a non-breaking hyphen and a non-breaking
11f2edfa 236space respectively. So the above Emacs command might be written as
237
238\c the Emacs command \c{M\-x\_psychoanalyze\-pinhead}
239
240Unfortunately, some of Halibut's output formats do not support
241non-breaking hyphens, and others don't support \e{breaking} hyphens!
242So Halibut cannot promise to honour these commands in all situations.
243All it can do is make a best effort.
244
339cbe09 245\S{input-date} \c{\\date}: Automatic \i{date} generation
11f2edfa 246
247Sometimes you might want your document to give an up-to-date
248indication of the date on which it was run through Halibut.
249
339cbe09 250Halibut supplies the \i\c{\\date} command to do this. In its
251simplest form, you simply say
11f2edfa 252
253\c This document was generated on \date.
254
255and Halibut generates something like
256
257\quote{
258This document was generated on \date.
259}
260
acbb8b72 261You can follow the \c{\\date} command directly with punctuation (as
262in this example, where it is immediately followed by a full stop),
263but if you try to follow it with an alphabetic or numeric character
264(such as writing \c{\\dateZ}) then Halibut will assume you are
265trying to invoke the name of a macro command you have defined
266yourself, and will complain if no such command exists. To get round
b7747050 267this you can use the special \cq{\\.} do-nothing command. See
acbb8b72 268\k{input-macro} for more about general Halibut command syntax and
b7747050 269\cq{\\.}.
acbb8b72 270
11f2edfa 271If you would prefer the date to be generated in a specific format,
272you can follow the \c{\\date} command with a format specification in
273braces. The format specification will be run through the standard C
339cbe09 274function \i\c{strftime}, so any format acceptable to that function
275is acceptable here as well. I won't document the format here,
276because the details vary from computer to computer (although there
277is a standard core which should be supported everywhere). You should
278look at your local system's manual for \c{strftime} for details.
11f2edfa 279
280Here's an example which generates the date in the international
339cbe09 281standard \i{ISO 8601} format:
11f2edfa 282
283\c This document was generated on \date{%Y-%m-%d %H:%M:%S}.
284
285And here's some sample output from that command:
286
287\quote{
288This document was generated on \date{%Y-%m-%d %H:%M:%S}.
289}
290
339cbe09 291\S{input-weblink} \c{\\W}: \i{WWW hyperlinks}
11f2edfa 292
339cbe09 293Since one of Halibut's output formats is \i{HTML}, it's obviously
294useful to be able to provide \I{linking to web sites}links to
295arbitrary \i{web sites} in a Halibut document.
11f2edfa 296
339cbe09 297This is done using the \i\c{\\W} command. \c{\\W} expects to be
11f2edfa 298followed by \e{two} sets of braces. In the first set of braces you
339cbe09 299put a \i{URL}; in the second set you put the text which should be a
300\i{hyperlink}. For example, you might write
11f2edfa 301
302\c Try searching on \W{http://www.google.com/}{Google}.
303
304and Halibut would generate
305
306\quote{
307Try searching on \W{http://www.google.com/}{Google}.
308}
309
310Note that hyperlinks, like the non-breaking commands discussed in
311\k{input-nonbreaking}, are \e{discretionary}: if an output format
312does not support them then they will just be left out completely. So
313unless you're \e{only} intending to use the HTML output format, you
314should avoid storing vital content in the URL part of a \c{\\W}
315command. The Google example above is reasonable (because most users
316are likely to be able to find Google for themselves even without a
317convenient hyperlink leading straight there), but if you really need
318to direct users to a specific web site, you will need to give the
319URL in actual displayed text (probably displayed as code as well).
320However, there's nothing to stop you making it a hyperlink \e{as
321well} for the convenience of HTML readers.
322
323The \c{\\W} command supports a piece of extra syntax to make this
324convenient for you. You can specify \c{\\c} or \c{\\cw} \e{between}
325the first and second pairs of braces. For example, you might write
326
e028d141 327\c Google is at \W{http://www.google.com/}\cw{www.google.com}.
11f2edfa 328
329and Halibut would produce
330
331\quote{
e028d141 332Google is at \W{http://www.google.com/}\cw{www.google.com}.
11f2edfa 333}
334
b80802ba 335If you want the link text to be an index term as well, you can also
336specify \c{\\i} or \c{\\ii}; this has to come before \c{\\c} or
337\c{\\cw} if both are present. (See \k{input-index} for more about
338indexing.)
339
339cbe09 340\S{input-unicode} \c{\\u}: Specifying arbitrary \i{Unicode}
341characters
11f2edfa 342
e34ba5c3 343Halibut has extensive support for Unicode and character set
344conversion. You can specify any (reasonably well known) \i{character
345set} for your input document, and Halibut will convert it all to
346Unicode as it reads it in. See \k{input-config} for more details of
347this.
11f2edfa 348
349If you need to specify a Unicode character in your input document
e34ba5c3 350which is not supported by the input character set you have chosen,
351you can use the \i\c{\\u} command to do this. \c{\\u} expects to be
352followed by a sequence of hex digits; so that \c{\\u0041}, for
353example, denotes the Unicode character \cw{0x0041}, which is the
354capital letter A.
11f2edfa 355
356If a Unicode character specified in this way is not supported in a
357particular \e{output} format, you probably don't just want it to be
358omitted. So you can put a pair of braces after the \c{\\u} command
339cbe09 359containing \i{fallback text}. For example, to specify an amount of
360money in euros, you might write this:
11f2edfa 361
16ea3abe 362\c This is likely to cost \u20AC{EUR\_}2500 at least.
11f2edfa 363
364Halibut will render that as a Euro sign \e{if available}, and
16ea3abe 365the text \q{EUR\_} if not. In the output format you're currently
11f2edfa 366reading in, the above input generates this:
367
368\quote{
16ea3abe 369This is likely to cost \u20AC{EUR\_}2500 at least.
11f2edfa 370}
371
372If you read it in other formats, you may see different results.
373
da090173 374\S{input-xref} \i\c{\\k} and \I{\\K-upper}\c{\\K}:
375\ii{Cross-references} to other sections
11f2edfa 376
339cbe09 377\K{intro-features} mentions that Halibut \I{section numbers}numbers
378the sections of your document automatically, and can generate
379cross-references to them on request. \c{\\k} and \c{\\K} are the
380commands used to generate those cross-references.
11f2edfa 381
382To use one of these commands, you simply follow it with a pair of
383braces containing the keyword for the section in question. For
384example, you might write something like
385
386\c \K{input-xref} expands on \k{intro-features}.
387
388and Halibut would generate something like
389
390\quote{
391\K{input-xref} expands on \k{intro-features}.
392}
393
339cbe09 394The \i{keywords} \c{input-xref} and \c{intro-features} are
395\i{section keywords} used in this manual itself. In your own
396document, you would have supplied a keyword for each one of your own
397sections, and you would provide your own keywords for the \c{\\k}
398command to work on.
11f2edfa 399
400The difference between \c{\\k} and \c{\\K} is simply that \c{\\K}
401starts the cross-reference text with a capital letter; so you would
402use \c{\\K} at the beginning of a sentence, and \c{\\k} everywhere
403else.
404
405In output formats which permit it, cross-references act as
339cbe09 406\i{hyperlinks}, so that clicking the mouse on a cross-reference
407takes you straight to the referenced section.
11f2edfa 408
409The \c{\\k} commands are also used for referring to entries in a
339cbe09 410\i{bibliography} (see \k{input-biblio} for more about
411bibliographies), and can also be used for referring to an element of
412a \i{numbered list} by its number (see \k{input-list-number} for
413more about numbered lists).
11f2edfa 414
415See \k{input-sections} for more about chapters and sections.
416
339cbe09 417\S{input-inline-comment} \i\c{\\#}: Inline comments
11f2edfa 418
339cbe09 419If you want to include \i{comments} in your Halibut input, to be seen
11f2edfa 420when reading it directly but not copied into the output text, then
421you can use \c{\\#} to do this. If you follow \c{\\#} with text in
422braces, that text will be ignored by Halibut.
423
424For example, you might write
425
fc8e7adb 426\c The typical behaviour of an antelope \#{do I mean
427\c gazelle?} is...
11f2edfa 428
429and Halibut will simply leave out the aside about gazelles, and will
430generate nothing but
431
432\quote{
fc8e7adb 433The typical behaviour of an antelope \#{do I mean
434gazelle?} is...
11f2edfa 435}
436
acbb8b72 437This command will respect nested braces, so you can use it to
438comment out sections of Halibut markup:
439
440\c This function is \#{very, \e{very}} important.
441
442In this example, the comment lasts until the final closing brace (so
443that the whole \q{very, \e{very}} section is commented out).
444
11f2edfa 445The \c{\\#} command can also be used to produce a whole-paragraph
446comment; see \k{input-commentpara} for details of that.
447
339cbe09 448\H{input-para} \ii{Paragraph-level commands}
11f2edfa 449
450This section describes Halibut commands which affect an entire
451paragraph, or sometimes even \e{more} than one paragraph, at a time.
452
339cbe09 453\S{input-codepara} \i\c{\\c}: Displaying whole \I{code
454paragraphs}paragraphs of \i{computer code}
11f2edfa 455
456\K{input-code} describes a mechanism for displaying computer code in
457the middle of a paragraph, a few words at a time.
458
459However, this is often not enough. Often, in a computer manual, you
339cbe09 460really want to show several lines of code in a \i{display
461paragraph}.
11f2edfa 462
463This is also done using the \c{\\c} command, in a slightly different
464way. Instead of using it in the middle of a paragraph followed by
465braces, you can use it at the start of each line of a paragraph. For
466example, you could write
467
468\c \c #include <stdio.h>
469\c \c
470\c \c int main(int argc, char **argv) {
471\c \c printf("hello, world\n");
472\c \c return 0;
473\c \c }
474
475and Halibut would generate
476
477\quote{
478
479\c #include <stdio.h>
480\c
481\c int main(int argc, char **argv) {
482\c printf("hello, world\n");
483\c return 0;
484\c }
485
486}
487
488Note that the above paragraph makes use of a backslash and a pair of
489braces, and does \e{not} need to escape them in the way described in
490\k{input-basics}. This is because code paragraphs formatted in this
491way are a special case; the intention is that you can just copy and
b7747050 492paste a lump of code out of your program, put \cq{\\c } at the
11f2edfa 493start of every line, and simply \e{not have to worry} about the
494details - you don't have to go through the whole block looking for
495characters to escape.
496
497Since a backslash inside a code paragraph generates a literal
498backslash, this means you cannot use any other Halibut formatting
499commands inside a code paragraph. In particular, if you want to
500emphasise a particular word in the paragraph, you can't do that
501using \c{\\e} (\k{input-emph}) in the normal way.
502
339cbe09 503Therefore, Halibut provides an alternative means of \i{emphasis in
504code paragraphs}. Each line beginning with \c{\\c} can optionally be
11f2edfa 505followed by a single line beginning with \c{\\e}, indicating the
506emphasis in that line. The emphasis line contains the letters \c{b}
507and \c{i} (for \q{bold} and \q{italic}, although some output formats
339cbe09 508might render \c{i} as underlining instead of italics), positioned to
509line up under the parts of the text that you want emphasised.
11f2edfa 510
339cbe09 511For example, if you wanted to do \i{syntax highlighting} on the
512above C code by highlighting the preprocessor command in italic and
513the keywords in bold, you might do it like this:
11f2edfa 514
515\c \c #include <stdio.h>
516\c \e iiiiiiiiiiiiiiiiii
517\c \c
518\c \c int main(int argc, char **argv) {
519\c \e bbb bbb bbbb
520\c \c printf("hello, world\n");
521\c \c return 0;
522\c \e bbbbbb
523\c \c }
524
525and Halibut would generate:
526
527\quote{
528
529\c #include <stdio.h>
530\e iiiiiiiiiiiiiiiiii
531\c
532\c int main(int argc, char **argv) {
533\e bbb bbb bbbb
534\c printf("hello, world\n");
535\c return 0;
536\e bbbbbb
537\c }
538
539}
540
541Note that not every \c{\\c} line has to be followed by a \c{\\e}
542line; they're optional.
543
544Also, note that highlighting within a code paragraph is
545\e{discretionary}. Not all of Halibut's output formats can support
546it (plain text, in particular, has no sensible way to do it). Unless
547you know you are using a restricted range of output formats, you
548should use highlighting in code paragraphs \e{only} as a visual aid,
549and not rely on it to convey any vital semantic content.
550
339cbe09 551\S{input-lists} \c{\\b}, \c{\\n}, \c{\\dt}, \c{\\dd}, \c{\\lcont}:
552\ii{Lists}
11f2edfa 553
554Halibut supports bulletted lists, numbered lists and description
555lists.
556
339cbe09 557\S2{input-list-bullet} \i\c{\\b}: \ii{Bulletted lists}
11f2edfa 558
559To create a bulletted list, you simply prefix each paragraph
560describing a bullet point with the command \c{\\b}. For example, this
561Halibut input:
562
563\c Here's a list:
564\c
565\c \b One.
566\c
567\c \b Two.
568\c
569\c \b Three.
570
571would produce this Halibut output:
572
573\quote{
574Here's a list:
575
576\b One.
577
578\b Two.
579
580\b Three.
581}
582
339cbe09 583\S2{input-list-number} \i\c{\\n}: \ii{Numbered lists}
11f2edfa 584
585Numbered lists are just as simple: instead of \c{\\b}, you use
586\c{\\n}, and Halibut takes care of getting the numbering right for
587you. For example:
588
589\c Here's a list:
590\c
591\c \n One.
592\c
593\c \n Two.
594\c
595\c \n Three.
596
597This produces the Halibut output:
598
599\quote{
600Here's a list:
601
602\n One.
603
604\n Two.
605
606\n Three.
607}
608
609The disadvantage of having Halibut sort out the list numbering for
610you is that if you need to refer to a list item by its number, you
fc8e7adb 611can't reliably know the number in advance (because if you later add
612another item at the start of the list, the numbers will all change).
613To get round this, Halibut allows an optional keyword in braces
614after the \c{\\n} command. This keyword can then be referenced using
615the \c{\\k} or \c{\\K} command (see \k{input-xref}) to provide the
616number of the list item. For example:
11f2edfa 617
618\c Here's a list:
619\c
620\c \n One.
621\c
622\c \n{this-one} Two.
623\c
624\c \n Three.
625\c
626\c \n Now go back to step \k{this-one}.
627
628This produces the following output:
629
630\quote{
631Here's a list:
632
633\n One.
634
635\n{this-one} Two.
636
637\n Three.
638
639\n Now go back to step \k{this-one}.
640}
641
acbb8b72 642The keyword you supply after \c{\\n} is allowed to contain escaped
643special characters (\c{\\\\}, \c{\\\{} and \c{\\\}}), but should not
644contain any other Halibut markup. It is intended to be a word or two
645of ordinary text. (This also applies to keywords used in other
646commands, such as \c{\\B} and \c{\\C}).
647
339cbe09 648\S2{input-list-description} \i\c{\\dt} and \i\c{\\dd}:
649\ii{Description lists}
11f2edfa 650
339cbe09 651To write a description list, you prefix alternate paragraphs with
652the \c{\\dt} (\q{described thing}) and \c{\\dd} (description)
653commands. For example:
11f2edfa 654
655\c \dt Pelican
656\c
657\c \dd This is a large bird with a big beak.
658\c
659\c \dt Panda
660\c
661\c \dd This isn't.
662
663This produces the following output:
664
665\quote{
666
667\dt Pelican
668
669\dd This is a large bird with a big beak.
670
671\dt Panda
672
673\dd This isn't.
674
675}
676
02478c4f 677If you really want to, you are allowed to use \c{\\dt} and \c{\\dd}
678without strictly interleaving them (multiple consecutive \c{\\dt}s
679or consecutive \c{\\dd}s, or a description list starting with
680\c{\\dd} or ending with \c{\\dt}). This is probably most useful if
681you are listing a sequence of things with \c{\\dt}, but only some of
682them actually need \c{\\dd} descriptions. You should \e{not} use
683multiple consecutive \c{\\dd}s to provide a multi-paragraph
684definition of something; that's what \c{\\lcont} is for, as
685explained in \k{input-list-continuation}.
686
339cbe09 687\S2{input-list-continuation} \ii{Continuing list items} into further
11f2edfa 688paragraphs
689
690All three of the above list types assume that each list item is a
691single paragraph. For a short, snappy list in which each item is
692likely to be only one or two words, this is perfectly sufficient;
693but occasionally you will find you want to include several
339cbe09 694paragraphs in a single list item, or even to \I{nested lists}nest
695other types of paragraph (such as code paragraphs, or other lists)
696inside a list item.
11f2edfa 697
339cbe09 698To do this, you use the \i\c{\\lcont} command. This is a command
699which can span \e{multiple} paragraphs.
11f2edfa 700
701After the first paragraph of a list item, include the text
702\c{\\lcont\{}. This indicates that the subsequent paragraph(s) are a
703\e{continuation} of the list item that has just been seen. So you
704can include further paragraphs, and eventually include a closing
705brace \c{\}} to finish the list continuation. After that, you can
706either continue adding other items to the original list, or stop
707immediately and return to writing normal paragraphs of text.
708
709Here's a (long) example.
710
711\c Here's a list:
712\c
713\c \n One. This item is followed by a code paragraph:
714\c
715\c \lcont{
716\c
717\c \c code
718\c \c paragraph
719\c
720\c }
721\c
722\c \n Two. Now when I say \q{two}, I mean:
723\c
724\c \lcont{
725\c
726\c \n Two, part one.
727\c
728\c \n Two, part two.
729\c
730\c \n Two, part three.
731\c
732\c }
733\c
734\c \n Three.
735
736The output produced by this fragment is:
737
738\quote{
739
740Here's a list:
741
742\n One. This item is followed by a code paragraph:
743
744\lcont{
745
746\c code
747\c paragraph
748
749}
750
751\n Two. Now when I say \q{two}, I mean:
752
753\lcont{
754
755\n Two, part one.
756
757\n Two, part two.
758
759\n Two, part three.
760
761}
762
763\n Three.
764
765}
766
fc8e7adb 767This syntax might seem a little bit inconvenient, and perhaps
11f2edfa 768counter-intuitive: you might expect the enclosing braces to have to
769go around the \e{whole} list item, rather than everything except the
770first paragraph.
771
772\c{\\lcont} is a recent addition to the Halibut input language;
773previously, \e{all} lists were required to use no more than one
774paragraph per list item. So it's certainly true that this feature
775looks like an afterthought because it \e{is} an afterthought, and
776it's possible that if I'd been designing the language from scratch
777with multiple-paragraph list items in mind, I would have made it
778look different.
779
780However, the advantage of doing it this way is that no enclosing
781braces are required in the \e{common} case: simple lists with only
782one paragraph per item are really, really easy to write. So I'm not
783too unhappy with the way it turned out; it obeys the doctrine of
784making simple things simple, and difficult things possible.
785
786Note that \c{\\lcont} can only be used on \c{\\b}, \c{\\n} and
787\c{\\dd} paragraphs; it cannot be used on \c{\\dt}.
788
339cbe09 789\S{input-rule} \i\c{\\rule}: \ii{Horizontal rules}
11f2edfa 790
791The command \c{\\rule}, appearing on its own as a paragraph, will
792cause a horizontal rule to be drawn, like this:
793
794\c Some text.
795\c
796\c \rule
797\c
798\c Some more text.
799
800This produces the following output:
801
802\quote{
803
804Some text.
805
806\rule
807
808Some more text.
809
810}
811
339cbe09 812\S{input-quote} \i\c{\\quote}: \ii{Indenting multiple paragraphs} as a
813long \i{quotation}
11f2edfa 814
815Quoting verbatim text using a code paragraph (\k{input-codepara}) is
816not always sufficient for your quoting needs. Sometimes you need to
817quote some normally formatted text, possibly in multiple paragraphs.
339cbe09 818This is similar to HTML's \i\cw{<BLOCKQUOTE>} command.
11f2edfa 819
820To do this, you can use the \c{\\quote} command. Like \c{\\lcont},
821this is a command which expects to enclose at least one paragraph
822and possibly more. Simply write \c{\\quote\{} at the beginning of
823your quoted section, and \c{\}} at the end, and the paragraphs in
824between will be formatted to indicate that they are a quotation.
825
826(This very manual, in fact, uses this feature a lot: all of the
fc8e7adb 827examples of Halibut input followed by Halibut output have the output
828quoted using \c{\\quote}.)
11f2edfa 829
830Here's some example Halibut input:
831
832\c In \q{Through the Looking Glass}, Lewis Carroll wrote:
833\c
834\c \quote{
835\c
836\c \q{The question is,} said Alice, \q{whether you \e{can} make
837\c words mean so many different things.}
838\c
fc8e7adb 839\c \q{The question is,} said Humpty Dumpty, \q{who is to be
840\c master - that's all.}
11f2edfa 841\c
842\c }
843\c
844\c So now you know.
845
846The output generated by this is:
847
848\quote{
849
850In \q{Through the Looking Glass}, Lewis Carroll wrote:
851
852\quote{
853
854\q{The question is,} said Alice, \q{whether you \e{can} make
855words mean so many different things.}
856
fc8e7adb 857\q{The question is,} said Humpty Dumpty, \q{who is to be
858master - that's all.}
11f2edfa 859
860}
861
862So now you know.
863
864}
865
da090173 866\S{input-sections} \I{\\C-upper}\c{\\C}, \i\c{\\H}, \i\c{\\S},
867\i\c{\\A}, \I{\\U-upper}\c{\\U}: Chapter and \i{section headings}
11f2edfa 868
339cbe09 869\K{intro-features} mentions that Halibut \I{section
870numbering}numbers the sections of your document automatically, and
871can generate cross-references to them on request; \k{input-xref}
872describes the \c{\\k} and \c{\\K} commands used to generate the
873cross-references. This section describes the commands used to set up
874the sections in the first place.
11f2edfa 875
876A paragraph beginning with the \c{\\C} command defines a chapter
877heading. The \c{\\C} command expects to be followed by a pair of
878braces containing a keyword for the chapter; this keyword can then
879be used with the \c{\\k} and \c{\\K} commands to generate
880cross-references to the chapter. After the closing brace, the rest
881of the paragraph is used as the displayed chapter title. So the
882heading for the current chapter of this manual, for example, is
883written as
884
885\c \C{input} Halibut input format
886
887and this allows me to use the command \c{\\k\{input\}} to generate a
888cross-reference to that chapter somewhere else.
889
acbb8b72 890The \I{keyword syntax}keyword you supply after one of these commands
891is allowed to contain escaped special characters (\c{\\\\}, \c{\\\{}
892and \c{\\\}}), but should not contain any other Halibut markup. It
893is intended to be a word or two of ordinary text. (This also applies
894to keywords used in other commands, such as \c{\\B} and \c{\\n}).
895
11f2edfa 896The next level down from \c{\\C} is \c{\\H}, for \q{heading}. This
897is used in exactly the same way as \c{\\C}, but section headings
898defined with \c{\\H} are considered to be part of a containing
899chapter, and will be numbered with a pair of numbers. After \c{\\H}
900comes \c{\\S}, and if necessary you can then move on to \c{\\S2},
901\c{\\S3} and so on.
902
903For example, here's a sequence of heading commands. Normally these
904commands would be separated at least by blank lines (because each is
905a separate paragraph), and probably also by body text; but for the
906sake of brevity, both of those have been left out in this example.
907
908\c \C{foo} Using Foo
909\c \H{foo-intro} Introduction to Foo
910\c \H{foo-running} Running the Foo program
911\c \S{foo-inter} Running Foo interactively
912\c \S{foo-batch} Running Foo in batch mode
913\c \H{foo-trouble} Troubleshooting Foo
914\c \C{bar} Using Bar instead of Foo
915
916This would define two chapters with keywords \c{foo} and \c{bar},
917which would end up being called Chapter 1 and Chapter 2 (unless
918there were other chapters before them). The sections \c{foo-intro},
919\c{foo-running} and \c{foo-trouble} would be referred to as Section
9201.1, Section 1.2 and Section 1.3 respectively; the subsections
921\c{foo-inter} and \c{foo-batch} would be Section 1.2.1 and Section
339cbe09 9221.2.2. If there had been a \i\c{\\S2} command within one of those,
923it would have been something like Section 1.2.1.1.
11f2edfa 924
925If you don't like the switch from \c{\\H} to \c{\\S}, you can use
926\c{\\S1} as a synonym for \c{\\S} and \c{\\S0} as a synonym for
927\c{\\H}. Chapters are still designated with \c{\\C}, because they
928need to be distinguished from other types of chapter such as
929appendices. (Personally, I like the \c{\\C},\c{\\H},\c{\\S} notation
930because it encourages me to think of my document as a hard disk :-)
931
339cbe09 932You can define an \i{appendix} by using \c{\\A} in place of \c{\\C}.
11f2edfa 933This is no different from a chapter except that it's given a letter
934instead of a number, and cross-references to it will say \q{Appendix
935A} instead of \q{Chapter 9}. Subsections of an appendix will be
936numbered \q{A.1}, \q{A.2}, \q{A.2.1} and so on.
937
339cbe09 938\I{renaming sections}If you want a particular section to be referred
939to as something other than a \q{chapter}, \q{section} or
940\q{appendix}, you can include a second pair of braces after the
941keyword. For example, if you're \i{writing a FAQ} chapter and you
942want cross-references between questions to refer to \q{question
9431.2.3} instead of \q{section 1.2.3}, you can write each section
944heading as
11f2edfa 945
946\c \S{question-about-fish}{Question} What about fish?
947
948(The word \q{Question} should be given with an initial capital
949letter. Halibut will lower-case it when you refer to it using
950\c{\\k}, and will leave it alone if you use \c{\\K}.)
951
952This technique allows you to change the designation of
953\e{particular} sections. To make an overall change in what \e{every}
954section is called, see \k{input-config}.
955
339cbe09 956Finally, the \c{\\U} command defines an \I{unnumbered
957chapter}\e{unnumbered} chapter. These sometimes occur in books, for
958specialist purposes such as \q{Bibliography} or
959\q{Acknowledgements}. \c{\\U} does not expect a keyword argument,
960because there is no sensible way to generate an automatic
961cross-reference to such a chapter anyway.
11f2edfa 962
8902e0ed 963\S{input-blurb} \c{\\copyright}, \c{\\title}, \c{\\versionid}:
339cbe09 964Miscellaneous \i{blurb commands}
11f2edfa 965
339cbe09 966These three commands define a variety of \i{special paragraph
967types}. They are all used in the same way: you put the command at
968the start of a paragraph, and then just follow it with normal text,
969like this:
11f2edfa 970
971\c \title My First Manual
972
8902e0ed 973The three special paragraph types are:
11f2edfa 974
339cbe09 975\dt \i\cw{\\title}
11f2edfa 976
977\dd This defines the overall title of the entire document. This
978title is treated specially in some output formats (for example, it's
01de151c 979used in a \cw{<TITLE>} tag in the HTML output), so it needs a
11f2edfa 980special paragraph type to point it out.
981
339cbe09 982\dt \i\cw{\\copyright}
11f2edfa 983
984\dd This command indicates that the paragraph attached to it
339cbe09 985contains a \i{copyright statement} for the document. This text is
9057a0a8 986displayed inline where it appears, exactly like a normal paragraph;
987but in some output formats it is given additional special treatment.
988For example, Windows Help files have a standard slot in which to
989store a copyright notice, so that other software can display it
990prominently.
11f2edfa 991
339cbe09 992\dt \i\cw{\\versionid}
11f2edfa 993
994\dd This command indicates that the paragraph contains a version
995identifier, such as those produced by CVS (of the form \c{$\#{hope this
996defuses CVS}Id: thingy.but,v 1.6 2004/01/01 16:47:48 simon Exp $}).
997This text will be tucked away somewhere unobtrusive, so that anyone
998wanting to (for example) report errors to the document's author can
339cbe09 999pick out the \i{version IDs} and send them as part of the report, so
11f2edfa 1000that the author can tell at a glance which revision of the document
1001is being discussed.
1002
339cbe09 1003\S{input-commentpara} \i\c{\\#}: Whole-paragraph \i{comments}
11f2edfa 1004
1005\K{input-inline-comment} describes the use of the \c{\\#} command to
1006put a short comment in the middle of a paragraph.
1007
1008If you need to use a \e{long} comment, Halibut also allows you to
1009use \c{\\#} without braces, to indicate that an entire paragraph is
1010a comment, like this:
1011
1012\c Here's a (fairly short) paragraph which will be displayed.
1013\c
1014\c \# Here's a comment paragraph which will not be displayed, no
fc8e7adb 1015\c matter how long it goes on. All I needed to indicate this was
1016\c the single \# at the start of the paragraph; I don't need one
1017\c on every line or anything like that.
11f2edfa 1018\c
1019\c Here's another displayed paragraph.
1020
1021When run through Halibut, this produces the following output:
1022
1023\quote{
1024
1025Here's a (fairly short) paragraph which will be displayed.
1026
1027\# Here's a comment paragraph which will not be displayed, no
fc8e7adb 1028matter how long it goes on. All I needed to indicate this was
1029the single \# at the start of the paragraph; I don't need one
1030on every line or anything like that.
11f2edfa 1031
1032Here's another displayed paragraph.
1033
1034}
1035
339cbe09 1036\H{input-biblio} Creating a \i{bibliography}
11f2edfa 1037
1038If you need your document to refer to other documents (research
1039papers, books, websites, whatever), you might find a bibliography
1040feature useful.
1041
da090173 1042You can define a bibliography entry using the \I{\\B-upper}\c{\\B}
1043command. This looks very like the \c{\\C} command and friends: it
1044expects a keyword in braces, followed by some text describing the
1045document being referred to. For example:
11f2edfa 1046
1047\c \B{freds-book} \q{The Taming Of The Mongoose}, by Fred Bloggs.
1048\c Published by Paperjam & Notoner, 1993.
1049
1050If this bibliography entry appears in the finished document, it will
1051look something like this:
1052
1053\quote{
1054
1055\B{freds-book} \q{The Taming Of The Mongoose}, by Fred Bloggs.
1056Published by Paperjam & Notoner, 1993.
1057
1058}
1059
1060I say \q{if} above because not all bibliography entries defined
1061using the \c{\\B} command will necessarily appear in the finished
339cbe09 1062document. They only appear if they are \I{citation}referred to by a
1063\i\c{\\k} command (see \k{input-xref}). This allows you to (for
1064example) maintain a single Halibut source file with a centralised
1065database of \e{all} the references you have ever needed in any of
1066your writings, include that file in every document you feed to
1067Halibut, and have it only produce the bibliography entries you
1068actually need for each particular document. (In fact, you might even
1069want this centralised source file to be created automatically by,
1070say, a Perl script from BibTeX input, so that you can share the same
1071bibliography with users of other formatting software.)
11f2edfa 1072
1073If you really want a bibliography entry to appear in the document
1074even though no text explicitly refers to it, you can do that using
339cbe09 1075the \i\c{\\nocite} command:
11f2edfa 1076
1077\c \nocite{freds-book}
1078
1079Normally, each bibliography entry will be referred to (in citations
1080and in the bibliography itself) by a simple reference number, such
1081as \k{freds-book}. If you would rather use an alternative reference
339cbe09 1082notation, such as [Fred1993], you can use the \i\c{\\BR}
11f2edfa 1083(\q{Bibliography Rewrite}) command to specify your own reference
1084format for a particular book:
1085
1086\c \BR{freds-book} [Fred1993]
1087
acbb8b72 1088The keyword you supply after \c{\\B} is allowed to contain escaped
1089special characters (\c{\\\\}, \c{\\\{} and \c{\\\}}), but should not
1090contain any other Halibut markup. It is intended to be a word or two
1091of ordinary text. (This also applies to keywords used in other
1092commands, such as \c{\\n} and \c{\\C}).
1093
339cbe09 1094\H{input-index} Creating an \i{index}
11f2edfa 1095
1096Halibut contains a comprehensive indexing mechanism, which attempts
1097to be reasonably easy to use in the common case in spite of its
1098power.
1099
1100\S{input-index-simple} Simple indexing
1101
1102In normal usage, you should be able to add index terms to your
339cbe09 1103document simply by using the \i\c{\\i} command to wrap one or two
11f2edfa 1104words at a time. For example, if you write
1105
1106\c The \i{hippopotamus} is a particularly large animal.
1107
1108then the index will contain an entry under \q{hippopotamus},
1109pointing to that sentence (or as close to that sentence as the
1110output format sensibly permits).
1111
1112You can wrap more than one word in \c{\\i} as well:
1113
1114\c We recommend using a \i{torque wrench} for this job.
1115
1116\S{input-index-special} Special cases of indexing
1117
1118If you need to index a computer-related term, you can use the
339cbe09 1119special case \i\c{\\i\\c} (or \i\c{\\i\\cw} if you prefer):
11f2edfa 1120
1121\c The \i\c{grep} command is what you want here.
1122
1123This will cause the word \q{grep} to appear in code style, as if the
1124\c{\\i} were not present and the input just said \c{\\c\{grep\}};
1125the word will also appear in code style in the actual index.
1126
1127If you want to simultaneously index and emphasise a word, there's
339cbe09 1128another special case \i\c{\\i\\e}:
11f2edfa 1129
1130\c This is what we call a \i\e{paper jam}.
1131
1132This will cause the words \q{paper jam} to be emphasised in the
1133document, but (unlike the behaviour of \c{\\i\\c}) they will \e{not}
1134be emphasised in the index. This different behaviour is based on an
1135expectation that most people indexing a word of computer code will
1136still want it to look like code in the index, whereas most people
1137indexing an emphasised word will \e{not} want it emphasised in the
1138index.
1139
8856f150 1140(In fact, \e{no} emphasis in the text inside \c{\\i} will be
1141preserved in the index. If you really want a term in the index to
1142appear emphasised, you must say so explicitly using \c{\\IM}; see
1143\k{input-index-rewrite}.)
1144
11f2edfa 1145Sometimes you might want to index a term which is not explicitly
1146mentioned, but which is highly relevant to the text and you think
1147that somebody looking up that term in the index might find it useful
da090173 1148to be directed here. To do this you can use the \I{\\I-upper}\c{\\I}
1149command, to create an \i{\e{invisible} index tag}:
11f2edfa 1150
1151\c If your printer runs out of toner, \I{replacing toner
1152\c cartridge}here is what to do:
1153
1154This input will produce only the output \q{If your printer runs out
1155of toner, here is what to do}; but an index entry will show up under
1156\q{replacing toner cartridge}, so that if a user thinks the obvious
1157place to start in the index is under R for \q{replacing}, they will
1158find their way here with a minimum of fuss.
1159
1160(It's worth noting that there is no functional difference between
1161\c{\\i\{foo\}} and \c{\\I\{foo\}foo}. The simple \c{\\i} case is
1162only a shorthand for the latter.)
1163
1164Finally, if you want to index a word at the start of a sentence, you
1165might very well not want it to show up with a capital letter in the
339cbe09 1166index. For this, Halibut provides the \i\c{\\ii} command, for
1167\q{index (case-)insensitively}. You use it like this:
11f2edfa 1168
1169\c \ii{Lions} are at the top of the food chain in this area.
1170
1171This is equivalent to \c{\\I\{lions\}Lions}; in other words, the
1172text will say \q{Lions}, but it will show up in the index as
1173\q{lions}. The text inside \c{\\ii} is converted entirely into lower
1174case before being added to the index data.
1175
339cbe09 1176\S{input-index-rewrite} \ii{Fine-tuning the index}
11f2edfa 1177
1178Halibut's index mechanism as described so far still has a few
1179problems left:
1180
1181\b In a reasonably large index, it's often difficult to predict
339cbe09 1182\I{replicating index terms}which of several words a user will think
1183of first when trying to look something up. For example, if they want
1184to know how to replace a toner cartridge, they might look up
1185\q{replacing} or they might look up \q{toner cartridge}. You
1186probably don't really want to have to try to figure out which of
1187those is more likely; instead, what you'd like is to be able to
1188effortlessly index the same set of document locations under \e{both}
1189terms.
11f2edfa 1190
1191\b Also, you may find you've indexed the same concept under multiple
339cbe09 1192different \I{merging index terms}index terms; for example, there
1193might be several instances of \c{\\i\{frog\}} and several of
1194\c{\\i\{frogs\}}, so that you'd end up with two separate index
1195entries for what really ought to be the same concept.
11f2edfa 1196
b7747050 1197\b You might well not want the word \cq{grep} to appear in the
11f2edfa 1198index without explanation; you might prefer it to say something more
339cbe09 1199\I{rewriting index terms}verbose such as \q{\cw{grep} command}, so
1200that a user encountering it in the index has some idea of what it is
1201\e{without} having to follow up the reference. However, you
1202certainly don't want to have to write \c{\\I\{\\cw\{grep\}
1203command\}\\c\{grep\}} every time you want to add an index term for
1204this! You wanted to write \c{\\i\\c\{grep\}} as shown in the
1205previous section, and tidy it all up afterwards.
1206
1207All of these problems can be cleaned up by the \i\c{\\IM} (for
11f2edfa 1208\q{Index Modification}) command. \c{\\IM} expects to be followed by
1209one or more pairs of braces containing index terms as seen in the
1210document, and then a piece of text (not in braces) describing how it
1211should be shown in the index.
1212
1213So to rewrite the \c{grep} example above, you might do this:
1214
1215\c \IM{grep} \cw{grep} command
1216
1217This will arrange that the set of places in the document where you
b7747050 1218asked Halibut to index \cq{grep} will be listed under
1219\q{\cw{grep} command} rather than just under \cq{grep}.
11f2edfa 1220
1221You can specify more than one index term in a \c{\\IM} command; so
1222to merge the index terms \q{frog} and \q{frogs} into a single term,
1223you might do this:
1224
1225\c \IM{frog}{frogs} frog
1226
1227This will arrange that the single index entry \q{frog} will list
1228\e{all} the places in the document where you asked Halibut to index
1229either \q{frog} or \q{frogs}.
1230
1231You can use multiple \c{\\IM} commands to replicate the same set of
1232document locations in more than one index entry. For example:
1233
1234\c \IM{replacing toner cartridge} replacing toner cartridge
1235\c \IM{replacing toner cartridge} toner cartridge, replacing
1236
1237This will arrange that every place in the document where you have
1238indexed \q{replacing toner cartridge} will be listed both there
1239\e{and} under \q{toner cartridge, replacing}, so that no matter
1240whether the user looks under R or under T they will stil find their
1241way to the same parts of the document.
1242
1243In this example, note that although the first \c{\\IM} command
1244\e{looks} as if it's a tautology, it is still necessary, because
1245otherwise those document locations will \e{only} be indexed under
1246\q{toner cartridge, replacing}. If you have \e{no} explicit \c{\\IM}
1247commands for a particular index term, then Halibut will assume a
1248default one (typically \c{\\IM\{foo\}\_foo}, although it might be
1249\c{\\IM\{foo\}\_\\c\{foo\}} if you originally indexed using
1250\c{\\i\\c}); but as soon as you specify an explicit \c{\\IM},
1251Halibut discards its default implicit one, and you must then specify
1252that one explicitly as well if you wanted to keep it.
1253
da090173 1254\S{input-index-case} Indexing terms that differ only in case
1255
1256The \e{tags} you use to define an index term (that is, the text in
1257the braces after \c{\\i}, \c{\\I} and \c{\\IM}) are treated
1258case-insensitively by Halibut. So if, as in this manual itself, you
1259need two index terms that differ only in case, doing this will not
1260work:
1261
1262\c The \i\c{\\c} command defines computer code.
1263\c
1264\c The \i\c{\\C} command defines a chapter.
1265
1266Halibut will treat these terms as the same, and will fold the two
1267sets of references into one combined list (although it will warn you
1268that it is doing this). The idea is to ensure that people who forget
1269to use \c{\\ii} find out about it rather than Halibut silently
1270generating a bad index; checking an index for errors is very hard
1271work, so Halibut tries to avoid errors in the first place as much as
1272it can.
1273
1274If you do come across this situation, you will need to define two
1275distinguishable index terms. What I did in this manual was something
1276like this:
1277
1278\c The \i\c{\\c} command defines computer code.
1279\c
1280\c The \I{\\C-upper}\c{\\C} command defines a chapter.
1281\c
1282\c \IM{\\C-upper} \c{\\C}
1283
1284The effect of this will be two separate index entries, one reading
1285\c{\\c} and the other reading \c{\\C}, pointing to the right places.
1286
339cbe09 1287\H{input-config} \ii{Configuring} Halibut
11f2edfa 1288
339cbe09 1289Halibut uses the \i\c{\\cfg} command to allow you to configure various
11f2edfa 1290aspects of its functionality.
1291
1292The \c{\\cfg} command expects to be followed by at least one pair of
1293braces, and usually more after that. The first pair of braces
1294contains a keyword indicating what aspect of Halibut you want to
1295configure, and the meaning of the one(s) after that depends on the
1296first keyword.
1297
1d1da251 1298Each output format supports a range of configuration options of its
1299own (and some configuration is shared between similar output formats
1300- the PDF and PostScript formats share most of their configuration,
1301as described in \k{output-paper}). The configuration keywords for
1302each output format are listed in the manual section for that format;
1303see \k{output}.
1304
1305There are also a small number of configuration options which apply
1306across all output formats:
11f2edfa 1307
339cbe09 1308\dt \I\cw{\\cfg\{chapter\}}\cw{\\cfg\{chapter\}\{}\e{new chapter name}\cw{\}}
11f2edfa 1309
1310\dd This tells Halibut that you don't want to call a chapter a
339cbe09 1311\I{renaming sections}\I{configuring heading display}chapter any
1312more. For example, if you give the command
11f2edfa 1313\cw{\\cfg\{chapter\}\{Book\}}, then any chapter defined with the
1314\c{\\C} command will be labelled \q{Book} rather than \q{Chapter},
1315both in the section headings and in cross-references. This is
1316probably most useful if your document is not written in English.
1317
339cbe09 1318\lcont{
1319
1320Your replacement name should be given with a capital letter. Halibut
1321will leave it alone if it appears at the start of a sentence (in a
1322chapter title, or when \c{\\K} is used), and will lower-case it
1323otherwise (when \c{\\k} is used).
1324
1325}
1326
1327\dt \I\cw{\\cfg\{section\}}\cw{\\cfg\{section\}\{}\e{new section name}\cw{\}}
11f2edfa 1328
1329\dd Exactly like \c{chapter}, but changes the name given to
1330subsections of a chapter.
1331
339cbe09 1332\dt \I\cw{\\cfg\{appendix\}}\cw{\\cfg\{appendix\}\{}\e{new appendix name}\cw{\}}
11f2edfa 1333
339cbe09 1334\dd Exactly like \c{chapter}, but changes the name given to
11f2edfa 1335appendices.
1336
f6220253 1337\dt \I\cw{\\cfg\{contents\}}\cw{\\cfg\{contents\}\{}\e{new contents name}\cw{\}}
1338
1339\dd This changes the name given to the contents section (by default
1340\q{Contents}) in back ends which generate one.
1341
1342\dt \I\cw{\\cfg\{index\}}\cw{\\cfg\{index\}\{}\e{new index name}\cw{\}}
1343
1344\dd This changes the name given to the index section (by default
1345\q{Index}) in back ends which generate one.
1346
e34ba5c3 1347\dt \I\cw{\\cfg\{input-charset\}}\cw{\\cfg\{input-charset\}\{}\e{character set name}\cw{\}}
1348
1349\dd This tells Halibut what \i{character set} you are writing your
1350input file in. By default, it is assumed to be US-ASCII (meaning
1351\e{only} plain \i{ASCII}, with no accented characters at all).
1352
1353\lcont{
1354
1355You can specify any well-known name for any supported character set.
1356For example, \c{iso-8859-1}, \c{iso8859-1} and \c{iso_8859-1} are
1357all recognised, \c{GB2312} and \c{EUC-CN} both work, and so on.
f336fa9a 1358(You can list character sets known to Halibut with by invoking it
1359with the \cw{--list-charsets} option; see \k{running-options}.)
e34ba5c3 1360
1361This directive takes effect immediately after the \c{\\cfg} command.
675958c3 1362All text after that until the end of the input file is expected to be
1363in the new character set. You can even change character set several
1364times within a file if you really want to.
e34ba5c3 1365
1366When Halibut reads the input file, everything you type will be
1367converted into \i{Unicode} from the character set you specify here,
1368will be processed as Unicode by Halibut internally, and will be
1369written to the various output formats in whatever character sets
1370they deem appropriate.
1371
1372}
1373
6069815a 1374\dt \I\cw{\\cfg\{quotes\}}\cw{\\cfg\{quotes\}\{}\e{open-quote}\cw{\}\{}\e{close-quote}\cw{\}}[\cw{\{}\e{open-quote}\cw{\}\{}\e{close-quote}...\cw{\}}]
1375
1376\dd This specifies the quote characters which should be used. You
1377should separately specify the open and close quote marks; each
1378quote mark can be one character (\cw{\\cfg\{quotes\}\{`\}\{'\}}), or
1379more than one (\cw{\\cfg\{quotes\}\{<<\}\{>>\}}).
1380
1381\lcont{
1382
1383\cw{\\cfg\{quotes\}} can be overridden by configuration directives for
1384each individual backend (see \k{output}); it is a convenient way of
1385setting quote characters for all backends at once.
1386
1387All backends use these characters in response to the \c{\\q} command
1388(see \k{input-quotes}). Some (such as the text backend) use them for
1389other purposes too.
1390
1391You can specify multiple fallback options in this command (a pair of
1392open and close quotes, each in their own braces, then another pair,
1393then another if you like), and Halibut will choose the first pair
1394which the output character set supports (Halibut will always use a
1395matching pair). (This is to allow you to configure quote characters
1396once, generate output in several different character sets, and have
1397Halibut constantly adapt to make the best use of the current
1398encoding.) For example, you might write
1399
1400\c \cfg{quotes}{\u201c}{\u201d}{"}{"}
1401
1402and Halibut would use the Unicode matched double quote characters if
1403possible, and fall back to ASCII double quotes otherwise. If the
1404output character set were to contain U+201C but not U+201D, then
1405Halibut would fall back to using the ASCII double quote character as
1406\e{both} open and close quotes. (No known character set is that
1407silly; I mention it only as an example.)
1408
d87cb8ae 1409\cw{\\cfg\{quotes\}} (and the backend-specific versions) apply to the
1410\e{entire} output; it's not possible to change quote characters
1411partway through the output.
1412
6069815a 1413}
1414
11f2edfa 1415In addition to these configuration commands, there are also
1416configuration commands provided by each individual output format.
1417These configuration commands are discussed along with each output
16ea3abe 1418format, in \k{output}.
11f2edfa 1419
339cbe09 1420The \i{default settings} for the above options are:
1421
1422\c \cfg{chapter}{Chapter}
1423\c \cfg{section}{Section}
1424\c \cfg{appendix}{Appendix}
f6220253 1425\c \cfg{contents}{Contents}
1426\c \cfg{index}{Index}
60f49347 1427\c \cfg{input-charset}{ASCII}
339cbe09 1428
675958c3 1429The default for \cw{\\cfg\{input-charset\}} can be changed with the
1430\cw{--input-charset} option; see \k{running-options}. The default
1431settings for \cw{\\cfg\{quotes\}} are backend-specific; see
1432\k{output}.
6069815a 1433
339cbe09 1434\H{input-macro} Defining \i{macros}
11f2edfa 1435
1436If there's a complicated piece of Halibut source which you think
1437you're going to use a lot, you can define your own Halibut command
1438to produce that piece of source.
1439
1440In \k{input-unicode}, there is a sample piece of code which prints a
1441Euro sign, or replaces it with \q{EUR} if the Euro sign is not
1442available:
1443
16ea3abe 1444\c This is likely to cost \u20AC{EUR\_}2500 at least.
11f2edfa 1445
1446If your document quotes a \e{lot} of prices in Euros, you might not
1447want to spend all your time typing that out. So you could define a
339cbe09 1448macro, using the \i\c{\\define} command:
11f2edfa 1449
16ea3abe 1450\c \define{eur} \u20AC{EUR\_}
11f2edfa 1451
acbb8b72 1452Your macro names may include Roman alphabetic characters
1453(\c{a}-\c{z}, \c{A}-\c{Z}) and ordinary Arabic numerals
1454(\c{0}-\c{9}), but nothing else. (This is general \I{command
1455syntax}syntax for all of Halibut's commands, except for a few
1456special ones such as \c{\\_} and \c{\\-} which consist of a single
1457punctuation character only.)
1458
672e4626 1459Then you can just write ...
11f2edfa 1460
1461\c This is likely to cost \eur 2500 at least.
1462
672e4626 1463... except that that's not terribly good, because you end up with a
acbb8b72 1464space between the Euro sign and the number. (If you had written
1465\c{\\eur2500}, Halibut would have tried to interpret it as a macro
1466command called \c{eur2500}, which you didn't define.) In this case,
1467it's helpful to use the special \i\c{\\.} command, which is defined
1468to \I{NOP}\I{doing nothing}do nothing at all! But it acts as a
339cbe09 1469separator between your macro and the next character:
672e4626 1470
1471\c This is likely to cost \eur\.2500 at least.
1472
1473This way, you will see no space between the Euro sign and the number
1474(although, of course, there will be space between \q{EUR} and the
1475number if the Euro sign is not available, because the macro
1476definition specifically asked for it).