Debian Codegraph @

texmf-dist/tex/latex/hvfloat/hvfloat.sty

raw
1 %% $Id: hvfloat.sty 1254 2026-05-18 14:23:17Z herbert $
2 %%
3 %%
4 %% IMPORTANT NOTICE:
5 %%
6 %% This is file `hvfloat.sty',
7 %%
8 %% Herbert Voss <[email protected]>
9 %% Copyright (C) 2003-26
10 %%
11 %% This program can be redistributed and/or modified under the terms
12 %% of the LaTeX Project Public License Distributed from CTAN archives
13 %% in directory macros/latex/base/lppl.txt.
14 %%
15 %% DESCRIPTION:
16 %% `hvfloat' offers rotating of captions and objects for floats
17 %%
18 \NeedsTeXFormat{LaTeX2e}
19 \def\fileversion{2.57}
20 \def\filedate{2026/05/18}
21 \ProvidesPackage{hvfloat}[\filedate\space v\fileversion\space special floating objects (hv)]
22 \let\hvFloatFileVersion\fileversion
23 %
24 \newif\ifhv@fbox \hv@fboxfalse
25 \newif\ifhv@hyperref \hv@hyperreffalse
26 \newif\ifhv@nostfloats \hv@nostfloatsfalse
27 \newif\ifhv@tugboat \hv@tugboatfalse
28 \newif\ifhv@forceLeft \hv@forceLeftfalse
29
30 \DeclareOption{fbox}{\hv@fboxtrue\setlength\fboxsep{1pt}}
31 \DeclareOption{hyperref}{\hv@hyperreftrue}
32 \DeclareOption{nostfloats}{\hv@nostfloatstrue}
33 \DeclareOption{no-stfloats}{\hv@nostfloatstrue}
34
35 \ProcessOptions
36
37
38 \PassOptionsToPackage{hypcap=false}{caption}
39 \RequirePackage{caption}
40 \RequirePackage{varwidth}
41 \DeclareCaptionBox{varwidth}{\varwidth[b]{#1}#2\endvarwidth}
42
43 \PassOptionsToPackage{hypcap}{subcaption}
44 \RequirePackage{subcaption}
45 \RequirePackage{atbegshi}
46 \RequirePackage{picture}
47 \RequirePackage{trimclip}
48 \renewcommand\clipbox{% overwrite macro from trimclip.sty to prevent overfull box message
49 \collectboxcheckenv{clipbox}%
50 \hfuzz=\maxdimen
51 \vbadness=10000
52 \@ifstar
53 \clipbox@s
54 \clipbox@
55 }
56
57 \RequirePackage{etoolbox,marginnote}% for "floats" in the margin
58
59 \RequirePackage{expl3,multido}
60 \RequirePackage{graphicx}
61 \RequirePackage{varwidth}
62 \RequirePackage{fbox}
63
64 \RequirePackage{xkeyval}
65 \RequirePackage{ifoddpage}
66 \RequirePackage{afterpage}
67
68 \RequirePackage{zref-savepos}
69 \newdimen\@tempx
70 \newdimen\@tempy
71 \newcounter{hvfloat@testCtr}
72 \newcounter{hvfloat@ref}
73 \newdimen\hv@float@head
74 \newdimen\hv@float@foot
75 \renewcommand\thehvfloat@ref{tmp@\arabic{hvfloat@ref}}
76 \setcounter{hvfloat@ref}{0}
77 \newif\ifhv@atPageBegin
78
79
80 \ifhv@hyperref
81 \RequirePackage{hyperref}
82 \fi
83
84 \ifhv@nostfloats
85 \else
86 \RequirePackage{stfloats}% for bottom floats in a twocolumn mode
87 % \RequirePackage{floatpag}% for bottom floats in a twocolumn mode
88 \fi
89 %
90 %\def\hv@thisfloatpagestyle#1{%
91 % \global\@namedef{\number\@currbox @float}{\thispagestyle{#1}}\relax
92 %}
93
94 \providecommand\hvfloat@typeout[1]{\ifhv@Debug\typeout{>>>> #1}\fi}
95 \providecommand*\LenToUnit[1]{\strip@pt\dimexpr#1*\p@/\unitlength}
96
97 \newlength\hvObjectWidth
98 \newlength\hvCapWidth
99 \newlength\hvWideWidth
100 \newlength\hvMultiFloatSkip
101 \newlength\hvNonFloatTopSkip
102 \newlength\hvMaxCapWidth
103 \newlength\hvFloatFullWidth % only for user purpose
104 \AtBeginDocument{\hvFloatFullWidth=\the\dimexpr\textwidth+\marginparwidth+\marginparsep\relax}
105
106
107 \newsavebox\hvObjectBox
108 \newsavebox\hvCaptionBox
109 \newsavebox\hvOBox
110 \newsavebox\@tempbox
111 \newsavebox\hv@caption@box
112 \newsavebox\hv@leftBox
113 \newsavebox\hv@rightBox
114
115 \newif\ifhv@capbeside \hv@capbesidefalse
116 \newif\ifhv@switchType
117
118 \def\hv@Top{top}
119 \def\hv@Bottom{bottom}
120 \def\hv@After{after}
121 \def\hv@Before{before}
122 \def\hv@Right{right}
123 \def\hv@Left{left}
124 \def\hv@Center{center}
125 \def\hv@Outer{outer}
126 \def\hv@Inner{inner}
127 \def\hv@Even{evenPage}
128 \def\hv@Odd{oddPage}
129 \def\hv@Natural{n}
130 \def\hv@LineWidth{l}
131 \def\hv@Width{w}
132 \def\hv@Height{h}
133 \def\hv@Zero{0}
134 %
135 \def\hv@figure{figure}
136 %
137 \define@key{hvSet}{floatPos}[tbp]{% LaTeX's position parameters htbp
138 \def\hvSet@floatPos{#1}%
139 }
140 \define@key{hvSet}{rotAngle}[0]{% rotates caption AND image together
141 \def\hvSet@rotAngle{#1}%
142 }
143 \define@key{hvSet}{capWidth}[n]{% (l)inewidth|(n)atural width|object (w)idth)|object (h)eight|<scale of \columnwidth>
144 \def\hvSet@capWidth{#1}%
145 }
146 \define@key{hvSet}{capAngle}[0]{% -360..+360, only integers
147 \def\hvSet@capAngle{#1}%
148 }
149
150 \define@choicekey*+{hvSet}{capPos}[\val\nr]{bottom,top,left,before,right,after,inner,outer,evenPage,oddPage}[bottom]{%
151 \def\hvSet@capPos{#1}% it is relativ to the object, (e),(d) only valid for fullpage float
152 \ifcase\nr\relax
153 \hv@capbesidefalse
154 \or
155 \hv@capbesidefalse
156 \else
157 \hv@capbesidetrue
158 \fi
159 }{\PackageWarning{hvfloat}{erroneous input (#1) for capPos ignored. Using bottom.}%
160 \def\hvSet@capPos{bottom}% it is relativ to the object, (e),(d) only valid for fullpage float
161 \hv@capbesidefalse
162 }
163
164 \define@choicekey*+{hvSet}{capVPos}[\val\nr]{bottom,center,top}[center]{%
165 \def\hvSet@capVPos{#1}% it is relativ to the object
166 \ifcase\nr\relax
167 \def\hv@@capVPos{b}%
168 \or
169 \def\hv@@capVPos{c}%
170 \else
171 \def\hv@@capVPos{t}%
172 \fi
173 }{\PackageWarning{hvfloat}{erroneous input (#1) for capVPos ignored. Using center.}%
174 \def\hvSet@capVPos{center}% it is relativ to the object
175 }
176
177 \define@choicekey*+{hvSet}{capHPos}[\val\nr]{left,center,right}[center]{%
178 \def\hvSet@capHPos{#1}%
179 \ifcase\nr\relax
180 \gdef\hv@@capHPos{l}%
181 \or
182 \gdef\hv@@capHPos{c}%
183 \else
184 \gdef\hv@@capHPos{r}%
185 \fi
186 }{\PackageWarning{hvfloat}{erroneous input (#1) for capHPos ignored. Using center.}%
187 \def\hvSet@capHPos{center}% it is relativ to the object
188 }
189
190 \define@choicekey*+{hvSet}{objectPos}[\val\nr]{left,center,right,inner,outer}[center]{%
191 \def\hvSet@objectPos{#1}% it is relativ to the object
192 }{\PackageWarning{hvfloat}{erroneous input (#1) for objectPos ignored. Using center.}%
193 \def\hvSet@capVPos{center}% it is relativ to the object
194 }
195 \define@key{hvSet}{objectAngle}[0]{% -360..+360
196 \def\hvSet@objectAngle{#1}%
197 }
198 \define@key{hvSet}{floatCapSep}[5pt]{% a width with the unit pt
199 \def\hvSet@floatCapSep{#1}%
200 }
201 \define@key{hvSet}{multiFloatSkip}[\normalbaselineskip]{% a width with the unit pt
202 \setlength\hvMultiFloatSkip{#1}%
203 }
204 \define@key{hvSet}{nonFloatTopSkip}[\medskipamount]{% a topskip for nonfloats with the unit pt
205 \setlength\hvNonFloatTopSkip{#1}%
206 }
207 \define@boolkey{hvSet}[hv@]{useOBox}[true]{}% use of the hvOBox contents
208 \define@boolkey{hvSet}[hv@]{nonFloat}[true]{}% Do not use float environment
209 \define@boolkey{hvSet}[hv@]{inMargin}[true]{}% use of the hvOBox contents
210 \define@boolkey{hvSet}[hv@]{onlyText}[true]{}% Write the caption only as text
211 \define@boolkey{hvSet}[hv@]{onlyTextInTOC}[true]{}% caption without number into TOC
212 \define@boolkey{hvSet}[hv@]{wide}[true]{}% Write the caption only as text
213 \define@boolkey{hvSet}[hv@]{forceLeft}[true]{}% use only one \afterpage instead of \afterpage{\afterpage{..
214 \define@boolkey{hvSet}[hv@]{twoColumnCaption}[true]\global\@nameuse{hv@twoColumnCaption#1}{}% Write the caption only as text
215 \define@boolkey{hvSet}[hv@]{sameHeight}[true]{\@nameuse{hv@sameHeight#1}}% Write the caption only as text
216 \define@boolkey{hvSet}[hv@]{Debug}[true]{}% give more infos in the terminal
217 \define@boolkey{hvSet}[hv@]{test}[true]{}% use of the hvOBox contents
218
219 \def\test@typeout#1{\ifhv@test\typeout{>>>test\thehvfloat@testCtr:>#1}\fi}
220
221 \newif\ifhv@fullpage
222 \newif\ifhv@FULLPAGE
223 \newif\ifhv@doubleFullPage
224 \newif\ifhv@doubleFULLPAGE
225 \newif\ifhv@doublePAGE
226 \newif\ifhv@doublePage
227 \newif\ifhv@setObjectLabel
228 \newif\ifhv@global@sameHeight
229 \newif\ifhv@forceOutput
230
231
232 \newlength\hvSet@bindCorrection
233 \newlength\hvSet@sepLineskip
234 \newlength\hv@leftPageObjectWidth% for doublepage images
235 \newlength\hv@tempWidthA
236 \newlength\hv@tempWidthB
237 \newlength\hv@minTextlines
238 \newlength\hv@floatCapSep
239 \newlength\hvSet@bindCorr
240
241 \define@key{hvSet}{fullpage}[true]{%
242 \global\@nameuse{hv@fullpage#1}%
243 \hv@doublePagefalse\hv@doublePAGEfalse\hv@doubleFULLPAGEfalse
244 \hv@FULLPAGEfalse\hv@doubleFullPagefalse
245 \hvfloat@typeout{>>>>Option fullpage}%
246 }
247 \define@key{hvSet}{FULLPAGE}[true]{%
248 \global\@nameuse{hv@FULLPAGE#1}%
249 \hv@doublePagefalse\hv@doublePAGEfalse\hv@doubleFULLPAGEfalse
250 \hv@fullpagefalse\hv@doubleFullPagefalse
251 \hvfloat@typeout{>>>>Option FULLPAGE}%
252 }
253 \define@key{hvSet}{doubleFULLPAGE}[true]{%
254 \global\@nameuse{hv@doubleFULLPAGE#1}%
255 \hv@doublePagefalse\hv@doublePAGEfalse
256 \hv@fullpagefalse\hv@FULLPAGEfalse\hv@doubleFullPagefalse
257 \hvfloat@typeout{>>>>Option doubleFULLPAGE->True / doublePAGE->False}%
258 }
259 \define@key{hvSet}{doublePAGE}[true]{%
260 \global\@nameuse{hv@doublePAGE#1}%
261 \hv@doublePagefalse\hv@doubleFULLPAGEfalse
262 \hv@fullpagefalse\hv@FULLPAGEfalse\hv@doubleFullPagefalse
263 \hvfloat@typeout{>>>>Option doublePAGE->True / doubleFULLPAGE->False}%
264 }
265 \define@key{hvSet}{doublePage}[true]{%
266 \global\@nameuse{hv@doublePage#1}%
267 \hv@doublePAGEfalse\hv@doubleFULLPAGEfalse
268 \hv@fullpagefalse\hv@FULLPAGEfalse\hv@doubleFullPagefalse
269 \hvfloat@typeout{>>>>Option doublepage->True / doubleFULLPAGE->False}%
270 }
271 \define@key{hvSet}{doubleFullPage}[true]{%
272 \global\@nameuse{hv@doubleFullPage#1}%
273 % \hv@doublePAGEfalse\hv@doubleFULLPAGEfalse\hv@doublePagefalse
274 % \hv@fullpagefalse\hv@FULLPAGEfalse
275 \hvfloat@typeout{>>>>Option doublefullPage->True / doubleFULLPAGE->False}%
276 }
277 \define@key{hvSet}{bindCorr}[0pt]{%
278 \def\hv@temp{#1}%
279 \ifx\hv@temp\hv@Inner
280 \hvSet@bindCorr=\the\dimexpr1in+\oddsidemargin\relax
281 \else
282 \setlength\hvSet@bindCorr{#1}%
283 \fi
284 }
285 %\setlength\hvSet@bindCorrection{#1}}% for doublepage objects
286
287 \define@boolkey{hvSet}[hv@]{subFloat}[true]{% typeset values as subfloats
288 \ifhv@subFloat\setkeys{hvSet}{multiFloat=false}\fi%
289 }%
290 \define@boolkey{hvSet}[hv@]{multiFloat}[true]{% typeset values as continous floats
291 \ifhv@multiFloat\setkeys{hvSet}{subFloat=false}\fi
292 }%
293 \define@boolkey{hvSet}[hv@]{vFill}[true]{}% \vfill between multifloat objects
294
295 \define@boolkey{hvSet}[hv@]{separatorLine}[true]{}% separator line for caption of a full page float
296 \define@key{hvSet}{sepLineskip}{\def\hv@sepLineskip{#1}}%
297 \define@key{hvSet}{minTextlines}{\setlength\hv@minTextlines{#1\baselineskip}}%
298 \define@boolkey{hvSet}[hv@]{objectFrame}[true]{}% a frame around the object with no separation
299 \define@key{hvSet}{fboxLines}[ltrb]{\def\hv@fboxLines{#1}}%
300 \define@key{hvSet}{fboxSep}[0pt]{\def\hv@fboxSep{#1}}%
301
302 \define@key{hvSet}{style}{%
303 \@ifundefined{hv@#1}%
304 {\errmessage{Custom style `#1' undefined}}%
305 {\begingroup
306 \edef\x{\endgroup\noexpand\setkeys{hvSet}{\@nameuse{hv@#1}}}\x}% use a defined style
307 }
308 \define@key{hvSet}{capFormat}{\def\hv@caption@format{#1}}%
309 \define@key{hvSet}{subcapFormat}{\def\hv@subcaption@format{#1}}%
310 \define@boolkey{hvSet}[hv@]{forceOutput}[true]{%
311 \ifhv@forceOutput\hv@nonFloattrue\fi}% immediate output, no floating!
312
313 \def\hv@set#1{\begingroup\edef\x{\endgroup\noexpand\setkeys{hvSet}{#1}}\x}
314 \let\hvFloatSet\hv@set
315 %
316 \def\defhvstyle#1#2{\@namedef{hv@#1}{#2}}
317 \let\hvDefFloatStyle\defhvstyle % better name
318 %
319 \newcommand\setDefaults{%
320 \hv@set{%
321 floatPos=, rotAngle=0, capWidth=n, capAngle=0, objectAngle=0,
322 capPos=bottom, capVPos=center, objectPos=center, capHPos=center,
323 floatCapSep=5pt, useOBox=false, forceLeft=false,
324 onlyText=false, onlyTextInTOC=false, wide=false, fullpage=false, FULLPAGE=false,
325 doubleFULLPAGE=false, doublePage=false, doublePAGE=false,
326 multiFloat=false,subFloat=false,inMargin=false,
327 separatorLine,objectFrame=false, fboxLines={ltrb}, fboxSep=0pt,
328 multiFloatSkip=\normalbaselineskip,
329 capFormat={}, subcapFormat={}, twoColumnCaption=false,
330 sameHeight=false,
331 bindCorr=\z@,sepLineskip=0pt,
332 nonFloatTopSkip=\medskipamount,
333 vFill=false, minTextlines=2,
334 forceOutput=false, nonFloat=false,
335 }%
336 }
337
338 \let\hvFloatSetDefaults\setDefaults
339 \hvFloatSetDefaults% onyl for first loading of the package
340
341
342 \providecommand\@tugclass{\@empty}
343 \ifx\@tugclass\@empty
344 \else
345 \hv@tugboattrue % special page handling
346 \hvfloat@typeout{>>> we are using a TUGboat class}%
347 \fi
348
349 \newcommand\reset@special@float{%
350 \hv@set{subFloat=false,%fullpage=false,
351 multiFloat=false,%FULLPAGE=false
352 }}
353
354 \def\hv@vskip{\vspace{\hvMultiFloatSkip}}
355 %
356 \newlength\hvAboveCaptionSkip
357 \newlength\hvBelowCaptionSkip
358 \newlength\hv@dblfptop
359 \newlength\hv@fptop
360 \newcount\hv@@capPos
361
362 \newlength\fboxlinewidth
363 \AtBeginDocument{%
364 \fboxlinewidth=\the\dimexpr\linewidth-2\fboxrule-2\fboxsep\relax
365 }
366
367 \setlength\belowcaptionskip{\abovecaptionskip}% it is in latex.ltx = 0pt
368 \newcommand\saveCaptionSkip{%
369 \setlength{\hvAboveCaptionSkip}{\abovecaptionskip}%
370 \setlength{\hvBelowCaptionSkip}{\belowcaptionskip}%
371 \setlength{\abovecaptionskip}{0pt}%
372 \setlength{\belowcaptionskip}{0pt}%
373 }
374 \newcommand\restoreCaptionSkip{%
375 \setlength\abovecaptionskip{\hvAboveCaptionSkip}%
376 \setlength\belowcaptionskip{\hvBelowCaptionSkip}%
377 }
378
379 \newcommand\hv@set@noverticalSpace{% no space on top for a float page
380 \let\hv@dblfptop\@dblfptop
381 \let\hv@fptop\@fptop
382 \global\@dblfptop=0\p@
383 \global\@fptop=0\p@
384 }
385
386 \newcommand\hv@reset@noverticalSpace{%
387 \global\@dblfptop=\hv@dblfptop
388 \global\@fptop=\hv@fptop
389 }
390
391 \providecommand\figcaption[2][]{}%
392 \providecommand\tabcaption[2][]{}%
393 \providecommand\tabcaptionbelow[2][]{}%
394 %
395 \renewcommand\figcaption[2][]{%
396 \begingroup
397 \def\@captype{figure}%
398 \ifx\relax\hv@caption@format\relax\else\expandafter\captionsetup\expandafter{\hv@caption@format}\fi
399 \ifx\relax#1\relax \caption{#2}\else\caption[#1]{#2}\fi
400 \endgroup}
401 \renewcommand\tabcaption[2][]{%
402 \begingroup
403 \def\@captype{table}%
404 \expandafter\captionsetup\expandafter{\hv@caption@format,position=top}%
405 \vspace{\hvAboveCaptionSkip}%
406 \ifx\relax#1\relax \caption{#2}\else\caption[#1]{#2}\fi
407 % \vspace{\hvBelowCaptionSkip}%
408 \endgroup}
409 \renewcommand\tabcaptionbelow[2][]{%
410 \begingroup
411 \def\@captype{table}%
412 \expandafter\captionsetup\expandafter{\hv@caption@format,position=below}
413 \ifx\relax#1\relax \caption{#2}\else\caption[#1]{#2}\fi
414 \endgroup}
415
416 %
417 \newlength\hv@maxImageWidth
418 \AtBeginDocument{\setlength\hv@maxImageWidth{\columnwidth}}
419
420 \define@key{Gin}{columnWidth}[true]{%
421 \def\Gin@ewidth{\columnwidth}%
422 % \def\Gin@eheight{1ex}%
423 \Gin@boolkey{true}{iso}%
424 }
425 \define@key{Gin}{fullpage}[true]{%
426 \def\Gin@ewidth{\columnwidth}%
427 \def\Gin@eheight{\textheight}%
428 \Gin@boolkey{false}{iso}%
429 }
430 \define@key{Gin}{FullPage}[true]{%
431 \def\Gin@ewidth{\textwidth}%
432 \def\Gin@eheight{\textheight}%
433 \Gin@boolkey{false}{iso}%
434 }
435 \define@key{Gin}{FULLPAGE}[true]{%
436 \def\Gin@ewidth{\paperwidth}%
437 \def\Gin@eheight{\paperheight}%
438 \Gin@boolkey{false}{iso}%
439 }
440 \define@key{Gin}{doubleFULLPAGE}[true]{%
441 \def\Gin@ewidth{2\paperwidth}%
442 \def\Gin@eheight{\paperheight}%
443 \Gin@boolkey{false}{iso}%
444 }
445 \define@key{Gin}{doubleFullPage}[true]{%
446 \def\Gin@ewidth{2\paperwidth}%
447 % \def\Gin@eheight{\paperheight}%
448 \Gin@boolkey{false}{iso}%
449 }
450 \define@key{Gin}{doublefullPage}[true]{%
451 \def\Gin@ewidth{\the\dimexpr2\paperwidth-2in-2\evensidemargin}%
452 % \def\Gin@eheight{\paperheight}%
453 \Gin@boolkey{true}{iso}%
454 }
455 \define@key{Gin}{doubleFullPagebindCorr}[true]{%
456 \def\Gin@ewidth{\the\dimexpr2\paperwidth-2\hvSet@bindCorrection\relax}%
457 % \def\Gin@eheight{\paperheight}%
458 \Gin@boolkey{false}{iso}%
459 }
460 \define@key{Gin}{doubleFULLPAGEbindCorr}[true]{%
461 \def\Gin@ewidth{\the\dimexpr2\paperwidth-2\hvSet@bindCorrection\relax}%
462 \def\Gin@eheight{\paperheight}%
463 \Gin@boolkey{false}{iso}%
464 }
465
466 \newcommand\IncludeGraphics[2][]{%
467 \vspace*{\the\dimexpr-1in-\voffset+\topskip-\headheight-0.5\baselineskip}%
468 \leavevmode\checkoddpage
469 \ifoddpage
470 \hspace*{\dimexpr-\oddsidemargin-\parindent-1in}%
471 \else
472 \hspace*{\dimexpr-\evensidemargin-\parindent-1in}%
473 \fi\noindent
474 \includegraphics[#1,width=\paperwidth,height=\paperheight,keepaspectratio=false]{#2}%
475 }
476
477 \newcommand\put@CaptionBox[1][0]{%
478 \ifcase#1
479 \ifhv@fbox
480 \fbox{\parbox{\wd\hvCaptionBox}{\usebox{\hvCaptionBox}}}%
481 \else
482 \parbox{\wd\hvCaptionBox}{\usebox{\hvCaptionBox}}%
483 \fi
484 \or
485 \ifhv@fbox
486 \fbox{\raisebox{-\height}{\usebox{\hvCaptionBox}}}%
487 \else
488 \raisebox{-\height}{\usebox{\hvCaptionBox}}%
489 \fi
490 \or
491 \ifhv@fbox\fbox{\usebox{\hvCaptionBox}}\else\usebox{\hvCaptionBox}\fi
492 \fi
493 }
494
495 \newcommand\put@ObjectBox[1][0]{%
496 \ifcase#1
497 \ifhv@fbox
498 \fbox{\parbox{\wd\hvObjectBox}{\usebox{\hvObjectBox}}}%
499 \else
500 \parbox{\wd\hvObjectBox}{\ifhv@objectFrame\fbox[boxsep=\hv@fboxSep,,\hv@fboxLines]{\usebox{\hvObjectBox}}\else\usebox{\hvObjectBox}\fi}%
501 \fi
502 \or
503 \ifhv@fbox
504 \fbox{\raisebox{-\height}{\usebox{\hvObjectBox}}}%
505 \else
506 \raisebox{-\height}{\ifhv@objectFrame\fbox[boxsep=\hv@fboxSep,,\hv@fboxLines]{\usebox{\hvObjectBox}}\else\usebox{\hvObjectBox}\fi}%
507 \fi
508 \or
509 \ifhv@fbox
510 \fbox{\usebox{\hvObjectBox}}%
511 \else
512 % rotated object with a depth need to raise up the \depth
513 \ifhv@objectFrame\fbox[boxsep=\hv@fboxSep,,\hv@fboxLines]{\usebox{\hvObjectBox}}\else\raisebox{\depth}{\usebox{\hvObjectBox}}\fi%
514 \fi
515 \fi
516 }
517
518 \def\drawSepLine{%
519 \par\noindent
520 \if@twocolumn
521 \ifhv@twoColumnCaption
522 \rule{\linewidth}{0.4pt}\\[-2.5ex]
523 \else
524 \rule{\columnwidth}{0.4pt}\\[-2.5ex]
525 \fi
526 \else
527 \rule{\linewidth}{0.4pt}\\[-2.5ex]
528 \fi
529 \vspace{\hv@sepLineskip}%
530 }
531
532 \newcounter{hv@tempCNTfigA}%
533 \newcounter{hv@tempCNTfigB}%
534 \newcounter{hv@tempCNTtabA}%
535 \newcounter{hv@tempCNTtabB}%
536 \newcounter{hv@pfigure}%
537 \newcounter{hv@ptable}%
538 \newcounter{subhv@pfigure}%
539 \newcounter{subhv@ptable}%
540 \newcount\hv@tempcnt
541
542 \newif\ifhv@star
543 \newif\if@hvsubstar
544 \setDefaults
545
546
547 %\newcommand*{\hvFloat}[5][]+{%
548 % [#1}: keyvalues
549 % #2: type figure | table | ...
550 % #3: float contents
551 % [#4]: short caption
552 % #5: caption
553 % #6: label
554 %
555
556
557 \def\hvFloat{\@ifnextchar*% Main macro
558 {\global\hv@startrue\hv@maxImageWidth=\textwidth\hvFloat@i}%
559 {\global\hv@starfalse\hv@maxImageWidth=\columnwidth\hvFloat@i*}%
560 }
561
562 \def\hvFloat@i*{\@ifnextchar[{\do@hvFloat}{\do@hvFloat[]}}
563 \def\do@hvFloat[#1]{%
564 %\marginnote{\textbf{hvFloat}}%
565 \savebox\hvObjectBox{}%
566 \begingroup
567 \hvWideWidth=\the\dimexpr\columnwidth+\marginparwidth+\marginparsep\relax%
568 % \setlength\hvWideWidth{\dimexpr\textwidth+\marginparwidth+\marginparsep}%
569 % \setlength\hvWideWidth{\dimexpr\linewidth+\marginparwidth}%
570 \hv@maxImageWidth=\textwidth
571 \reset@special@float
572 \global\setcounter{hv@pfigure}{\value{figure}}%
573 \global\setcounter{hv@ptable}{\value{table}}%
574 \setcounter{hv@tempCNTfigA}{\value{figure}}%
575 \setcounter{hv@tempCNTfigB}{\value{figure}}%
576 \setcounter{hv@tempCNTtabA}{\value{table}}%
577 \setcounter{hv@tempCNTtabB}{\value{table}}%
578 \gdef\hv@save@setting{#1}% for later use after \endgroup inside figure/table env
579 \ifx\relax#1\relax\else\setkeys{hvSet}{#1}\fi
580 \global\stepcounter{hvfloat@ref}%
581 \test@typeout{>>>test:>hvfloat@ref \thehvfloat@ref}%
582 \global\stepcounter{hvfloat@testCtr}% use anyway, it's only for debugging
583 \ifx\hv@caption@format\@empty\else\expandafter\captionsetup\expandafter{\hv@caption@format}\fi
584 \ifx\hv@subcaption@format\@empty\else
585 \expandafter
586 \captionsetup\expandafter[\expandafter s\expandafter u\expandafter b\expandafter]\expandafter
587 {\hv@subcaption@format}%
588 \fi
589 \gdef\hv@floatType{figure}% presetting
590 \ifhv@Debug\marginnote{\textbf{hvFloat}}\fi%
591 \@ifnextchar+{\do@multiFloat}{\hvFloat@ii[#1]}%
592 }
593
594 \ExplSyntaxOn
595
596 \def\do@multiFloat+#1#2{%
597 \clist_set:Nn\l_clist_Type{{#1}}%
598 \clist_set:Nn\l_clist_Object{{#2}}%
599 \@ifnextchar[\do@multiFloat@i{\do@multiFloat@i[]}%
600 }
601 \def\do@multiFloat@i[#1]#2#3{% lof-caption, caption,label
602 \ifx\relax#1\relax
603 \clist_set:Nn\l_clist_LofCaption{{}}%
604 \else
605 \clist_set:Nn\l_clist_LofCaption{{#1}}%
606 \fi
607 \clist_set:Nn\l_clist_Caption{{#2}}%
608 \ifx\relax#3\relax
609 \clist_set:Nn\l_clist_Label{{}}%
610 \else
611 \clist_set:Nn\l_clist_Label{{#3}}%
612 \fi
613 \@ifnextchar+{\do@multiFloat@ii}{}%
614 }
615 \def\do@multiFloat@ii+#1#2{%
616 \clist_put_right:Nn\l_clist_Type{{#1}}%
617 \clist_put_right:Nn\l_clist_Object{{#2}}%
618 \@ifnextchar[\do@multiFloat@iii{\do@multiFloat@iii[]}%
619 }
620
621 \def\do@multiFloat@iii[#1]#2#3{% lof-caption, caption, label
622 \ifx\relax#1\relax
623 \clist_put_right:Nn\l_clist_LofCaption{{}}%
624 \else
625 \clist_put_right:Nn\l_clist_LofCaption{{#1}}%
626 \fi
627 \clist_put_right:Nn\l_clist_Caption{{#2}}%
628 \ifx\relax#3\relax
629 \clist_put_right:Nn\l_clist_Label{{}}%
630 \else
631 \clist_put_right:Nn\l_clist_Label{{#3}}%
632 \fi
633 \@ifnextchar+\do@multiFloat@ii%
634 {\def\hvSet@CapWidth{n}%
635 \do@@@@hvFloat}%
636 }
637 \ExplSyntaxOff
638
639 \newcount\hv@cnta
640 \newcount\hv@cntb
641
642 \def\hvFloat@ii[#1]#2#3{% #1: key/value, #2: floattype, #3: object
643 \hv@maxImageWidth=\textwidth
644 % \ifx\relax#1\relax\else\setkeys{hvSet}{#1}\fi
645 \gdef\hv@floatType{#2}%
646 \ifx\relax#2\relax
647 \setkeys{hvSet}{nonFloat,onlyText}%
648 \xdef\hv@save@setting{\hv@save@setting,nonFloat,onlyText}% for later use after \endgroup inside figure/table env
649 \else
650 \xdef\hv@save@setting{\hv@save@setting}% for later use after \endgroup inside figure/table env
651 \fi
652 % \xdef\hv@floatListOfExt{\@nameuse{ext@\hv@floatType}}%
653 \ifhv@useOBox\gdef\hv@floatObject{\usebox\hvOBox}\else\gdef\hv@floatObject{#3}\fi
654 % \gdef\hv@floatObject{#3}%
655 \@ifnextchar[{\do@@hvFloat}{\do@@hvFloat[]}%
656 }
657
658 \def\do@@hvFloat[#1]#2#3{% #1: listof caption, #2. long caption #3: label
659 \gdef\hv@shortCap{#1}%
660 \gdef\hv@longCap{#2}%
661 \gdef\hv@label{#3}%
662 \ifhv@capbeside\def\@@temp{1}\else\def\@@temp{0}\fi
663 \ifhv@sameHeight\global\hv@global@sameHeighttrue\else\global\hv@global@sameHeightfalse\fi
664 \global\hvSet@bindCorrection=\hvSet@bindCorr% for doublepage objects
665 \global\hv@floatCapSep=\hvSet@floatCapSep
666 %
667 \ifhv@fullpage
668 \hvfloat@typeout{>>>> do@@hvFloat: fullpage true}%
669 \def\hvSet@CapWidth{n}% relative value
670 \do@@@@hvFloat% fullpage with caption on other page
671 \else
672 \ifhv@FULLPAGE
673 \hvfloat@typeout{>>>> do@@hvFloat: FULLPAGE true}%
674 \def\hvSet@CapWidth{n}% relative value
675 \do@@@@hvFloat% FULLPAGE with caption on other page
676 \else
677 \ifhv@doubleFULLPAGE
678 \hvfloat@typeout{>>>> do@@hvFloat: doubleFULLPAGE true}%
679 \setlength\hvCapWidth{\textheight}%
680 \expandafter\do@hvFloat@doubleFULLPAGE\@@temp% fullpage with caption rotated or under on an odd page
681 \else
682 \ifhv@doubleFullPage
683 \hvfloat@typeout{>>>> do@@hvFloat: doubleFullPage true}%
684 \setlength\hvCapWidth{\textwidth}%
685 \expandafter\do@hvFloat@doubleFullPage\@@temp % fullpage with caption under an odd page
686 \else
687 \ifhv@doublePAGE
688 \hvfloat@typeout{>>>> do@@hvFloat: doublePAGE true}%
689 \expandafter\do@hvFloat@doublePAGE\@@temp % fullpage with caption rotated or under on an odd page
690 \else
691 \ifhv@doublePage
692 \hvfloat@typeout{>>>> do@@hvFloat: doublePage true}%
693 \expandafter\do@hvFloat@doublePage\@@temp% fullpage with caption rotated or under on an odd page
694 \else
695 \ifhv@inMargin
696 \hvfloat@typeout{>>>> do@@hvFloat: inMargin true}%
697 \do@@@hvFloatInMargin
698 \else
699 \hvfloat@typeout{>>>> do@@hvFloat: no special caption}%
700 \do@@@hvFloat
701 \fi
702 \fi
703 \fi
704 \fi
705 \fi
706 \fi
707 \fi
708 }
709 %
710 \def\do@@@hvFloat{% no special float page, caption and image on top of each other or side by side
711 \def\@tempa{90}%
712 \setlength\hvWideWidth{\dimexpr\textwidth+\marginparsep+\marginparwidth-10pt}% Mehr Platz rechts
713 \ifx\hvSet@rotAngle\@tempa
714 \setlength\hvMaxCapWidth{\textheight}%
715 \else
716 \setlength\hvMaxCapWidth{\hvWideWidth}%
717 \fi
718 \ifhv@nonFloat
719 \ifx\hvSet@capPos\hv@Top\else\vspace{\hvNonFloatTopSkip}\fi
720 \fi
721 %
722 % First we save the object in \hvObjectBox
723 %
724 \ifnum\hvSet@objectAngle=0 % rotate the object?
725 \ifhv@useOBox
726 \let\hvObjectBox\hvOBox
727 \else
728 \global\savebox\hvObjectBox{\hv@floatObject}%
729 \fi
730 \else
731 \global\savebox\hvObjectBox{%
732 \rotatebox{\hvSet@objectAngle}{%
733 \ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi
734 }%
735 }%
736 \fi
737 % \ifhv@useOBox\global\savebox\hvOBox{}\fi%%%%%%%%%%%%%
738 \setlength\hvObjectWidth{\wd\hvObjectBox}%
739 %
740 % Now we save the caption with its defined \hvCapWidth
741 %
742 \ifx\hvSet@capWidth\hv@Width% captionwidth=objectwidth
743 \setlength\hvCapWidth{\hvObjectWidth}%
744 \else
745 \ifx\hvSet@capWidth\hv@Height% captionwidth=objectheight
746 \setlength\hvCapWidth{\ht\hvObjectBox}%
747 \else
748 \ifx\hvSet@capWidth\hv@LineWidth% captionwidth=objectheight
749 \setlength\hvCapWidth{\linewidth}%
750 \else
751 \ifx\hvSet@capWidth\hv@Natural% captionwidth=\linewidth-\objectwidth-separation
752 \ifhv@capbeside
753 \ifhv@wide
754 \hvCapWidth=\the\dimexpr\hvWideWidth-\hvObjectWidth-\hv@floatCapSep\relax
755 \else
756 \ifhv@star
757 \hvCapWidth=\the\dimexpr\textwidth-\hvObjectWidth-\hv@floatCapSep\relax
758 \else
759 \hvCapWidth=\the\dimexpr\linewidth-\hvObjectWidth-\hv@floatCapSep\relax
760 \fi
761 \fi
762 \else
763 \setlength\hvCapWidth{\columnwidth}%
764 \fi
765 \else
766 \ifhv@capbeside
767 \ifhv@wide
768 \setlength\hvCapWidth{\hvSet@capWidth\hvWideWidth}%
769 \@tempdima=\the\dimexpr\hvWideWidth-\hvObjectWidth-\hv@floatCapSep\relax % 2, damit nicht zu dicht am Rand
770 \else
771 \setlength\hvCapWidth{\hvSet@capWidth\columnwidth}%
772 \@tempdima=\the\dimexpr\columnwidth-\hvObjectWidth-\hv@floatCapSep\relax
773 \fi
774 \ifdim\hvCapWidth>\@tempdima \hvCapWidth=\@tempdima\fi
775 \else
776 \ifhv@wide
777 \setlength\hvCapWidth{\hvSet@capWidth\hvWideWidth}%
778 \else
779 \setlength\hvCapWidth{\hvSet@capWidth\columnwidth}%
780 \fi
781 \fi
782 \fi
783 \fi
784 \fi
785 \fi
786 \saveCaptionSkip % we put this space ourselve
787 \ifnum\hvSet@capAngle=0 % need rotation?
788 \savebox\hvCaptionBox{% NO rotation
789 \minipage[b]{\hvCapWidth}%% minipage, to get hyphenation
790 % \ifx\relax\hv@caption@format\relax\else\expandafter\captionsetup\expandafter{\hv@caption@format}\fi
791 \ifhv@nonFloat
792 \ifhv@onlyText
793 \hv@longCap
794 \ifhv@onlyTextInTOC\captionlistentry{\hv@longCap}\fi
795 \else
796 \ifx\hv@floatType\hv@figure
797 \ifx\relax\hv@shortCap\relax
798 \figcaption{\hv@longCap\ifx\hv@label\@empty\else\label{\hv@label}\fi}%
799 \else
800 \figcaption[\hv@shortCap]{\hv@longCap\ifx\hv@label\@empty\else\label{\hv@label}\fi}%
801 \fi
802 \else
803 \edef\hvFloat@temp{\hv@shortCap}%
804 % \typeout{Short caption Test!!!!!!!!!!!>/\hv@shortCap/}%
805 \ifx\@empty\hvFloat@temp
806 % \typeout{No Short caption!!!!!!!!!!!>/\hv@shortCap/}%
807 \ifx\relax\hv@label\relax
808 \tabcaption{\hv@longCap}%
809 \else
810 \tabcaption{\hv@longCap\label{\hv@label}}%
811 \fi
812 \else
813 % \typeout{A Short caption!!!!!!!!!!!>|\hv@shortCap|}%
814 \ifx\relax\hv@label\relax
815 \tabcaption[\hv@shortCap]{\hv@longCap}%
816 \else
817 \tabcaption[\hv@shortCap]{\hv@longCap\label{\hv@label}}%
818 \fi
819 \fi
820 \fi
821 \fi
822 \else
823 \ifhv@onlyText
824 \hv@longCap
825 \ifhv@onlyTextInTOC\captionlistentry{\hv@longCap}\fi
826 \else
827 \expandafter\ifx\hv@longCap\@empty \else
828 \let\@captype\hv@floatType
829 \ifx\hv@shortCap\@empty\caption{\hv@longCap}\else\caption[\hv@shortCap]{\hv@longCap}\fi
830 \ifx\hv@label\@empty\else\label{\hv@label}\fi
831 \fi
832 \fi
833 \fi
834 \endminipage
835 }% end CaptionBox without rotation
836 \else
837 \savebox\hvCaptionBox{% with Rotation
838 \rotatebox{\hvSet@capAngle}{%
839 \minipage[b]{\hvCapWidth}%% minipage, to get hyphenation
840 % \ifx\relax\hv@caption@format\relax\else\expandafter\captionsetup\expandafter{\hv@caption@format}\fi
841 \ifhv@nonFloat
842 \ifhv@onlyText
843 \hv@longCap
844 \ifhv@onlyTextInTOC\captionlistentry{\hv@longCap}\fi
845 \else
846 \ifx\hv@floatType\hv@figure
847 \ifx\hv@shortCap\@empty \figcaption{\hv@longCap}\else\figcaption[\hv@shortCap]{\hv@longCap}\fi
848 \else
849 \ifx\hv@shortCap\@empty \tabcaption{\hv@longCap}\else\tabcaption[\hv@shortCap]{\hv@longCap}\fi
850 \fi
851 \fi
852 \else
853 \expandafter\ifx\hv@longCap\@empty \else
854 \ifhv@onlyText
855 \hv@longCap
856 \ifhv@onlyTextInTOC\captionlistentry{\hv@longCap}\fi
857 \else
858 \let\@captype\hv@floatType
859 \ifx\hv@shortCap\@empty \caption{\hv@longCap}\else\caption[\hv@shortCap]{\hv@longCap}%
860 \fi
861 \fi
862 \fi
863 \fi
864 \ifx\hv@label\@empty\else\label{\hv@label}\fi
865 \endminipage
866 }% rotatebox
867 }% \sbox
868 \fi
869 %
870 % now we have the object and the caption with the right
871 % rotated angles saved in different boxes
872 %%
873 \restoreCaptionSkip% save old values
874 % \def\fps@figure{\hvSet@floatPos}%
875 \ifx\hvSet@floatPos\@empty % use type default
876 \else
877 \@namedef{fps@\hv@floatType}{\hvSet@floatPos}%
878 \fi
879 \ifhv@nonFloat
880 \noindent
881 \begingroup% Start the nonfloat part
882 \else
883 \ifhv@star
884 \ifx\hvSet@floatPos\hv@floatBottom
885 \@nameuse{\hv@floatType*}[b]% Start the floating environment *****************************
886 \else
887 \@nameuse{\hv@floatType*}%
888 \fi
889 \else
890 \begin{\hv@floatType}% Start the floating environment
891 \fi
892 \fi
893 \ifx\hvSet@objectPos\hv@Right\raggedleft\fi
894 \ifx\hvSet@objectPos\hv@Center
895 \ifhv@nonFloat\hspace*{\fill}\else\centering\fi
896 \fi
897 \ifx\hvSet@objectPos\hv@Outer
898 \checkoddpage
899 \ifoddpage\raggedleft\fi
900 \fi
901 \ifx\hvSet@objectPos\hv@Inner
902 \checkoddpage
903 \ifoddpage\else\raggedleft\fi
904 \fi
905 %
906 % to rotate object and caption together, we save all in another box
907 % the caption comes first, if its on the left or the top
908 % 0 caption left, inner and odd page, oneside inner
909 % 1 caption top
910 % 2 caption right, inner and even page, oneside outer
911 % 3 caption bottom
912 %
913 \ifx\hvSet@capPos\hv@Left
914 \hv@@capPos=0
915 \else
916 \ifx\hvSet@capPos\hv@Top
917 \hv@@capPos=1
918 \else
919 \ifx\hvSet@capPos\hv@Right
920 \hv@@capPos=2
921 \else
922 \ifx\hvSet@capPos\hv@Bottom
923 \hv@@capPos=3
924 \else
925 \ifx\hvSet@capPos\hv@Inner
926 \checkoddpage
927 \ifoddpageoroneside\hv@@capPos=0\else\hv@@capPos=2\fi
928 \else
929 \ifx\hvSet@capPos\hv@Outer
930 \checkoddpage
931 \ifoddpage\hv@@capPos=2\else\hv@@capPos=0\fi
932 % \ifoddpageoroneside\hv@@capPos=2\else\hv@@capPos=0\fi
933 % even page (left=0) | odd page (oneside) (right=2)
934 \else
935 \ifx\hvSet@capPos\hv@Before
936 \hv@@capPos=0% same as cappos=left
937 \else
938 \ifx\hvSet@capPos\hv@After
939 \hv@@capPos=2% same as capPos=right
940 \fi
941 \fi
942 \fi
943 \fi
944 \fi
945 \fi
946 \fi
947 \fi
948 %%%%
949 \test@typeout{>>>>>>>>>Pos: \the\hv@@capPos}%
950 \savebox{\@tempboxa}{% ***** @tempbox start
951 \expandafter%
952 \ifcase\the\hv@@capPos % 0 is LEFT START \ifcase
953 \ifx\hvSet@capVPos\hv@Center
954 \put@CaptionBox
955 \hspace{\hv@floatCapSep}% capfloatsep
956 \put@ObjectBox
957 \else
958 \ifx\hvSet@capVPos\hv@Top% caption and object at top aligned
959 \put@CaptionBox[1]%
960 \hspace{\hv@floatCapSep}% capfloatsep
961 \put@ObjectBox[1]%
962 \else% caption on bottom
963 \put@CaptionBox[2]%
964 \hspace{\hv@floatCapSep}% capfloatsep
965 \put@ObjectBox[2]%
966 \fi
967 \fi% end caption left
968 \or%1 is top
969 \ifdim\wd\hvCaptionBox>\wd\hvObjectBox
970 \begin{minipage}{\wd\hvCaptionBox}%
971 \else
972 \begin{minipage}{\wd\hvObjectBox}%
973 \fi
974 \ifx\hvSet@capHPos\hv@Left% horizontal justification
975 \raggedright
976 \else
977 \ifx\hvSet@capHPos\hv@Center
978 \centering
979 \else
980 \raggedleft
981 \fi
982 \fi
983 \ifhv@fbox
984 \fbox{\usebox{\hvCaptionBox}}\\[0.5\hvBelowCaptionSkip]%
985 \fbox{\usebox{\hvObjectBox}}%
986 \else
987 \usebox{\hvCaptionBox}\\[0.5\hvBelowCaptionSkip]%
988 \usebox{\hvObjectBox}%
989 \fi
990 \end{minipage}%
991 \or%2 is right
992 \ifx\hvSet@capVPos\hv@Center
993 \put@ObjectBox
994 \hspace{\hv@floatCapSep}%
995 \put@CaptionBox
996 \else
997 \ifx\hvSet@capVPos\hv@Top
998 \put@ObjectBox[1]%
999 \hspace{\hv@floatCapSep}% capfloatsep
1000 \put@CaptionBox[1]%
1001 \else
1002 \put@ObjectBox[2]% bottom
1003 \hspace{\hv@floatCapSep}% capfloatsep
1004 \put@CaptionBox[2]%
1005 \fi
1006 \fi
1007 \or%3 bottom
1008 \ifdim\wd\hvCaptionBox>\wd\hvObjectBox
1009 \begin{minipage}{\wd\hvCaptionBox}%
1010 \else
1011 \begin{minipage}{\wd\hvObjectBox}%
1012 \fi
1013 \ifx\hvSet@capHPos\hv@Left% horizontal justification
1014 \raggedright
1015 \else
1016 \ifx\hvSet@capHPos\hv@Center
1017 \centering
1018 \else
1019 \raggedleft
1020 \fi
1021 \fi
1022 \ifhv@fbox
1023 \fbox{\usebox{\hvObjectBox}}\\[0.5\hvAboveCaptionSkip]%
1024 \fbox{\usebox{\hvCaptionBox}}%
1025 \else
1026 \ifhv@objectFrame\fbox[boxsep=\hv@fboxSep,,\hv@fboxLines]{\usebox{\hvObjectBox}}\else\usebox{\hvObjectBox}\fi\\[0.5\hvAboveCaptionSkip]%
1027 \usebox{\hvCaptionBox}%
1028 \fi
1029 \end{minipage}%
1030 \fi% \ifcase\the\hv@@capPos
1031 }% End savebox Object and caption %%%%%%%%%%%%%%%%% @tempboxa
1032 %
1033 % now we rotate the object and caption, if needed
1034 %
1035 \ifhv@wide
1036 \checkoddpage
1037 \ifoddpageoroneside
1038 \if@twocolumn
1039 \if@firstcolumn
1040 \noindent
1041 \hspace*{\dimexpr-\marginparwidth-\marginparsep}% oddpage first column
1042 \fi
1043 \fi
1044 \else
1045 \checkoddpage
1046 \ifoddpage
1047 \if@twocolumn
1048 \if@firstcolumn
1049 \noindent
1050 \hspace*{\dimexpr-\marginparwidth-\marginparsep}% oddpage first column
1051 \fi
1052 \fi
1053 \else% evenpage
1054 \if@firstcolumn
1055 \noindent
1056 \hspace*{\dimexpr-\marginparwidth-\marginparsep}% <- for wide and left page
1057 \fi
1058 \fi
1059 \fi
1060 \fi
1061 \ifx\hvSet@rotAngle\hv@Zero
1062 \usebox{\@tempboxa}%
1063 \else
1064 \rotatebox{\hvSet@rotAngle}{\usebox{\@tempboxa}}%
1065 \fi
1066 \ifhv@nonFloat
1067 \ifx\hvSet@objectPos\hv@Center
1068 % \ifhv@nonFloat
1069 \hspace{\fill}%
1070 % \fi
1071 \fi
1072 \endgroup% End the nonfloat part
1073 \vspace{\medskipamount}% last vertical skip
1074 \else
1075 \ifhv@star
1076 \@nameuse{end\hv@floatType*}% End the floating environment
1077 \else
1078 \end{\hv@floatType}% End the floating environment
1079 \fi
1080 \fi
1081 \endgroup% startet at main \hvFloat
1082 }
1083
1084
1085 \def\do@@@hvFloatInMargin{% no special float page, caption and image on top of each other or side by side
1086 \def\@tempa{90}%
1087 \ifx\hvSet@rotAngle\@tempa \setlength\hvMaxCapWidth{\textheight}\else\setlength\hvMaxCapWidth{\marginparwidth}\fi
1088 %
1089 % First we save the object in \hvObjectBox
1090 %
1091 \ifnum\hvSet@objectAngle=0 % rotate the object?
1092 \ifhv@useOBox\global\let\hvObjectBox\hvOBox\else\global\savebox\hvObjectBox{\hv@floatObject}\fi
1093 \else
1094 \global\savebox\hvObjectBox{\rotatebox{\hvSet@objectAngle}{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}}%
1095 \fi
1096 \setlength\hvObjectWidth{\wd\hvObjectBox}%
1097 %%%\ifhv@useOBox\global\savebox\hvOBox{}\fi%%%%%%%%%%%%%%%%%%%
1098 %
1099 % Now we save the caption with its defined \hvCapWidth
1100 %
1101 \renewcommand*{\raggedleftmarginnote}{}%
1102 \renewcommand*{\raggedrightmarginnote}{}%
1103 \marginnote{%
1104 \ifx\hvSet@capWidth\hv@Width \setlength\hvCapWidth{\hvObjectWidth}%
1105 \else
1106 \ifx\hvSet@capWidth\hv@Height \setlength\hvCapWidth{\ht\hvObjectBox}%
1107 \else
1108 \ifx\hvSet@capWidth\hv@LineWidth \setlength\hvCapWidth{\marginparwidth}%
1109 \else
1110 \ifx\hvSet@capWidth\hv@Natural% captionwidth=\linewidth-\objectwidth-separation
1111 \ifhv@capbeside
1112 \hvCapWidth=\the\dimexpr\marginparwidth-\hvObjectWidth-\hv@floatCapSep\relax
1113 \else
1114 \setlength\hvCapWidth{\marginparwidth}%
1115 \fi
1116 \else
1117 \ifhv@capbeside
1118 \setlength\hvCapWidth{\hvSet@capWidth\marginparwidth}%
1119 \@tempdima=\the\dimexpr\marginparwidth-\hvObjectWidth-\hv@floatCapSep\relax
1120 \ifdim\hvCapWidth>\@tempdima \hvCapWidth=\@tempdima \fi
1121 \else
1122 \setlength\hvCapWidth{\hvSet@capWidth\marginwidth}%
1123 \fi
1124 \fi
1125 \fi
1126 \fi
1127 \fi
1128 \saveCaptionSkip% we put this space ourselve
1129 \ifnum\hvSet@capAngle=0 % need rotation?
1130 \savebox\hvCaptionBox{% NO rotation
1131 \minipage[b]{\hvCapWidth}%% minipage, to get hyphenation
1132 \ifx\hv@floatType\hv@figure
1133 \ifx\relax\hv@shortCap\relax
1134 \figcaption{\hv@longCap\ifx\hv@label\@empty\else\label{\hv@label}\fi}%
1135 \else
1136 \figcaption[\hv@shortCap]{\hv@longCap\ifx\hv@label\@empty\else\label{\hv@label}\fi}%
1137 \fi
1138 \else
1139 \ifx\relax\hv@shortCap\relax
1140 \tabcaption{\hv@longCap\ifx\hv@label\@empty\else\label{\hv@label}\fi}%
1141 \else
1142 \tabcaption[\hv@shortCap]{\hv@longCap\ifx\hv@label\@empty\else\label{\hv@label}\fi}%
1143 \fi
1144 \fi
1145 \endminipage
1146 }% end CaptionBox without rotation
1147 \else
1148 \savebox\hvCaptionBox{% with Rotation
1149 \rotatebox{\hvSet@capAngle}{%
1150 \minipage[b]{\hvCapWidth}%% minipage, to get hyphenation
1151 \ifx\hv@floatType\hv@figure
1152 \ifx\hv@shortCap\@empty \figcaption{\hv@longCap}\else\figcaption[\hv@shortCap]{\hv@longCap}\fi
1153 \else
1154 \ifx\hv@shortCap\@empty \tabcaption{\hv@longCap}\else\tabcaption[\hv@shortCap]{\hv@longCap}\fi
1155 \fi
1156 \ifx\hv@label\@empty\else\label{\hv@label}\fi
1157 \endminipage
1158 }% rotatebox
1159 }% end \avesbox
1160 \fi
1161 %
1162 % now we have the object and the caption with the right
1163 % rotated angles saved in different boxes
1164 %%
1165 \restoreCaptionSkip% save old values
1166 % \def\fps@figure{\hvSet@floatPos}%
1167 \ifx\hvSet@floatPos\@empty \else\@namedef{fps@\hv@floatType}{\hvSet@floatPos}\fi
1168 \noindent
1169 \begingroup% Start the nonfloat part
1170 \ifx\hvSet@objectPos\hv@Right \raggedleft\fi
1171 \ifx\hvSet@objectPos\hv@Center \hspace*{\fill}\fi
1172 \ifx\hvSet@objectPos\hv@Outer \checkoddpage\ifoddpage\raggedleft\fi\fi
1173 \ifx\hvSet@objectPos\hv@Inner \checkoddpage\ifoddpage\else\raggedleft\fi\fi
1174 %
1175 % to rotate object and caption together, we save all in another box
1176 % the caption comes first, if its on the left or the top
1177 % 0 caption left, inner and odd page, oneside inner
1178 % 1 caption top
1179 % 2 caption right, inner and even page, oneside outer
1180 % 3 caption bottom
1181 %
1182 % \checkoddpage
1183 \ifx\hvSet@capPos\hv@Left \hv@@capPos=0
1184 \else
1185 \ifx\hvSet@capPos\hv@Top \hv@@capPos=1
1186 \else
1187 \ifx\hvSet@capPos\hv@Right \hv@@capPos=2
1188 \else
1189 \ifx\hvSet@capPos\hv@Bottom \hv@@capPos=3
1190 \else
1191 \ifx\hvSet@capPos\hv@Inner \checkoddpage\ifoddpageoroneside\hv@@capPos=0\else\hv@@capPos=2\fi
1192 \else
1193 \ifx\hvSet@capPos\hv@Outer \checkoddpage\ifoddpage\hv@@capPos=2\else\hv@@capPos=0\fi
1194 % \ifoddpageoroneside\hv@@capPos=2\else\hv@@capPos=0\fi
1195 % even page (left=0) | odd page (oneside) (right=2)
1196 \else
1197 \ifx\hvSet@capPos\hv@Before \hv@@capPos=0% same as cappos=left
1198 \else
1199 \ifx\hvSet@capPos\hv@After \hv@@capPos=2% same as capPos=right
1200 \fi
1201 \fi
1202 \fi
1203 \fi
1204 \fi
1205 \fi
1206 \fi
1207 \fi
1208 %%%%
1209 \test@typeout{>>>>>>>>>Pos: \the\hv@@capPos}%
1210 \savebox{\@tempboxa}{% ***** @tempbox start
1211 \expandafter\ifcase\the\hv@@capPos % 0 is LEFT START \ifcase
1212 \ifx\hvSet@capVPos\hv@Center
1213 \put@CaptionBox
1214 \hspace{\hv@floatCapSep}% capfloatsep
1215 \put@ObjectBox
1216 \else
1217 \ifx\hvSet@capVPos\hv@Top% caption and object at top aligned
1218 \put@CaptionBox[1]%
1219 \hspace{\hv@floatCapSep}% capfloatsep
1220 \put@ObjectBox[1]%
1221 \else% caption on bottom
1222 \put@CaptionBox[2]%
1223 \hspace{\hv@floatCapSep}% capfloatsep
1224 \put@ObjectBox[2]%
1225 \fi
1226 \fi% end caption left
1227 \or%1 is top
1228 \ifdim\wd\hvCaptionBox>\wd\hvObjectBox
1229 \begin{minipage}{\wd\hvCaptionBox}%
1230 \else
1231 \begin{minipage}{\wd\hvObjectBox}%
1232 \fi
1233 \ifx\hvSet@capHPos\hv@Left% horizontal justification
1234 \raggedright
1235 \else
1236 \ifx\hvSet@capHPos\hv@Center \centering\else\raggedleft\fi
1237 \fi
1238 \ifhv@fbox
1239 \fbox{\usebox{\hvCaptionBox}}\\[0.5\hvBelowCaptionSkip]%
1240 \fbox{\usebox{\hvObjectBox}}%
1241 \else
1242 \usebox{\hvCaptionBox}\\[0.5\hvBelowCaptionSkip]%
1243 \usebox{\hvObjectBox}%
1244 \fi
1245 \end{minipage}%
1246 \or%2 is right
1247 \ifx\hvSet@capVPos\hv@Center
1248 \put@ObjectBox
1249 \hspace{\hv@floatCapSep}%
1250 \put@CaptionBox
1251 \else
1252 \ifx\hvSet@capVPos\hv@Top
1253 \put@ObjectBox[1]%
1254 \hspace{\hv@floatCapSep}% capfloatsep
1255 \put@CaptionBox[1]%
1256 \else
1257 \put@ObjectBox[2]% bottom
1258 \hspace{\hv@floatCapSep}% capfloatsep
1259 \put@CaptionBox[2]%
1260 \fi
1261 \fi
1262 \or%3 bottom
1263 \ifdim\wd\hvCaptionBox>\wd\hvObjectBox\begin{minipage}{\wd\hvCaptionBox}\else\begin{minipage}{\wd\hvObjectBox}\fi
1264 \ifx\hvSet@capHPos\hv@Left% horizontal justification
1265 \raggedright
1266 \else
1267 \ifx\hvSet@capHPos\hv@Center \centering\else\raggedleft\fi
1268 \fi
1269 \ifhv@fbox
1270 \fbox{\usebox{\hvObjectBox}}\\[0.5\hvAboveCaptionSkip]%
1271 \fbox{\usebox{\hvCaptionBox}}%
1272 \else
1273 \ifhv@objectFrame\fbox[boxsep=\hv@fboxSep,,\hv@fboxLines]{\usebox{\hvObjectBox}}\else\usebox{\hvObjectBox}\fi\\[0.5\hvAboveCaptionSkip]%
1274 \usebox{\hvCaptionBox}%
1275 \fi
1276 \end{minipage}%
1277 \fi% \ifcase\the\hv@@capPos
1278 }% End savebox Object and caption %%%%%%%%%%%%%%%%% @tempboxa
1279 %
1280 % now we rotate the object and caption, if needed
1281 %
1282 \ifx\hvSet@rotAngle\hv@Zero\usebox{\@tempboxa}\else\rotatebox{\hvSet@rotAngle}{\usebox{\@tempboxa}}\fi
1283 \ifx\hvSet@objectPos\hv@Center \hspace{\fill}\fi
1284 \endgroup% End the nonfloat part
1285 }% end marginnote
1286 \endgroup}% end of \marginnote and \@@@hvFloatInMargin
1287
1288 %
1289 \newenvironment{hvFloatEnv}[1][\textwidth]
1290 {\minipage{#1}}
1291 {\endminipage}
1292 %
1293
1294 \ExplSyntaxOn
1295 \let\clist@item@Nn\clist_item:Nn
1296 \let\l@clist@Type\l_clist_Type
1297 \let\l@clist@LofCaption\l_clist_LofCaption
1298 \let\l@clist@Label\l_clist_Label
1299 \let\clist@count@N\clist_count:N
1300 \ExplSyntaxOff
1301
1302 \def\do@@@@hvFloat{% special float page: caption <-> FULLPAGE images
1303 % \ifhv@useOBox\gdef\hv@floatObject{\usebox\hvOBox}\fi
1304 \hvfloat@typeout{>>>do@@@@hvFloat: special float page}%
1305 \ifx\hvSet@capPos\hv@After \global\hv@@capPos=1
1306 \else
1307 \ifx\hvSet@capPos\hv@Even \global\hv@@capPos=2
1308 \else
1309 \ifx\hvSet@capPos\hv@Odd \global\hv@@capPos=3
1310 \else
1311 \ifx\hvSet@capPos\hv@Inner \global\hv@@capPos=4
1312 \else
1313 \ifx\hvSet@capPos\hv@Outer \global\hv@@capPos=5
1314 \else
1315 \ifx\hvSet@capPos\hv@Right \global\hv@@capPos=6 % only for twocolumn mode
1316 \else
1317 \ifx\hvSet@capPos\hv@Left \global\hv@@capPos=7 % only for twocolumn mode
1318 \else
1319 \global\hv@@capPos=0
1320 \fi
1321 \fi
1322 \fi
1323 \fi
1324 \fi
1325 \fi
1326 \fi
1327 \hvfloat@typeout{>>>do@@@@hvFloat: hv@capPos is \the\hv@@capPos}%
1328 % \checkoddpage
1329 \hvfloat@typeout{>>>do@@@@hvFloat: set floattype}%
1330 \set@caption@object{\hv@floatType}% set caption and object into a box
1331 %
1332 \ifcase\hv@@capPos% caption before object 0-> _always_ left
1333 \hvfloat@typeout{>>>do@@@@hvFloat: setBottomCaption and setPageObject (0)}%
1334 \setBottomCaption\setPageObject
1335 \or% caption after object 1-> _always_ right
1336 \hvfloat@typeout{>>>do@@@@hvFloat: setPageObject and setBottomCaption (1)}%
1337 \setPageObject\setBottomCaption
1338 \or% caption on even page 2-> left page
1339 \checkoddpage
1340 \ifoddpage
1341 \hvfloat@typeout{>>>do@@@@hvFloat: afterpage-> oddpage/setBottomCaption and setPageObject (2)}%
1342 \afterpage{%
1343 \setBottomCaption
1344 \global\savebox\hvObjectBox{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
1345 \setPageObject
1346 }%
1347 \else% we are on an even page
1348 \hvfloat@typeout{>>>do@@@@hvFloat: evenpage/setBottomCaption and setPageObject (2)}%
1349 \setBottomCaption\setPageObject
1350 \fi
1351 \or% caption on odd page 3->right page
1352 \if@twoside
1353 \hvfloat@typeout{>>>do@@@@hvFloat: twoside and caption on oddpage (3)}%
1354 \if@twocolumn
1355 \hvfloat@typeout{>>>do@@@@hvFloat: twoside/twocolumn and caption on oddpage (3)}%
1356 \checkoddpage
1357 \ifoddpage
1358 \hvfloat@typeout{>>>do@@@@hvFloat: twoside/twocolumn/oddpage and caption on oddpage (3)}%
1359 \if@firstcolumn% on right side
1360 \hvfloat@typeout{>>>do@@@@hvFloat: twoside/twocolumn/oddpage/firstcolumn and caption on oddpage (3)}%
1361 \setBottomCaption\setPageObject
1362 \else
1363 \hvfloat@typeout{>>>do@@@@hvFloat: afterpage->twoside/twocolumn/oddpage/secondcolumn and caption on oddpage (3)}%
1364 \afterpage{%
1365 \global\savebox\hvObjectBox{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
1366 \setPageObject\setBottomCaption
1367 }% start next column
1368 \fi
1369 \else% left (even) page
1370 \hvfloat@typeout{>>>do@@@@hvFloat: twoside/twocolumn/oddpage and caption on evenpage (3)}%
1371 \if@firstcolumn
1372 \hvfloat@typeout{>>>do@@@@hvFloat: afterpage->twoside/twocolumn/evenpage/firstcolumn and caption on oddpage (3)}%
1373 \afterpage{\global\savebox\hvObjectBox{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
1374 \setPageObject\setBottomCaption
1375 }% start next column
1376 \else
1377 \hvfloat@typeout{>>>do@@@@hvFloat: twoside/twocolumn/evenage/secondcolumn and caption on oddpage (3)}%
1378 \setPageObject\setBottomCaption
1379 \fi
1380 \fi
1381 \else% onecolumn
1382 \hvfloat@typeout{>>>do@@@@hvFloat: twoside/onecolumn and caption on oddpage (3)}%
1383 \checkoddpage
1384 \ifoddpage
1385 \hvfloat@typeout{>>>do@@@@hvFloat: twoside/onecolumn/oddpage and caption on oddpage (3)}%
1386 \setPageObject\setBottomCaption
1387 \else% even page
1388 \hvfloat@typeout{>>>do@@@@hvFloat: afterpage->twoside/onecolumn/evenpage and caption on oddpage (3)}%
1389 \afterpage{%
1390 \global\savebox\hvObjectBox{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
1391 \setPageObject\setBottomCaption
1392 }%
1393 \fi
1394 \fi
1395 \else% oneside
1396 \hvfloat@typeout{>>>do@@@@hvFloat: oneside and caption on oddpage (3)}%
1397 \if@twocolumn
1398 \hvfloat@typeout{>>>do@@@@hvFloat: oneside/twocolumn and caption on oddpage (3)}%
1399 \checkoddpage
1400 \ifoddpage
1401 \hvfloat@typeout{>>>do@@@@hvFloat: oneside/twocolumn/oddpage and caption on oddpage (3)}%
1402 \if@firstcolumn% on right side
1403 \hvfloat@typeout{>>>do@@@@hvFloat: oneside/twocolumn/oddpage/firstcolumn and caption on oddpage (3)}%
1404 \setBottomCaption\setPageObject
1405 \else
1406 \hvfloat@typeout{>>>do@@@@hvFloat: oneside/twocolumn/oddpage/secondcolumn and caption on oddpage (3)}%
1407 \setPageObject\setBottomCaption
1408 \fi
1409 \else
1410 \hvfloat@typeout{>>>do@@@@hvFloat: oneside/twocolumn/evenpage and caption on oddpage (3)}%
1411 \if@firstcolumn% on left side
1412 \hvfloat@typeout{>>>do@@@@hvFloat: afterpage->oneside/twocolumn/evenpage/firstcolumn and caption on oddpage (3)}%
1413 \afterpage{%
1414 \global\savebox\hvObjectBox{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
1415 \setPageObject\setBottomCaption
1416 }%
1417 \else
1418 \hvfloat@typeout{>>>do@@@@hvFloat: oneside/twocolumn/evenpage/secondcolumn and caption on oddpage (3)}%
1419 \setPageObject\setBottomCaption
1420 \fi
1421 \fi
1422 \else % onecolumn
1423 \hvfloat@typeout{>>>do@@@@hvFloat: oneside/onecolumn and caption on oddpage (3)}%
1424 \checkoddpage
1425 \ifoddpage
1426 \hvfloat@typeout{>>>do@@@@hvFloat: oneside/onecolumn/oddpage and caption on oddpage (3)}%
1427 \setBottomCaption\setPageObject%
1428 \else
1429 \hvfloat@typeout{>>>do@@@@hvFloat: afterpage->oneside/onecolumn/evenpage and caption on oddpage (3)}%
1430 \afterpage{\setBottomCaption
1431 \global\savebox\hvObjectBox{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
1432 \setPageObject}%
1433 \fi
1434 \fi
1435 \fi
1436 \or% caption on the inner column 4->inner
1437 % \set@caption@object
1438 \if@twocolumn
1439 \hvfloat@typeout{>>>do@@@@hvFloat: twocolumn and caption on inner column (4)}%
1440 \checkoddpage
1441 \ifoddpage
1442 \hvfloat@typeout{>>>do@@@@hvFloat: twoside/oddpage and caption on inner column (4)}%
1443 \if@firstcolumn% on right side
1444 \hvfloat@typeout{>>>do@@@@hvFloat: twoside/oddpage/firstcolumn and caption on inner column (4)}%
1445 \setBottomCaption\setPageObject
1446 \else % right column on right side
1447 \hvfloat@typeout{>>>do@@@@hvFloat: twoside/oddpage/secondcolumn and caption on inner column (4)}%
1448 \setPageObject\setBottomCaption% start next firstcolumn next page
1449 \fi
1450 \else
1451 \hvfloat@typeout{>>>do@@@@hvFloat: twoside/evenpage and caption on inner column (4)}%
1452 \if@firstcolumn% on left side
1453 \hvfloat@typeout{>>>do@@@@hvFloat: afterpage^2 -> twoside/evenpage/firstcolumn and caption on inner column (4)}%
1454 \afterpage{\afterpage{%
1455 \setBottomCaption
1456 \global\savebox\hvObjectBox{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
1457 \setPageObject}%
1458 }% start next page/first column
1459 \else% left page/column
1460 \hvfloat@typeout{>>>do@@@@hvFloat: twoside/evenpage/secondcolumn and caption on inner column (4)}%
1461 \setBottomCaption\setPageObject% start on same page/column
1462 \fi
1463 \fi
1464 \else% onecolumn
1465 \hvfloat@typeout{>>>do@@@@hvFloat: onecolumn and caption on inner column (4)}%
1466 \setBottomCaption\setPageObject
1467 \fi
1468 \or% caption on the outer column 5->outer
1469 % \set@caption@object
1470 \if@twocolumn
1471 \hvfloat@typeout{>>>do@@@@hvFloat: twocolumn and caption on outer column (5)}%
1472 \checkoddpage
1473 \ifoddpage
1474 \hvfloat@typeout{>>>do@@@@hvFloat: twocolumn/oddpage and caption on outer column (5)}%
1475 \if@firstcolumn
1476 \hvfloat@typeout{>>>do@@@@hvFloat: afterpage^2 -> firstcolumn/oddpage/twocolumn and caption on outer column (5)}%
1477 \afterpage{\afterpage{%
1478 \global\savebox\hvObjectBox{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
1479 \setBottomCaption\setPageObject}}%
1480 \else
1481 \hvfloat@typeout{>>>do@@@@hvFloat: afterpage -> twocolumn/oddpage/secondcolumn and caption on outer column (5)}%
1482 \afterpage{%
1483 \setBottomCaption
1484 \global\savebox\hvObjectBox{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
1485 \setPageObject}%
1486 \fi
1487 \else% even page (left)
1488 \hvfloat@typeout{>>>do@@@@hvFloat: twocolumn/evenpage and caption on outer column (5)}%
1489 \if@firstcolumn
1490 \hvfloat@typeout{>>>do@@@@hvFloat: twocolumn/evenpage/firstcolumn and caption on outer column (5)}%
1491 \setBottomCaption\setPageObject
1492 \else
1493 \hvfloat@typeout{>>>do@@@@hvFloat: twocolumn/evenpage/secondolumn and caption on outer column (5)}%
1494 %%% !!!! to-do: !!!!
1495 \fi
1496 \fi
1497 \else% onecolumn
1498 \setBottomCaption\setPageObject
1499 \fi
1500 \or% caption after object on same page 6->right for twocolumn
1501 \if@twocolumn
1502 \hvfloat@typeout{>>>do@@@@hvFloat: twocolumn and caption after object (6)}%
1503 \if@firstcolumn
1504 \hvfloat@typeout{>>>do@@@@hvFloat: afterpage -> twocolumn/firstcolumn and caption after object (6)}%
1505 \afterpage{%
1506 \global\savebox\hvObjectBox{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
1507 \setPageObject\setBottomCaption}%
1508 \else
1509 \hvfloat@typeout{>>>do@@@@hvFloat: twocolumn/secondcolumn and caption after object (6)}%
1510 \setPageObject\setBottomCaption
1511 \fi
1512 \else% always caption _after_ object for onecolumn
1513 \hvfloat@typeout{>>>do@@@@hvFloat: onecolumn and caption after object (6)}%
1514 \setPageObject\setBottomCaption
1515 \fi
1516 \or% caption before object on same page 7->left for twocolumn
1517 \if@twocolumn
1518 \hvfloat@typeout{>>>do@@@@hvFloat: twocolumn and caption before object (7)}%
1519 \if@firstcolumn
1520 \hvfloat@typeout{>>>do@@@@hvFloat: twocolumn/firstcolumn and caption before object (7)}%
1521 \setBottomCaption\setPageObject
1522 \else
1523 \hvfloat@typeout{>>>do@@@@hvFloat: afterpage -> twocolumn/secondcolumn and caption before object (7)}%
1524 % \global\savebox\hvObjectBox{\hv@floatObject}%
1525 \afterpage{%
1526 \global\savebox\hvObjectBox{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
1527 \setBottomCaption\setPageObject}%
1528 \fi
1529 \else% onecolumn -> same as before
1530 \hvfloat@typeout{>>>do@@@@hvFloat: onecolumn and caption before object (7)}%
1531 \setBottomCaption\setPageObject
1532 \fi
1533 \fi
1534 \endgroup% startet at main \hvFloat
1535 }
1536
1537 \newsavebox\hv@boxLeftPage
1538 \newsavebox\hv@boxRightPage
1539 \newif\ifhv@temp
1540
1541 \input{hvfloat-3.inc}% doublePage
1542
1543 \input{hvfloat-2.inc}% doublePAGE
1544
1545 \input{hvfloat-1.inc}% doubleFULLPAGE
1546
1547 \input{hvfloat-0.inc}% doubleFullPage
1548
1549 \ExplSyntaxOn
1550
1551 \def\getMultiCaptionAndLabel{%
1552 \ifhv@twoColumnCaption\hv@tempWidthA=\textwidth \else \hv@tempWidthA=\linewidth\fi
1553 \global\sbox\hvCaptionBox{\minipage[b]{\hv@tempWidthA}%
1554 \captionsetup{aboveskip=\z@,belowskip=\z@,position=below,parbox=none}%,skip=-1ex}%
1555 \expandafter\hvFloatSet\expandafter{\hv@save@setting}%
1556 \parskip=-0.5\baselineskip
1557 \hv@cntb=\clist_count:N\l_clist_Type
1558 \advance\hv@cntb by \@ne
1559 \hv@cnta=1
1560 \loop
1561 \edef\@captype{\clist_item:Nn\l_clist_Type{\hv@cnta}}%
1562 \edef\@tempa{\clist_item:Nn\l_clist_LofCaption{\hv@cnta}}%
1563 \ifx\@tempa\@empty
1564 \caption{\clist_item:Nn\l_clist_Caption{\hv@cnta}}%
1565 \else
1566 \expandafter\caption\expandafter[\@tempa]{\clist_item:Nn\l_clist_Caption{\hv@cnta}}%
1567 \fi
1568 \edef\@tempa{\clist_item:Nn\l_clist_Label{\hv@cnta}}%
1569 \ifx\@tempa\@empty
1570 \else
1571 \expandafter\label\expandafter{\clist_item:Nn\l_clist_Label{\hv@cnta}-cap}\fi
1572 \advance\hv@cnta by \@ne
1573 \ifnum\hv@cnta<\hv@cntb
1574 \repeat
1575 \vspace{-\baselineskip}% no vspace at the end
1576 \endminipage}%
1577 }
1578
1579 \def\getMultiObjectAndLabel{%
1580 \global\savebox\hvObjectBox{%
1581 \ifhv@vFill
1582 \minipage[b][\textheight][s]{\columnwidth}%
1583 \else
1584 \minipage{\columnwidth}%
1585 \fi
1586 \expandafter\hvFloatSet\expandafter{\hv@save@setting}%
1587 \ifx\hvSet@objectPos\hv@Right\raggedleft\else
1588 \ifx\hvSet@objectPos\hv@Left\raggedleft\else
1589 \ifx\hvSet@objectPos\hv@Center\centering
1590 \fi\fi\fi
1591 \hv@cntb=\clist_count:N\l_clist_Type
1592 \advance\hv@cntb by \@ne
1593 \hv@cnta=1
1594 \loop
1595 \def\@temp{\clist_item:Nn\l_clist_Object{\hv@cnta}}%
1596 \ifhv@objectFrame\fbox[boxsep=\hv@fboxSep,,\hv@fboxLines]{\@temp}\else\@temp\fi
1597 \edef\@tempa{\clist_item:Nn\l_clist_Label{\hv@cnta}}%
1598 \edef\@tempb{\clist_item:Nn\l_clist_Type{\hv@cnta}}%
1599 \edef\@captype{hv@p\@tempb}%
1600 \ifx\@tempa\@empty
1601 \else
1602 \refstepcounter{\@captype}%
1603 \expandafter\label\expandafter{\clist_item:Nn\l_clist_Label{\hv@cnta}}%
1604 \fi
1605 \ifnum\hv@cnta<\clist_count:N\l_clist_Type\par\hv@vskip\fi
1606 \advance\hv@cnta by \@ne
1607 \ifnum\hv@cnta<\hv@cntb
1608 \ifhv@vFill\vfill\fi
1609 \repeat
1610 \endminipage}%
1611 }
1612 \def\getMultiSubCaptionAndLabel{%
1613 \global\sbox\hvCaptionBox{%
1614 \minipage{\linewidth}%
1615 \expandafter\hvFloatSet\expandafter{\hv@save@setting}%
1616 \setlength\belowcaptionskip{5pt}%
1617 \setlength\abovecaptionskip{0pt}%
1618 \xdef\@captype{\clist_item:Nn\l_clist_Type{1}}% the same for all subfloats
1619 \edef\@tempa{\clist_item:Nn\l_clist_LofCaption{1}}%
1620 \ifx\@tempa\@empty
1621 \caption{\clist_item:Nn\l_clist_Caption{1}}%
1622 \else
1623 \expandafter\caption\expandafter[\@tempa]{\clist_item:Nn\l_clist_Caption{1}}%
1624 \fi
1625 \edef\@tempa{\clist_item:Nn\l_clist_Label{1}}%
1626 \ifx\@tempa\@empty\else\expandafter\label\expandafter{\clist_item:Nn\l_clist_Label{1}-cap}\fi
1627 \endminipage}%
1628 }
1629
1630 \def\getMultiSubObjectAndLabel{%
1631 \global\savebox\hvObjectBox{%
1632 \expandafter\hvFloatSet\expandafter{\hv@save@setting}%
1633 \ifhv@vFill
1634 \minipage[b][\textheight][s]{\columnwidth}%
1635 \captionsetup{belowskip=0pt}%
1636 \else
1637 \minipage{\columnwidth}%
1638 \fi
1639 % \ifx\hv@subcaption@format\@empty\else
1640 % \expandafter
1641 % \captionsetup\expandafter[\expandafter s\expandafter u\expandafter b\expandafter]\expandafter
1642 % {\hv@subcaption@format}%
1643 % \fi
1644 \ifx\hvSet@objectPos\hv@Right\raggedleft\else
1645 \ifx\hvSet@objectPos\hv@Left\raggedleft\else
1646 \ifx\hvSet@objectPos\hv@Center\centering
1647 \fi\fi\fi
1648 \hv@cntb=\clist_count:N\l_clist_Caption
1649 \advance\hv@cntb by \@ne
1650 \hv@cnta=2
1651 \edef\@captype{\clist_item:Nn\l_clist_Type{1}}% the same for all subfloats
1652 \ifx\@tempa\@empty
1653 \else
1654 % \refstepcounter{\@captype}%
1655 % \expandafter\label\expandafter{\@tempa}%
1656 \fi
1657 \loop
1658 \def\@temp{\clist_item:Nn\l_clist_Object{\hv@cnta}}%
1659 \ifhv@objectFrame\fbox[boxsep=\hv@fboxSep,,\hv@fboxLines]{\@temp}\else\@temp\fi
1660 \begingroup
1661 \edef\@tempa{\clist_item:Nn\l_clist_LofCaption{\hv@cnta}}%
1662 \ifx\@tempa\@empty
1663 \subcaption{\clist_item:Nn\l_clist_Caption{\hv@cnta}}%
1664 \else
1665 \expandafter\subcaption\expandafter[\@tempa]{\clist_item:Nn\l_clist_Caption{\hv@cnta}}%
1666 \fi
1667 \edef\@tempa{\clist_item:Nn\l_clist_Label{\hv@cnta}}%
1668 \ifx\@tempa\@empty
1669 \else
1670 \expandafter\label\expandafter{\clist_item:Nn\l_clist_Label{\hv@cnta}}%
1671 \fi
1672 \endgroup
1673 \ifnum\hv@cnta<\clist_count:N\l_clist_Type\par\hv@vskip\fi
1674 \advance\hv@cnta by \@ne
1675 \ifnum\hv@cnta<\hv@cntb
1676 \ifhv@vFill\vfill\fi
1677 \repeat
1678 \edef\@tempa{\clist_item:Nn\l_clist_Label{1}}% the main label at the end
1679 \ifx\@tempa\@empty
1680 \else
1681 \edef\@temp{hv@p\@captype}%
1682 \refstepcounter{\@temp}%
1683 \expandafter\label\expandafter{\@tempa}%
1684 \fi
1685 \endminipage}%
1686 }
1687 \ExplSyntaxOff
1688
1689 \def\getSingleCaptionAndLabel{%
1690 \global\sbox\hvCaptionBox{\minipage{\linewidth}%
1691 \expandafter\hvFloatSet\expandafter{\hv@save@setting}%
1692 \setlength\belowcaptionskip{5pt}%
1693 \setlength\abovecaptionskip{0pt}%
1694 \ifhv@onlyText
1695 \hv@longCap
1696 \ifhv@onlyTextInTOC\captionlistentry{\hv@longCap}\fi
1697 \else
1698 \edef\@captype{\hv@floatType}%
1699 \expandafter\ifx\expandafter\relax\hv@shortCap\relax
1700 \expandafter\ifx\hv@longCap\@empty \else% empty caption?
1701 \caption{\hv@longCap}%
1702 \fi
1703 \else
1704 \expandafter\ifx\hv@longCap\@empty
1705 \caption[\hv@shortCap]{}%
1706 \else
1707 \caption[\hv@shortCap]{\hv@longCap}%
1708 \fi
1709 \fi
1710 \fi
1711 \ifx\hv@label\@empty\else\label{\hv@label-cap}\fi
1712 \endminipage}%
1713 }
1714
1715 \def\set@caption@object#1{% first caption, then object #1=\hv@floatType
1716 \ifhv@multiFloat
1717 \setcounter{hv@pfigure}{\value{figure}}%
1718 \setcounter{hv@ptable}{\value{table}}%
1719 \getMultiCaptionAndLabel
1720 \else
1721 \ifhv@subFloat
1722 \setcounter{hv@pfigure}{\value{figure}}%
1723 \setcounter{hv@ptable}{\value{table}}%
1724 \getMultiSubCaptionAndLabel
1725 \else
1726 \getSingleCaptionAndLabel
1727 \fi
1728 \fi
1729 \edef\@captype{hv@p#1}%
1730 \ifhv@multiFloat
1731 \getMultiObjectAndLabel
1732 \else
1733 \ifhv@subFloat
1734 \getMultiSubObjectAndLabel
1735 \else
1736 \global\savebox\hvObjectBox{%
1737 \refstepcounter{\@captype}%
1738 \ifhv@objectFrame\fbox[boxsep=\hv@fboxSep,,\hv@fboxLines]{\hv@floatObject}\else\hv@floatObject\fi
1739 \expandafter\ifx\expandafter\relax\hv@label\relax
1740 \else
1741 \expandafter\label\expandafter{\hv@label}%
1742 \fi
1743 }%
1744 \fi
1745 \fi
1746 }
1747 %
1748 \endinput