Clarify the section about backend-generic config options to make it
[sgt/halibut] / doc / input.but
index e3849e3..8cf4b8a 100644 (file)
@@ -1,3 +1,5 @@
+\versionid $Id$
+
 \C{input} Halibut input format
 
 This chapter describes the format in which you should write
 \C{input} Halibut input format
 
 This chapter describes the format in which you should write
@@ -52,6 +54,10 @@ and Halibut would generate the text
 This \\ is a backslash, and these are \{braces\}.
 }
 
 This \\ is a backslash, and these are \{braces\}.
 }
 
+If you want to write your input file in a character set other than
+ASCII, you can do so by using the \c{\\cfg\{input-charset\}}
+command. See \k{input-config} for details of this.
+
 \H{input-inline} Simple \i{inline formatting commands}
 
 Halibut formatting commands all begin with a backslash, followed by
 \H{input-inline} Simple \i{inline formatting commands}
 
 Halibut formatting commands all begin with a backslash, followed by
@@ -79,14 +85,14 @@ be treated identically:
 
 \S{input-emph} \c{\\e}: Emphasising text
 
 
 \S{input-emph} \c{\\e}: Emphasising text
 
-Possibly the most obvious piece of formatting you might want to use
-in a document is \i\e{emphasis}. To emphasise text, you use the
-\i\c{\\e} command, and follow it up with the text to be emphasised
-in braces. For example, the first sentence in this paragraph was
-generated using the Halibut input
+Possibly the most obvious piece of formatting you might want
+to use in a document is \i\e{emphasis}.
+To emphasise text, you use the \i\c{\\e} command, and follow it up
+with the text to be emphasised in braces. For example, the first
+sentence in this paragraph was generated using the Halibut input
 
 
-\c Possibly the most obvious piece of formatting you might want to use
-\c in a document is \e{emphasis}.
+\c Possibly the most obvious piece of formatting you might want
+\c to use in a document is \e{emphasis}.
 
 \S{input-code} \c{\\c} and \c{\\cw}: Displaying \i{computer code} inline
 
 
 \S{input-code} \c{\\c} and \c{\\cw}: Displaying \i{computer code} inline
 
@@ -126,22 +132,22 @@ knows where the literal computer text starts and stops; and in plain
 text, this cannot be done by changing font, so there needs to be an
 alternative way.
 
 text, this cannot be done by changing font, so there needs to be an
 alternative way.
 
-So in the plain text back end, things marked as code (\c{\\c}) will
-be surrounded by quote marks, so that it's obvious where they start
-and finish. Things marked as weak code (\c{\\cw}) will not look any
-different from normal text.
+So in the plain text output format, things marked as code (\c{\\c})
+will be surrounded by quote marks, so that it's obvious where they
+start and finish. Things marked as weak code (\c{\\cw}) will not
+look any different from normal text.
 
 I recommend using weak code for any application where it is
 \e{obvious} that the text is literal computer input or output. For
 example, if the text is capitalised, that's usually good enough. If
 I talk about the Pentium's \cw{EAX} and \cw{EDX} registers, for
 example, you don't need quotes to notice that those are special; so
 
 I recommend using weak code for any application where it is
 \e{obvious} that the text is literal computer input or output. For
 example, if the text is capitalised, that's usually good enough. If
 I talk about the Pentium's \cw{EAX} and \cw{EDX} registers, for
 example, you don't need quotes to notice that those are special; so
-I would write that in Halibut as \q{\c{the Pentium's \\cw\{EAX\} and
-\\cw\{EDX\} registers}}. But if I'm talking about the Unix command
+I would write that in Halibut as \cq{the Pentium's \\cw\{EAX\} and
+\\cw\{EDX\} registers}. But if I'm talking about the Unix command
 \c{man}, which is an ordinary English word in its own right, a reader
 might be slightly confused if it appeared in the middle of a
 \c{man}, which is an ordinary English word in its own right, a reader
 might be slightly confused if it appeared in the middle of a
-sentence undecorated; so I would write that as \q{\c{the Unix command
-\\c\{man\}}}.
+sentence undecorated; so I would write that as \cq{the Unix command
+\\c\{man\}}.
 
 In summary:
 
 
 In summary:
 
