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.sty209
1 files changed, 119 insertions, 90 deletions
diff --git a/macros/latex/contrib/hvfloat/latex/hvfloat.sty b/macros/latex/contrib/hvfloat/latex/hvfloat.sty
index 66a354eae6..cb9f1b0742 100644
--- a/macros/latex/contrib/hvfloat/latex/hvfloat.sty
+++ b/macros/latex/contrib/hvfloat/latex/hvfloat.sty
@@ -1,4 +1,4 @@
-%% $Id: hvfloat.sty 103 2021-05-31 12:37:11Z herbert $
+%% $Id: hvfloat.sty 105 2021-06-07 07:30:15Z herbert $
%%
%%
%% IMPORTANT NOTICE:
@@ -15,8 +15,8 @@
%% `hvfloat' offers rotating of captions and objects for floats
%%
\NeedsTeXFormat{LaTeX2e}
-\def\fileversion{2.26}
-\def\filedate{2021/05/26}
+\def\fileversion{2.27}
+\def\filedate{2021/06/07}
\message{`hvfloat' v\fileversion, \filedate\space (Herbert Voss)}
\ProvidesPackage{hvfloat}[\filedate\ rotating of floating objects]
\let\hvFloatFileVersion\fileversion
@@ -29,6 +29,7 @@
\DeclareOption{fbox}{\hv@fboxtrue\setlength{\fboxsep}{1pt}}
\DeclareOption{hyperref}{\hv@hyperreftrue}
\DeclareOption{nostfloats}{\hv@nostfloatstrue}
+\DeclareOption{no-stfloats}{\hv@nostfloatstrue}
\ProcessOptions
@@ -41,6 +42,9 @@
\PassOptionsToPackage{hypcap}{caption}
\RequirePackage{caption}
+\RequirePackage{varwidth}
+\DeclareCaptionBox{varwidth}{\varwidth[b]{#1}#2\endvarwidth}
+
\PassOptionsToPackage{hypcap}{subcaption}
\RequirePackage{subcaption}
\RequirePackage{atbegshi}
@@ -48,6 +52,7 @@
\RequirePackage{expl3,multido}
\RequirePackage{graphicx}
+\RequirePackage{varwidth}
\RequirePackage{xkeyval}
\RequirePackage{ifoddpage}
@@ -136,7 +141,20 @@
\else
\gdef\hv@@capVPos{t}%
\fi
-}{\PackageWarning{hvfloat}{erroneous input (#1) for capVPos ignored. Using bottom.}%
+}{\PackageWarning{hvfloat}{erroneous input (#1) for capVPos ignored. Using center.}%
+ \def\hvSet@capVPos{center}% it is relativ to the object
+ }
+
+\define@choicekey*+{hvSet}{allHPos}[\val\nr]{left,center,right}[center]{%
+ \def\hvSet@allHPos{#1}%
+ \ifcase\nr\relax
+ \gdef\hv@@allHPos{l}%
+ \or
+ \gdef\hv@@allHPos{c}%
+ \else
+ \gdef\hv@@allHPos{r}%
+ \fi
+}{\PackageWarning{hvfloat}{erroneous input (#1) for allHPos ignored. Using center.}%
\def\hvSet@capVPos{center}% it is relativ to the object
}
@@ -230,8 +248,8 @@
%
\newcommand\setDefaults{%
\hv@set{%
- floatPos=, rotAngle=0, capWidth=n, capAngle=0,
- capPos=bottom, capVPos=center, objectPos=center, objectAngle=0,
+ floatPos=, rotAngle=0, capWidth=n, capAngle=0, objectAngle=0,
+ capPos=bottom, capVPos=center, objectPos=center, allHPos=center,
floatCapSep=5pt, useOBox=false, nonFloat=false,
onlyText=false, wide=false, fullpage=false, FULLPAGE=false,
doubleFULLPAGE=false, doublePage=false, doublePAGE=false,
@@ -273,15 +291,28 @@
\setlength\abovecaptionskip{\hvAboveCaptionSkip}%
\setlength\belowcaptionskip{\hvBelowCaptionSkip}%
}
+
+\providecommand\figcaption[2][]{}%
+\providecommand\tabcaption[2][]{}%
+\providecommand\tabcaptionbelow[2][]{}%
%
-\newcommand\figcaption[2][]{%
- \def\@captype{figure}%
+\renewcommand\figcaption[2][]{%
\begingroup
+ \def\@captype{figure}%
\ifx\relax\hv@caption@format\relax\else\expandafter\captionsetup\expandafter{\hv@caption@format}\fi
\if$#1$ \caption{#2}\else\caption[#1]{#2}\fi
\endgroup}
-\newcommand\tabcaption[2][]{\def\@captype{table}%
+\renewcommand\tabcaption[2][]{%
+ \begingroup
+ \def\@captype{table}%
+ \edef\hv@caption@format{position=top,\hv@caption@format}%
+ \expandafter\captionsetup\expandafter{\hv@caption@format}%
+ \ifx\relax#1\relax \caption{#2}\else\caption[#1]{#2}\fi
+ \endgroup}
+\renewcommand\tabcaptionbelow[2][]{%
\begingroup
+ \def\@captype{table}%
+ \edef\hv@caption@format{position=below,\hv@caption@format}%
\ifx\relax\hv@caption@format\relax\else\expandafter\captionsetup\expandafter{\hv@caption@format}\fi
\ifx\relax#1\relax \caption{#2}\else\caption[#1]{#2}\fi
\endgroup}
@@ -372,6 +403,21 @@
\fi
}
+
+\def\drawSepLine{%
+ \par\noindent
+ \if@twocolumn
+ \ifhv@twoColumnCaption
+ \rule{\linewidth}{0.4pt}\\[-2.5ex]
+ \else
+ \rule{\columnwidth}{0.4pt}\\[-2.5ex]
+ \fi
+ \else
+ \rule{\linewidth}{0.4pt}\\[-2.5ex]
+ \fi
+ \vspace{\hv@sepLineskip}%
+}
+
\newcounter{hv@tempCNTfigA}%
\newcounter{hv@tempCNTfigB}%
\newcounter{hv@tempCNTtabA}%
@@ -415,6 +461,12 @@
\setcounter{hv@tempCNTtabB}{\value{table}}%
\gdef\hv@save@setting{#1}%
\ifx\relax#1\relax\else\setkeys{hvSet}{#1}\fi
+ \ifx\hv@caption@format\@empty\else\expandafter\captionsetup\expandafter{\hv@caption@format}\fi
+ \ifx\hv@subcaption@format\@empty\else
+ \expandafter
+ \captionsetup\expandafter[\expandafter s\expandafter u\expandafter b\expandafter]\expandafter
+ {\hv@subcaption@format}%
+ \fi
\gdef\hv@floatType{figure}% presetting
\@ifnextchar+{\do@multiFloat}{\hvFloat@ii[#1]}%
}
@@ -466,20 +518,6 @@
-\def\drawSepLine{%
- \par\noindent
- \if@twocolumn
- \ifhv@twoColumnCaption
- \rule{\linewidth}{0.4pt}\\[-2.5ex]
- \else
- \rule{\columnwidth}{0.4pt}\\[-2.5ex]
- \fi
- \else
- \rule{\linewidth}{0.4pt}\\[-2.5ex]
- \fi
- \vspace{\hv@sepLineskip}%
-}
-
\newcount\hv@cnta
\newcount\hv@cntb
@@ -597,8 +635,7 @@
\saveCaptionSkip% we put this space ourselve
\ifnum\hvSet@capAngle=0 % need rotation?
\savebox\hvCaptionBox{% NO rotation
- \begin{minipage}[b]{\hvCapWidth}%% minipage, to get hyphenation
- \ifx\hv@caption@format\@empty\else\expandafter\captionsetup\expandafter{\hv@caption@format}\fi
+ \minipage[b]{\hvCapWidth}%% minipage, to get hyphenation
\ifhv@nonFloat
\ifhv@onlyText
\hv@longCap
@@ -625,22 +662,22 @@
\ifx\hv@shortCap\@empty\caption{\hv@longCap}\else\caption[\hv@shortCap]{\hv@longCap}\fi
\fi
\fi
- \ifx\hv@label\@empty\else\label{\hv@label}\fi
- \end{minipage}%
+ \ifx\hv@label\@empty\else\label{\hv@label}\fi
+ \endminipage
}%
\else
\savebox\hvCaptionBox{% Rotation
\rotatebox{\hvSet@capAngle}{%
- \begin{minipage}[b]{\hvCapWidth}%% minipage, to get hyphenation
- \ifx\relax\hv@caption@format\relax\else\expandafter\captionsetup\expandafter{\hv@caption@format}\fi
+ \minipage[b]{\hvCapWidth}%% minipage, to get hyphenation
+% \ifx\relax\hv@caption@format\relax\else\expandafter\captionsetup\expandafter{\hv@caption@format}\fi
\ifhv@nonFloat
\ifhv@onlyText
\hv@longCap
\else
\ifx\hv@floatType\hv@figure
- \ifx\relax\hv@shortCap\relax \figcaption{\hv@longCap}\else\figcaption[\hv@shortCap]{\hv@longCap}\fi
+ \ifx\hv@shortCap\@empty \figcaption{\hv@longCap}\else\figcaption[\hv@shortCap]{\hv@longCap}\fi
\else
- \ifx\relax\hv@shortCap\relax \tabcaption{\hv@longCap}\else\tabcaption[\hv@shortCap]{\hv@longCap}\fi
+ \ifx\hv@shortCap\@empty \tabcaption{\hv@longCap}\else\tabcaption[\hv@shortCap]{\hv@longCap}\fi
\fi
\fi
\else
@@ -648,12 +685,12 @@
\hv@longCap
\else
\let\@captype\hv@floatType
- \ifx\relax\hv@shortCap\relax \caption{\hv@longCap}\else\caption[\hv@shortCap]{\hv@longCap}%
+ \ifx\hv@shortCap\@empty \caption{\hv@longCap}\else\caption[\hv@shortCap]{\hv@longCap}%
\fi
\fi
\fi
\ifx\hv@label\@empty\else\label{\hv@label}\fi
- \end{minipage}%
+ \endminipage
}% rotatebox
}% \sbox
\fi
@@ -735,7 +772,7 @@
\savebox{\@tempboxa}{% ***** @tempbox start
\expandafter\ifcase\the\hv@@capPos% 0 is LEFT START \ifcase
\ifx\hvSet@capVPos\hv@Center
- \put@CaptionBox
+ \put@CaptionBox
\hspace{\hvSet@floatCapSep}% capfloatsep
\put@ObjectBox
\else
@@ -847,8 +884,8 @@
}
%
\newenvironment{hvFloatEnv}[1][\textwidth]
- {\minipage{#1}\center}
- {\endcenter\endminipage}
+ {\minipage{#1}}
+ {\endminipage}
%
\ExplSyntaxOn
@@ -1010,6 +1047,7 @@
\global\setlength\hv@leftPageObjectWidth{\dimexpr\paperwidth-1in-\evensidemargin-\hvSet@bindCorrection}%
\global\setlength\hv@tempWidthA{\the\dimexpr-1in-\oddsidemargin+\hvSet@bindCorrection}%
\xdef\hv@@capAngle{\hvSet@capAngle}%
+ \xdef\hv@caption@format@temp{\hv@caption@format}% it gets lost otherwise for next afterpage
\checkoddpage
\ifoddpage
\if@twocolumn
@@ -1036,7 +1074,7 @@
\afterpage{\afterpage{\do@hvFloat@doublePageCaptionRight{#1}}}%
\fi
\fi
- \endgroup% started at main macro \hvFloat
+ \endgroup% started at main macro \hvFloat
}
%
\def\do@hvFloat@doublePageCaptionRight#1{% image on left and right page with caption on the right page ----------------------------------
@@ -1046,9 +1084,9 @@
\setcounter{totalnumber}{0}%
\setcounter{dbltopnumber}{0}%
\def\dblfloatpagefraction{0.5}%
- \begin{\hv@floatType*}[!thb]
+ \begin{\hv@floatType*}[!t]
\global\savebox{\hvObjectBox}{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
- \clipbox*{0 -\depth{} \hv@leftPageObjectWidth{} \height}{\usebox\hvObjectBox}%
+ \clipbox*{0 -\depth{} \hv@leftPageObjectWidth{} \height}{\usebox\hvObjectBox}%
\ifx\hv@label\@empty
\else
\ifx\hv@floatType\hv@figure
@@ -1060,7 +1098,7 @@
\fi
\end{\hv@floatType*}%
\afterpage{%
- \begin{\hv@floatType*}[!thb]
+ \begin{\hv@floatType*}[!t]
\global\savebox{\hvObjectBox}{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
\hspace*{\hv@tempWidthA}%
\noindent
@@ -1078,45 +1116,37 @@
\fi
\label{\hv@label-2}%
\fi
- \ifnum#1>0 % caption on the right
-% \medskip
- \ifnum\hv@@capAngle > 0
-% \ifdim\dp\hvObjectBox > \z@
-% \rotatebox[origin=c]{\hv@@capAngle}{\parbox{\the\dimexpr\ht\hvObjectBox+\dp\hvObjectBox}{%
-% \ifx\relax\hv@shortCap\relax
-% \captionof{\hv@floatType}{\hv@longCap}%
-% \else
-% \captionof{\hv@floatType}[\hv@shortCap]{\hv@longCap}%
-% \fi
-% \ifx\hv@label\@empty\else\label{\hv@label-cap}\fi
-% }}%
-% \else
- \rotatebox[origin=c]{\hv@@capAngle}{\parbox{\the\dimexpr\ht\hvObjectBox+\dp\hvObjectBox}{%
- \ifx\relax\hv@shortCap\relax
- \captionof{\hv@floatType}{\hv@longCap}%
- \else
- \captionof{\hv@floatType}[\hv@shortCap]{\hv@longCap}%
- \fi
- }}%
- \ifx\relax\hv@label\relax\else\label{\hv@label-cap}\fi
-% \fi
+ \ifx\hv@caption@format@temp\@empty\else
+ \expandafter\captionsetup\expandafter{\hv@caption@format@temp}%
+ \fi
+ \ifnum#1>\z@ % caption on the right
+ \ifnum\hv@@capAngle > \z@
+ \rotatebox[origin=c]{\hv@@capAngle}{\parbox{\the\dimexpr\ht\hvObjectBox+\dp\hvObjectBox}{%
+ \ifx\relax\hv@shortCap\relax
+ \caption{\hv@longCap}%
+ \else
+ \caption[\hv@shortCap]{\hv@longCap}%
+ \fi
+ }}%
+ \ifx\relax\hv@label\relax\else\label{\hv@label-cap}\fi
\else
\hspace{\marginparsep}%
\parbox[\hv@@capVPos]{\hv@tempWidthB}{%
+ \abovecaptionskip=0pt% local inside parbox
\vspace{0pt}%
\ifx\hv@shortCap\@empty
- \captionof{\hv@floatType}{\hv@longCap\ifx\hv@label\@empty\else\label{\hv@label-cap}\fi}%
+ \caption{\hv@longCap}%
\else
- \captionof{\hv@floatType}[\hv@shortCap]{\hv@longCap}
+ \caption[\hv@shortCap]{\hv@longCap}
\fi
}%
\ifx\hv@label\@empty\else\label{\hv@label-cap}\fi
\fi
\else % #1 = 0 caption below
\ifx\relax\hv@shortCap\relax
- \captionof{\hv@floatType}{\hv@longCap}%
+ \caption{\hv@longCap}%
\else
- \captionof{\hv@floatType}[\hv@shortCap]{\hv@longCap}%
+ \caption[\hv@shortCap]{\hv@longCap}%
\fi
\ifx\hv@label\@empty\else\label{\hv@label-cap}\fi
\fi
@@ -1162,7 +1192,7 @@
\afterpage{\do@hvFloat@doublePAGECaptionRight{#1}}%
\fi
\fi
- \endgroup
+ \endgroup% startet at main macro
}
%
\def\do@hvFloat@doublePAGECaptionRight#1{% image on left and right page with caption on the right ----------------------------------
@@ -1226,7 +1256,7 @@
\global\setlength\hv@leftPageObjectWidth{\dimexpr\paperwidth-\hvSet@bindCorrection}%
% \savebox\hv@leftBox{\clipbox*{0 0 \the\hv@leftPageObjectWidth{} \height}{\usebox\hvObjectBox}}%
% \savebox\hv@rightBox{\clipbox*{\the\hv@leftPageObjectWidth{} \depth{} \width{} \height}{\usebox\hvObjectBox}}%
- \expandafter\captionsetup\expandafter{\hv@caption@format}%
+% \expandafter\captionsetup\expandafter{\hv@caption@format}%
\ifoddpage
\ifcase\hv@@capPos % =0 Caption before
\if@twocolumn
@@ -1326,8 +1356,8 @@
\def\set@Normal@Bottom@Caption@{%
\begin{\hv@floatType}[!b]
\ifhv@separatorLine\drawSepLine\fi
- \expandafter\captionsetup\expandafter{\hv@caption@format}%
- \ifx\relax\hv@shortCap\relax
+% \expandafter\captionsetup\expandafter{\hv@caption@format}%
+ \ifx\hv@shortCap\@empty
\captionof{\hv@floatType}{\hv@longCap}%
\else
\captionof{\hv@floatType}[\hv@shortCap]{\hv@longCap}%
@@ -1338,8 +1368,8 @@
\def\set@Normal@Bottom@CaptionStar*{%
\begin{\hv@floatType*}[!b]
\ifhv@separatorLine\drawSepLine\fi
- \expandafter\captionsetup\expandafter{\hv@caption@format}%
- \ifx\relax\hv@shortCap\relax
+% \expandafter\captionsetup\expandafter{\hv@caption@format}%
+ \ifx\hv@shortCap\@empty
\captionof{\hv@floatType}{\hv@longCap}%
\else
\captionof{\hv@floatType}[\hv@shortCap]{\hv@longCap}%
@@ -1416,8 +1446,8 @@
\newpage\if@twocolumn\null\newpage\fi
\begin{\hv@floatType}[!b]
\ifhv@separatorLine\drawSepLine\fi
- \expandafter\captionsetup\expandafter{\hv@caption@format}%
- \ifx\relax\hv@shortCap\relax
+% \expandafter\captionsetup\expandafter{\hv@caption@format}%
+ \ifx\hv@shortCap\@empty
\captionof{\hv@floatType}{\hv@longCap}%
\else
\captionof{\hv@floatType}[\hv@shortCap]{\hv@longCap}%
@@ -1457,8 +1487,8 @@
\begin{\hv@floatType*}[!b]
\hv@twoColumnCaptiontrue
\ifhv@separatorLine\drawSepLine\fi
- \expandafter\captionsetup\expandafter{\hv@caption@format}%
- \ifx\relax\hv@shortCap\relax
+% \expandafter\captionsetup\expandafter{\hv@caption@format}%
+ \ifx\hv@shortCap\@empty
\captionof{\hv@floatType}{\hv@longCap}%
\else
\captionof{\hv@floatType}[\hv@shortCap]{\hv@longCap}%
@@ -1500,8 +1530,8 @@
% \setlength\hv@tempWidthB{\dimexpr\ht\hvCaptionBox+\wd\hvObjectBox+2\hvSet@bindCorrection}%
\ifdim\hv@tempWidthB < 2\paperwidth
\rotatebox[origin=lb]{90}{\makebox[\paperheight][c]{\parbox{0.8\ht\hvObjectBox}{%
- \expandafter\captionsetup\expandafter{\hv@caption@format}%
- \ifx\relax\hv@shortCap\relax
+% \expandafter\captionsetup\expandafter{\hv@caption@format}%
+ \ifx\hv@shortCap\@empty
\captionof{\hv@floatType}{\hv@longCap}%
\else
\captionof{\hv@floatType}[\hv@shortCap]{\hv@longCap}%
@@ -1511,7 +1541,7 @@
\else% ifdim: no space left on page
\put(-2\ht\hvCaptionBox,0.5\ht\hvObjectBox){\makebox(0,0){\rotatebox{90}{\minipage{\textwidth}\centering
\parbox{0.8\textwidth}{%
- \ifx\relax\hv@shortCap\relax
+ \ifx\hv@shortCap\@empty
\captionof{\hv@floatType}{\hv@longCap}%
\else
\captionof{\hv@floatType}[\hv@shortCap]{\hv@longCap}%
@@ -1525,8 +1555,8 @@
\ifdim\hv@tempWidthA > \ht\hvCaptionBox
\else
\put(\the\dimexpr1.5\paperwidth-\wd\hvObjectBox-\hvSet@bindCorrection,\the\dimexpr\ht\hvCaptionBox+\abovecaptionskip+\belowcaptionskip){\makebox[0pt][c]{\parbox{\textwidth}{%%
- \expandafter\captionsetup\expandafter{\hv@caption@format}%
- \ifx\relax\hv@shortCap\relax
+% \expandafter\captionsetup\expandafter{\hv@caption@format}%
+ \ifx\hv@shortCap\@empty
\captionof{\hv@floatType}{\hv@longCap}%
\else
\captionof{\hv@floatType}[\hv@shortCap]{\hv@longCap}%
@@ -1583,7 +1613,7 @@
\def\getMultiCaptionAndLabel{%
\global\sbox\hvCaptionBox{\minipage[b]{\linewidth}%
- \ifx\relax\hv@caption@format\relax\else\expandafter\captionsetup\expandafter{\hv@caption@format}\fi
+% \ifx\relax\hv@caption@format\relax\else\expandafter\captionsetup\expandafter{\hv@caption@format}\fi
\setlength\belowcaptionskip{5pt}%
\setlength\abovecaptionskip{0pt}%
\hv@cntb=\clist_count:N\l_clist_Type
@@ -1614,7 +1644,7 @@
\else
\minipage{\columnwidth}%
\fi
- \ifx\relax\hv@caption@format\relax\else\expandafter\captionsetup\expandafter{\hv@caption@format}\fi
+% \ifx\relax\hv@caption@format\relax\else\expandafter\captionsetup\expandafter{\hv@caption@format}\fi
\ifx\hvSet@objectPos\hv@Right\raggedleft\else
\ifx\hvSet@objectPos\hv@Left\raggedleft\else
\ifx\hvSet@objectPos\hv@Center\centering
@@ -1643,7 +1673,7 @@
\def\getMultiSubCaptionAndLabel{%
\global\sbox\hvCaptionBox{\minipage{\linewidth}%
- \ifx\hv@caption@format\@empty\else\expandafter\captionsetup\expandafter{\hv@caption@format}\fi
+% \ifx\hv@caption@format\@empty\else\expandafter\captionsetup\expandafter{\hv@caption@format}\fi
\setlength\belowcaptionskip{5pt}%
\setlength\abovecaptionskip{0pt}%
\xdef\@captype{\clist_item:Nn\l_clist_Type{1}}% the same for all subfloats
@@ -1665,11 +1695,11 @@
\else
\minipage{\columnwidth}%
\fi
- \ifx\hv@subcaption@format\@empty\else
- \expandafter
- \captionsetup\expandafter[\expandafter s\expandafter u\expandafter b\expandafter]\expandafter
- {\hv@subcaption@format}%
- \fi
+% \ifx\hv@subcaption@format\@empty\else
+% \expandafter
+% \captionsetup\expandafter[\expandafter s\expandafter u\expandafter b\expandafter]\expandafter
+% {\hv@subcaption@format}%
+% \fi
\ifx\hvSet@objectPos\hv@Right\raggedleft\else
\ifx\hvSet@objectPos\hv@Left\raggedleft\else
\ifx\hvSet@objectPos\hv@Center\centering
@@ -1712,7 +1742,6 @@
\def\getSingleCaptionAndLabel{%
\global\sbox\hvCaptionBox{\minipage{\linewidth}%
- \ifx\relax\hv@caption@format\relax\else\expandafter\captionsetup\expandafter{\hv@caption@format}\fi
\setlength\belowcaptionskip{5pt}%
\setlength\abovecaptionskip{0pt}%
\edef\@captype{\hv@floatType}%