Debian Codegraph @

texmf-dist/source/latex/sttools/floatpag.dtx

raw
1 % \iffalse meta-comment/*% \end{macrocode}*/
2 %
3 % Copyright (C) 1999-2012 by Vytas Statulevi\v{c}ius <[email protected]>
4 % Copyright (C) 2021 by Sigitas Tolu\v{s}is <[email protected]>
5 % ---------------------------------------------------------------------------
6 % This work may be distributed and/or modified under the
7 % conditions of the LaTeX Project Public License, either version 1.3
8 % of this license or (at your option) any later version.
9 % The latest version of this license is in
10 % http://www.latex-project.org/lppl.txt
11 % and version 1.3 or later is part of all distributions of LaTeX
12 % version 2005/12/01 or later.
13 %
14 % This work has the LPPL maintenance status `maintained'.
15 %
16 % The Current Maintainer of this work is Sigitas Tolu\v{s}is.
17 %
18 % This work consists of the files floatpag.dtx and floatpag.ins
19 % and the derived filebase floatpag.sty.
20 %
21 % \fi
22 %
23 % \iffalse
24 %<*internal>
25 \begingroup
26 %</internal>
27 %<*batchfile>
28 \input docstrip.tex
29 \keepsilent\askforoverwritefalse
30 \preamble
31 %%
32 %% This is file `floatpag.sty',
33 %% generated with the docstrip utility.
34 %%
35 %% The original source files were:
36 %%
37 %% floatpag.dtx (with options: `package')
38 %%
39 \endpreamble
40 \generate{\file{floatpag.sty}{\from{floatpag.dtx}{package}}}
41 %</batchfile>
42 %<batchfile>\endbatchfile
43 %<*internal>
44 \generate{\file{floatpag.ins}{\from{floatpag.dtx}{batchfile}}}
45 \endgroup
46 %</internal>
47 %<*driver>
48 \ProvidesFile{floatpag.dtx}
49 %</driver>
50 %% Copyright (C) 1999-2012 by Vytas Statulevi\v{c}ius <[email protected]>
51 %% Copyright (C) 2021 by Sigitas Tolu\v{s}is <[email protected]>
52 %% UAB VTeX, Mokslininkų 2A, LT-08412 Vilnius, Lithuania
53 %% --------------------------------------------------------------------------
54 %% This work may be distributed and/or modified under the
55 %% conditions of the LaTeX Project Public License, either version 1.3
56 %% of this license or (at your option) any later version.
57 %% The latest version of this license is in
58 %% http://www.latex-project.org/lppl.txt
59 %% and version 1.3 or later is part of all distributions of LaTeX
60 %% version 2005/12/01 or later.
61 %%
62 %% The macros, developed by Sigitas Tolu\v{s}is <[email protected]>,
63 %% were used in this package.
64 %%
65 %% The Current Maintainer of this work is Sigitas Tolu\v{s}is.
66 %%
67 %% PURPOSE: provides commands to apply different pagestyles
68 %% to the full page floats.
69 %%
70 %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
71 %<package>\ProvidesPackage{floatpag}
72 %<*package>
73 [2021/10/04 v2.0 Different pagestyles on float pages]
74
75 %</package>
76 %
77 %<*driver>
78 \documentclass{ltxdoc}
79 \usepackage{floatpag}[2021/10/04]
80 \EnableCrossrefs
81 \CodelineIndex
82 \RecordChanges
83 \begin{document}
84 \DocInput{floatpag.dtx}
85 \PrintChanges
86 \PrintIndex
87 \end{document}
88 %</driver>
89 % \fi
90 %
91 % \CheckSum{216}
92 %
93 % \CharacterTable
94 % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
95 % Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
96 % Digits \0\1\2\3\4\5\6\7\8\9
97 % Exclamation \! Double quote \" Hash (number) \#
98 % Dollar \$ Percent \% Ampersand \&
99 % Acute accent \' Left paren \( Right paren \)
100 % Asterisk \* Plus \+ Comma \,
101 % Minus \- Point \. Solidus \/
102 % Colon \: Semicolon \; Less than \<
103 % Equals \= Greater than \> Question mark \?
104 % Commercial at \@ Left bracket \[ Backslash \\
105 % Right bracket \] Circumflex \^ Underscore \_
106 % Grave accent \` Left brace \{ Vertical bar \|
107 % Right brace \} Tilde \~}
108 %
109 %
110 % \changes{v1.1}{2012/05/29}{Converted to DTX file}
111 % \changes{v2.0}{2021/10/04}{Removed latex209 compatibility; added rotated dblfloat support}
112 %
113 % \DoNotIndex{\newcommand,\newenvironment}
114 %
115 % \providecommand*{\url}{\texttt}
116 % \GetFileInfo{floatpag.dtx}
117 % \title{The \textsf{floatpag} package}
118 % \author{Vytas Statulevi\v{c}ius and Sigitas Tolu\v{s}is \\
119 % \url{[email protected]}, \url{[email protected]}}
120 % \date{\fileversion~from \filedate}
121 %
122 % \maketitle
123 %
124 % \section{Introduction}
125 %
126 % Provides commands to apply different pagestyles to the full page floats.
127 %
128 % \section{Usage}
129 %
130 % \DescribeMacro{\floatpagestyle}
131 % \marg{foo} will apply pagestyle \meta{foo} to all pages
132 % occupied by full page floats.
133 %
134 % \medskip
135 % \DescribeMacro{\rotfloatpagestyle}
136 % \marg{foo} will apply pagestyle \meta{foo} to all pages
137 % occupied by sideways figures and tables
138 % produced with the help of |rotating|
139 % package (Sebastian Rahtz and Leonor Barroca).
140 %
141 % \medskip
142 % \DescribeMacro{\thisfloatpagestyle}
143 % \marg{foo} will apply pagestyle \meta{foo} to a page where
144 % this command was used inside figure or table
145 % environment.
146 %
147 % \medskip
148 % \textbf{Default:} |\floatpagestyle{headings}| and |\rotfloatpagestyle{plain}|.
149 %
150 % \medskip
151 % The following commands from the LaTeX2e kernel were redefined:
152 % |\@xfloat|, |\@vtryfc|.
153 %
154 % \medskip
155 % The following commands from the rotating.sty was redefined:
156 % |\@xrotfloat|, |\@rotxdblfloat|.
157 %
158 % \StopEventually{}
159 %
160 % \section{Implementation}
161 %
162 % \iffalse
163 %<*package>
164 % \fi
165 %
166 % \begin{macro}{\floatpagestyle}
167 % \begin{macrocode}
168 \def\floatpagestyle#1{\gdef\at@float@page{\thispagestyle{#1}}}
169 % \end{macrocode}
170 % \end{macro}
171 %
172 %
173 % \begin{macro}{\rotfloatpagestyle}
174 % \begin{macrocode}
175 \def\rotfloatpagestyle#1{\gdef\@r@f@pagestyle{#1}}
176 % \end{macrocode}
177 % \end{macro}
178 %
179 % \begin{macrocode}
180 \floatpagestyle{headings}
181 \rotfloatpagestyle{plain}
182 % \end{macrocode}
183 %
184 % \begin{macro}{\thisfloatpagestyle}
185 %
186 % \begin{macrocode}
187 \def\thisfloatpagestyle#1{%
188 \global\@namedef{\number\@currbox @float}{\thispagestyle{#1}}\relax
189 }
190 % \end{macrocode}
191 % \end{macro}
192 %
193 %
194 % \begin{macro}{\@xfloat}
195 %
196 %% Modify |\x@float| - ordinary floats
197 %
198 % \begin{macrocode}
199 \def\@xfloat #1[#2]{%
200 \@nodocument
201 \def \@captype {#1}%
202 \def \@fps {#2}%
203 \@onelevel@sanitize \@fps
204 \def \reserved@b {!}%
205 \ifx \reserved@b \@fps
206 \@fpsadddefault
207 \else
208 \ifx \@fps \@empty
209 \@fpsadddefault
210 \fi
211 \fi
212 \ifhmode
213 \@bsphack
214 \@floatpenalty -\@Mii
215 \else
216 \@floatpenalty-\@Miii
217 \fi
218 \ifinner
219 \@parmoderr\@floatpenalty\z@
220 \else
221 \@next\@currbox\@freelist
222 {%
223 \@tempcnta \sixt@@n
224 \expandafter \@tfor \expandafter \reserved@a
225 \expandafter :\expandafter =\@fps
226 \do
227 {%
228 \if \reserved@a h%
229 \ifodd \@tempcnta
230 \else
231 \advance \@tempcnta \@ne
232 \fi
233 \else\if \reserved@a t%
234 \@setfpsbit \tw@
235 \else\if \reserved@a b%
236 \@setfpsbit 4%
237 \else\if \reserved@a p%
238 \@setfpsbit 8%
239 \else\if \reserved@a !%
240 \ifnum \@tempcnta>15
241 \advance\@tempcnta -\sixt@@n\relax
242 \fi
243 \else
244 \@latex@error{Unknown float option `\reserved@a'}%
245 {Option `\reserved@a' ignored and `p' used.}%
246 \@setfpsbit 8%
247 \fi\fi\fi\fi\fi
248 }%
249 \@tempcntb \csname ftype@\@captype \endcsname
250 \multiply \@tempcntb \@xxxii
251 \advance \@tempcnta \@tempcntb
252 \global \count\@currbox \@tempcnta
253 \global\@namedef{\number\@currbox @float}{\at@float@page}\relax
254 }%
255 \@fltovf
256 \fi
257 \global \setbox\@currbox
258 \color@vbox
259 \normalcolor
260 \vbox \bgroup
261 \hsize\columnwidth
262 \@parboxrestore
263 \@floatboxreset
264 }
265 % \end{macrocode}
266 % \end{macro}
267 %
268 %
269 % \begin{macro}{\floatpag@@xrotfloat}
270 %
271 % rotating.sty v. $>$2.10:
272 % \begin{macrocode}
273 \def\floatpag@@xrotfloat#1[#2]{%
274 \@float{#1}[#2]%
275 \thisfloatpagestyle{\@r@f@pagestyle}%
276 \begin{lrbox}\rot@float@box
277 \begin{minipage}\textheight
278 }
279 % \end{macrocode}
280 % \end{macro}
281 %
282 %
283 % \begin{macro}{\floatpag@@rotxdblfloat}
284 %
285 % rotating.sty v. $>$2.10:
286 % \begin{macrocode}
287 \def\floatpag@@rotxdblfloat#1[#2]{%
288 \@float{#1}[#2]%
289 \thisfloatpagestyle{\@r@f@pagestyle}%
290 \hsize\textwidth\linewidth\textwidth
291 \begin{lrbox}\rot@float@box
292 \begin{minipage}\textheight
293 }
294 % \end{macrocode}
295 % \end{macro}
296 %
297 %
298 % \begin{macrocode}
299 \AtBeginDocument{%
300 \let\@xrotfloat\floatpag@@xrotfloat
301 \let\@rotxdblfloat\floatpag@@rotxdblfloat
302 }%
303 % \end{macrocode}
304 %
305 %
306 % \begin{macro}{\spec@float}
307 %
308 %% "Hook" in the output procedure.
309 % \begin{macrocode}
310 \def\spec@float#1{%
311 \@nameuse{\number#1@float}%
312 \global\@namedef{\number#1@float}{}%
313 }
314 % \end{macrocode}
315 % \end{macro}
316 %
317 %
318 % \begin{macro}{\@vtryfc}
319 % \begin{macrocode}
320 \def\@vtryfc#1{%
321 \global\setbox\@outputbox\vbox{}%
322 \let\@elt\@wtryfc
323 \@flsucceed
324 \let\@elt\spec@float
325 \@flsucceed
326 \global\setbox\@outputbox \vbox to\@colht{%
327 \vskip \@fptop
328 \vskip -\@fpsep
329 \unvbox \@outputbox
330 \vskip \@fpbot
331 }%
332 \let\@elt\relax
333 \xdef#1{\@failedlist\@flfail}%
334 \xdef\@freelist{\@freelist\@flsucceed}%
335 }
336 % \end{macrocode}
337 % \end{macro}
338 %
339 % \begin{macrocode}
340 %\endinput
341 % \end{macrocode}
342 %
343 % \iffalse
344 %</package>
345 % \fi
346 %
347 % \Finale