@@ -152,6 +158,24 @@ changing the font if possible, or by using quotes if not.
 \b \c{\\cw} means \q{it would be nice to display this text in a
 fixed-width font if possible, but it's not essential}.
 
 \b \c{\\cw} means \q{it would be nice to display this text in a
 fixed-width font if possible, but it's not essential}.
 
+In really extreme cases, you might want Halibut to use \i{quotation
+marks} even in output formats which can change font. In
+\k{input-date}, for example, I mention the special formatting
+command \cq{\\.}. If that appeared at the end of a sentence
+\e{without} the quotes, then the two adjacent full stops would look
+pretty strange even if they were obviously in different fonts.
+
+For this, Halibut supports the \i\c{\\cq} command, which is exactly
+equivalent to using \c{\\q} to provide quotes and then using
+\c{\\cw} inside the quotes. So in the paragraph above, for example,
+I wrote
+
+\c the special formatting command \cq{\\.}.
+
+and I could equivalently have written
+
+\c the special formatting command \q{\cw{\\.}}.
+
 There is a separate mechanism for displaying computer code in an
 entire paragraph; see \k{input-codepara} for that one.
 
 There is a separate mechanism for displaying computer code in an
 entire paragraph; see \k{input-codepara} for that one.
 
@@ -176,19 +200,23 @@ Here is some \q{text in quotes}.
 }
 
 and in every output format Halibut generates, it will choose the
 }
 
 and in every output format Halibut generates, it will choose the
-best quote characters available to it in that format.
-
-You can still use ordinary ASCII \i{double quotes} if you prefer; or
-you could even use the \c{\\u} command (see \k{input-unicode}) to
-generate \i{Unicode matched quotes} (single or double) and fall back
-to the normal ASCII one if they aren't available. But I recommend
-using the built-in \c{\\q} command in most cases, because it's
-simple and does the best it can everywhere.
-
-(Note that if you're using the \c{\\c} or \c{\\cw} commands to
-display literal computer code, you probably \e{will} want to use
-literal \i{ASCII quote characters}, because it is likely to matter
-precisely which quote character you use.)
+best quote characters available to it in that format. (The quote
+characters to use can be configured with the \c{\\cfg} command.)
+
+You can still use the ordinary quote characters of your choice if
+you prefer; or you could even use the \c{\\u} command (see
+\k{input-unicode}) to generate \i{Unicode matched quotes} (single or
+double) in a way which will automatically fall back to the normal
+ASCII one if they aren't available. But I recommend using the
+built-in \c{\\q} command in most cases, because it's simple and does
+the best it can everywhere.
+
+If you're using the \c{\\c} or \c{\\cw} commands to display literal
+computer code, you will probably want to use literal \i{ASCII quote
+characters}, because it is likely to matter precisely which quote
+character you use. In fact, Halibut actually \e{disallows} the use
+of \c{\\q} within either of \c{\\c} and \c{\\cw}, since this
+simplifies some of the output formats.
 
 \S{input-nonbreaking} \c{\\-} and \c{\\_}: \ii{Non-breaking hyphens}
 and \I{non-breaking spaces}spaces
 
 \S{input-nonbreaking} \c{\\-} and \c{\\_}: \ii{Non-breaking hyphens}
 and \I{non-breaking spaces}spaces
@@ -230,6 +258,16 @@ and Halibut generates something like
 This document was generated on \date.
 }
 
 This document was generated on \date.
 }
 
+You can follow the \c{\\date} command directly with punctuation (as
+in this example, where it is immediately followed by a full stop),
+but if you try to follow it with an alphabetic or numeric character
+(such as writing \c{\\dateZ}) then Halibut will assume you are
+trying to invoke the name of a macro command you have defined
+yourself, and will complain if no such command exists. To get round
+this you can use the special \cq{\\.} do-nothing command. See
+\k{input-macro} for more about general Halibut command syntax and
+\cq{\\.}.
+
 If you would prefer the date to be generated in a specific format,
 you can follow the \c{\\date} command with a format specification in
 braces. The format specification will be run through the standard C
 If you would prefer the date to be generated in a specific format,
 you can follow the \c{\\date} command with a format specification in
 braces. The format specification will be run through the standard C
@@ -286,34 +324,34 @@ The \c{\\W} command supports a piece of extra syntax to make this
 convenient for you. You can specify \c{\\c} or \c{\\cw} \e{between}
 the first and second pairs of braces. For example, you might write
 
 convenient for you. You can specify \c{\\c} or \c{\\cw} \e{between}
 the first and second pairs of braces. For example, you might write
 
