summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/hvfloat/latex/hvfloat.sty
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/hvfloat/latex/hvfloat.sty')
-rw-r--r--macros/latex/contrib/hvfloat/latex/hvfloat.sty118
1 files changed, 82 insertions, 36 deletions
diff --git a/macros/latex/contrib/hvfloat/latex/hvfloat.sty b/macros/latex/contrib/hvfloat/latex/hvfloat.sty
index a5a5e51c65..5c4539a9b2 100644
--- a/macros/latex/contrib/hvfloat/latex/hvfloat.sty
+++ b/macros/latex/contrib/hvfloat/latex/hvfloat.sty
@@ -1,4 +1,4 @@
-%% $Id: hvfloat.sty 876 2024-03-03 14:04:56Z herbert $
+%% $Id: hvfloat.sty 879 2024-03-17 10:44:09Z herbert $
%%
%%
%% IMPORTANT NOTICE:
@@ -16,8 +16,8 @@
%% `hvfloat' offers rotating of captions and objects for floats
%%
\NeedsTeXFormat{LaTeX2e}
-\def\fileversion{2.48}
-\def\filedate{2024/03/03}
+\def\fileversion{2.49}
+\def\filedate{2024/03/17}
\ProvidesPackage{hvfloat}[\filedate\space v\fileversion\space special floating objects (hv)]
\let\hvFloatFileVersion\fileversion
%
@@ -58,6 +58,7 @@
\RequirePackage{zref-savepos}
\newdimen\@tempx
\newdimen\@tempy
+\newcounter{hvfloat@testCtr}
\newcounter{hvfloat@ref}
\renewcommand\thehvfloat@ref{tmp@\arabic{hvfloat@ref}}
\setcounter{hvfloat@ref}{0}
@@ -196,6 +197,9 @@
\define@boolkey{hvSet}[hv@]{twoColumnCaption}[true]\global\@nameuse{hv@twoColumnCaption#1}{}% Write the caption only as text
\define@boolkey{hvSet}[hv@]{sameHeight}[true]{\@nameuse{hv@sameHeight#1}}% Write the caption only as text
\define@boolkey{hvSet}[hv@]{Debug}[true]{}% give more infos in the terminal
+\define@boolkey{hvSet}[hv@]{test}[true]{}% use of the hvOBox contents
+
+\def\test@typeout#1{\ifhv@test\typeout{>>>test\thehvfloat@testCtr:>#1}\fi}
\newif\ifhv@fullpage
\newif\ifhv@FULLPAGE
@@ -531,12 +535,13 @@
\def\hvFloat{\@ifnextchar*% Main macro
- {\checkoddpage\global\hv@startrue\hv@maxImageWidth=\textwidth\hvFloat@i}%
- {\checkoddpage\global\hv@starfalse\hv@maxImageWidth=\columnwidth\hvFloat@i*}%
+ {\global\hv@startrue\hv@maxImageWidth=\textwidth\hvFloat@i}%
+ {\global\hv@starfalse\hv@maxImageWidth=\columnwidth\hvFloat@i*}%
}
\def\hvFloat@i*{\@ifnextchar[{\do@hvFloat}{\do@hvFloat[]}}
\def\do@hvFloat[#1]{%
+ \ifhv@Debug\marginnote{\textbf{hvFloat}}\fi%
%\marginnote{\textbf{hvFloat}}%
\savebox\hvObjectBox{}%
\begingroup
@@ -553,6 +558,9 @@
\setcounter{hv@tempCNTtabB}{\value{table}}%
\gdef\hv@save@setting{#1}% for later use after \endgroup inside figure/table env
\ifx\relax#1\relax\else\setkeys{hvSet}{#1}\fi
+ \global\stepcounter{hvfloat@ref}%
+ \test@typeout{>>>test:>hvfloat@ref \thehvfloat@ref}%
+ \global\stepcounter{hvfloat@testCtr}% use anyway, it's only for debugging
\ifx\hv@caption@format\@empty\else\expandafter\captionsetup\expandafter{\hv@caption@format}\fi
\ifx\hv@subcaption@format\@empty\else
\expandafter
@@ -608,7 +616,6 @@
}
\ExplSyntaxOff
-
\newcount\hv@cnta
\newcount\hv@cntb
@@ -623,7 +630,8 @@
\xdef\hv@save@setting{\hv@save@setting}% for later use after \endgroup inside figure/table env
\fi
% \xdef\hv@floatListOfExt{\@nameuse{ext@\hv@floatType}}%
- \gdef\hv@floatObject{#3}%
+ \ifhv@useOBox\gdef\hv@floatObject{\usebox\hvOBox}\else\gdef\hv@floatObject{#3}\fi
+% \gdef\hv@floatObject{#3}%
\@ifnextchar[{\do@@hvFloat}{\do@@hvFloat[]}%
}
@@ -644,7 +652,7 @@
\ifhv@FULLPAGE
\hvfloat@typeout{>>>> do@@hvFloat: FULLPAGE true}%
\def\hvSet@CapWidth{n}% relative value
- \do@@@@hvFloat% fullpage with caption on other page
+ \do@@@@hvFloat% FULLPAGE with caption on other page
\else
\ifhv@doubleFULLPAGE
\hvfloat@typeout{>>>> do@@hvFloat: doubleFULLPAGE true}%
@@ -702,7 +710,7 @@
}%
}%
\fi
- \ifhv@useOBox\global\savebox\hvOBox{}\fi
+% \ifhv@useOBox\global\savebox\hvOBox{}\fi%%%%%%%%%%%%%
\setlength\hvObjectWidth{\wd\hvObjectBox}%
%
% Now we save the caption with its defined \hvCapWidth
@@ -844,15 +852,16 @@
\begin{\hv@floatType}% Start the floating environment
\fi
\fi
- \checkoddpage
\ifx\hvSet@objectPos\hv@Right\raggedleft\fi
\ifx\hvSet@objectPos\hv@Center
\ifhv@nonFloat\hspace*{\fill}\else\centering\fi
\fi
\ifx\hvSet@objectPos\hv@Outer
+ \checkoddpage
\ifoddpage\raggedleft\fi
\fi
\ifx\hvSet@objectPos\hv@Inner
+ \checkoddpage
\ifoddpage\else\raggedleft\fi
\fi
%
@@ -876,9 +885,11 @@
\hv@@capPos=3
\else
\ifx\hvSet@capPos\hv@Inner
+ \checkoddpage
\ifoddpageoroneside\hv@@capPos=0\else\hv@@capPos=2\fi
\else
\ifx\hvSet@capPos\hv@Outer
+ \checkoddpage
\ifoddpage\hv@@capPos=2\else\hv@@capPos=0\fi
% \ifoddpageoroneside\hv@@capPos=2\else\hv@@capPos=0\fi
% even page (left=0) | odd page (oneside) (right=2)
@@ -897,7 +908,7 @@
\fi
\fi
%%%%
-%\typeout{>>>>>>>>>Pos: \the\hv@@capPos}%
+\test@typeout{>>>>>>>>>Pos: \the\hv@@capPos}%
\savebox{\@tempboxa}{% ***** @tempbox start
\expandafter%
\ifcase\the\hv@@capPos % 0 is LEFT START \ifcase
@@ -984,6 +995,7 @@
% now we rotate the object and caption, if needed
%
\ifhv@wide
+ \checkoddpage
\ifoddpageoroneside
\if@twocolumn
\if@firstcolumn
@@ -992,6 +1004,7 @@
\fi
\fi
\else
+ \checkoddpage
\ifoddpage
\if@twocolumn
\if@firstcolumn
@@ -1042,7 +1055,7 @@
\global\savebox\hvObjectBox{\rotatebox{\hvSet@objectAngle}{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}}%
\fi
\setlength\hvObjectWidth{\wd\hvObjectBox}%
- \ifhv@useOBox\global\savebox\hvOBox{}\fi
+ %%%\ifhv@useOBox\global\savebox\hvOBox{}\fi%%%%%%%%%%%%%%%%%%%
%
% Now we save the caption with its defined \hvCapWidth
%
@@ -1115,11 +1128,10 @@
\ifx\hvSet@floatPos\@empty \else\@namedef{fps@\hv@floatType}{\hvSet@floatPos}\fi
\noindent
\begingroup% Start the nonfloat part
- %\checkoddpage
\ifx\hvSet@objectPos\hv@Right \raggedleft\fi
\ifx\hvSet@objectPos\hv@Center \hspace*{\fill}\fi
- \ifx\hvSet@objectPos\hv@Outer \ifoddpage\raggedleft\fi\fi
- \ifx\hvSet@objectPos\hv@Inner \ifoddpage\else\raggedleft\fi\fi
+ \ifx\hvSet@objectPos\hv@Outer \checkoddpage\ifoddpage\raggedleft\fi\fi
+ \ifx\hvSet@objectPos\hv@Inner \checkoddpage\ifoddpage\else\raggedleft\fi\fi
%
% to rotate object and caption together, we save all in another box
% the caption comes first, if its on the left or the top
@@ -1128,6 +1140,7 @@
% 2 caption right, inner and even page, oneside outer
% 3 caption bottom
%
+% \checkoddpage
\ifx\hvSet@capPos\hv@Left \hv@@capPos=0
\else
\ifx\hvSet@capPos\hv@Top \hv@@capPos=1
@@ -1136,9 +1149,9 @@
\else
\ifx\hvSet@capPos\hv@Bottom \hv@@capPos=3
\else
- \ifx\hvSet@capPos\hv@Inner \ifoddpageoroneside\hv@@capPos=0\else\hv@@capPos=2\fi
+ \ifx\hvSet@capPos\hv@Inner \checkoddpage\ifoddpageoroneside\hv@@capPos=0\else\hv@@capPos=2\fi
\else
- \ifx\hvSet@capPos\hv@Outer \ifoddpage\hv@@capPos=2\else\hv@@capPos=0\fi
+ \ifx\hvSet@capPos\hv@Outer \checkoddpage\ifoddpage\hv@@capPos=2\else\hv@@capPos=0\fi
% \ifoddpageoroneside\hv@@capPos=2\else\hv@@capPos=0\fi
% even page (left=0) | odd page (oneside) (right=2)
\else
@@ -1154,7 +1167,7 @@
\fi
\fi
%%%%
-%\typeout{>>>>>>>>>Pos: \the\hv@@capPos}%
+\test@typeout{>>>>>>>>>Pos: \the\hv@@capPos}%
\savebox{\@tempboxa}{% ***** @tempbox start
\expandafter\ifcase\the\hv@@capPos % 0 is LEFT START \ifcase
\ifx\hvSet@capVPos\hv@Center
@@ -1247,7 +1260,8 @@
\let\clist@count@N\clist_count:N
\ExplSyntaxOff
-\def\do@@@@hvFloat{% special float page: caption <-> fullpage images
+\def\do@@@@hvFloat{% special float page: caption <-> FULLPAGE images
+% \ifhv@useOBox\gdef\hv@floatObject{\usebox\hvOBox}\fi
\hvfloat@typeout{>>>do@@@@hvFloat: special float page}%
\ifx\hvSet@capPos\hv@After \global\hv@@capPos=1
\else
@@ -1259,9 +1273,9 @@
\else
\ifx\hvSet@capPos\hv@Outer \global\hv@@capPos=5
\else
- \ifx\hvSet@capPos\hv@Right \global\hv@@capPos=6% only for twocolumn mode
+ \ifx\hvSet@capPos\hv@Right \global\hv@@capPos=6 % only for twocolumn mode
\else
- \ifx\hvSet@capPos\hv@Left \global\hv@@capPos=7% only for twocolumn mode
+ \ifx\hvSet@capPos\hv@Left \global\hv@@capPos=7 % only for twocolumn mode
\else
\global\hv@@capPos=0
\fi
@@ -1272,9 +1286,10 @@
\fi
\fi
\hvfloat@typeout{>>>do@@@@hvFloat: hv@capPos is \the\hv@@capPos}%
- %\checkoddpage
+% \checkoddpage
\hvfloat@typeout{>>>do@@@@hvFloat: set floattype}%
\set@caption@object{\hv@floatType}% set caption and object into a box
+%
\ifcase\hv@@capPos% caption before object 0-> _always_ left
\hvfloat@typeout{>>>do@@@@hvFloat: setBottomCaption and setPageObject (0)}%
\setBottomCaption\setPageObject
@@ -1282,9 +1297,13 @@
\hvfloat@typeout{>>>do@@@@hvFloat: setPageObject and setBottomCaption (1)}%
\setPageObject\setBottomCaption
\or% caption on even page 2-> left page
+ \checkoddpage
\ifoddpage
\hvfloat@typeout{>>>do@@@@hvFloat: afterpage-> oddpage/setBottomCaption and setPageObject (2)}%
- \afterpage{\setBottomCaption\setPageObject}%
+ \afterpage{%
+ \setBottomCaption
+ \global\savebox\hvObjectBox{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
+ \setPageObject}%
\else% we are on an even page
\hvfloat@typeout{>>>do@@@@hvFloat: evenpage/setBottomCaption and setPageObject (2)}%
\setBottomCaption\setPageObject
@@ -1294,6 +1313,7 @@
\hvfloat@typeout{>>>do@@@@hvFloat: twoside and caption on oddpage (3)}%
\if@twocolumn
\hvfloat@typeout{>>>do@@@@hvFloat: twoside/twocolumn and caption on oddpage (3)}%
+ \checkoddpage
\ifoddpage
\hvfloat@typeout{>>>do@@@@hvFloat: twoside/twocolumn/oddpage and caption on oddpage (3)}%
\if@firstcolumn% on right side
@@ -1301,13 +1321,16 @@
\setBottomCaption\setPageObject
\else
\hvfloat@typeout{>>>do@@@@hvFloat: afterpage->twoside/twocolumn/oddpage/secondcolumn and caption on oddpage (3)}%
- \afterpage{\setPageObject\setBottomCaption}% start next column
+ \afterpage{%
+ \global\savebox\hvObjectBox{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
+ \setPageObject\setBottomCaption}% start next column
\fi
\else% left (even) page
\hvfloat@typeout{>>>do@@@@hvFloat: twoside/twocolumn/oddpage and caption on evenpage (3)}%
\if@firstcolumn
\hvfloat@typeout{>>>do@@@@hvFloat: afterpage->twoside/twocolumn/evenpage/firstcolumn and caption on oddpage (3)}%
- \afterpage{\setPageObject\setBottomCaption}% start next column
+ \afterpage{\global\savebox\hvObjectBox{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
+ \setPageObject\setBottomCaption}% start next column
\else
\hvfloat@typeout{>>>do@@@@hvFloat: twoside/twocolumn/evenage/secondcolumn and caption on oddpage (3)}%
\setPageObject\setBottomCaption
@@ -1315,18 +1338,22 @@
\fi
\else% onecolumn
\hvfloat@typeout{>>>do@@@@hvFloat: twoside/onecolumn and caption on oddpage (3)}%
+ \checkoddpage
\ifoddpage
\hvfloat@typeout{>>>do@@@@hvFloat: twoside/onecolumn/oddpage and caption on oddpage (3)}%
\setPageObject\setBottomCaption
\else% even page
\hvfloat@typeout{>>>do@@@@hvFloat: afterpage->twoside/onecolumn/evenpage and caption on oddpage (3)}%
- \afterpage{\setPageObject\setBottomCaption}%
+ \afterpage{%
+ \global\savebox\hvObjectBox{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
+ \setPageObject\setBottomCaption}%
\fi
\fi
\else% oneside
\hvfloat@typeout{>>>do@@@@hvFloat: oneside and caption on oddpage (3)}%
\if@twocolumn
\hvfloat@typeout{>>>do@@@@hvFloat: oneside/twocolumn and caption on oddpage (3)}%
+ \checkoddpage
\ifoddpage
\hvfloat@typeout{>>>do@@@@hvFloat: oneside/twocolumn/oddpage and caption on oddpage (3)}%
\if@firstcolumn% on right side
@@ -1340,7 +1367,9 @@
\hvfloat@typeout{>>>do@@@@hvFloat: oneside/twocolumn/evenpage and caption on oddpage (3)}%
\if@firstcolumn% on left side
\hvfloat@typeout{>>>do@@@@hvFloat: afterpage->oneside/twocolumn/evenpage/firstcolumn and caption on oddpage (3)}%
- \afterpage{\setPageObject\setBottomCaption}%
+ \afterpage{%
+ \global\savebox\hvObjectBox{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
+ \setPageObject\setBottomCaption}%
\else
\hvfloat@typeout{>>>do@@@@hvFloat: oneside/twocolumn/evenpage/secondcolumn and caption on oddpage (3)}%
\setPageObject\setBottomCaption
@@ -1348,12 +1377,15 @@
\fi
\else % onecolumn
\hvfloat@typeout{>>>do@@@@hvFloat: oneside/onecolumn and caption on oddpage (3)}%
+ \checkoddpage
\ifoddpage
\hvfloat@typeout{>>>do@@@@hvFloat: oneside/onecolumn/oddpage and caption on oddpage (3)}%
- \setBottomCaption\setPageObject
+ \setBottomCaption\setPageObject%
\else
\hvfloat@typeout{>>>do@@@@hvFloat: afterpage->oneside/onecolumn/evenpage and caption on oddpage (3)}%
- \afterpage{\setBottomCaption\setPageObject}%
+ \afterpage{\setBottomCaption
+ \global\savebox\hvObjectBox{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
+ \setPageObject}%
\fi
\fi
\fi
@@ -1361,11 +1393,12 @@
% \set@caption@object
\if@twocolumn
\hvfloat@typeout{>>>do@@@@hvFloat: twocolumn and caption on inner column (4)}%
+ \checkoddpage
\ifoddpage
\hvfloat@typeout{>>>do@@@@hvFloat: twoside/oddpage and caption on inner column (4)}%
\if@firstcolumn% on right side
\hvfloat@typeout{>>>do@@@@hvFloat: twoside/oddpage/firstcolumn and caption on inner column (4)}%
- \setBottomCaption\setPageObject
+ \setBottomCaption\setPageObject
\else % right column on right side
\hvfloat@typeout{>>>do@@@@hvFloat: twoside/oddpage/secondcolumn and caption on inner column (4)}%
\setPageObject\setBottomCaption% start next firstcolumn next page
@@ -1374,7 +1407,10 @@
\hvfloat@typeout{>>>do@@@@hvFloat: twoside/evenpage and caption on inner column (4)}%
\if@firstcolumn% on left side
\hvfloat@typeout{>>>do@@@@hvFloat: afterpage^2 -> twoside/evenpage/firstcolumn and caption on inner column (4)}%
- \afterpage{\afterpage{\setBottomCaption\setPageObject}}% start next page/first column
+ \afterpage{\afterpage{%
+ \setBottomCaption
+ \global\savebox\hvObjectBox{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
+ \setPageObject}}% start next page/first column
\else% left page/column
\hvfloat@typeout{>>>do@@@@hvFloat: twoside/evenpage/secondcolumn and caption on inner column (4)}%
\setBottomCaption\setPageObject% start on same page/column
@@ -1388,14 +1424,20 @@
% \set@caption@object
\if@twocolumn
\hvfloat@typeout{>>>do@@@@hvFloat: twocolumn and caption on outer column (5)}%
+ \checkoddpage
\ifoddpage
\hvfloat@typeout{>>>do@@@@hvFloat: twocolumn/oddpage and caption on outer column (5)}%
\if@firstcolumn
\hvfloat@typeout{>>>do@@@@hvFloat: afterpage^2 -> firstcolumn/oddpage/twocolumn and caption on outer column (5)}%
- \afterpage{\afterpage{\setBottomCaption\setPageObject}}%
+ \afterpage{\afterpage{%
+ \global\savebox\hvObjectBox{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
+ \setBottomCaption\setPageObject}}%
\else
\hvfloat@typeout{>>>do@@@@hvFloat: afterpage -> twocolumn/oddpage/secondcolumn and caption on outer column (5)}%
- \afterpage{\setBottomCaption\setPageObject}%
+ \afterpage{%
+ \setBottomCaption
+ \global\savebox\hvObjectBox{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
+ \setPageObject}%
\fi
\else% even page (left)
\hvfloat@typeout{>>>do@@@@hvFloat: twocolumn/evenpage and caption on outer column (5)}%
@@ -1415,7 +1457,9 @@
\hvfloat@typeout{>>>do@@@@hvFloat: twocolumn and caption after object (6)}%
\if@firstcolumn
\hvfloat@typeout{>>>do@@@@hvFloat: afterpage -> twocolumn/firstcolumn and caption after object (6)}%
- \afterpage{\setPageObject\setBottomCaption}%
+ \afterpage{%
+ \global\savebox\hvObjectBox{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
+ \setPageObject\setBottomCaption}%
\else
\hvfloat@typeout{>>>do@@@@hvFloat: twocolumn/secondcolumn and caption after object (6)}%
\setPageObject\setBottomCaption
@@ -1432,7 +1476,10 @@
\setBottomCaption\setPageObject
\else
\hvfloat@typeout{>>>do@@@@hvFloat: afterpage -> twocolumn/secondcolumn and caption before object (7)}%
- \afterpage{\setBottomCaption\setPageObject}%
+% \global\savebox\hvObjectBox{\hv@floatObject}%
+ \afterpage{%
+ \global\savebox\hvObjectBox{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
+ \setBottomCaption\setPageObject}%
\fi
\else% onecolumn -> same as before
\hvfloat@typeout{>>>do@@@@hvFloat: onecolumn and caption before object (7)}%
@@ -1441,7 +1488,6 @@
\fi
\endgroup% startet at main \hvFloat
}
-%
\newsavebox\hv@boxLeftPage
\newsavebox\hv@boxRightPage