From 342f2e1be699f5ec70b5b1c35d9cd59798d37304 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Tue, 4 May 2021 03:01:16 +0000 Subject: CTAN sync 202105040301 --- macros/latex/contrib/hvfloat/latex/hvfloat.sty | 203 +++++++++++++++++-------- 1 file changed, 136 insertions(+), 67 deletions(-) (limited to 'macros/latex/contrib/hvfloat/latex/hvfloat.sty') diff --git a/macros/latex/contrib/hvfloat/latex/hvfloat.sty b/macros/latex/contrib/hvfloat/latex/hvfloat.sty index 1fef91099f..dd27d7af47 100644 --- a/macros/latex/contrib/hvfloat/latex/hvfloat.sty +++ b/macros/latex/contrib/hvfloat/latex/hvfloat.sty @@ -1,4 +1,4 @@ -%% $Id: hvfloat.sty 56 2021-03-15 07:20:37Z herbert $ +%% $Id: hvfloat.sty 73 2021-05-03 07:38:13Z herbert $ %% %% %% IMPORTANT NOTICE: @@ -15,8 +15,8 @@ %% `hvfloat' offers rotating of captions and objects for floats %% \NeedsTeXFormat{LaTeX2e} -\def\fileversion{2.20} -\def\filedate{2021/04/29} +\def\fileversion{2.21} +\def\filedate{2021/05/04} \message{`hvfloat' v\fileversion, \filedate\space (Herbert Voss)} \ProvidesPackage{hvfloat}[\filedate\ rotating of floating objects] \let\hvFloatFileVersion\fileversion @@ -87,7 +87,7 @@ % \def\hv@figure{figure} % -\define@key{hvSet}{floatPos}[htbp]{% LaTeX's position parameters htbp +\define@key{hvSet}{floatPos}[tbp]{% LaTeX's position parameters htbp \def\hvSet@floatPos{#1}% } \define@key{hvSet}{rotAngle}[0]{% rotates caption AND image together @@ -99,25 +99,45 @@ \define@key{hvSet}{capAngle}[0]{% -360..+360 \def\hvSet@capAngle{#1}% } -\define@key{hvSet}{capPos}[bottom]{% (l)eft|(b)ottom|(t)op|(r)ight|(i)nner|(o)uter|(e)ven|o(d)d + + +\define@choicekey*+{hvSet}{capPos}[\val\nr]{bottom,top,left,before,right,after,inner,outer,even,odd}[bottom]{% \def\hvSet@capPos{#1}% it is relativ to the object, (e),(d) only valid for fullpage float - \edef\@tempa{#1}% - \ifx\hv@Bottom\@tempa + \ifcase\nr\relax + \hv@capbesidefalse + \or \hv@capbesidefalse \else - \ifx\hv@Top\@tempa - \hv@capbesidefalse - \else - \hv@capbesidetrue - \fi + \hv@capbesidetrue \fi -} -\define@key{hvSet}{capVPos}[center]{% bottom|center|top - \def\hvSet@capVPos{#1}% it is relativ to the object -} -\define@key{hvSet}{objectPos}[center]{% (l)eft|(c)enter|(r)ight|(i)nner|(o)uter - \def\hvSet@objectPos{#1}% it is relativ to the document -} +}{\PackageWarning{hvfloat}{erroneous input (#1) for capPos ignored. Using bottom.}% + \def\hvSet@capPos{bottom}% it is relativ to the object, (e),(d) only valid for fullpage float + \hv@capbesidefalse + } + +\define@choicekey*+{hvSet}{capVPos}[\val\nr]{bottom,center,top}[center]{% + \def\hvSet@capVPos{#1}% it is relativ to the object +}{\PackageWarning{hvfloat}{erroneous input (#1) for capVPos ignored. Using bottom.}% + \def\hvSet@capVPos{center}% it is relativ to the object + } + +\define@choicekey*+{hvSet}{objectPos}[\val\nr]{left,center,right,inner,outer}[center]{% + \def\hvSet@objectPos{#1}% it is relativ to the object +}{\PackageWarning{hvfloat}{erroneous input (#1) for objectPos ignored. Using center.}% + \def\hvSet@capVPos{center}% it is relativ to the object + } + +\newif\ifhv@floatRefToObject +\define@choicekey*+{hvSet}{floatRef}[\val\nr]{caption,object}[object]{% where the LOF entry should point to + \ifcase\nr\relax + \hv@floatRefToObjectfalse + \else + \hv@floatRefToObjecttrue + \fi +}{\PackageWarning{hvfloat}{erroneous input (#1) for floatRef ignored. Using option object.}% + \hv@floatRefToObjecttrue + } + \define@key{hvSet}{objectAngle}[0]{% -360..+360 \def\hvSet@objectAngle{#1}% } @@ -177,7 +197,8 @@ doubleFULLPAGE=false, doublePage=false, doublePAGE=false, multiFloat=false,subFloat=false, separatorLine,objectFrame=false,multiFloatSkip=\normalbaselineskip, - capFormat={}, subcapFormat={}, + capFormat={}, subcapFormat={}, + floatRef=object, }% } @@ -201,10 +222,10 @@ } \setlength\belowcaptionskip{\abovecaptionskip}% it is in latex.ltx = 0pt \newcommand\saveCaptionSkip{% - \setlength{\hvAboveCaptionSkip}{\abovecaptionskip} - \setlength{\hvBelowCaptionSkip}{\belowcaptionskip} - \setlength{\abovecaptionskip}{0pt} - \setlength{\belowcaptionskip}{0pt} + \setlength{\hvAboveCaptionSkip}{\abovecaptionskip}% + \setlength{\hvBelowCaptionSkip}{\belowcaptionskip}% + \setlength{\abovecaptionskip}{0pt}% + \setlength{\belowcaptionskip}{0pt}% } \newcommand{\restoreCaptionSkip}{% \setlength\abovecaptionskip{\hvAboveCaptionSkip}% @@ -311,7 +332,8 @@ \def\hvFloat@i*{\@ifnextchar[{\do@hvFloat}{\do@hvFloat[]}} \def\do@hvFloat[#1]{% \begingroup - \setlength\hvWideWidth{\dimexpr\linewidth+\marginparwidth}% + \setlength\hvWideWidth{\dimexpr\textwidth+\marginparwidth+\marginparsep}% +% \setlength\hvWideWidth{\dimexpr\linewidth+\marginparwidth}% \hv@maxImageWidth=\textwidth \reset@special@float \setcounter{hv@pfigure}{\value{figure}}% @@ -319,7 +341,8 @@ \gdef\hv@save@setting{#1}% \ifx\relax#1\relax\else\setkeys{hvSet}{#1}\fi \gdef\hv@floatType{figure}% - \@ifnextchar+{\do@multiFloat}{\hvFloat@ii[#1]}} + \@ifnextchar+{\do@multiFloat}{\hvFloat@ii[#1]}% +} \ExplSyntaxOn @@ -381,15 +404,28 @@ \newcount\hv@cnta \newcount\hv@cntb +\def\hvFloat@ii[#1]#2{% #1: key/value, #2: floattype + \@ifnextchar[{\hvFloat@iii[#1]{#2}}{\hvFloat@iii[#1]{#2}[]}% +} -\def\hvFloat@ii[#1]#2#3{% +\def\hvFloat@iii[#1]#2[#3]#4{% #1: key/value, #2: floattype, #3: ListOfExt, #4: object \hv@maxImageWidth=\textwidth \ifx\relax#1\relax\else\setkeys{hvSet}{#1}\fi \gdef\hv@floatType{#2}% + \ifx\relax#3\relax + \ifx\hv@floatType\hv@figure + \gdef\hv@floatListOfExt{lof}% + \else + \gdef\hv@floatListOfExt{lot}% + \fi + \else + \gdef\hv@floatListOfExt{#3}% + \fi \ifx\relax#2\relax \setkeys{hvSet}{nonFloat=true}\fi - \gdef\hv@floatObject{#3}% + \gdef\hv@floatObject{#4}% \@ifnextchar[{\do@@hvFloat}{\do@@hvFloat[]}% } + \def\do@@hvFloat[#1]#2#3{% \gdef\hv@shortCap{#1}% \gdef\hv@longCap{#2}% @@ -404,7 +440,7 @@ \do@@@@hvFloat% fullpage with caption on other page \else \ifhv@doubleFULLPAGE - \setlength\hvCapWidth{\textheight} + \setlength\hvCapWidth{\textheight}% \expandafter\do@hvFloat@doubleFULLPAGE\@@temp% fullpage with caption rotated or under on an odd page \else \ifhv@doublePAGE @@ -432,7 +468,7 @@ % % First we save the object in \hvObjectBox % - \ifx\hvSet@objectAngle\hv@Zero % rotate the object? + \ifx\hvSet@objectAngle\hv@Zero% rotate the object? \savebox{\hvObjectBox}{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}% \else \savebox{\hvObjectBox}{% @@ -485,15 +521,16 @@ \fi \fi \fi - \fi - \fi - \saveCaptionSkip % we put this space ourselve - \ifx\hvSet@capAngle\hv@Zero % need rotation? + \fi + \fi + \saveCaptionSkip% we put this space ourselve + \ifx\hvSet@capAngle\hv@Zero% need rotation? \savebox\hvCaptionBox{% NO rotation \begin{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 + \ifhv@onlyText + \hv@longCap \else \ifx\hv@floatType\hv@figure \ifx\relax\hv@shortCap\relax @@ -510,11 +547,25 @@ \fi \fi \else - \let\@captype\hv@floatType - \expandafter\ifx\expandafter\relax\hv@shortCap\relax - \caption{\hv@longCap\expandafter\label\expandafter{\hv@label}}% - \else - \caption[\hv@shortCap]{\hv@longCap\expandafter\label\expandafter{\hv@label}}% + \ifhv@onlyText + \hv@longCap + \else + \let\@captype\hv@floatType + \ifhv@floatRefToObject + \expandafter\ifx\expandafter\relax\hv@shortCap\relax + \caption[]{\hv@longCap\expandafter\label\expandafter{\hv@label}}% + \addcontentsline{\hv@floatListOfExt}{\hv@floatType}{\protect\numberline{\csname the\hv@floatType\endcsname}{\ignorespaces\hv@longCap}}% + \else + \caption[]{\hv@shortCap\expandafter\label\expandafter{\hv@label}}% + \addcontentsline{\hv@floatListOfExt}{\hv@floatType}{\protect\numberline{\csname the\hv@floatType\endcsname}{\ignorespaces\hv@shortCap}}% + \fi + \else + \expandafter\ifx\expandafter\relax\hv@shortCap\relax + \caption{\hv@longCap\expandafter\label\expandafter{\hv@label}}% + \else + \caption[\hv@shortCap]{\hv@longCap\expandafter\label\expandafter{\hv@label}}% + \fi + \fi \fi \fi % \expandafter\label\expandafter{\hv@label}% 2.17 put label into the caption argument @@ -526,19 +577,37 @@ \begin{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 - \else - \ifx\relax\hv@shortCap\relax \tabcaption{\hv@longCap}\else\tabcaption[\hv@shortCap]{\hv@longCap}\fi + \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 + \else + \ifx\relax\hv@shortCap\relax \tabcaption{\hv@longCap}\else\tabcaption[\hv@shortCap]{\hv@longCap}\fi + \fi \fi - \fi - \else - \let\@captype\hv@floatType - \expandafter\ifx\expandafter\relax\hv@shortCap\relax \caption{\hv@longCap}\else\caption[\hv@shortCap]{\hv@longCap}\fi - \fi - \label{\hv@label}% + \else + \ifhv@onlyText + \hv@longCap + \else + \let\@captype\hv@floatType + \ifhv@floatRefToObject + \expandafter\ifx\expandafter\relax\hv@shortCap\relax + \caption[]{\hv@longCap\expandafter\label\expandafter{\hv@label}}% + \addcontentsline{\hv@floatListOfExt}{\hv@floatType}{\protect\numberline{\csname the\hv@floatType\endcsname}{\ignorespaces\hv@longCap}}% + \else + \caption[]{\hv@shortCap\expandafter\label\expandafter{\hv@label}}% + \addcontentsline{\hv@floatListOfExt}{\hv@floatType}{\protect\numberline{\csname the\hv@floatType\endcsname}{\ignorespaces\hv@shortCap}}% + \fi + \else + \expandafter\ifx\expandafter\relax\hv@shortCap\relax + \caption{\hv@longCap}\else\caption[\hv@shortCap]{\hv@longCap}% + \fi + \fi +% \expandafter\ifx\expandafter\relax\hv@shortCap\relax \caption{\hv@longCap}\else\caption[\hv@shortCap]{\hv@longCap}\fi + \fi + \fi + \label{\hv@label}% \end{minipage}% }% rotatebox }% \sbox @@ -555,7 +624,7 @@ \ifhv@star \@nameuse{\hv@floatType*}% Start the floating environment ***************************** \else - \begin{\hv@floatType} % Start the floating environment + \begin{\hv@floatType}% Start the floating environment \fi \fi \checkoddpage @@ -596,10 +665,10 @@ \ifoddpageoroneside\hv@@capPos=2\else\hv@@capPos=0\fi \else \ifx\hvSet@capPos\hv@Before - \hv@@capPos=0 % same as cappos=right + \hv@@capPos=0% same as cappos=right \else \ifx\hvSet@capPos\hv@After - \hv@@capPos=2 % same as capPos=right + \hv@@capPos=2% same as capPos=right \fi \fi \fi @@ -641,7 +710,7 @@ \usebox{\hvObjectBox}% \fi \end{minipage}% - \or %2 is right + \or%2 is right \ifx\hvSet@capVPos\hv@Center \put@ObjectBox \hspace{\hvSet@floatCapSep}% @@ -657,7 +726,7 @@ \put@CaptionBox[2]% \fi \fi - \or %3 bottom + \or%3 bottom \ifdim\wd\hvCaptionBox>\wd\hvObjectBox \begin{minipage}{\wd\hvCaptionBox}% \else @@ -678,7 +747,7 @@ % now we rotate the object and caption, if needed % \ifhv@wide - \ifoddpageoroneside\else\ifoddpage\else\hspace*{-\marginparwidth}\fi\fi% <- for wide and left page + \ifoddpageoroneside\else\ifoddpage\else\hspace*{\dimexpr-\marginparwidth-\marginparsep}\fi\fi% <- for wide and left page \fi \ifx\hvSet@rotAngle\hv@Zero \usebox{\@tempboxa}% @@ -726,9 +795,9 @@ \else \ifx\hvSet@capPos\hv@Outer \hv@@capPos=5 \else - \ifx\hvSet@capPos\hv@Right \hv@@capPos=6 % only for twocolumn mode + \ifx\hvSet@capPos\hv@Right \hv@@capPos=6% only for twocolumn mode \else - \ifx\hvSet@capPos\hv@Left \hv@@capPos=7 % only for twocolumn mode + \ifx\hvSet@capPos\hv@Left \hv@@capPos=7% only for twocolumn mode \else \hv@@capPos=0 \fi @@ -771,20 +840,20 @@ \setPageObject\setBottomCaption \fi \fi - \else % onecolumn + \else% onecolumn \ifoddpage \setPageObject\setBottomCaption \else% even page \afterpage{\setPageObject\setBottomCaption}% \fi \fi - \else % oneside + \else% oneside \if@twocolumn \ifoddpage \if@firstcolumn% on right side \setBottomCaption\setPageObject \else - \setPageObject\setBottomCaption + \setPageObject\setBottomCaption \fi \else \if@firstcolumn% on left side @@ -817,7 +886,7 @@ \setBottomCaption\setPageObject% start on same page/column \fi \fi - \else % onecolumn + \else% onecolumn \setBottomCaption\setPageObject \fi \or% caption on the outer column 5->outer @@ -833,7 +902,7 @@ \if@firstcolumn \setBottomCaption\setPageObject \else - +%%% !!!! to-do: !!!! \fi \fi \else% onecolumn @@ -854,7 +923,7 @@ \if@firstcolumn \setBottomCaption\setPageObject \else - \afterpage{\setBottomCaption\setPageObject} + \afterpage{\setBottomCaption\setPageObject}% \fi \else% onecolumn -> same as before \setBottomCaption\setPageObject @@ -1053,7 +1122,7 @@ } \def\setBottomCaption{% - \begin{\hv@floatType}[!b] + \begin{\hv@floatType}[!b]% \ifhv@separatorLine\drawSepLine\fi \par \usebox\hvCaptionBox -- cgit v1.2.3