-\c Google is located at \W{http://www.google.com/}\cw{www.google.com}.
+\c Google is at \W{http://www.google.com/}\cw{www.google.com}.
 
 and Halibut would produce
 
 \quote{
 
 and Halibut would produce
 
 \quote{
-Google is located at \W{http://www.google.com/}\cw{www.google.com}.
+Google is at \W{http://www.google.com/}\cw{www.google.com}.
 }
 
 }
 
+If you want the link text to be an index term as well, you can also
+specify \c{\\i} or \c{\\ii}; this has to come before \c{\\c} or
+\c{\\cw} if both are present. (See \k{input-index} for more about
+indexing.)
+
 \S{input-unicode} \c{\\u}: Specifying arbitrary \i{Unicode}
 characters
 
 \S{input-unicode} \c{\\u}: Specifying arbitrary \i{Unicode}
 characters
 
-When Halibut is finished, it should have full Unicode support. You
-should be able to specify any (reasonably well known) \i{character
-set} for your input document, and Halibut should convert it all to
-Unicode as it reads it in. Similarly, you should be able to specify
-the character set you want for each output format and have all the
-conversion done automatically.
-
-Currently, none of this is actually supported. Input text files are
-assumed to be in \i{ISO 8859-1}, and each output format has its own
-non-configurable character set (although the HTML output can use the
-\c{Ӓ} mechanism to output any Unicode character it likes).
+Halibut has extensive support for Unicode and character set
+conversion. You can specify any (reasonably well known) \i{character
+set} for your input document, and Halibut will convert it all to
+Unicode as it reads it in. See \k{input-config} for more details of
+this.
 
 If you need to specify a Unicode character in your input document
 
 If you need to specify a Unicode character in your input document
-which is not supported by the input character set, you can use the
-\i\c{\\u} command to do this. \c{\\u} expects to be followed by a
-sequence of hex digits; so that \c{\\u0041}, for example, denotes
-the Unicode character \cw{0x0041}, which is the capital letter A.
+which is not supported by the input character set you have chosen,
+you can use the \i\c{\\u} command to do this. \c{\\u} expects to be
+followed by a sequence of hex digits; so that \c{\\u0041}, for
+example, denotes the Unicode character \cw{0x0041}, which is the
+capital letter A.
 
 If a Unicode character specified in this way is not supported in a
 particular \e{output} format, you probably don't just want it to be
 
 If a Unicode character specified in this way is not supported in a
 particular \e{output} format, you probably don't just want it to be
@@ -333,8 +371,8 @@ This is likely to cost \u20AC{EUR\_}2500 at least.
 
 If you read it in other formats, you may see different results.
 
 
 If you read it in other formats, you may see different results.
 
-\S{input-xref} \i\c{\\k} and \i\c{\\K}: \ii{Cross-references} to
-other sections
+\S{input-xref} \i\c{\\k} and \I{\\K-upper}\c{\\K}:
+\ii{Cross-references} to other sections
 
 \K{intro-features} mentions that Halibut \I{section numbers}numbers
 the sections of your document automatically, and can generate
 
 \K{intro-features} mentions that Halibut \I{section numbers}numbers
 the sections of your document automatically, and can generate
@@ -385,15 +423,25 @@ braces, that text will be ignored by Halibut.
 
 For example, you might write
 
 
 For example, you might write
 
-\c The typical behaviour of an antelope \#{do I mean gazelle?} is...
+\c The typical behaviour of an antelope \#{do I mean
+\c gazelle?} is...
 
 and Halibut will simply leave out the aside about gazelles, and will
 generate nothing but
 
 \quote{
 
 and Halibut will simply leave out the aside about gazelles, and will
 generate nothing but
 
 \quote{
-The typical behaviour of an antelope \#{do I mean gazelle?} is...
+The typical behaviour of an antelope \#{do I mean
+gazelle?} is...
 }
 
 }
 
+This command will respect nested braces, so you can use it to
+comment out sections of Halibut markup:
+
+\c This function is \#{very, \e{very}} important.
+
+In this example, the comment lasts until the final closing brace (so
+that the whole \q{very, \e{very}} section is commented out).
+
 The \c{\\#} command can also be used to produce a whole-paragraph
 comment; see \k{input-commentpara} for details of that.
 
 The \c{\\#} command can also be used to produce a whole-paragraph
 comment; see \k{input-commentpara} for details of that.
 
@@ -441,7 +489,7 @@ Note that the above paragraph makes use of a backslash and a pair of
 braces, and does \e{not} need to escape them in the way described in
 \k{input-basics}. This is because code paragraphs formatted in this
 way are a special case; the intention is that you can just copy and
 braces, and does \e{not} need to escape them in the way described in
 \k{input-basics}. This is because code paragraphs formatted in this
 way are a special case; the intention is that you can just copy and
-paste a lump of code out of another program, put \q{\cw{\\c }} at the
+paste a lump of code out of your program, put \cq{\\c } at the
 start of every line, and simply \e{not have to worry} about the
 details - you don't have to go through the whole block looking for
 characters to escape.
 start of every line, and simply \e{not have to worry} about the
 details - you don't have to go through the whole block looking for
 characters to escape.
@@ -560,10 +608,12 @@ Here's a list:
 
 The disadvantage of having Halibut sort out the list numbering for
 you is that if you need to refer to a list item by its number, you
 
 The disadvantage of having Halibut sort out the list numbering for
 you is that if you need to refer to a list item by its number, you
-can't reliably do so. To get round this, Halibut allows an optional
-keyword in braces after the \c{\\n} command. This keyword can then
-be referenced using the \c{\\k} or \c{\\K} command (see
-\k{input-xref}) to provide the number of the list item. For example:
+can't reliably know the number in advance (because if you later add
+another item at the start of the list, the numbers will all change).
+To get round this, Halibut allows an optional keyword in braces
+after the \c{\\n} command. This keyword can then be referenced using
+the \c{\\k} or \c{\\K} command (see \k{input-xref}) to provide the
+number of the list item. For example:
 
 \c Here's a list:
 \c
 
 \c Here's a list:
 \c
@@ -589,6 +639,12 @@ Here's a list:
 \n Now go back to step \k{this-one}.
 }
 
 \n Now go back to step \k{this-one}.
 }
 
+The keyword you supply after \c{\\n} is allowed to contain escaped
+special characters (\c{\\\\}, \c{\\\{} and \c{\\\}}), but should not
+contain any other Halibut markup. It is intended to be a word or two
+of ordinary text. (This also applies to keywords used in other
+commands, such as \c{\\B} and \c{\\C}).
+
 \S2{input-list-description} \i\c{\\dt} and \i\c{\\dd}:
 \ii{Description lists}
 
 \S2{input-list-description} \i\c{\\dt} and \i\c{\\dd}:
 \ii{Description lists}
 
@@ -618,6 +674,16 @@ This produces the following output:
 
 }
 
 
 }
 
