% usa.sty
%
%  MODIFIED (Rather clumsily) by KAH to use 8 1/2 by 11 inch USA paper
%  in as close to A4 style as possible.
%
%  Hacked even further to squeeze that bit more onto a page.  (KAH, October 94)
%
%
% Easily Modifiable a4 page layout. Use this instead of a4 document substyle.
% 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}
% 
% Defaults to same size as old a4.sty
%
% AJCD, 5/12/89
% AJCD  2/2/90   Changed default size to [a4,fullpage] (1" margins all round)
% AJCD  22/2/91  Changed default size original a4.sty
% AJCD  9/10/91  Added \endinput in case loaded twice
%
\@ifundefined{resetmargins}{}{\endinput}

\typeout{ken.sty 16/10/94}

\newlength{\p@perwidth}
\setlength{\p@perwidth}{21.5 true cm}     % paper width
\newlength{\p@perlength}
\setlength{\p@perlength}{27.8 true cm}  %  paper height

\setlength{\voffset}{0 true in}        % shift origin to paper corner
\setlength{\hoffset}{0.5 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.0 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.5 true in}{\mainsize}{2\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{62 pt}{10pt}
\setmarginnote{62.27 true pt}{10 true pt}

\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



