summaryrefslogtreecommitdiff
path: root/language/japanese/plautopatch/pxstfloats.sty
blob: 95769fc0c49a0183417575fd1a4b753859c4da3a (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
%
% pxstfloats.sty
% written by Hironobu Yamashita (@aminophen)
%
% This package is actually part of the pxsttools bundle, but
% for now distributed as part of the plautopatch bundle.
% https://github.com/aminophen/plautopatch
%
% This package is expected to be compatible with
%   * stfloats.sty in sttools
%     (2012/05/29 v1.1 -- 2017/03/27 v3.3)
%   * plcore.ltx in platex
%     (2001/09/26 v1.2a -- 2021/03/25 v1.3i)
% Many thanks to lltjp-stfloats.sty in LuaTeX-ja project.
%

\NeedsTeXFormat{pLaTeX2e}
\ProvidesPackage{pxstfloats}
  [2021/05/24 v0.2a stfloats package for pLaTeX]
\RequirePackage{stfloats}

\ifx\pltx@adjust@wd@outputbox\@undefined
  % pLaTeX2e <2020-10-01>+2 or older
  \ifx\pdfprimitive\@undefined % just in case ...
    \def\pltx@adjust@wd@outputbox{%
      \ifydir\else\vbox{\hskip\z@}\fi}
  \else                        % same as plcore.dtx 2021/03/25 v1.3i
    \def\pltx@adjust@wd@outputbox{%
      \ifydir\else\vbox{\pdfprimitive\everypar{}\hskip\z@}\fi}
  \fi
\fi

%% mostly based on \fn@makecol in stfloats.sty, and
%% the additions for supporting pLaTeX are based on
%% pLaTeX2e 2021-06-01 community ed.
%% the code is essentially compatible with
%%   fnpos.sty (yafoot) 1999/07/14 v1.0
%%   |\makeFNmid| + |\makeFNbelow| status.
\gdef\pxstfl@fnbelowfl@makecol{%
    \setbox\@outputbox \box\@cclv
    \let\@elt\relax
    \xdef\@freelist{\@freelist\@midlist}%
    \global \let \@midlist \@empty
    \@combinefloats
    \ifvoid\footins
    \else
        \setbox\@outputbox \vbox {%
            \boxmaxdepth \@maxdepth
            \unvbox \@outputbox
            \vskip \skip\footins
            \color@begingroup
                \normalcolor
                \footnoterule
                \unvbox \footins
            \color@endgroup
            }%
    \fi
    \ifvbox\@kludgeins
        \@makespecialcolbox
    \else
        \setbox\@outputbox \vbox to\@colht {%
            \@texttop
            \dimen@ \dp\@outputbox
            \unvbox \@outputbox
            \pltx@adjust@wd@outputbox %% for pLaTeX
            \vskip -\dimen@
            \@textbottom
            }%
    \fi
    \global \maxdepth \@maxdepth
}

%% mostly based on \@makecol in latex.ltx, and
%% the additions for supporting pLaTeX are based on
%% pLaTeX2e 2021-06-01 community ed.
%% the code is essentially compatible with
%%   fnpos.sty (yafoot) 1999/07/14 v1.0
%%   |\makeFNmid| + |\makeFNabove| status.
\gdef\pxstfl@fnabovefl@makecol {%
   \ifvoid\footins
     \setbox\@outputbox \box\@cclv
   \else
     \setbox\@outputbox \vbox {%
       \boxmaxdepth \@maxdepth
       \unvbox \@cclv
       \vskip \skip\footins
       \color@begingroup
         \normalcolor
         \footnoterule
         \unvbox \footins
       \color@endgroup
       }%
   \fi
   \let\@elt\relax
   \xdef\@freelist{\@freelist\@midlist}%
   \global \let \@midlist \@empty
   \@combinefloats
   \ifvbox\@kludgeins
     \@makespecialcolbox
   \else
     \setbox\@outputbox \vbox to\@colht {%
       \@texttop
       \dimen@ \dp\@outputbox
       \unvbox \@outputbox
       \pltx@adjust@wd@outputbox %% for pLaTeX
       \vskip -\dimen@
       \@textbottom
       }%
   \fi
   \global \maxdepth \@maxdepth
}

%% the definition \fnunderfloat is unnecessary, as stfloats.sty
%% has already defined it. others should be re-declared here
\def\fnbelowfloat{\global\let\@makecol\pxstfl@fnbelowfl@makecol}
\def\fnabovefloat{\global\let\@makecol\pxstfl@fnabovefl@makecol}

%% all done

\endinput