+If you really want to, you are allowed to use \c{\\dt} and \c{\\dd}
+without strictly interleaving them (multiple consecutive \c{\\dt}s
+or consecutive \c{\\dd}s, or a description list starting with
+\c{\\dd} or ending with \c{\\dt}). This is probably most useful if
+you are listing a sequence of things with \c{\\dt}, but only some of
+them actually need \c{\\dd} descriptions. You should \e{not} use
+multiple consecutive \c{\\dd}s to provide a multi-paragraph
+definition of something; that's what \c{\\lcont} is for, as
+explained in \k{input-list-continuation}.
+
 \S2{input-list-continuation} \ii{Continuing list items} into further
 paragraphs
 
 \S2{input-list-continuation} \ii{Continuing list items} into further
 paragraphs
 
@@ -698,7 +764,7 @@ Here's a list:
 
 }
 
 
 }
 
-This syntax seems a little bit inconvenient, and perhaps
+This syntax might seem a little bit inconvenient, and perhaps
 counter-intuitive: you might expect the enclosing braces to have to
 go around the \e{whole} list item, rather than everything except the
 first paragraph.
 counter-intuitive: you might expect the enclosing braces to have to
 go around the \e{whole} list item, rather than everything except the
 first paragraph.
@@ -758,8 +824,8 @@ your quoted section, and \c{\}} at the end, and the paragraphs in
 between will be formatted to indicate that they are a quotation.
 
 (This very manual, in fact, uses this feature a lot: all of the
 between will be formatted to indicate that they are a quotation.
 
 (This very manual, in fact, uses this feature a lot: all of the
-examples of Halibut source followed by Halibut output have the
-output quoted using \c{\\quote}.)
+examples of Halibut input followed by Halibut output have the output
+quoted using \c{\\quote}.)
 
 Here's some example Halibut input:
 
 
 Here's some example Halibut input:
 
@@ -770,8 +836,8 @@ Here's some example Halibut input:
 \c \q{The question is,} said Alice, \q{whether you \e{can} make
 \c words mean so many different things.}
 \c
 \c \q{The question is,} said Alice, \q{whether you \e{can} make
 \c words mean so many different things.}
 \c
