From 6f4efefcd6d0e97ded44d129e5838d89b4870bc8 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 5 Mar 2012 23:22:05 +0000 Subject: hvfloat (5mar12) git-svn-id: svn://tug.org/texlive/trunk@25570 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/hvfloat/hvfloat.sty | 355 ++++++++++-------------- 1 file changed, 153 insertions(+), 202 deletions(-) (limited to 'Master/texmf-dist/tex/latex/hvfloat') diff --git a/Master/texmf-dist/tex/latex/hvfloat/hvfloat.sty b/Master/texmf-dist/tex/latex/hvfloat/hvfloat.sty index a3039d82038..f9f778a7f6f 100644 --- a/Master/texmf-dist/tex/latex/hvfloat/hvfloat.sty +++ b/Master/texmf-dist/tex/latex/hvfloat/hvfloat.sty @@ -1,11 +1,12 @@ \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{hvfloat}[2003/05/31 rotating of floating objects] +\ProvidesPackage{hvfloat}[2012/03/04 rotating of floating objects] %% %% IMPORTANT NOTICE: %% %% This is file `hvfloat.sty', %% %% Herbert Voss +%% march 04, 2012 %% %% This program can be redistributed and/or modified under the terms %% of the LaTeX Project Public License Distributed from CTAN archives @@ -15,36 +16,32 @@ %% `hvfloat' offers rotating of captions and objects for floats %% \def\fileversion{1.1} -\def\filedate{2003/05/31} +\def\filedate{2012/03/04} \message{`hvfloat' v\fileversion, \filedate\space (Herbert Voss)} % +\newif\ifhv@fbox \hv@fboxfalse +\DeclareOption{fbox}{\hv@fboxtrue\setlength{\fboxsep}{1pt}} +\ProcessOptions % \RequirePackage{graphicx} \RequirePackage{keyval} -\RequirePackage{ifthen} -% -\newif\ifhv@fbox \hv@fboxfalse -\DeclareOption{fbox}{% - \hv@fboxtrue% - \setlength{\fboxsep}{1pt}% -} -\ProcessOptions\relax +%\RequirePackage{ifthen} +\RequirePackage{caption} % -\newlength{\hvObjectWidth} -\newlength{\hvCapWidth} -\newlength{\hvMaxCapWidth} -\newsavebox{\hvObjectBox} -\newsavebox{\hvCaptionBox} -\newsavebox{\hvOBox} +\newlength\hvObjectWidth +\newlength\hvCapWidth +\newlength\hvMaxCapWidth +\newsavebox\hvObjectBox +\newsavebox\hvCaptionBox +\newsavebox\hvOBox % \newif\ifhv@useOBox \newif\ifhv@nonFloat \newif\ifhv@onlyText -\newif\ifhv@framedCaption -\newif\ifhv@framedObject + +\def\hv@figure{figure} % -\def\hvSet@boolkey#1#2{% - \csname hv@#2\ifx\relax#1\relax true\else#1\fi\endcsname} +\def\hvSet@boolkey#1#2{\csname hv@#2\ifx\relax#1\relax true\else#1\fi\endcsname} % \define@key{hvSet}{floatPos}[htbp]{ % LaTeX's position parameters htbp \def\hvSet@floatPos{#1}% @@ -82,24 +79,14 @@ \define@key{hvSet}{onlyText}[false]{% Write the caption only as text \lowercase{\hvSet@boolkey{#1}}{onlyText}% } -\define@key{hvSet}{framedCaption}[false]{% boxed caption - \lowercase{\hvSet@boolkey{#1}}{framedCaption}% -} -\define@key{hvSet}{framedObject}[false]{% boxed object - \lowercase{\hvSet@boolkey{#1}}{framedObject}% -} % -\def\setDefaults{% +\newcommand{\setDefaults}{% \setkeys{hvSet}{% - floatPos=htbp, rotAngle=0, capWidth=0.8, capAngle=0,% + floatPos=htbp, rotAngle=0, capWidth=.8, capAngle=0,% capPos=b, capVPos=c, objectPos=c, objectAngle=0,% floatCapSep=5, useOBox=false, nonFloat=false,% onlyText=false}% } -\setDefaults% -\ifhv@fbox - \setkeys{hvSet}{framedCaption=true, framedObject=true}% -\fi % \def\hv@Top{t} \def\hv@Bottom{b} @@ -120,26 +107,26 @@ \setlength{\belowcaptionskip}{0pt} } \newcommand{\restoreCaptionSkip}{% - \setlength{\abovecaptionskip}{\hvAboveCaptionSkip} - \setlength{\belowcaptionskip}{\hvBelowCaptionSkip} + \setlength\abovecaptionskip{\hvAboveCaptionSkip} + \setlength\belowcaptionskip{\hvBelowCaptionSkip} } % % \newcommand{\figcaption}[2][]{\def\@captype{figure}% - \ifthenelse{\equal{#1}{}}{\caption{#2}}{\caption[#1]{#2}}} + \ifx\relax#1\relax \caption{#2}\else\caption[#1]{#2}\fi} \newcommand{\tabcaption}[2][]{\def\@captype{table}% - \ifthenelse{\equal{#1}{}}{\caption{#2}}{\caption[#1]{#2}}} + \ifx\relax#1\relax \caption{#2}\else\caption[#1]{#2}\fi} % % % \def\hvFloat{\@ifnextchar[{\do@hvFloat}{\do@hvFloat[]}} \def\do@hvFloat[#1]#2#3{% - \setDefaults% - \ifthenelse{\equal{#1}{}}{}{\setkeys{hvSet}{#1}}% - \gdef\hv@floatType{#2}% - \ifthenelse{\equal{#2}{}}{\setkeys{hvSet}{nonFloat=true}}{}% - \gdef\hv@floatObject{#3}% - \@ifnextchar[{\do@@hvFloat}{\do@@hvFloat[]}% + \setDefaults% + \ifx\relax#1\relax\else\setkeys{hvSet}{#1}\fi% + \gdef\hv@floatType{#2}% + \ifx\relax#2\relax \setkeys{hvSet}{nonFloat=true}\fi% + \gdef\hv@floatObject{#3}% + \@ifnextchar[{\do@@hvFloat}{\do@@hvFloat[]}% } \def\do@@hvFloat[#1]#2#3{% \def\hv@shortCap{#1} @@ -152,160 +139,129 @@ % [#4]: short caption % #5: caption % #6: label -% \setDefaults% -% \def\@tempa{#1}% -% \ifx\@tempa\empty\else\setkeys{hvSet}{#1}\fi% set options, only when not empty - \def\@tempa{90}% - \ifx\hvSet@rotAngle\@tempa - \setlength{\hvMaxCapWidth}{\textheight} - \else - \setlength{\hvMaxCapWidth}{\linewidth} - \fi +% \setDefaults% +% \def\@tempa{#1}% +% \ifx\@tempa\empty\else\setkeys{hvSet}{#1}\fi% set options, only when not empty + \def\@tempa{90}% + \ifx\hvSet@rotAngle\@tempa \setlength{\hvMaxCapWidth}{\textheight} + \else \setlength{\hvMaxCapWidth}{\linewidth} + \fi % % First we save the object in \hvObjectBox % - \ifx\hvSet@objectAngle\hv@Zero % rotate the object? - \savebox{\hvObjectBox}{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi} - \else - \savebox{\hvObjectBox}{% - \rotatebox{\hvSet@objectAngle}{% - \ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}} - \fi - \setlength{\hvObjectWidth}{\wd\hvObjectBox} + \ifx\hvSet@objectAngle\hv@Zero % rotate the object? + \savebox{\hvObjectBox}{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi} + \else + \savebox{\hvObjectBox}{% + \rotatebox{\hvSet@objectAngle}{% + \ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}} + \fi + \setlength{\hvObjectWidth}{\wd\hvObjectBox} % % Now we save the caption with its defined \hvCapWidth % - \ifx\hvSet@capWidth\hv@Width - \setlength{\hvCapWidth}{\hvObjectWidth} - \else - \ifx\hvSet@capWidth\hv@Height - \setlength{\hvCapWidth}{\ht\hvObjectBox} - \else - \setlength{\hvCapWidth}{\hvObjectWidth} - \ifx\hvSet@capPos\hv@Left - \addtolength{\hvMaxCapWidth}{-\hvObjectWidth} - \fi - \ifx\hvSet@capPos\hv@Right - \addtolength{\hvMaxCapWidth}{-\hvObjectWidth} - \fi - \ifdim\hvSet@capWidth\columnwidth<\hvMaxCapWidth - \setlength{\hvCapWidth}{\hvSet@capWidth\columnwidth} - \else - \setlength{\hvCapWidth}{\hvMaxCapWidth} - \fi - \fi - \fi + \ifx\hvSet@capWidth\hv@Width\setlength{\hvCapWidth}{\hvObjectWidth} + \else + \ifx\hvSet@capWidth\hv@Height\setlength{\hvCapWidth}{\ht\hvObjectBox} + \else + \setlength{\hvCapWidth}{\hvObjectWidth} + \ifx\hvSet@capPos\hv@Left\addtolength{\hvMaxCapWidth}{-\hvObjectWidth}\fi + \ifx\hvSet@capPos\hv@Right\addtolength{\hvMaxCapWidth}{-\hvObjectWidth}\fi + \ifdim\hvSet@capWidth\columnwidth<\hvMaxCapWidth + \setlength{\hvCapWidth}{\hvSet@capWidth\columnwidth} + \else + \setlength{\hvCapWidth}{\hvMaxCapWidth} + \fi + \fi + \fi % % now we have the object and the caption with the right % rotated angles saved in boxes % - \def\fps@figure{\hvSet@floatPos} - \ifhv@nonFloat% - \begingroup% Start the nonfloat part - \else% - \begin{\hv@floatType}% Start the floating environment + \def\fps@figure{\hvSet@floatPos} + \ifhv@nonFloat\begingroup% Start the nonfloat part + \else \begin{\hv@floatType}% Start the floating environment + \fi% + \saveCaptionSkip% we put this space ourselve + \ifx\hvSet@capAngle\hv@Width % need rotation? + \sbox{\hvCaptionBox}{% + \begin{minipage}[b]{\hvCapWidth}% minipage, to get hyphenation + \ifhv@nonFloat% + \ifhv@onlyText#2% + \else% + \ifx\hv@floatType\hv@figure + \ifx\relax#1\relax \figcaption{#2}\else\figcaption[#1]{#2}\fi + \else + \ifx\relax#1\relax \tabcaption{#2}\else\tabcaption[#1]{#2}\fi% + \fi + \fi + \else\ifx\relax\hv@shortCap\relax\caption{#2}\else\caption[#1]{#2}\fi% \fi% - \saveCaptionSkip% we put this space ourselve - \ifx\hvSet@capAngle\hv@Width % need rotation? - \sbox{\hvCaptionBox}{% - \begin{minipage}[b]{\hvCapWidth}% minipage, to get hyphenation - \ifhv@nonFloat% - \ifhv@onlyText% - #2% - \else% - \ifthenelse{\equal{\hv@floatType}{figure}}{% - \ifthenelse{\equal{#1}{}}{\figcaption{#2}}{\figcaption[#1]{#2}}% - }{% - \ifthenelse{\equal{#1}{}}{\tabcaption{#2}}{\tabcaption[#1]{#2}}% - }% - \fi% - \else% - \ifx\hv@shortCap\empty\caption{#2}\else\caption[#1]{#2}\fi% - \fi% - \label{#3}% - \end{minipage}% - }% - \else% - \sbox{\hvCaptionBox}{% - \rotatebox{\hvSet@capAngle}{% - \begin{minipage}[b]{\hvCapWidth}% minipage, to get hyphenation - \ifhv@nonFloat% - \ifhv@onlyText% - #2% - \else% - \ifthenelse{\equal{\hv@floatType}{figure}}{% - \ifthenelse{\equal{#1}{}}{\figcaption{#2}}{\figcaption[#1]{#2}}% - }{% - \ifthenelse{\equal{#1}{}}{\tabcaption{#2}}{\tabcaption[#1]{#2}}% - }% - \fi% - \else% - \ifx\hv@shortCap\empty\caption{#2}\else\caption[#1]{#2}\fi% - \fi% - \label{#3}% - \end{minipage}% - }% - }% - \fi% + \label{#3}% + \end{minipage}% + }% + \else% + \sbox{\hvCaptionBox}{% + \rotatebox{\hvSet@capAngle}{% + \begin{minipage}[b]{\hvCapWidth}% minipage, to get hyphenation + \ifhv@nonFloat% + \ifhv@onlyText#2% + \else% + \ifx\hv@floatType\hv@figure + \ifx\relax#1\relax \figcaption{#2}\else\figcaption[#1]{#2}\fi + \else + \ifx\relax#1\relax \tabcaption{#2}\else\tabcaption[#1]{#2}\fi% + \fi + \fi + \else\ifx\relax\hv@shortCap\relax\caption{#2}\else\caption[#1]{#2}\fi% + \fi% + \label{#3}% + \end{minipage}% + }% + }% + \fi% %% - \restoreCaptionSkip% save old values - \ifx\hvSet@objectPos\hv@Right% - \raggedleft% - \else% - \ifx\hvSet@objectPos\hv@Center% - \ifhv@nonFloat% - \hspace*{\fill}% - \else% - \centering - \fi% - \fi% - \fi% + \restoreCaptionSkip% save old values + \ifx\hvSet@objectPos\hv@Right\raggedleft% + \else% + \ifx\hvSet@objectPos\hv@Center + \ifhv@nonFloat\hspace*{\fill}\else\centering\fi% + \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 % - \savebox{\@tempboxa}{% - \ifx\hvSet@capPos\hv@Left % caption on left side - \ifx\hvSet@capVPos\hv@Center% - \ifhv@framedCaption% - \fbox{\parbox{\wd\hvCaptionBox}{\usebox{\hvCaptionBox}}}% - \else - \parbox{\wd\hvCaptionBox}{\usebox{\hvCaptionBox}} - \fi% - \hspace{\hvSet@floatCapSep pt}% capfloatsep - \ifhv@framedObject% - \fbox{\parbox{\wd\hvObjectBox}{\usebox{\hvObjectBox}}} - \else - \parbox{\wd\hvObjectBox}{\usebox{\hvObjectBox}} - \fi% - \else% - \ifx\hvSet@capVPos\hv@Top % caption at top - \ifhv@framedCaption% - \fbox{\raisebox{-\height}{\usebox{\hvCaptionBox}}}% - \else - \raisebox{-\height}{\usebox{\hvCaptionBox}}% - \fi - \hspace{\hvSet@floatCapSep pt}% capfloatsep - \ifhv@framedObject% - \fbox{\raisebox{-\height}{\usebox{\hvObjectBox}}}% - \else - \raisebox{-\height}{\usebox{\hvObjectBox}}% - \fi% - \else% caption on bottom - \ifhv@framedCaption% - \fbox{\usebox{\hvCaptionBox}} - \else - \usebox{\hvCaptionBox} - \fi% - \hspace{\hvSet@floatCapSep pt}% - \ifhv@framedObject% - \fbox{\usebox{\hvObjectBox}} - \else - \usebox{\hvObjectBox} - \fi% - \fi% - \fi% - \else + \savebox{\@tempboxa}{% + \ifx\hvSet@capPos\hv@Left % caption on left side + \ifx\hvSet@capVPos\hv@Center% + \ifhv@fbox\fbox{\parbox{\wd\hvCaptionBox}{\usebox{\hvCaptionBox}}}% + \else \parbox{\wd\hvCaptionBox}{\usebox{\hvCaptionBox}}% + \fi% + \hspace{\hvSet@floatCapSep pt}% capfloatsep + \ifhv@fbox\fbox{\parbox{\wd\hvObjectBox}{\usebox{\hvObjectBox}}} + \else \parbox{\wd\hvObjectBox}{\usebox{\hvObjectBox}} + \fi% + \else% + \ifx\hvSet@capVPos\hv@Top % caption at top + \ifhv@fbox\fbox{\raisebox{-\height}{\usebox{\hvCaptionBox}}}% + \else \raisebox{-\height}{\usebox{\hvCaptionBox}}% + \fi + \hspace{\hvSet@floatCapSep pt}% capfloatsep + \ifhv@fbox\fbox{\raisebox{-\height}{\usebox{\hvObjectBox}}}% + \else \raisebox{-\height}{\usebox{\hvObjectBox}}% + \fi% + \else% caption on bottom + \ifhv@fbox\fbox{\usebox{\hvCaptionBox}} + \else\usebox{\hvCaptionBox} + \fi% + \hspace{\hvSet@floatCapSep pt}% + \ifhv@fbox\fbox{\usebox{\hvObjectBox}} + \else \usebox{\hvObjectBox} + \fi% + \fi% + \fi% + \else \ifx\hvSet@capPos\hv@Top \ifdim\wd\hvCaptionBox>\wd\hvObjectBox \begin{minipage}{\wd\hvCaptionBox} @@ -313,15 +269,12 @@ \begin{minipage}{\wd\hvObjectBox} \fi \centering - \ifhv@framedCaption% + \ifhv@fbox \fbox{\usebox{\hvCaptionBox}}\\[\hvBelowCaptionSkip] + \fbox{\usebox{\hvObjectBox}} \else - \usebox{\hvCaptionBox}\\[\hvBelowCaptionSkip]% - \fi% - \ifhv@framedObject% - \fbox{\usebox{\hvObjectBox}}% - \else - \usebox{\hvObjectBox}% + \usebox{\hvCaptionBox}\\[\hvBelowCaptionSkip] + \usebox{\hvObjectBox} \fi% \end{minipage} \else @@ -332,51 +285,48 @@ \begin{minipage}{\wd\hvObjectBox} \fi \centering - \ifhv@framedObject + \ifhv@fbox \fbox{\usebox{\hvObjectBox}}\\[\hvAboveCaptionSkip] + \fbox{\usebox{\hvCaptionBox}} \else \usebox{\hvObjectBox}\\[\hvAboveCaptionSkip] - \fi% - \ifhv@framedCaption - \fbox{\usebox{\hvCaptionBox}}% - \else - \usebox{\hvCaptionBox}% + \usebox{\hvCaptionBox} \fi% \end{minipage} \else% the last option: put the caption on the right \ifx\hvSet@capVPos\hv@Center% - \ifhv@framedObject + \ifhv@fbox \fbox{\parbox{\wd\hvObjectBox}{\usebox{\hvObjectBox}}} \else \parbox{\wd\hvObjectBox}{\usebox{\hvObjectBox}} \fi% \hspace{\hvSet@floatCapSep pt}% - \ifhv@framedCaption + \ifhv@fbox \fbox{\parbox{\wd\hvCaptionBox}{\usebox{\hvCaptionBox}}}% \else \parbox{\wd\hvCaptionBox}{\usebox{\hvCaptionBox}} \fi% \else% \ifx\hvSet@capVPos\hv@Top - \ifhv@framedObject + \ifhv@fbox \fbox{\raisebox{-\height}{\usebox{\hvObjectBox}}}% \else \raisebox{-\height}{\usebox{\hvObjectBox}}% \fi% \hspace{\hvSet@floatCapSep pt}% - \ifhv@framedCaption + \ifhv@fbox \fbox{\raisebox{-\height}{\usebox{\hvCaptionBox}}}% \else \raisebox{-\height}{\usebox{\hvCaptionBox}}% \fi \else - \ifhv@framedObject + \ifhv@fbox \fbox{\usebox{\hvObjectBox}}% \else \usebox{\hvObjectBox}% \fi \hspace{\hvSet@floatCapSep pt}% - \ifhv@framedCaption + \ifhv@fbox \fbox{\usebox{\hvCaptionBox}}% \else \usebox{\hvCaptionBox}% @@ -405,9 +355,10 @@ \else \end{\hv@floatType}% End the floating environment \fi - \ifhv@fbox % reset local settings - \setkeys{hvSet}{framedCaption=true, framedObject=true} - \fi } % +\newenvironment{hvFloatEnv}[1][\textwidth] + {\minipage{#1}\center} + {\endcenter\endminipage} +% \endinput -- cgit v1.2.3