summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/dpfloat/dpfloat.sty
blob: 15eea00940d3e4ad48c29a2764815f70128e37dc (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
%  ========================================================================
%
%  Copyright (c) 2006 The University of Washington
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% This work has the LPPL maintenance status `maintained'.
% 
% The Current Maintainer of this work is Jim Fox, fox@washington.edu
%
%  ========================================================================
%
%
% double-page float package
%
% Jim Fox
% fox@washington.edu
% http://staff.washington.edu/fox/
%

%
% Version history
%
% 2006/10/05: fix footer placement (suggestion by Mark Henning (mh@homolog.de)
% 1997/09/21: original


\ProvidesPackage{dpfloat}[2006/10/05]
\NeedsTeXFormat{LaTeX2e}
 
%  This package allows you to format a double-page figure or table
% 
%  It provides two environments:
% 
%    {fullpage}      makes a full page figure or table
%    {leftfullpage}  like fullpage, but guarantees a left side page
%
%  Example use:
%   
% -------------------------------------------------------
%      \begin{figure}[p]% will be the left-side figure
%        \begin{leftfullpage}
%          ...
%        \end{leftfullpage}
%      \end{figure}
%      \begin{figure}[p]% will be the right-side figure
%        \begin{fullpage}
%          ...
%        \end{fullpage}
%      \end{figure}
% -------------------------------------------------------
%
%  
%  LaTeX's output routine is modified to reject left-page floats
%  if they appear on odd pages (right page).  These will then
%  be moved to the next page (a left page).
%
%  This is obviously dependent upon specific details of the
%  output routine which are probably subject to change without notice.
%  

\newif\if@LP \@LPfalse

% For each float we define a macro indicating whether or not
% it is 'left-page' only

\newbox\@@wholepage
\def\fullpage{\setbox\@@wholepage=\vbox\bgroup}
\def\endfullpage{\egroup\dp\@@wholepage\z@
   \vbox to\textheight{\vss\unvbox\@@wholepage\vss}}
\def\leftfullpage{\setbox\@@wholepage=\vbox\bgroup}
\def\endleftfullpage{\egroup\dp\@@wholepage\z@
   \vbox to\textheight{\vss\unvbox\@@wholepage\vss}\global\@LPtrue}

\let\oldend@float\end@float
\def\end@float{%
  \if@LP\global\@namedef{LP:\expandafter\string\@currbox}{L}%
  \else \global\@namedef{LP:\expandafter\string\@currbox}{X}%
  \fi
   \global\@LPfalse
  \oldend@float
}

% Reject a left-page float that appears on an even page

\if@twoside

% reject a left-side float that appears on an odd page
 \let\old@xtryfc\@xtryfc
 \def\@xtryfc #1{%
   \expandafter\if\csname LP:\string#1\endcsname L%
      \ifodd\count0\global\@fpmin\maxdimen
          \typeout{dpfloat moved a leftpage float from page \the\count0.}%
      \fi\fi
    \old@xtryfc #1}

\else

% if you want to do something special for one-sided printing
% do it here

\fi

% assure that any remaining floats are printed
\def\@dpf@mtlist{}
\AtEndDocument{\ifx\@deferlist\@dpf@mtlist\else\ifodd\count0\else\typeout{dpfloat added a blank page}\clearpage\ \clearpage\fi\fi}

% end of dpfloat