-\c \q{The question is,} said Humpty Dumpty, \q{who is to be master -
-\c that's all.}
+\c \q{The question is,} said Humpty Dumpty, \q{who is to be
+\c master - that's all.}
 \c
 \c }
 \c
 \c
 \c }
 \c
@@ -788,8 +854,8 @@ In \q{Through the Looking Glass}, Lewis Carroll wrote:
 \q{The question is,} said Alice, \q{whether you \e{can} make
 words mean so many different things.}
 
 \q{The question is,} said Alice, \q{whether you \e{can} make
 words mean so many different things.}
 
-\q{The question is,} said Humpty Dumpty, \q{who is to be master -
-that's all.}
+\q{The question is,} said Humpty Dumpty, \q{who is to be
+master - that's all.}
 
 }
 
 
 }
 
@@ -797,8 +863,8 @@ So now you know.
 
 }
 
 
 }
 
-\S{input-sections} \i\c{\\C}, \i\c{\\H}, \i\c{\\S}, \i\c{\\A},
-\i\c{\\U}: Chapter and \i{section headings}
+\S{input-sections} \I{\\C-upper}\c{\\C}, \i\c{\\H}, \i\c{\\S},
+\i\c{\\A}, \I{\\U-upper}\c{\\U}: Chapter and \i{section headings}
 
 \K{intro-features} mentions that Halibut \I{section
 numbering}numbers the sections of your document automatically, and
 
 \K{intro-features} mentions that Halibut \I{section
 numbering}numbers the sections of your document automatically, and
@@ -821,6 +887,12 @@ written as
 and this allows me to use the command \c{\\k\{input\}} to generate a
 cross-reference to that chapter somewhere else.
 
 and this allows me to use the command \c{\\k\{input\}} to generate a
 cross-reference to that chapter somewhere else.
 
+The \I{keyword syntax}keyword you supply after one of these commands
+is allowed to contain escaped special characters (\c{\\\\}, \c{\\\{}
+and \c{\\\}}), but should not contain any other Halibut markup. It
+is intended to be a word or two of ordinary text. (This also applies
+to keywords used in other commands, such as \c{\\B} and \c{\\n}).
+
 The next level down from \c{\\C} is \c{\\H}, for \q{heading}. This
 is used in exactly the same way as \c{\\C}, but section headings
 defined with \c{\\H} are considered to be part of a containing
 The next level down from \c{\\C} is \c{\\H}, for \q{heading}. This
 is used in exactly the same way as \c{\\C}, but section headings
 defined with \c{\\H} are considered to be part of a containing
@@ -904,7 +976,7 @@ The three special paragraph types are:
 
 \dd This defines the overall title of the entire document. This
 title is treated specially in some output formats (for example, it's
 
 \dd This defines the overall title of the entire document. This
 title is treated specially in some output formats (for example, it's
-used in a \cw{<title>} tag in the HTML output), so it needs a
+used in a \cw{<TITLE>} tag in the HTML output), so it needs a
 special paragraph type to point it out.
 
 \dt \i\cw{\\copyright}
 special paragraph type to point it out.
 
 \dt \i\cw{\\copyright}
@@ -940,9 +1012,9 @@ a comment, like this:
 \c Here's a (fairly short) paragraph which will be displayed.
 \c
 \c \# Here's a comment paragraph which will not be displayed, no
 \c Here's a (fairly short) paragraph which will be displayed.
 \c
 \c \# Here's a comment paragraph which will not be displayed, no
-\c matter how long it goes on. All I needed to indicate this was the
-\c single \# at the start of the paragraph; I don't need one on
-\c every line or anything like that.
+\c matter how long it goes on. All I needed to indicate this was
+\c the single \# at the start of the paragraph; I don't need one
+\c on every line or anything like that.
 \c
 \c Here's another displayed paragraph.
 
 \c
 \c Here's another displayed paragraph.
 
@@ -953,9 +1025,9 @@ When run through Halibut, this produces the following output:
 Here's a (fairly short) paragraph which will be displayed.
 
 \# Here's a comment paragraph which will not be displayed, no
 Here's a (fairly short) paragraph which will be displayed.
 
 \# Here's a comment paragraph which will not be displayed, no
-matter how long it goes on. All I needed to indicate this was the
-single \# at the start of the paragraph; I don't need one on
-every line or anything like that.
+matter how long it goes on. All I needed to indicate this was
+the single \# at the start of the paragraph; I don't need one
+on every line or anything like that.
 
 Here's another displayed paragraph.
 
 
 Here's another displayed paragraph.
 
