I'm writing one document with a letterhead which applies only to the first page, so I needs the margins changed, in particular I need to change the \textheight length only for one page of the document: the first.
I have success doing this the "bad" way but I'm trying to do it better (Knuth-compliant way).

I'm doing the following (the bad way):
Code: Select all
\usepackage{changepage}
\begin{document}
\changepage{1.5cm}{}{}{}{}{-1.5cm}{}{}{}
.
THE LETTERHEAD CODE (not important here).
.
.
.
Document text
.
.
.
Here comes the bad thing: somewhere the new page happens, so I need to revert the \changepage command almost exactly after the second page begins:
\changepage{-1.5cm}{}{}{}{}{1.5cm}{}{}{}
.
.
.
What I want? I want something like making a page style definition and calling it with \thispagestyle after document's begins, i.e.:
Code: Select all
\makeatletter
\def\ps@titlepage{
\changepage{1.5cm}{}{}{}{}{-1.5cm}{}{}{}
}
\makeatother
\begin{document}
\thispagestyle{titlepage}
I did search inside latex.ltx format file and I have found that \thispagestyle command defines \@specialstyle to the arg. of \thispagestyle{} and sets \@specialpagetrue which will be checked inside \@outputpage to define the page style only for the current page, I guess this happens after something that doesn't allows changing \textheight variable.
Also I did test the following:
Code: Select all
\def\ps@titlepage
{
\addtolength{\textheight}{1.5cm}%
\addtolength{\topmargin}{-1.5cm}%
\setlength{\@colht}{\textheight}\setlength{\@colroom}{\textheight}%
\setlength{\vsize}{\textheight}%
}
Also, something like \AtBeginNextPage (which doesn't exists) should work the following way:
Code: Select all
\begin{document}
\changepage{1.5cm}{}{}{}{}{-1.5cm}{}{}{}
\AtBeginNextPage{
\changepage{-1.5cm}{}{}{}{}{1.5cm}{}{}{}
}
Thanks!!