Debian Codegraph @

texmf-dist/tex/latex/hvfloat/hvfloat-3.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\textwidth+\leftmargin+\rightmargin height=variable
9 %% _With_ additional text on the doublepage
10 %%
11 %% ------------------------------------- the doublepage obejcts ---------------------------
12 %% ||1in+evenside --- |1in+oddside ---||
13 %
14 \def\do@hvFloat@doublePage#1{% image on left and right page with caption on the right page
15 % #1-> 0/1 caption under/right
16 \setcounter{topnumber}{1}%
17 \setcounter{dbltopnumber}{1}%
18 \global\hv@leftPageObjectWidth=\the\dimexpr\paperwidth-1in-\evensidemargin-\hvSet@bindCorrection\relax
19 \global\hv@tempWidthA=\the\dimexpr1in+\oddsidemargin-\hvSet@bindCorrection\relax
20 \xdef\hv@caption@format@temp{\hv@caption@format}% it gets lost otherwise for next afterpage
21 \@dblfpbot=0\p@ \@plus 1fil%
22 \global\hv@switchTypefalse
23 \setcounter{hv@tempCNTfigA}{\value{figure}}%
24 \setcounter{hv@tempCNTfigB}{\value{figure}}%
25 \setcounter{hv@tempCNTtabA}{\value{table}}%
26 \setcounter{hv@tempCNTtabB}{\value{table}}%
27 \savebox\hvCaptionBox{% NO rotation
28 \minipage{\textwidth}%% minipage, to get hyphenation
29 \let\@captype\hv@floatType
30 \caption*{\hv@longCap}%
31 \endminipage}%
32 \global\savebox\hvObjectBox{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
33 \ifnum#1=0\relax % no rotation, caption below
34 \@tempdima=\dimexpr\ht\hvObjectBox+\ht\hvCaptionBox+\abovecaptionskip+\belowcaptionskip +\textfloatsep\relax%+\floatsep\relax
35 \ifdim\@tempdima > \dimexpr\textheight-\hv@minTextlines\relax
36 \hv@switchTypetrue
37 \fi
38 \fi
39 \ifhv@forceOutput
40 \do@hvFloat@doublePAGECaptionRight{#1}% no cheque
41 \else
42 \checkoddpage
43 \ifoddpage % we are on the right page
44 \if@twocolumn
45 \if@firstcolumn % we are in the left column of the right page
46 \ifhv@switchType
47 \afterpage{%
48 \global\savebox\hvObjectBox{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
49 \do@hvFloat@doublePAGECaptionRight{#1}}%
50 \else
51 \afterpage{%
52 %\afterpage{%
53 \global\savebox\hvObjectBox{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
54 \do@hvFloat@doublePageCaptionRight{#1}}%}%
55 \fi
56 \else % we are in the right column of the right page
57 \ifhv@tugboat
58 \do@hvFloat@doublePageCaptionRight{#1}%
59 \else
60 \ifhv@switchType
61 \do@hvFloat@doublePAGECaptionRight{#1}%
62 \else
63 \afterpage{%
64 \global\savebox\hvObjectBox{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
65 \do@hvFloat@doublePageCaptionRight{#1}}%
66 \fi
67 \fi
68 \fi
69 \else% onecolumn
70 \ifhv@switchType
71 \do@hvFloat@doublePAGECaptionRight{#1}%
72 \else
73 \ifhv@forceLeft
74 \do@hvFloat@doublePageCaptionRight{#1}% no \afterpage
75 \else
76 \afterpage{%
77 \global\savebox\hvObjectBox{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
78 \do@hvFloat@doublePageCaptionRight{#1}}%
79 \fi
80 \fi
81 \fi
82 \else% we have an even page
83 \if@twocolumn
84 \if@firstcolumn % We are in the left column of the left page
85 \ifhv@switchType
86 \afterpage{\afterpage{%
87 \global\savebox\hvObjectBox{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
88 \do@hvFloat@doublePAGECaptionRight{#1}}}%
89 \else %
90 \afterpage{\afterpage{%\afterpage{%
91 \global\savebox\hvObjectBox{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
92 \do@hvFloat@doublePageCaptionRight{#1}}}%}%
93 \fi
94 \else% second column(right column on left page)
95 \ifhv@switchType
96 \afterpage{%
97 \global\savebox\hvObjectBox{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
98 \do@hvFloat@doublePAGECaptionRight{#1}}%
99 \else
100 \afterpage{\afterpage{%
101 \global\savebox\hvObjectBox{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
102 \do@hvFloat@doublePageCaptionRight{#1}}}%
103 \fi
104 \fi
105 \else% onecolumn
106 \ifhv@switchType
107 \afterpage{%
108 \global\savebox\hvObjectBox{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
109 \do@hvFloat@doublePAGECaptionRight{#1}}%
110 \else
111 \ifhv@forceLeft
112 \afterpage{%
113 \global\savebox\hvObjectBox{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
114 \do@hvFloat@doublePageCaptionRight{#1}}%
115 \else
116 \afterpage{\afterpage{%
117 \global\savebox\hvObjectBox{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
118 \do@hvFloat@doublePageCaptionRight{#1}}}%
119 \fi
120 \fi
121 \fi
122 \fi
123 \let\@fptop\hv@fptop
124 \fi
125 \endgroup% started at main macro \hvFloat
126 }
127 %
128 \def\do@hvFloat@doublePageCaptionRight#1{% image on left and right page with caption on the right page ----------------------------------
129 \setcounter{topnumber}{1}%
130 \setcounter{dbltopnumber}{1}%
131 \hfuzz=\maxdimen
132 \vfuzz=\maxdimen
133 \hbadness=10000
134 \vbadness=10000
135 \hvfloat@typeout{do@hvFloat@doublePageCaptionRight->start}%
136 \do@hvFloat@doublePageCaptionRightObjectLeft{0pt}%
137 \do@hvFloat@doublePageCaptionRightObjectRight{#1}%
138 }
139 %
140 \def\do@hvFloat@doublePageCaptionRightObjectLeft#1{% left part of the object
141 \begin{\hv@floatType*}[t]
142 \hvfloat@typeout{>>>doublePage: begin with left side of the object \hv@floatObject}%
143 \hv@set@noverticalSpace
144 \hfuzz=\maxdimen
145 \vfuzz=\maxdimen
146 \hbadness=10000
147 \vbadness=10000
148 \let\c@hv@tempCNTfigA\c@figure
149 \let\c@hv@tempCNTtabA\c@table
150 \expandafter\hvFloatSet\expandafter{\hv@save@setting}%
151 \hvfloat@typeout{Float position parameter is for left page: !t}%
152 \global\savebox{\hvObjectBox}{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
153 \clipbox*{0 -\depth{} \hv@leftPageObjectWidth{} \height}{\usebox\hvObjectBox}%
154 \ifx\hv@label\@empty
155 \else
156 \ifx\hv@floatType\hv@figure
157 \global\refstepcounter{hv@tempCNTfigA}%
158 \else
159 \global\refstepcounter{hv@tempCNTtabA}% before caption
160 \fi
161 \label{\hv@label}%
162 \fi
163 \ifhv@global@sameHeight \ifx\hvSet@capPos\hv@Bottom % only for capPos=bottom
164 \hvfloat@typeout{text should be of same height of both pages}%
165 \par\noindent\phantom{\parbox{\textwidth}{\caption*{\hv@longCap}}}%
166 \vspace{\belowcaptionskip}% default
167 \fi\fi
168 \hv@reset@noverticalSpace
169 \end{\hv@floatType*}%
170 }
171
172 \def\do@hvFloat@doublePageCaptionRightObjectRight#1{% right part of the object
173 \begin{\hv@floatType*}[t]
174 \hv@set@noverticalSpace
175 \hfuzz=\maxdimen
176 \vfuzz=\maxdimen
177 \hbadness=10000
178 \vbadness=10000
179 \let\c@hv@tempCNTfigA\c@figure
180 \let\c@hv@tempCNTtabA\c@table
181 \expandafter\hvFloatSet\expandafter{\hv@save@setting}%
182 \global\savebox\hvObjectBox{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
183 \hv@tempWidthA=\the\dimexpr1in+\oddsidemargin-\hvSet@bindCorrection\relax% FÜR DTK
184 \hspace*{-\hv@tempWidthA}%
185 \hv@leftPageObjectWidth=\the\dimexpr\paperwidth-1in-\evensidemargin-\hvSet@bindCorrection\relax% FÜR FTK
186 \savebox\hv@rightBox{\clipbox*{\hv@leftPageObjectWidth{} -\depth{} \width{} \height{}}{\usebox\hvObjectBox}}%
187 \hv@tempWidthB=\dimexpr\textwidth-\wd\hv@rightBox-\hvSet@bindCorrection+1in+\oddsidemargin-\hv@floatCapSep\relax
188 \hvfloat@typeout{Height of right box: \the\ht\hv@rightBox}%
189 \hvfloat@typeout{Depth of right box : \the\dp\hv@rightBox}%
190 \ifdim\dp\hv@rightBox > \z@
191 \raisebox{\depth}{\usebox\hv@rightBox}%
192 \else
193 \usebox\hv@rightBox
194 \fi
195 \c@hv@tempCNTfigB=\numexpr\c@figure-1\relax
196 \c@hv@tempCNTtabB=\numexpr\c@table-1\relax
197 \ifx\hv@label\@empty\else
198 \ifx\hv@floatType\hv@figure
199 \refstepcounter{hv@tempCNTfigB}%
200 \else
201 \refstepcounter{hv@tempCNTtabB}% before caption
202 \fi
203 \label{\hv@label-2}%
204 \fi
205 \ifx\hv@caption@format@temp\@empty\else
206 \expandafter\captionsetup\expandafter{\hv@caption@format@temp}%
207 \fi
208 \c@figure=\numexpr\c@hv@tempCNTfigB-1\relax
209 \c@table=\numexpr\c@hv@tempCNTtabB-1\relax
210 \ifnum#1>\z@ % caption on the right
211 \hvfloat@typeout{doublePage: capAngle=\hvSet@capAngle}%
212 \ifnum\hvSet@capAngle > \z@
213 \hspace{\hv@floatCapSep}%
214 \rlap{\rotatebox{\hvSet@capAngle}{\parbox[b]{\the\dimexpr\ht\hvObjectBox+\dp\hvObjectBox}{%
215 \abovecaptionskip=0pt% local inside parbox
216 \belowcaptionskip=0pt% local inside parbox
217 \ifx\relax\hv@shortCap\relax
218 \caption{\hv@longCap}%
219 \else
220 \caption[\hv@shortCap]{\hv@longCap}%
221 \fi
222 }}}%
223 \ifx\hv@label\@empty\else\label{\hv@label-cap}\fi
224 \else
225 \hv@tempWidthB=\dimexpr\textwidth-\wd\hv@rightBox-\hvSet@bindCorrection+1in+\oddsidemargin-\hv@floatCapSep\relax
226 \hspace{\hv@floatCapSep}%
227 \rlap{\parbox[b][\dimexpr\ht\hv@rightBox+\dp\hv@rightBox][\hv@@capVPos]{\hv@tempWidthB}{%
228 \abovecaptionskip=0pt % local inside parbox
229 \belowcaptionskip=0pt % local inside parbox
230 \ifx\hv@shortCap\@empty
231 \caption{\hv@longCap}%
232 \else
233 \caption[\hv@shortCap]{\hv@longCap}%
234 \fi
235 }}%
236 \ifx\hv@label\@empty\else\label{\hv@label-cap}\fi
237 \fi
238 \else % #1 = 0 caption below
239 \ifx\relax\hv@shortCap\relax
240 \caption{\hv@longCap}%
241 \else
242 \caption[\hv@shortCap]{\hv@longCap}%
243 \fi
244 \ifx\hv@label\@empty\else\label{\hv@label-cap}\fi
245 \fi
246 \vspace{0pt}%
247 \hv@reset@noverticalSpace
248 \end{\hv@floatType*}
249 }