@@ -967,10 +1039,10 @@ If you need your document to refer to other documents (research
 papers, books, websites, whatever), you might find a bibliography
 feature useful.
 
 papers, books, websites, whatever), you might find a bibliography
 feature useful.
 
-You can define a bibliography entry using the \i\c{\\B} command. This
-looks very like the \c{\\C} command and friends: it expects a
-keyword in braces, followed by some text describing the document
-being referred to. For example:
+You can define a bibliography entry using the \I{\\B-upper}\c{\\B}
+command. This looks very like the \c{\\C} command and friends: it
+expects a keyword in braces, followed by some text describing the
+document being referred to. For example:
 
 \c \B{freds-book} \q{The Taming Of The Mongoose}, by Fred Bloggs.
 \c Published by Paperjam & Notoner, 1993.
 
 \c \B{freds-book} \q{The Taming Of The Mongoose}, by Fred Bloggs.
 \c Published by Paperjam & Notoner, 1993.
@@ -1013,6 +1085,12 @@ format for a particular book:
 
 \c \BR{freds-book} [Fred1993]
 
 
 \c \BR{freds-book} [Fred1993]
 
+The keyword you supply after \c{\\B} is allowed to contain escaped
+special characters (\c{\\\\}, \c{\\\{} and \c{\\\}}), but should not
+contain any other Halibut markup. It is intended to be a word or two
+of ordinary text. (This also applies to keywords used in other
+commands, such as \c{\\n} and \c{\\C}).
+
 \H{input-index} Creating an \i{index}
 
 Halibut contains a comprehensive indexing mechanism, which attempts
 \H{input-index} Creating an \i{index}
 
 Halibut contains a comprehensive indexing mechanism, which attempts
@@ -1067,8 +1145,8 @@ appear emphasised, you must say so explicitly using \c{\\IM}; see
 Sometimes you might want to index a term which is not explicitly
 mentioned, but which is highly relevant to the text and you think
 that somebody looking up that term in the index might find it useful
 Sometimes you might want to index a term which is not explicitly
 mentioned, but which is highly relevant to the text and you think
 that somebody looking up that term in the index might find it useful
-to be directed here. To do this you can use the \i\c{\\I} command,
-to create an \i{\e{invisible} index tag}:
+to be directed here. To do this you can use the \I{\\I-upper}\c{\\I}
+command, to create an \i{\e{invisible} index tag}:
 
 \c If your printer runs out of toner, \I{replacing toner
 \c cartridge}here is what to do:
 
 \c If your printer runs out of toner, \I{replacing toner
 \c cartridge}here is what to do:
@@ -1116,7 +1194,7 @@ might be several instances of \c{\\i\{frog\}} and several of
 \c{\\i\{frogs\}}, so that you'd end up with two separate index
 entries for what really ought to be the same concept.
 
 \c{\\i\{frogs\}}, so that you'd end up with two separate index
 entries for what really ought to be the same concept.
 
-\b You might well not want the word \q{\cw{grep}} to appear in the
+\b You might well not want the word \cq{grep} to appear in the
 index without explanation; you might prefer it to say something more
 \I{rewriting index terms}verbose such as \q{\cw{grep} command}, so
 that a user encountering it in the index has some idea of what it is
 index without explanation; you might prefer it to say something more
 \I{rewriting index terms}verbose such as \q{\cw{grep} command}, so
 that a user encountering it in the index has some idea of what it is
@@ -1137,8 +1215,8 @@ So to rewrite the \c{grep} example above, you might do this:
 \c \IM{grep} \cw{grep} command
 
 This will arrange that the set of places in the document where you
 \c \IM{grep} \cw{grep} command
 
 This will arrange that the set of places in the document where you
-asked Halibut to index \q{\cw{grep}} will be listed under
-\q{\cw{grep} command} rather than just under \q{\cw{grep}}.
+asked Halibut to index \cq{grep} will be listed under
+\q{\cw{grep} command} rather than just under \cq{grep}.
 
 You can specify more than one index term in a \c{\\IM} command; so
 to merge the index terms \q{frog} and \q{frogs} into a single term,
 
 You can specify more than one index term in a \c{\\IM} command; so
 to merge the index terms \q{frog} and \q{frogs} into a single term,
