[Tex/LaTex] change title page margins ONLY without packages

marginspackage-writingtitles

I am trying to prepare a package for students that offers a uniform standard title page for their work (homework, reports, theses, and probably more).

I have the title page laid out as it should be. However, I am having problems setting the margins. I wish to centre ONLY the title page, without side effects to possible margin settings that the students might have already set up for the rest of their document.

I have seen other solutions such as this one, but they invariably make use of some package like geometry etc. I am seeking a solution that works with plain LaTeX only. The reason is that I do not know what class the title page package ends up in (book, report, memoir, classicthesis, …), and I need something that provides maximum compatibility.

Best Answer

One option would be to borrow the definitions for the \changepage command from the changepage package:

\documentclass{article}
\usepackage{lipsum}

\makeatletter
% Definitions taken from changepage.sty
\begingroup
\catcode`\Q=3
\long\gdef\@ifmtarg#1{\@xifmtarg#1QQ\@secondoftwo\@firstoftwo\@nil}
\long\gdef\@xifmtarg#1#2Q#3#4#5\@nil{#4}
\endgroup

% Set the page output parameters
\DeclareRobustCommand{\ch@ngetext}{%
  \setlength{\@colht}{\textheight}\setlength{\@colroom}{\textheight}%
  \setlength{\vsize}{\textheight}\setlength{\columnwidth}{\textwidth}%
  \if@twocolumn%
    \advance\columnwidth-\columnsep \divide\columnwidth\tw@%
    \@firstcolumntrue%
  \fi%
  \setlength{\hsize}{\columnwidth}%
  \setlength{\linewidth}{\hsize}}

\DeclareRobustCommand{\changepage}[9]{%
  \@ifmtarg{#1}{}{\addtolength{\textheight}{#1}}%
  \@ifmtarg{#2}{}{\addtolength{\textwidth}{#2}}%
  \@ifmtarg{#3}{}{\addtolength{\evensidemargin}{#3}}%
  \@ifmtarg{#4}{}{\addtolength{\oddsidemargin}{#4}}%
  \@ifmtarg{#5}{}{\addtolength{\columnsep}{#5}}%
  \ch@ngetext%
  \@ifmtarg{#6}{}{\addtolength{\topmargin}{#6}}%
  \@ifmtarg{#7}{}{\addtolength{\headheight}{#7}}%
  \@ifmtarg{#8}{}{\addtolength{\headsep}{#8}}%
  \@ifmtarg{#9}{}{\addtolength{\footskip}{#9}}}
\makeatother
%
%\changepage{<textheight>}{<textwidth>}{<even-side-margin>}{<odd-side-margin>}{<columnsep>}{<topmargin>}{<headheight>}{<headsep>}{<footskip>}  

\begin{document}

\changepage{7cm}{6cm}{-3cm}{-3cm}{}{-3cm}{}{}{}
\lipsum[1-10]
\clearpage
\changepage{-7cm}{-6cm}{3cm}{3cm}{}{3cm}{}{}{}
\lipsum[1-5]
\end{document}

The result:

enter image description here