diff options
Diffstat (limited to 'Master/texmf-doc/doc/english/FAQ-en/html/FAQ-wrongpn.html')
-rw-r--r-- | Master/texmf-doc/doc/english/FAQ-en/html/FAQ-wrongpn.html | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/Master/texmf-doc/doc/english/FAQ-en/html/FAQ-wrongpn.html b/Master/texmf-doc/doc/english/FAQ-en/html/FAQ-wrongpn.html new file mode 100644 index 00000000000..6e6a7177610 --- /dev/null +++ b/Master/texmf-doc/doc/english/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'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 set 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'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'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 "forcibly" +changed, either by changing its value directly, or by breaking the +page where TeX wouldn'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> +you should write: +<blockquote> +<pre> +Here is page \pageref{here}\label{here}. +</pre> +</blockquote> +(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><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> |