summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/misc209/portland.sty
blob: 56ebf455e88b93cbc7085a324f023e1695c28c0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
% 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