summaryrefslogtreecommitdiff
path: root/Master/texmf-doc/doc/english/FAQ-en/html/FAQ-the-commands.html
blob: 4525754246eb6af5867b557df5bfdd6feb20c0fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<head>
<title>UK TeX FAQ -- question label the-commands</title>
</head><body>
<h3>Redefining counters&rsquo; <code>\</code><code>the-</code>commands</h3>
<p>Whenever you request a new LaTeX counter, LaTeX creates a bunch
of behind-the-scenes commands, as well as definining the counter
itself.
<p>Among other things, <code>\</code><code>newcounter{</code><em>fred</em><code>}</code> creates a command
<code>\</code><code>the</code><code><em>fred</em></code>, which expands to &ldquo;the value of
<code><em>fred</em></code>&rdquo; when you&rsquo;re typesetting.
<p>The definition of <code>\</code><code>the</code><code><em>fred</em></code> should express the
value of the counter: it is almost always always a mistake to use the
command to produce anything else.  The value may reasonably be
expressed as an arabic, a roman or a greek number, as an alphabetic
expression, or even as a sequence (or pattern of) symbols.  If you
need a decision process on whether to re-define
<code>\</code><code>the</code><code><em>fred</em></code>, consider what might happen when you do
so.
<p>So, for example, if you want your section numbers to be terminated by
a period, you could make <code>\</code><code>thesection</code> expand with a terminating
period.  However, such a change to <code>\</code><code>thesection</code> makes the
definition of <code>\</code><code>thesubsection</code> look distinctly odd: you are going to
find yourself redefining things left, right and centre.  Rather, use
the standard techniques for 
<a href="FAQ-seccntfmt.html">adjusting the presentation of section numbers</a>. 
<p>Or, suppose you want the page number to appear at the bottom of each
page surrounded by dashes (&ldquo;<code>-</code><code>- nnn -</code><code>-</code>&rdquo;). Would you want to
achieve this by redefining <code>\</code><code>thepage</code>, given the likely appearance
of the table of contents with the dashes attached every page number,
or of the modified <code>\</code><code>pageref</code> references.  In this case, the
modification is best done by redefining the page style itself, perhaps
<a href="FAQ-fancyhdr.html">package <i>fancyhdr</i></a>.
<p><p><p><p>This question on the Web: <a href="http://www.tex.ac.uk/cgi-bin/texfaq2html?label=the-commands">http://www.tex.ac.uk/cgi-bin/texfaq2html?label=the-commands</a>
</body>