Debian Codegraph @

texmf-dist/tex/latex/hvfloat/hvfloat-1.inc

raw
1 %% Herbert Voss <[email protected]>
2 %% Copyright (C) 2026
3 %%
4 %% This program can be redistributed and/or modified under the terms
5 %% of the LaTeX Project Public License Distributed from CTAN archives
6 %% in directory macros/latex/base/lppl.txt.
7 %%
8 %% width=2\paperwidth, height=\paperheight
9 %%
10 %% ||1in+evenside --- |1in+oddside ---||
11 %
12 \def\do@hvFloat@doubleFULLPAGE#1{% image on left and right page with caption before/below/right/after
13 % #1-> 0/1 caption under/right
14 \expandafter\hvFloatSet\expandafter{\hv@save@setting}%
15 \ifx\hv@caption@format\@empty\else\expandafter\captionsetup\expandafter{\hv@caption@format}\fi
16 \ifx\hv@subcaption@format\@empty\else
17 \expandafter
18 \captionsetup\expandafter[\expandafter s\expandafter u\expandafter b\expandafter]\expandafter
19 {\hv@subcaption@format}%
20 \fi
21 \ifx\hvSet@capPos\hv@After \global\hv@@capPos=1
22 \else
23 \ifx\hvSet@capPos\hv@Before \global\hv@@capPos=0
24 \else
25 \global\hv@@capPos=2 % other caption type
26 \fi\fi
27 \let\c@hv@tempCNTfigA\c@figure
28 \let\c@hv@tempCNTtabA\c@table
29 \global\savebox{\hvObjectBox}{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
30 \global\hv@tempWidthA=\dimexpr-\oddsidemargin-1in-\parindent+\hvSet@bindCorrection% the width of the right side offset
31 \global\hv@tempWidthB=\dimexpr\ht\hvCaptionBox+\wd\hvObjectBox+2\hvSet@bindCorrection%
32 \global\hv@leftPageObjectWidth=\dimexpr\paperwidth-\hvSet@bindCorrection%
33 \checkoddpage
34 \ifoddpage
35 \hvfloat@typeout{do@hvFloat@doubleFULLPAGE: oddpage}%
36 \ifcase\hv@@capPos % =0 Caption before
37 \if@twocolumn
38 \if@firstcolumn
39 \ifhv@twoColumnCaption
40 \set@Normal@Bottom@Caption*
41 \afterpage{\do@hvFloat@doubleFULLPAGE@CaptionBefore}%
42 \else
43 \afterpage{\set@Normal@Bottom@Caption\do@hvFloat@doubleFULLPAGE@CaptionBefore}%
44 \fi
45 \else
46 \set@Normal@Bottom@Caption
47 \do@hvFloat@doubleFULLPAGE@CaptionBefore
48 \fi
49 \else
50 \set@Normal@Bottom@Caption
51 \do@hvFloat@doubleFULLPAGE@CaptionBefore
52 \fi
53 \or % =1 Caption after
54 \ifhv@twoColumnCaption
55 \if@firstcolumn
56 \afterpage{\do@hvFloat@doubleFULLPAGE@CaptionAfterTwoCol}%
57 \else
58 \do@hvFloat@doubleFULLPAGE@CaptionAfterTwoCol
59 \fi
60 \else
61 \if@twocolumn
62 \if@firstcolumn
63 \afterpage{\do@hvFloat@doubleFULLPAGE@CaptionAfter}%
64 \else
65 \do@hvFloat@doubleFULLPAGE@CaptionAfter
66 \fi
67 \else
68 \do@hvFloat@doubleFULLPAGE@CaptionAfter
69 \fi
70 \fi
71 \else% \ifcase >1 all other Captions
72 \if@twocolumn
73 \if@firstcolumn
74 \afterpage{\do@hvFloat@doubleFULLPAGE@CaptionOther{#1}}%
75 \else
76 \do@hvFloat@doubleFULLPAGE@CaptionOther{#1}%
77 \fi
78 \else % \if@twocolumn
79 \do@hvFloat@doubleFULLPAGE@CaptionOther{#1}%
80 \fi
81 \fi% \ifcase
82 \else% we have an even page
83 \ifcase\hv@@capPos% Before
84 \if@twocolumn
85 \if@firstcolumn
86 \ifhv@twoColumnCaption
87 \afterpage{\afterpage\set@Normal@Bottom@Caption*\afterpage{\do@hvFloat@doubleFULLPAGE@CaptionBefore{#1}}}%
88 \else
89 \afterpage{\afterpage{\afterpage{\set@Normal@Bottom@Caption\do@hvFloat@doubleFULLPAGE@CaptionBefore{#1}}}}%
90 \fi
91 \else
92 \afterpage{\afterpage{\set@Normal@Bottom@Caption\do@hvFloat@doubleFULLPAGE@CaptionBefore{#1}}}%
93 \fi
94 \else
95 \afterpage{\set@Normal@Bottom@Caption\do@hvFloat@doubleFULLPAGE@CaptionBefore}%
96 \fi
97 \or % capPos after
98 \if@twocolumn
99 \if@firstcolumn
100 \ifhv@twoColumnCaption
101 \afterpage{\afterpage\afterpage{\do@hvFloat@doubleFULLPAGE@CaptionAfterTwoCol{#1}}}%
102 \else
103 \afterpage{\afterpage\afterpage{\do@hvFloat@doubleFULLPAGE@CaptionAfter{#1}}}%
104 \fi
105 \else
106 \ifhv@twoColumnCaption
107 \afterpage{\afterpage{\do@hvFloat@doubleFULLPAGE@CaptionAfterTwoCol{#1}}}%
108 \else
109 \afterpage{\afterpage{\do@hvFloat@doubleFULLPAGE@CaptionAfter{#1}}}%
110 \fi
111 \fi
112 \else
113 \afterpage{\do@hvFloat@doubleFULLPAGE@CaptionAfter}%
114 \fi
115 \else % \ifcase Any other caption
116 \if@twocolumn
117 \if@firstcolumn
118 \afterpage{\afterpage{\afterpage{\do@hvFloat@doubleFULLPAGE@CaptionOther{#1}}}}%
119 \else
120 \afterpage{\afterpage{\do@hvFloat@doubleFULLPAGE@CaptionOther{#1}}}%
121 \fi
122 \else
123 \afterpage{\do@hvFloat@doubleFULLPAGE@CaptionOther{#1}}%
124 \fi
125 \fi% \ifcase
126 \fi% main ifoddpage
127 \endgroup% started at main macro \hvFloat
128 }
129
130 \def\set@Normal@Bottom@Caption{\@ifnextchar*\set@Normal@Bottom@CaptionStar\set@Normal@Bottom@Caption@}
131 \def\set@Normal@Bottom@Caption@{%
132 \let\c@hv@tempCNTfigA\c@figure
133 \let\c@hv@tempCNTtabA\c@table
134 \begin{\hv@floatType}[!b]
135 \expandafter\hvFloatSet\expandafter{\hv@save@setting}%
136 \ifhv@separatorLine\drawSepLine\fi
137 % \expandafter\captionsetup\expandafter{\hv@caption@format}%
138 \ifhv@onlyText
139 \hv@longCap
140 \else
141 \ifx\hv@shortCap\@empty
142 \captionof{\hv@floatType}{\hv@longCap}%
143 \else
144 \captionof{\hv@floatType}[\hv@shortCap]{\hv@longCap}%
145 \fi
146 \fi
147 \ifx\hv@label\@empty\else
148 \expandafter\label\expandafter{\hv@label-cap}
149 \fi
150 \end{\hv@floatType}%
151 }
152 \def\set@Normal@Bottom@CaptionStar*{%
153 \begin{\hv@floatType*}[!b]
154 \expandafter\hvFloatSet\expandafter{\hv@save@setting}%
155 \ifhv@separatorLine\drawSepLine\fi
156 \ifhv@onlyText
157 \hv@longCap
158 \else
159 \ifx\hv@shortCap\@empty
160 \captionof{\hv@floatType}{\hv@longCap}%
161 \else
162 \captionof{\hv@floatType}[\hv@shortCap]{\hv@longCap}%
163 \fi
164 \fi
165 \ifx\hv@label\@empty\else
166 \expandafter\label\expandafter{\hv@label-cap}
167 \fi
168 \end{\hv@floatType*}%
169 }
170
171 \def\do@hvFloat@doubleFULLPAGE@CaptionBefore{%
172 \afterpage{%
173 \hfuzz=\maxdimen
174 \vfuzz=\maxdimen
175 \global\savebox{\hvObjectBox}{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
176 \vspace*{\the\dimexpr-1in-\voffset-\topmargin-\headheight-\headsep-\baselineskip-\parskip+1.5\lineskip}% no interlineskip
177 \hspace*{\the\dimexpr-\evensidemargin-\parindent-1in}%
178 \thispagestyle{empty}%
179 \ifx\hv@floatType\hv@figure
180 \global\refstepcounter{hv@tempCNTfigB}%
181 \else
182 \global\refstepcounter{hv@tempCNTtabB}% before caption
183 \fi
184 \expandafter\label\expandafter{\hv@label}%
185 \clipbox*{0 0 \the\hv@leftPageObjectWidth{} \height}{\usebox\hvObjectBox}%
186 \afterpage{%
187 \if@twocolumn\newpage\null\newpage\fi
188 \global\savebox{\hvObjectBox}{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
189 \thispagestyle{empty}%
190 \vspace*{\the\dimexpr-1in-\voffset-\topmargin-\headheight-\headsep-\baselineskip-\parskip+1.5\lineskip}% -0.5\paperheight+0.5\ht\hvObjectBox
191 \hspace*{\hv@tempWidthA}%
192 \global\savebox{\hvObjectBox}{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
193 \clipbox*{\the\hv@leftPageObjectWidth{} \dp\hvObjectBox{} \wd\hvObjectBox{} \ht\hvObjectBox}{\usebox\hvObjectBox}%
194 \ifx\hv@floatType\hv@figure
195 \global\refstepcounter{hv@tempCNTfigA}%
196 \else
197 \global\refstepcounter{hv@tempCNTtabA}% before caption
198 \fi
199 \expandafter\label\expandafter{\hv@label-2}%
200 \newpage\if@twocolumn\null\newpage\fi
201 }}%
202 }
203
204 \def\do@hvFloat@doubleFULLPAGE@CaptionAfter{%
205 \afterpage{%
206 \hfuzz=\maxdimen
207 \vfuzz=\maxdimen
208 \global\savebox{\hvObjectBox}{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
209 \vspace*{\the\dimexpr-1in-\voffset-\topmargin-\headheight-\headsep-\baselineskip-\parskip+1.5\lineskip}% no interlineskip
210 \hspace*{\the\dimexpr-\evensidemargin-\parindent-1in}%
211 \thispagestyle{empty}%
212 \clipbox*{0 \the\dp\hvObjectBox{} \the\hv@leftPageObjectWidth{} \the\ht\hvObjectBox}{\usebox\hvObjectBox}%
213 \ifx\hv@floatType\hv@figure
214 \refstepcounter{hv@tempCNTfigA}%
215 \else
216 \refstepcounter{hv@tempCNTtabA}% before caption
217 \fi
218 \ifx\hv@label\@empty\else\expandafter\label\expandafter{\hv@label}\fi
219 \newpage\if@twocolumn\null\newpage\fi
220 \global\savebox{\hvObjectBox}{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
221 \thispagestyle{empty}%
222 \vspace*{\the\dimexpr-1in-\voffset-\topmargin-\headheight-\headsep-\baselineskip-\parskip+1.5\lineskip}% -0.5\paperheight+0.5\ht\hvObjectBox
223 \hspace*{\hv@tempWidthA}%
224 \global\savebox{\hvObjectBox}{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
225 \clipbox*{\the\hv@leftPageObjectWidth{} \dp\hvObjectBox{} \wd\hvObjectBox{} \ht\hvObjectBox}{\usebox\hvObjectBox}%
226 \ifx\hv@floatType\hv@figure
227 \refstepcounter{hv@tempCNTfigB}%
228 \else
229 \refstepcounter{hv@tempCNTtabB}% before caption
230 \fi
231 \expandafter\label\expandafter{\hv@label-2}%
232 \newpage\if@twocolumn\null\newpage\fi
233 \begin{\hv@floatType}[!b]
234 \ifhv@separatorLine\drawSepLine\fi
235 % \expandafter\captionsetup\expandafter{\hv@caption@format}%
236 \ifhv@onlyText
237 \hv@longCap
238 \else
239 \ifx\hv@shortCap\@empty
240 \captionof{\hv@floatType}{\hv@longCap}%
241 \else
242 \captionof{\hv@floatType}[\hv@shortCap]{\hv@longCap}%
243 \fi
244 \fi
245 \ifx\hv@label\@empty\else
246 \expandafter\label\expandafter{\hv@label-cap}%
247 \fi
248 \end{\hv@floatType}%
249 }%
250 }
251
252 \def\do@hvFloat@doubleFULLPAGE@CaptionAfterTwoCol{%
253 \afterpage{%
254 \hfuzz=\maxdimen
255 \vfuzz=\maxdimen
256 \let\c@hv@tempCNTfigA\c@figure
257 \let\c@hv@tempCNTtabA\c@table
258 \global\savebox{\hvObjectBox}{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
259 \vspace*{\the\dimexpr-1in-\voffset-\topmargin-\headheight-\headsep-\baselineskip-\parskip+1.5\lineskip}% no interlineskip
260 \hspace*{\the\dimexpr-\evensidemargin-\parindent-1in}%
261 \thispagestyle{empty}%
262 \ifx\hv@floatType\hv@figure
263 \refstepcounter{hv@tempCNTfigA}%
264 \else
265 \refstepcounter{hv@tempCNTtabA}% before caption
266 \fi
267 \ifx\hv@label\@empty\else\label{\hv@label}\fi
268 \clipbox*{0 0 \the\hv@leftPageObjectWidth{} \height}{\usebox\hvObjectBox}%
269 \newpage\if@twocolumn\null\newpage\fi
270 \global\savebox{\hvObjectBox}{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
271 \thispagestyle{empty}%
272 \vspace*{\the\dimexpr-1in-\voffset-\topmargin-\headheight-\headsep-\baselineskip-\parskip+1.5\lineskip}% -0.5\paperheight+0.5\ht\hvObjectBox
273 \hspace*{\hv@tempWidthA}%
274 \global\savebox{\hvObjectBox}{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
275 \clipbox*{\the\hv@leftPageObjectWidth{} \dp\hvObjectBox{} \wd\hvObjectBox{} \ht\hvObjectBox}{\usebox\hvObjectBox}%
276 \ifx\hv@floatType\hv@figure
277 \refstepcounter{hv@tempCNTfigB}%
278 \else
279 \refstepcounter{hv@tempCNTtabB}% before caption
280 \fi
281 \ifx\hv@label\@empty\else\expandafter\label\expandafter{\hv@label-2}\fi
282 \newpage\if@twocolumn\null\newpage\fi
283 \begin{\hv@floatType*}[!b]
284 \hv@twoColumnCaptiontrue
285 \ifhv@separatorLine\drawSepLine\fi
286 % \expandafter\captionsetup\expandafter{\hv@caption@format}%
287 \ifhv@onlyText
288 \hv@longCap
289 \else
290 \ifx\hv@shortCap\@empty
291 \captionof{\hv@floatType}{\hv@longCap}%
292 \else
293 \captionof{\hv@floatType}[\hv@shortCap]{\hv@longCap}%
294 \fi
295 \fi
296 \ifx\hv@label\@empty\else\expandafter\label{\expandafter\hv@label-cap}\fi
297 \end{\hv@floatType*}%
298 }%
299 \hvfloat@typeout{do@hvFloat@doubleFULLPAGE@CaptionAfterTwoCol: afterpage done} %
300 }
301
302 \def\do@hvFloat@doubleFULLPAGE@CaptionOther#1{%
303 \afterpage{%
304 \let\c@hv@tempCNTfigA\c@figure
305 \let\c@hv@tempCNTtabA\c@table
306 \vspace*{\the\dimexpr-1in-\voffset-\topmargin-\headheight-\headsep-\baselineskip-\parskip+1.5\lineskip}% -0.5\paperheight+0.5\ht\hvObjectBox
307 \hspace*{\the\dimexpr-\evensidemargin-\parindent-1in}%
308 \global\savebox{\hvObjectBox}{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
309 \thispagestyle{empty}%
310 \hfuzz=\maxdimen
311 \vfuzz=\maxdimen
312 \global\savebox{\hvObjectBox}{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
313 \clipbox*{0 \depth{} \hv@leftPageObjectWidth{} \height}{\usebox\hvObjectBox}%
314 \ifx\hv@floatType\hv@figure
315 \refstepcounter{hv@tempCNTfigA}%
316 \else
317 \refstepcounter{hv@tempCNTtabA}% before caption
318 \fi
319 \label{\hv@label}%
320 \afterpage{%
321 \if@twocolumn\newpage\if@firstcolumn\else\null\newpage\fi\fi
322 \global\savebox{\hvObjectBox}{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
323 \thispagestyle{empty}%
324 \vspace*{\the\dimexpr-1in-\voffset-\topmargin-\headheight-\headsep-\baselineskip-\parskip+1.5\lineskip}% -0.5\paperheight+0.5\ht\hvObjectBox
325 \hspace*{\hv@tempWidthA}%
326 \clipbox*{\hv@leftPageObjectWidth{} \dp\hvObjectBox{} \wd\hvObjectBox{} \ht\hvObjectBox}{\usebox\hvObjectBox}%
327 \ifx\hv@floatType\hv@figure
328 \refstepcounter{hv@tempCNTfigB}%
329 \else
330 \refstepcounter{hv@tempCNTtabB}% before caption
331 \fi
332 \expandafter\label\expandafter{\hv@label-2}%
333 \savebox\hvCaptionBox{\parbox{0.9\ht\hvObjectBox}{\captionof*{\hv@floatType}{\hv@longCap}}}%
334 \ifnum#1 > 0\relax % rotation with 90°
335 \ifdim\hv@tempWidthB < 2\paperwidth
336 \rotatebox[origin=lb]{90}{\makebox[\paperheight][c]{\parbox{0.8\ht\hvObjectBox}{%
337 \ifhv@onlyText
338 \hv@longCap
339 \else
340 \ifx\hv@shortCap\@empty
341 \captionof{\hv@floatType}{\hv@longCap}%
342 \else
343 \captionof{\hv@floatType}[\hv@shortCap]{\hv@longCap}%
344 \fi
345 \fi
346 }}}% rotatebox
347 \ifx\hv@label\@empty\else\label{\hv@label-cap}\fi
348 \else% ifdim: no space left on page
349 \put(-2\ht\hvCaptionBox,0.5\ht\hvObjectBox){\makebox(0,0){\rotatebox{90}{\minipage{\textwidth}\centering
350 \parbox{0.8\textwidth}{%
351 \ifhv@onlyText
352 \hv@longCap
353 \else
354 \ifx\hv@shortCap\@empty
355 \captionof{\hv@floatType}{\hv@longCap}%
356 \else
357 \captionof{\hv@floatType}[\hv@shortCap]{\hv@longCap}%
358 \fi
359 \fi
360 }%
361 \ifx\hv@label\@empty\else\label{\hv@label-cap}\fi
362 \endminipage}}}%
363 \fi
364 \else% ifnum, caption not rotated, under or over the right page
365 \hv@tempWidthA=\the\dimexpr\paperheight-\ht\hvObjectBox\relax
366 \ifdim\hv@tempWidthA > \ht\hvCaptionBox
367 \else
368 \put(\the\dimexpr1.5\paperwidth-\wd\hvObjectBox-\hvSet@bindCorrection,\the\dimexpr\ht\hvCaptionBox+\abovecaptionskip+\belowcaptionskip){\makebox[0pt][c]{\parbox{\textwidth}{%%
369 \ifhv@onlyText
370 \hv@longCap
371 \else
372 \ifx\hv@shortCap\@empty
373 \captionof{\hv@floatType}{\hv@longCap}%
374 \else
375 \captionof{\hv@floatType}[\hv@shortCap]{\hv@longCap}%
376 \fi
377 \fi
378 }}}%
379 \ifx\hv@label\@empty\else\label{\hv@label-cap}\fi
380 \fi
381 \fi% end \ifnum#1>0
382 \newpage\if@twocolumn\null\newpage\fi
383 }%
384 }%
385 }
386
387
388 \def\setBottomCaption{%
389 \ifhv@twoColumnCaption
390 \begin{\hv@floatType*}[!b]%
391 \else
392 \begin{\hv@floatType}[!b]%
393 \fi
394 \expandafter\hvFloatSet\expandafter{\hv@save@setting}%
395 \ifhv@separatorLine\drawSepLine\fi
396 \par
397 \usebox\hvCaptionBox
398 \ifhv@twoColumnCaption
399 \end{\hv@floatType*}%
400 \else
401 \end{\hv@floatType}%
402 \fi
403 }
404
405 \def\setPageObject{%
406 \afterpage{\checkoddpage}%
407 \ifhv@star
408 \begin{\hv@floatType*}[p]%
409 \else
410 \begin{\hv@floatType}[p]%
411 \fi
412 \hv@tempcnt=\@floatpenalty% suppress "float too big" message
413 \hfuzz=\maxdimen
414 \vfuzz=\maxdimen
415 \expandafter\hvFloatSet\expandafter{\hv@save@setting}%
416 \ifhv@FULLPAGE
417 \@floatpenalty=\z@% no message that float too large
418 \vspace*{\the\dimexpr-1in-\voffset-\topmargin-\headheight-\headsep}%-0.5\baselineskip%
419 \if@twoside
420 \checkoddpage
421 \ifoddpage
422 \hspace*{\the\dimexpr-\oddsidemargin-\parindent-1in}%
423 \else
424 \hspace*{\the\dimexpr-\evensidemargin-\parindent-1in}%
425 \fi
426 \else
427 \hspace*{\the\dimexpr-\oddsidemargin-\parindent-1in}%
428 \fi
429 \AtBeginShipoutNext{\thispagestyle{empty}}% to prevent heading/footer
430 % \afterpage{\AddToHookNext{shipout/after}{\thispagestyle{empty}}}%
431 \usebox\hvObjectBox
432 \else
433 \usebox\hvObjectBox
434 \fi
435 \ifhv@star
436 \end{\hv@floatType*}%
437 \else
438 \end{\hv@floatType}%
439 \fi
440 \@floatpenalty=\hv@tempcnt% restore
441 }