TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Here is the code, that demonstrates the problem:



current page = \thepage


All text in minipage appears on the second page (this is the desired behavior), but I get 'current page = 1' on the second page. Why?

share|improve this question
up vote 7 down vote accepted

This is due to the asynchronous page breaking of TeX. \thepage in the document body is not reliable. Use it only in headers and footers. In the document body use \label{A}\pageref{A}.

share|improve this answer
I've been wondering ... do you mark code according to a specific pattern? Do you mind if your posts are edited to format all code as code? – doncherry Sep 21 '11 at 13:51
Well I'm trying to mark all commands but sometimes I overlook one (like I overlook typing errors). I don't mind if someone correct them but I also don't think it is really necessary when there is no danger of misunderstanding. – Ulrike Fischer Sep 21 '11 at 13:56

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.