@@ -1173,6 +1251,39 @@ default one (typically \c{\\IM\{foo\}\_foo}, although it might be
 Halibut discards its default implicit one, and you must then specify
 that one explicitly as well if you wanted to keep it.
 
 Halibut discards its default implicit one, and you must then specify
 that one explicitly as well if you wanted to keep it.
 
+\S{input-index-case} Indexing terms that differ only in case
+
+The \e{tags} you use to define an index term (that is, the text in
+the braces after \c{\\i}, \c{\\I} and \c{\\IM}) are treated
+case-insensitively by Halibut. So if, as in this manual itself, you
+need two index terms that differ only in case, doing this will not
+work:
+
+\c The \i\c{\\c} command defines computer code.
+\c
+\c The \i\c{\\C} command defines a chapter.
+
+Halibut will treat these terms as the same, and will fold the two
+sets of references into one combined list (although it will warn you
+that it is doing this). The idea is to ensure that people who forget
+to use \c{\\ii} find out about it rather than Halibut silently
+generating a bad index; checking an index for errors is very hard
+work, so Halibut tries to avoid errors in the first place as much as
+it can.
+
+If you do come across this situation, you will need to define two
+distinguishable index terms. What I did in this manual was something
+like this:
+
+\c The \i\c{\\c} command defines computer code.
+\c
+\c The \I{\\C-upper}\c{\\C} command defines a chapter.
+\c
+\c \IM{\\C-upper} \c{\\C}
+
+The effect of this will be two separate index entries, one reading
+\c{\\c} and the other reading \c{\\C}, pointing to the right places.
+
 \H{input-config} \ii{Configuring} Halibut
 
 Halibut uses the \i\c{\\cfg} command to allow you to configure various
 \H{input-config} \ii{Configuring} Halibut
 
 Halibut uses the \i\c{\\cfg} command to allow you to configure various
@@ -1184,8 +1295,15 @@ contains a keyword indicating what aspect of Halibut you want to
 configure, and the meaning of the one(s) after that depends on the
 first keyword.
 
 configure, and the meaning of the one(s) after that depends on the
 first keyword.
 
-The current list of configuration keywords in the main Halibut code
-is quite small. Here it is in full:
+Each output format supports a range of configuration options of its
+own (and some configuration is shared between similar output formats
+- the PDF and PostScript formats share most of their configuration,
+as described in \k{output-paper}). The configuration keywords for
+each output format are listed in the manual section for that format;
+see \k{output}.
+
+There are also a small number of configuration options which apply
+across all output formats:
 
 \dt \I\cw{\\cfg\{chapter\}}\cw{\\cfg\{chapter\}\{}\e{new chapter name}\cw{\}}
 
 
 \dt \I\cw{\\cfg\{chapter\}}\cw{\\cfg\{chapter\}\{}\e{new chapter name}\cw{\}}
 
@@ -1216,6 +1334,84 @@ subsections of a chapter.
 \dd Exactly like \c{chapter}, but changes the name given to
 appendices.
 
 \dd Exactly like \c{chapter}, but changes the name given to
 appendices.
 
+\dt \I\cw{\\cfg\{contents\}}\cw{\\cfg\{contents\}\{}\e{new contents name}\cw{\}}
+
+\dd This changes the name given to the contents section (by default
+\q{Contents}) in back ends which generate one.
+
+\dt \I\cw{\\cfg\{index\}}\cw{\\cfg\{index\}\{}\e{new index name}\cw{\}}
+
+\dd This changes the name given to the index section (by default
+\q{Index}) in back ends which generate one.
+
+\dt \I\cw{\\cfg\{input-charset\}}\cw{\\cfg\{input-charset\}\{}\e{character set name}\cw{\}}
+
+\dd This tells Halibut what \i{character set} you are writing your
+input file in. By default, it is assumed to be US-ASCII (meaning
+\e{only} plain \i{ASCII}, with no accented characters at all).
+
+\lcont{
+
+You can specify any well-known name for any supported character set.
+For example, \c{iso-8859-1}, \c{iso8859-1} and \c{iso_8859-1} are
+all recognised, \c{GB2312} and \c{EUC-CN} both work, and so on.
+(You can list character sets known to Halibut with by invoking it
+with the \cw{--list-charsets} option; see \k{running-options}.)
+
+This directive takes effect immediately after the \c{\\cfg} command.
+All text after that until the end of the input file is expected to be
+in the new character set. You can even change character set several
+times within a file if you really want to. 
+
+When Halibut reads the input file, everything you type will be
+converted into \i{Unicode} from the character set you specify here,
+will be processed as Unicode by Halibut internally, and will be
+written to the various output formats in whatever character sets
+they deem appropriate.
+
+}
+
+\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{\}}]
+
+\dd This specifies the quote characters which should be used. You
+should separately specify the open and close quote marks; each
+quote mark can be one character (\cw{\\cfg\{quotes\}\{`\}\{'\}}), or
+more than one (\cw{\\cfg\{quotes\}\{<<\}\{>>\}}).
+
+\lcont{
+
+\cw{\\cfg\{quotes\}} can be overridden by configuration directives for
+each individual backend (see \k{output}); it is a convenient way of
+setting quote characters for all backends at once.
+
+All backends use these characters in response to the \c{\\q} command
+(see \k{input-quotes}). Some (such as the text backend) use them for
+other purposes too.
+
+You can specify multiple fallback options in this command (a pair of
+open and close quotes, each in their own braces, then another pair,
+then another if you like), and Halibut will choose the first pair
+which the output character set supports (Halibut will always use a
+matching pair). (This is to allow you to configure quote characters
+once, generate output in several different character sets, and have
+Halibut constantly adapt to make the best use of the current
+encoding.) For example, you might write
+
+\c \cfg{quotes}{\u201c}{\u201d}{"}{"}
+
+and Halibut would use the Unicode matched double quote characters if
+possible, and fall back to ASCII double quotes otherwise. If the
+output character set were to contain U+201C but not U+201D, then
+Halibut would fall back to using the ASCII double quote character as
+\e{both} open and close quotes. (No known character set is that
+silly; I mention it only as an example.)
+
+\cw{\\cfg\{quotes\}} (and the backend-specific versions) apply to the
+\e{entire} output; it's not possible to change quote characters
+partway through the output.
+
+}
+
 In addition to these configuration commands, there are also
 configuration commands provided by each individual output format.
 These configuration commands are discussed along with each output
 In addition to these configuration commands, there are also
 configuration commands provided by each individual output format.
 These configuration commands are discussed along with each output
@@ -1226,6 +1422,14 @@ The \i{default settings} for the above options are:
 \c \cfg{chapter}{Chapter}
 \c \cfg{section}{Section}
 \c \cfg{appendix}{Appendix}
 \c \cfg{chapter}{Chapter}
 \c \cfg{section}{Section}
 \c \cfg{appendix}{Appendix}
+\c \cfg{contents}{Contents}
+\c \cfg{index}{Index}
+\c \cfg{input-charset}{ASCII}
+
+The default for \cw{\\cfg\{input-charset\}} can be changed with the
+\cw{--input-charset} option; see \k{running-options}. The default
+settings for \cw{\\cfg\{quotes\}} are backend-specific; see
+\k{output}.
 
 \H{input-macro} Defining \i{macros}
 
 
 \H{input-macro} Defining \i{macros}
 
@@ -1245,14 +1449,23 @@ macro, using the \i\c{\\define} command:
 
 \c \define{eur} \u20AC{EUR\_}
 
 
 \c \define{eur} \u20AC{EUR\_}
 
+Your macro names may include Roman alphabetic characters
+(\c{a}-\c{z}, \c{A}-\c{Z}) and ordinary Arabic numerals
+(\c{0}-\c{9}), but nothing else. (This is general \I{command
+syntax}syntax for all of Halibut's commands, except for a few
+special ones such as \c{\\_} and \c{\\-} which consist of a single
+punctuation character only.)
+
 Then you can just write ...
 
 \c This is likely to cost \eur 2500 at least.
 
 ... except that that's not terribly good, because you end up with a
 Then you can just write ...
 
 \c This is likely to cost \eur 2500 at least.
 
 ... except that that's not terribly good, because you end up with a
-space between the Euro sign and the number. In this case, it's
-helpful to use the special \i\c{\\.} command, which is defined to
-\I{NOP}\I{doing nothing}do nothing at all! But it acts as a
+space between the Euro sign and the number. (If you had written
+\c{\\eur2500}, Halibut would have tried to interpret it as a macro
+command called \c{eur2500}, which you didn't define.) In this case,
+it's helpful to use the special \i\c{\\.} command, which is defined
+to \I{NOP}\I{doing nothing}do nothing at all! But it acts as a
 separator between your macro and the next character:
 
 \c This is likely to cost \eur\.2500 at least.
 separator between your macro and the next character:
 
 \c This is likely to cost \eur\.2500 at least.