Changes

Jump to navigation Jump to search
2,661 bytes added ,  13:13, 3 April 2006
An addition clarifying textcommand, deeptextcommand and textstyle.
A new header <cmd>myheader</cmd> is defined and it inherits the properties of <cmd>section</cmd> (title, subject, whatever).
You can "define" several headers at once!
 
==Formatting Titles with <cmd>setuphead</cmd>==
 
<cmd>setuphead</cmd> accepts a number of parameters which change the style of the heading. At least the following commands are available:
 
<table>
<tr bgcolor="#CCCCCC"><th>text</th><th>number</th></tr>
<tr><td><tt>textstyle</tt></td><td><tt>numberstyle</tt></td></tr>
<tr><td><tt>textcommand</tt></td><td><tt>numbercommand</tt></td></tr>
<tr><td><tt>deeptextcommand</tt></td><td><tt>deepnumbercommand</tt></td></tr>
</table>
 
Quite obviously, the number-commands work on the chapter/section/etc. number, their text counterparts change the text itself. However, there are differences between <tt>style</tt>, <tt>command</tt> and <tt>deepcommand</tt>.
 
The <tt>style</tt> variants accept a style (<tt>bold</tt>, <tt>cap</tt>, etc.) or a font switch (<cmd>em</cmd>, <cmd>tfx</cmd>, etc). <tt>texstyle</tt> prepends the text with the associated style. <tt>textcommand</tt> is a command name which is given the text (with all markup) as a parameter. <tt>deeptextcommand</tt> is similar to <tt>textcommand</tt> but it acts only on the text (not on the markup).
 
So, if we have <cmd>title{A story}</cmd>, the different parameters have the following results:
 
<table>
<tr><td><tt>textstyle=\em</tt></td><td><tt>=></tt></td><td><tt>\em A story</tt></td></tr>
<tr><td><tt>textstyle=\em, textcommand=\uppercase</tt></td><td><tt>=></tt></td><td><tt>\uppercase{\em A story}</tt></td><td><tt>=></tt></td><td><tt>\em A STORY</tt></td></tr>
<tr><td><tt>textstyle=\em, deeptextcommand=\uppercase</tt></td><td><tt>=></tt></td><td><tt>\em\uppercase{A story}</tt></td><td><tt>=></tt></td><td><tt>\em A STORY</tt></td></tr>
</table>
 
What is the difference between <tt>textcommand</tt> and <tt>deeptextcommand</tt>, then? With this example there is very little difference, as <tt>uppercase</tt> knows how to handle markup. Sometimes this is not the case. For example, an almost similar command <tt>WORD</tt> is not compatible with <tt>textcommand</tt>, because it wreaks havoc with markup:
 
<table>
<tr><td><tt>textstyle=\em, textcommand=\WORD</tt></td><td><tt>=></tt></td><td><tt>\WORD{\em A story}</tt></td><td><tt>=></tt></td><td><tt>\EM A STORY</tt></td></tr>
<tr><td><tt>textstyle=\em, deeptextcommand=\WORD</tt></td><td><tt>=></tt></td><td><tt>\em\WORD{A story}</tt></td><td><tt>=></tt></td><td><tt>\em A STORY</tt></td></tr>
</table>
 
In this case using <tt>deeptextcommand</tt> is the correct solution for capitalizing headers. (Using <cmd>uppercase</cmd> works in this specific case, but only if you stick to Latin 1 or Anglo-Saxon characters. Other languages will suffer from lowercase accented characters, like CAFé.)
 
==Table(s) of Contents==
Anonymous user

Navigation menu