wtorek, 28 lutego 2012

Titlepage resets the page count

I was not aware that \titlepage command resets page counter. Have no idea why LaTeX works this way but in result \setcounter{page} is ignored no matter where one inserts it in the source code.

It somehow works if \setounter{page} is executed after \begin{titlepage}... (or \maketitle which uses titlepage) but page number for titlepage is always 1.

Worse: definitely LaTeX would be more user-friendly if it would write such brute actions as page counter resets to log file.

Simple fix is to redefine titlepage environment. For example below is a simplified titlepage environment from article.cls:


\renewenvironment{titlepage}
{%
\if@twocolumn
\@restonecoltrue\onecolumn
\else
\@restonecolfalse\newpage
\fi
\thispagestyle{empty}%
%%\setcounter{page}\z@
}%
{\if@restonecol\twocolumn \else \newpage \fi
}

The unwanted \setcounter was commented-out in the code above.

Brak komentarzy:

Prześlij komentarz