Plan 9 from Bell Labs’s /usr/web/sources/contrib/steve/root/sys/lib/texmf/tex/latex/misc/portland.sty

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


% This is PORTLAND.STY by H.Partl, TU Wien, as of 16 Dec 1988.
% Definition of commands and environments \portrait and \landscape
% for switching between PORTRAIT and LANDSCAPE printing. To be
% called as document style option with any available style.
%
% Commands:
% \portrait   sets or resets the page layout to the initial values
%             (i.e. the values valid at \begin{document})
% \landscape  sets the page layout such that the horizontal and
%             vertical measures are interchanged with respect to
%             the initial values. The text area will occupy the
%             same position on the page as in \portrait mode.
% Both command issue a \clearpage before changing the layout.
%
% Environments:
% \begin{portrait}  ...  \end{portrait}
% \begin{landscape} ...  \end{landscape}
% Both issue \clearpage at the \begin and at the \end.
%
% Implementation Dependencies:
% You should insert the correct paper height (11in or 197mm or ...)
% into \paperheight for correct positioning.
% If your printer driver allows mixing of protrait and landscape pages
% within one printout, you should insert the corresponding \special
% commands just after the four \clearpage commands.
% If your printer only allows printing of the whole document either in
% protrait or in landscape orientation, you should print the document
% twice (or selected parts of it) - once in portrait and once in landscape -
% and then merge the correct pages.
% If your printer can't print in landscape orientation, then these commands
% can be used only for small pages that fit onto the paper in both direc-
% tions.
     
\newdimen \paperheight  % needed for calculation of bottom margin.
\paperheight 297mm      % <--- 11in for US paper or 297mm for A4 paper!
     
\newdimen\phoffset
\newdimen\pvoffset
\newdimen\ptextwidth
\newdimen\ptextheight
\newdimen\ptopmargin
\newdimen\poddsidemargin
\newdimen\pevensidemargin
     
\newdimen\lhoffset
\newdimen\lvoffset
\newdimen\ltextwidth
\newdimen\ltextheight
\newdimen\ltopmargin
\newdimen\loddsidemargin
\newdimen\levensidemargin
     
\def\set@portland@values{%
%   portrait values = current values
\phoffset\hoffset
\pvoffset\voffset
\ptextwidth\textwidth
\ptextheight\textheight
\ptopmargin\topmargin
\poddsidemargin\oddsidemargin
\pevensidemargin\evensidemargin
%   landscape margins will be measured from zero point
\lhoffset \z@
\lvoffset \z@
%   landscape textwidth = portrait textheight
\ltextwidth \ptextheight
%   landscape textheight = portrait textwidth
\ltextheight \ptextwidth
%   landscape left margin = portrait bottom margin (same for odd and even)
\loddsidemargin \paperheight
\advance \loddsidemargin by -\ptextheight
\advance \loddsidemargin by -\headsep
\advance \loddsidemargin by -\headheight
\advance \loddsidemargin by -\ptopmargin
\advance \loddsidemargin by -\pvoffset
\advance \loddsidemargin by -2in
\levensidemargin \loddsidemargin
%   landscape top margin (incl. head) = portrait oddside left margin
\ltopmargin \poddsidemargin
\advance \ltopmargin by -\headheight
\advance \ltopmargin by -\headsep
\advance \ltopmargin by \phoffset
}
     
\def\portrait{\clearpage \message{ \string\portrait }%
    \hoffset\phoffset
    \voffset\pvoffset
    \textwidth\ptextwidth
    \textheight\ptextheight
         \@colht\textheight  \@colroom\textheight \vsize\textheight
         \columnwidth\textwidth \@clubpenalty\clubpenalty
         \if@twocolumn \advance\columnwidth -\columnsep
         \divide\columnwidth\tw@ \hsize\columnwidth \@firstcolumntrue
         \fi
         \hsize\columnwidth \linewidth\hsize
    \topmargin\ptopmargin
    \oddsidemargin\poddsidemargin
    \evensidemargin\pevensidemargin
    }
     
\def\endportrait{\clearpage \message{ \string\endportrait }}
     
\def\landscape{\clearpage \message{ \string\landscape }%
    \hoffset\lhoffset
    \voffset\lvoffset
    \textwidth\ltextwidth
    \textheight\ltextheight
         \@colht\textheight  \@colroom\textheight \vsize\textheight
         \columnwidth\textwidth \@clubpenalty\clubpenalty
         \if@twocolumn \advance\columnwidth -\columnsep
         \divide\columnwidth\tw@ \hsize\columnwidth \@firstcolumntrue
         \fi
         \hsize\columnwidth \linewidth\hsize
    \topmargin\ltopmargin
    \oddsidemargin\loddsidemargin
    \evensidemargin\levensidemargin
    }
     
\def\endlandscape{\clearpage \message{ \string\endlandscape }}
     
\let\set@document@values \document
\def\document{\set@document@values \set@portland@values}
     
\endinput

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].