

% landscape.sty
% Easily Modifiable landscape page layout.
% Provides the macros:
%
%   \setleftmargin{left margin}{rightward shift on odd pages}
%   \setrightmargin{right margin}{leftward shift on even pages}
%   \setheadmargin{top margin}{header height}{header separation}
%   \setfootmargin{bottom margin}{footer height}{footer separation}
%   \setmarginnote{margin note width}{margin note separation}
% 
% AJCD  22/2/91  Changed from a4.sty
% MN941130      Changed from a5.sty
%
\typeout{landscape.sty 31-Nov-94}
\typeout{You must use `dvips -t landscape -t a4' or equiv. for correct output.}

% Better use: dvips -t landscape -t a4
%\typeout{Works only together with PostScript!}
%\special{papersize=29.7cm,21cm}
%\special{! /landplus90 true store}

\@ifundefined{footheight}{\newskip\footheight}{}

\newlength{\p@perwidth}
\setlength{\p@perwidth}{29.7 true cm} % a4 paper width
\newlength{\p@perlength}
\setlength{\p@perlength}{21 true cm}   % a4 paper height

\setlength{\voffset}{0 true in}        % shift origin to paper corner
\setlength{\hoffset}{0 true in}

% pick up point size of current font
% these parameters are not changed by the macros below
\newlength{\mainsize}
\setlength{\mainsize}{1\@ptsize pt}
\setlength{\topskip}{\mainsize} % plain has 10pt
\setlength{\maxdepth}{.4\mainsize}      % plain has 4pt
\setlength{\@maxdepth}{\maxdepth}       % this has to be set as well

\newlength{\leftsidemargin}
\newlength{\leftsideshift}
\newlength{\rightsidemargin}
\newlength{\rightsideshift}
\newlength{\headsidemargin}
\newlength{\footsidemargin}

\let\resetmargins\relax

\def\setleftmargin#1#2{% set left printer margin and odd page shift
  \setlength{\leftsidemargin}{#1}%
  \setlength{\leftsideshift}{#2}%
  \resetmargins
}
\setleftmargin{0.5 true in}{0 in}

\def\setrightmargin#1#2{% set right printer margin and even page shift
  \setlength{\rightsidemargin}{#1}%
  \setlength{\rightsideshift}{#2}%
  \resetmargins
}
\setrightmargin{0.5 true in}{0 in}

\def\setheadmargin#1#2#3{% set head printer margin, size, and separation
  \setlength{\headsidemargin}{#1}%
  \setlength{\headheight}{#2}%
  \setlength{\headsep}{#3}%
  \resetmargins
}
\setheadmargin{0.4 true in}{\mainsize}{1.5\mainsize}

\def\setfootmargin#1#2#3{% set foot printer margin, size, and separation
  \setlength{\footsidemargin}{#1}%
  \setlength{\footheight}{#2}%
  \setlength{\footskip}{#3}%
  \addtolength{\footskip}{\footheight}%
  \resetmargins
}
\setfootmargin{0.5 true in}{\mainsize}{1.5\mainsize}

\def\setmarginnote#1#2{% set marginal note width and separation
  \setlength{\marginparwidth}{#1}%
  \setlength{\marginparsep}{#2}%
  \resetmargins
}
\setmarginnote{0pt}{0pt}

\def\resetmargins{% reset textheight and length from parameters
  \setlength{\oddsidemargin}{\leftsidemargin}%
  \addtolength{\oddsidemargin}{-1 true in}%
  \addtolength{\oddsidemargin}{\leftsideshift}%
  \setlength{\evensidemargin}{\oddsidemargin}%
  \addtolength{\evensidemargin}{-\rightsideshift}%
  \setlength{\textwidth}{\p@perwidth}% start at full width
  \addtolength{\textwidth}{-\leftsidemargin}%
  \addtolength{\textwidth}{-\leftsideshift}%
  \addtolength{\textwidth}{-\marginparwidth}%
  \addtolength{\textwidth}{-\marginparsep}%
  \addtolength{\textwidth}{-\rightsidemargin}%
  \setlength{\topmargin}{\headsidemargin}%
  \addtolength{\topmargin}{-1 true in}%
  \setlength{\textheight}{\p@perlength}% start at full height
  \addtolength{\textheight}{-\headsidemargin}%
  \addtolength{\textheight}{-\headheight}%
  \addtolength{\textheight}{-\headsep}%
  \addtolength{\textheight}{-\footskip}%
  \addtolength{\textheight}{-\footsidemargin}%
}
\resetmargins
