summaryrefslogtreecommitdiff
path: root/macros/latex-dev/required/graphics/lscape.dtx
blob: e14462c9d4216690fd538e922fdfb20d66bfff56 (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
125
126
127
128
129
130
131
132
133
134
135
%
% \iffalse
%
%% lscape.dtx Copyright (C) 1994 1999-2000 David Carlisle
%%            Copyright (C) 2000-2020 David Carlisle, LaTeX3 Project
%%
%% This file is part of the Standard LaTeX `Graphics Bundle'.
%% It may be distributed under the terms of the LaTeX Project Public
%% License, as described in lppl.txt in the base LaTeX distribution.
%% Either version 1.3c or, at your option, any later version.
%%
%<*dtx>
          \ProvidesFile{lscape.dtx}
%</dtx>
%<package>\NeedsTeXFormat{LaTeX2e}[1994/06/01]
%<package>\ProvidesPackage{lscape}
%<driver> \ProvidesFile{lscape.drv}
% \fi
%         \ProvidesFile{lscape.dtx}
          [2000/10/22 v3.01 Landscape Pages (DPC)]
%
% \iffalse
%<*driver>
\documentclass{ltxdoc}
\usepackage{lscape}
\begin{document}
 \DocInput{lscape.dtx}
\end{document}
%</driver>
% \fi
%
% \GetFileInfo{lscape.dtx}
%
% \title{The \textsf{lscape} package\thanks{This file
%        has version number \fileversion, last
%        revised \filedate.}}
% \author{D. P. Carlisle}
% \date{\filedate}
%
%
% \begin{landscape}
% \MaintainedByLaTeXTeam{graphics}
% \maketitle
%
% All text, within the \texttt{landscape} environment is rotated through
% 90 degrees. The environment may span several pages. It works well
% with, and was originally created for, use with \textsf{longtable} to
% produce long wide tables.
%
% All the work is done by the \textsf{graphics} package, the trick is to
% call it at the right place in the output routine to rotate the current
% page before the page head and foot are added.
%
%
% \StopEventually{\end{landscape}}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \changes{v1.00}{1992/04/28}{Initial release}
% \changes{v2.00}{1992/11/18}{Support for footnotes and floats.
%         Special thanks to Sarah J. McQuay for testing this release}
% \changes{v3.00}{1994/10/05}{Update using LaTeX2e graphics package}
% \changes{v3.01}{1999/06/22}{Added better pdfTeX support
%    by Scott Pakin, from graphics/3063}
%
%
%    \begin{macrocode}
%<*package>
%    \end{macrocode}
%  Here is what Scott Pakin wrote about the pdftex option:
% \begin{quote}
%    I've made a minor improvement to lscape.dtx that I'd like to share
% with the world.  My addition makes lscape rotate the PDF "paper" --
% not just the text on the page -- when given the "pdftex" option.
% (Naturally, this works only with pdfLaTeX.)  The result is that the
% text is viewable online without the reader having to rotate his/her
% head 90 degrees.  The document still prints normally.
% \end{quote}
%
%
%    \begin{macrocode}
\newif\ifGin@pdftex
\Gin@pdftexfalse
\DeclareOption{pdftex}{%
  \PassOptionsToPackage\CurrentOption{graphics}
  \Gin@pdftextrue
}
\DeclareOption*{\PassOptionsToPackage\CurrentOption{graphics}}
\ProcessOptions
\RequirePackage{graphics}
%    \end{macrocode}
%
%    \begin{macrocode}
\let\LS@makecol=\@makecol
\let\LS@makefcolumn=\@makefcolumn
\def\LS@rot{%
  \setbox\@outputbox\vbox{\hbox{\rotatebox{90}{\box\@outputbox}}}}
%    \end{macrocode}
%
% First set up the page size for landscape.
%    \begin{macrocode}
\def\landscape{%
  \clearpage
  \begingroup
  \vsize=\textwidth
  \hsize=\textheight
  \linewidth=\hsize
  \columnwidth=\hsize
  \@colroom=\vsize
  \textheight=\vsize
  \@colht=\vsize
%    \end{macrocode}
%    Rotate the page body (text and float pages).
%    \begin{macrocode}
  \def\@makecol{\LS@makecol\LS@rot}%
  \def\@makefcolumn##1{\LS@makefcolumn{##1}\LS@rot}}
%    \end{macrocode}
%
%    Restore everything.  This is where the pdftex option makes a
%    difference.
%    \begin{macrocode}
\def\endlandscape{%
  \ifGin@pdftex
    \pdfpageattr{/Rotate 90}
  \fi
  \clearpage
  \endgroup
  \global\@colht=\textheight
  \global\vsize=\textheight
  \global\@colroom=\textheight}
%</package>
%    \end{macrocode}
%
%
% \Finale
%