# why minipage environment prevents \thepage counter update?

Here is the code, that demonstrates the problem:

\documentclass{article}
\usepackage{lipsum}
\usepackage[a4paper]{geometry}

\begin{document}

\lipsum[1-6]
\begin{minipage}{\textwidth}
\lipsum[7]
\end{minipage}
current page = \thepage

\end{document}


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?

-

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}.

-
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