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