summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-wrongpn.html
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-wrongpn.html')
-rw-r--r--Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-wrongpn.html39
1 files changed, 39 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-wrongpn.html b/Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-wrongpn.html
new file mode 100644
index 00000000000..9acc7076e44
--- /dev/null
+++ b/Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-wrongpn.html
@@ -0,0 +1,39 @@
+<head>
+<title>UK TeX FAQ -- question label wrongpn</title>
+</head><body>
+<h3>Page number is wrong at start of page</h3>
+<p/>This is a long story, whose sources are deep inside the workings of
+TeX itself; it all derives from the TeX&rsquo;s striving to generate
+the best possible output.
+<p/>The page number is conventionally stored in <code>\</code><code>count0</code>; LaTeX
+users see this as the counter <code>page</code>, and may typeset its value
+using <code>\</code><code>thepage</code>.
+<p/>The number (that is to say, <code>\</code><code>count0</code>) is only updated when TeX
+actually outputs a page. TeX only even tries to do this when it
+detects a hint that it may be a good thing to do. From TeX&rsquo;s point
+of view, the end of a paragraph is a good time to consider outputting
+a page; it will output a page if it has <em>more</em> than a page&rsquo;s
+worth of material to output. (Ensuring it always has something in
+hand makes some optimisations possible.) As a result, <code>\</code><code>count0</code>
+(<code>\</code><code>thepage</code>) is almost always wrong in the first paragraph of a
+page (the exception is where the page number has been &ldquo;forcibly&rdquo;
+changed, either by changing its value directly, or by breaking the
+page where TeX wouldn&rsquo;t necessarily have chosen to break).
+<p/>LaTeX provides a safe way of referring to the page number, by using
+label references. So, rather than writing:
+<blockquote>
+<pre>
+Here is page \thepage{}.
+</pre>
+</blockquote><p>
+you should write:
+<blockquote>
+<pre>
+Here is page \pageref{here}\label{here}.
+</pre>
+</blockquote><p>
+(note: no space between the <code>\</code><code>pageref</code> and the <code>\</code><code>label</code>, since
+that could potentially end up as a page-break space itself, which
+rather defeats the purpose of the exercise!).
+<p/><p>This question on the Web: <a href="http://www.tex.ac.uk/cgi-bin/texfaq2html?label=wrongpn">http://www.tex.ac.uk/cgi-bin/texfaq2html?label=wrongpn</a>
+</body>