summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/hvfloat
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-03-14 20:45:17 +0000
committerKarl Berry <karl@freefriends.org>2019-03-14 20:45:17 +0000
commitf325d429c265c8eb01cd3b572d5f96207ae8cafa (patch)
tree8af2d34ec53650263f9d007f083fc8a37683f868 /Master/texmf-dist/tex/latex/hvfloat
parent0f0e72f13860bcbb83239088dbabba756f545229 (diff)
hvfloat (14mar19)
git-svn-id: svn://tug.org/texlive/trunk@50386 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/hvfloat')
-rw-r--r--Master/texmf-dist/tex/latex/hvfloat/hvfloat-fps.sty2
-rw-r--r--Master/texmf-dist/tex/latex/hvfloat/hvfloat.sty758
2 files changed, 546 insertions, 214 deletions
diff --git a/Master/texmf-dist/tex/latex/hvfloat/hvfloat-fps.sty b/Master/texmf-dist/tex/latex/hvfloat/hvfloat-fps.sty
index dd0218e8322..4ed1187c469 100644
--- a/Master/texmf-dist/tex/latex/hvfloat/hvfloat-fps.sty
+++ b/Master/texmf-dist/tex/latex/hvfloat/hvfloat-fps.sty
@@ -1,3 +1,5 @@
+%% $Id: hvfloat-fps.sty 949 2019-03-09 10:08:31Z herbert $
+%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{hvfloat-fps}[2017/09/16 setting float objects]
%%
diff --git a/Master/texmf-dist/tex/latex/hvfloat/hvfloat.sty b/Master/texmf-dist/tex/latex/hvfloat/hvfloat.sty
index fa901ed58f8..fbcea5ee3e9 100644
--- a/Master/texmf-dist/tex/latex/hvfloat/hvfloat.sty
+++ b/Master/texmf-dist/tex/latex/hvfloat/hvfloat.sty
@@ -1,5 +1,7 @@
+%% $Id: hvfloat.sty 964 2019-03-14 11:37:36Z herbert $
+%%
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{hvfloat}[2017/01/28 rotating of floating objects]
+\ProvidesPackage{hvfloat}[2019/02/03 rotating of floating objects]
%%
%% IMPORTANT NOTICE:
%%
@@ -14,20 +16,37 @@
%% DESCRIPTION:
%% `hvfloat' offers rotating of captions and objects for floats
%%
-\def\fileversion{1.2b}
-\def\filedate{2017/12/22}
+\def\fileversion{2.00}
+\def\filedate{2019/03/14}
\message{`hvfloat' v\fileversion, \filedate\space (Herbert Voss)}
%
\newif\ifhv@fbox \hv@fboxfalse
+\newif\ifhv@hyperref \hv@hyperreffalse
\DeclareOption{fbox}{\hv@fboxtrue\setlength{\fboxsep}{1pt}}
+\DeclareOption{hyperref}{\hv@hyperreftrue}
+
\ProcessOptions
+
+\ifhv@hyperref
+ \RequirePackage{hyperref}
+ \RequirePackage{hypcap}
+% \newcommand\fltref[1]{\ref{#1}\vpageref{#1-flt}}%%
+\fi
+\AtBeginDocument{\providecommand\capstart{}}% in no hyperref/hypcap is loaded
%
\RequirePackage{graphicx}
-\RequirePackage{keyval}
+
+
+\RequirePackage{xkeyval}
\RequirePackage{caption}
+\RequirePackage{ifoddpage}
%
+\RequirePackage{afterpage}
+
\newlength\hvObjectWidth
\newlength\hvCapWidth
+\newlength\hvWideWidth
+
\newlength\hvMaxCapWidth
\newsavebox\hvObjectBox
\newsavebox\hvCaptionBox
@@ -36,10 +55,29 @@
\newif\ifhv@useOBox
\newif\ifhv@nonFloat
\newif\ifhv@onlyText
+\newif\ifhv@wide
+\newif\ifhv@fullpage
+\newif\ifhv@FullPage
+\newif\ifhv@capbeside \hv@capbesidefalse
+\newif\ifhv@separatorLine \hv@separatorLinetrue
+\newif\ifhv@objectFrame \hv@objectFramefalse
-\def\hv@figure{figure}
+\def\hv@Top{t}
+\def\hv@Bottom{b}
+\def\hv@Right{r}
+\def\hv@Left{l}
+\def\hv@Center{c}
+\def\hv@Outer{o}
+\def\hv@Inner{i}
+\def\hv@Even{e}
+\def\hv@Odd{d}
+\def\hv@Natural{n}
+\def\hv@Width{w}
+\def\hv@Height{h}
+\def\hv@Zero{0}
%
-\def\hvSet@boolkey#1#2{\csname hv@#2\ifx\relax#1\relax true\else#1\fi\endcsname}
+
+\def\hv@figure{figure}
%
\define@key{hvSet}{floatPos}[htbp]{% LaTeX's position parameters htbp
\def\hvSet@floatPos{#1}%
@@ -47,19 +85,29 @@
\define@key{hvSet}{rotAngle}[0]{% rotates caption AND image together
\def\hvSet@rotAngle{#1}%
}
-\define@key{hvSet}{capWidth}[.8]{% object (w)idth)|object (h)eight|<scale of \columnwidth>
+\define@key{hvSet}{capWidth}[n]{% (n)atural width|object (w)idth)|object (h)eight|<scale of \columnwidth>
\def\hvSet@capWidth{#1}%
}
\define@key{hvSet}{capAngle}[0]{% -360..+360
\def\hvSet@capAngle{#1}%
}
-\define@key{hvSet}{capPos}[b]{% (l)eft|(b)ottom|(t)op|(r)ight
- \def\hvSet@capPos{#1}% it is relativ to the object
+\define@key{hvSet}{capPos}[b]{% (l)eft|(b)ottom|(t)op|(r)ight|(i)nner|(o)uter|(e)ven|o(d)d
+ \def\hvSet@capPos{#1}% it is relativ to the object, (e),(d) only valid for fullpage float
+ \edef\@tempa{#1}%
+ \ifx\hv@Bottom\@tempa
+ \global\hv@capbesidefalse
+ \else
+ \ifx\hv@Top\@tempa
+ \global\hv@capbesidefalse
+ \else
+ \global\hv@capbesidetrue
+ \fi
+ \fi
}
\define@key{hvSet}{capVPos}[c]{% (b)ottom|(c)enter|(t)op
\def\hvSet@capVPos{#1}% it is relativ to the object
}
-\define@key{hvSet}{objectPos}[c]{% (l)eft|(c)enter|(r)ight
+\define@key{hvSet}{objectPos}[c]{% (l)eft|(c)enter|(r)ight|(i)nner|(o)uter
\def\hvSet@objectPos{#1}% it is relativ to the document
}
\define@key{hvSet}{objectAngle}[0]{% -360..+360
@@ -68,67 +116,155 @@
\define@key{hvSet}{floatCapSep}[5]{% a width with the unit pt
\def\hvSet@floatCapSep{#1}%
}
-\define@key{hvSet}{useOBox}[false]{% use of the hvOBox contents
- \lowercase{\hvSet@boolkey{#1}}{useOBox}%
+\define@key{hvSet}{useOBox}[true]{% use of the hvOBox contents
+ \@nameuse{hv@useOBox#1}%
}
-\define@key{hvSet}{nonFloat}[false]{% Do not use float environment
- \lowercase{\hvSet@boolkey{#1}}{nonFloat}%
+\define@key{hvSet}{nonFloat}[true]{% Do not use float environment
+ \@nameuse{hv@nonFloat#1}%
}
\define@key{hvSet}{onlyText}[false]{% Write the caption only as text
- \lowercase{\hvSet@boolkey{#1}}{onlyText}%
+ \@nameuse{hv@onlyText#1}%
+}
+\define@key{hvSet}{wide}[true]{% Write the caption only as text
+ \@nameuse{hv@wide#1}%
+}
+\define@key{hvSet}{fullpage}[true]{% fullpage float with caption on other page
+ \@nameuse{hv@fullpage#1}%
+% \def\hvSet@capWidth{n}%
}
+\define@key{hvSet}{FullPage}[true]{% fullpage float with caption on other page
+ \@nameuse{hv@FullPage#1}%
+% \def\hvSet@capWidth{n}%
+}
+\define@key{hvSet}{separatorLine}[true]{% separator line for caption of a full page float
+ \@nameuse{hv@separatorLine#1}%
+}%
+\define@key{hvSet}{objectFrame}[true]{% a frame around the object with no separation
+ \@nameuse{hv@objectFrame#1}%
+}%
+\define@key{hvSet}{style}{%
+ \@ifundefined{hv@#1}%
+ {\errmessage{Custom style `#1' undefined}}%
+ {\begingroup
+ \edef\x{\endgroup\noexpand\setkeys{hvSet}{\@nameuse{hv@#1}}}\x}% use a defined style
+}
+
+\def\hvset#1{\setkeys{hvSet}{#1}}
%
+\def\defhvstyle#1#2{\@namedef{hv@#1}{#2}}
+%
+
\newcommand{\setDefaults}{%
-\setkeys{hvSet}{%
- floatPos=htbp, rotAngle=0, capWidth=.8, capAngle=0,
+ \hvset{%
+ floatPos=htbp, rotAngle=0, capWidth=n, capAngle=0,
capPos=b, capVPos=c, objectPos=c, objectAngle=0,
floatCapSep=5, useOBox=false, nonFloat=false,
- onlyText=false}%
+ onlyText=false, wide=false, fullpage=false, FullPage=false,
+ separatorLine,objectFrame=false}%
}
%
-\def\hv@Top{t}
-\def\hv@Bottom{b}
-\def\hv@Right{r}
-\def\hv@Left{l}
-\def\hv@Center{c}
-\def\hv@Width{w}
-\def\hv@Height{h}
-\def\hv@Zero{0}
-%
-\newlength{\hvAboveCaptionSkip}
-\newlength{\hvBelowCaptionSkip}
-\setlength{\belowcaptionskip}{\abovecaptionskip}% it is in latex.ltx = 0pt
-\newcommand{\saveCaptionSkip}{%
+\newlength\hvAboveCaptionSkip
+\newlength\hvBelowCaptionSkip
+\newcount\hv@@capPos
+
+\newlength\fboxlinewidth
+\AtBeginDocument{%
+ \setlength\fboxlinewidth{\dimexpr\linewidth-2\fboxrule-2\fboxsep}%
+}
+\setlength\belowcaptionskip{\abovecaptionskip}% it is in latex.ltx = 0pt
+\newcommand\saveCaptionSkip{%
\setlength{\hvAboveCaptionSkip}{\abovecaptionskip}
\setlength{\hvBelowCaptionSkip}{\belowcaptionskip}
\setlength{\abovecaptionskip}{0pt}
\setlength{\belowcaptionskip}{0pt}
}
\newcommand{\restoreCaptionSkip}{%
- \setlength\abovecaptionskip{\hvAboveCaptionSkip}
- \setlength\belowcaptionskip{\hvBelowCaptionSkip}
+ \setlength\abovecaptionskip{\hvAboveCaptionSkip}%
+ \setlength\belowcaptionskip{\hvBelowCaptionSkip}%
}
%
-%
-\newcommand{\figcaption}[2][]{\def\@captype{figure}%
+\newcommand\figcaption[2][]{\def\@captype{figure}%
\ifx\relax#1\relax \caption{#2}\else\caption[#1]{#2}\fi}
-\newcommand{\tabcaption}[2][]{\def\@captype{table}%
+\newcommand\tabcaption[2][]{\def\@captype{table}%
\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
- \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[]}%
+\newlength\hv@maxImageWidth
+\AtBeginDocument{\hv@maxImageWidth=\columnwidth}
+
+\define@key{Gin}{fullpage}[true]{%
+ \def\Gin@ewidth{\columnwidth}%
+ \def\Gin@eheight{\textheight}%
+ \Gin@boolkey{false}{iso}%
}
-\def\do@@hvFloat[#1]#2#3{%
- \def\hv@shortCap{#1}%
- \def\hv@longCap{#2}%
- \def\hv@label{#3}%
+\define@key{Gin}{FullPage}[true]{%
+ \def\Gin@ewidth{\textwidth}%
+ \def\Gin@eheight{\textheight}%
+ \Gin@boolkey{false}{iso}%
+}
+\newcommand\IncludeGraphics[2][]{%
+ \checkoddpage
+ \vspace*{\the\dimexpr-1in-\voffset+\topskip-\headheight-0.5\baselineskip}%
+ \ifoddpage
+ \hspace*{\dimexpr-\oddsidemargin-\parindent-1in}%
+ \else
+ \hspace*{\dimexpr-\evensidemargin-\parindent-1in}%
+ \fi
+ \includegraphics[#1,width=\paperwidth,height=\paperheight,keepaspectratio=false]{#2}%
+}
+
+\newcommand\put@CaptionBox[1][0]{%
+ \ifcase#1
+ \ifhv@fbox
+ \fbox{\parbox{\wd\hvCaptionBox}{\usebox{\hvCaptionBox}}}%
+ \else
+ \parbox{\wd\hvCaptionBox}{\usebox{\hvCaptionBox}}%
+ \fi
+ \or
+ \ifhv@fbox
+ \fbox{\raisebox{-\height}{\usebox{\hvCaptionBox}}}%
+ \else
+ \raisebox{-\height}{\usebox{\hvCaptionBox}}%
+ \fi
+ \or
+ \ifhv@fbox\fbox{\usebox{\hvCaptionBox}}\else\usebox{\hvCaptionBox}\fi
+ \fi
+}
+
+\newcommand\put@ObjectBox[1][0]{%
+ \ifcase#1
+ \ifhv@fbox
+ \fbox{\parbox{\wd\hvObjectBox}{\usebox{\hvObjectBox}}}%
+ \else
+ \parbox{\wd\hvObjectBox}{\ifhv@objectFrame\frame{\usebox{\hvObjectBox}}\else\usebox{\hvObjectBox}\fi}%
+ \fi
+ \or
+ \ifhv@fbox
+ \fbox{\raisebox{-\height}{\usebox{\hvObjectBox}}}%
+ \else
+ \raisebox{-\height}{\ifhv@objectFrame\frame{\usebox{\hvObjectBox}}\else\usebox{\hvObjectBox}\fi}%
+ \fi
+ \or
+ \ifhv@fbox
+ \fbox{\usebox{\hvObjectBox}}%
+ \else
+ \ifhv@objectFrame\frame{\usebox{\hvObjectBox}}\else\usebox{\hvObjectBox}\fi%
+ \fi
+ \fi
+}
+
+\newif\if@hvstar
+
+\def\hvFloat{\@ifnextchar*%
+ {\@hvstartrue
+ \hv@maxImageWidth=\textwidth
+ \hvFloat@i}%
+ {\@hvstarfalse
+ \hv@maxImageWidth=\columnwidth
+ \hvFloat@i*}%
+}
+
+\setDefaults
+
%\newcommand*{\hvFloat}[5][]{%
% [#1}: keyvalues
% #2: type figure | table | ...
@@ -136,12 +272,37 @@
% [#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\hvFloat@i*{\@ifnextchar[{\do@hvFloat}{\do@hvFloat[]}}
+\def\do@hvFloat[#1]#2#3{%
+ \begingroup
+ \setlength\hvWideWidth{\dimexpr\linewidth+\marginparwidth}%
+ \hv@maxImageWidth=\textwidth
+ \global\hv@capbesidefalse
+ \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{%
+ \gdef\hv@shortCap{#1}%
+ \gdef\hv@longCap{#2}%
+ \gdef\hv@label{#3}%
+ \ifhv@fullpage
+ \def\hvSet@CapWidth{n}% relative value
+ \do@@@@hvFloat% fullpage with caption on other page
+ \else
+ \do@@@hvFloat
+ \fi
+}
+%
+\def\do@@@hvFloat{% no special float page
\def\@tempa{90}%
- \ifx\hvSet@rotAngle\@tempa \setlength{\hvMaxCapWidth}{\textheight}%
- \else \setlength{\hvMaxCapWidth}{\linewidth}%
+ \ifx\hvSet@rotAngle\@tempa
+ \setlength\hvMaxCapWidth{\textheight}%
+ \else
+ \setlength\hvMaxCapWidth{\hvWideWidth}%
\fi
%
% First we save the object in \hvObjectBox
@@ -150,214 +311,383 @@
\savebox{\hvObjectBox}{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
\else
\savebox{\hvObjectBox}{%
- \rotatebox{\hvSet@objectAngle}{%
- \ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}}%
+ \rotatebox{\hvSet@objectAngle}{%
+ \ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi
+ }%
+ }%
\fi
- \setlength{\hvObjectWidth}{\wd\hvObjectBox}%
+ \setlength\hvObjectWidth{\wd\hvObjectBox}%
%
% Now we save the caption with its defined \hvCapWidth
%
- \ifx\hvSet@capWidth\hv@Width\setlength{\hvCapWidth}{\hvObjectWidth}%
+ \ifx\hvSet@capWidth\hv@Width% captionwidth=objectwidth
+ \setlength\hvCapWidth{\hvObjectWidth}%
\else
- \ifx\hvSet@capWidth\hv@Height\setlength{\hvCapWidth}{\ht\hvObjectBox}%
+ \ifx\hvSet@capWidth\hv@Height% captionwidth=objectheight
+ \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}%
+ \ifx\hvSet@capWidth\hv@Natural% captionwidth=\linewidth-\objectwidth-separation
+ \ifhv@capbeside
+ \ifhv@wide
+ \setlength\hvCapWidth{\the\dimexpr\hvWideWidth-\hvObjectWidth-\hvSet@floatCapSep pt\relax}%
+ \else
+ \setlength\hvCapWidth{\the\dimexpr\columnwidth-\hvObjectWidth-\hvSet@floatCapSep pt\relax}%
+ \fi
+ \else
+ \setlength\hvCapWidth{\columnwidth}%
+ \fi
\else
- \setlength{\hvCapWidth}{\hvMaxCapWidth}%
+ \ifhv@capbeside
+ \ifhv@wide
+ \setlength\hvCapWidth{\hvSet@capWidth\hv@WideWidth}%
+ \setlength\@tempdima{\the\dimexpr\hvWideWidth-\hvObjectWidth-\hvSet@floatCapSep pt\relax}%
+ \else
+ \setlength\hvCapWidth{\hvSet@capWidth\columnwidth}%
+ \setlength\@tempdima{\the\dimexpr\columnwidth-\hvObjectWidth-\hvSet@floatCapSep pt\relax}%
+ \fi
+ \ifdim\hvCapWidth>\@tempdima
+ \setlength\hvCapWidth{\@tempdima}%
+ \fi
+ \else
+ \ifhv@wide
+ \setlength\hvCapWidth{\hvSet@capWidth\hv@WideWidth}%
+ \else
+ \setlength\hvCapWidth{\hvSet@capWidth\columnwidth}%
+ \fi
+ \fi
\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
- \fi
- \saveCaptionSkip% we put this space ourselve
- \ifx\hvSet@capAngle\hv@Width % need rotation?
- \sbox{\hvCaptionBox}{%
+ \fi
+ \fi
+ \saveCaptionSkip % we put this space ourselve
+ \ifx\hvSet@capAngle\hv@Zero % need rotation?
+ \sbox\hvCaptionBox{% NO rotation
\begin{minipage}[b]{\hvCapWidth}% minipage, to get hyphenation
\ifhv@nonFloat
- \ifhv@onlyText#2
+ \ifhv@onlyText\hv@longCap
\else
\ifx\hv@floatType\hv@figure
- \ifx\relax#1\relax \figcaption{#2}\else\figcaption[#1]{#2}\fi
+ \ifx\relax\hv@shortCap\relax \figcaption{\hv@longCap}\else\figcaption[\hv@shortCap]{\hv@longCap}\fi
\else
- \ifx\relax#1\relax \tabcaption{#2}\else\tabcaption[#1]{#2}\fi
+ \ifx\relax\hv@shortCap\relax \tabcaption{\hv@longCap}\else\tabcaption[\hv@shortCap]{\hv@longCap}\fi
\fi
\fi
\else
- \expandafter\ifx\expandafter\relax\hv@shortCap\relax \caption{#2}\else\caption[#1]{#2}\fi
+ \let\@captype\hv@floatType
+ \expandafter\ifx\expandafter\relax\hv@shortCap\relax \caption{\hv@longCap}\else\caption[\hv@shortCap]{\hv@longCap}\fi
\fi
- \label{#3}%
+ \label{\hv@label}%
\end{minipage}%
}%
\else
- \sbox{\hvCaptionBox}{%
+ \sbox\hvCaptionBox{% Rotation
\rotatebox{\hvSet@capAngle}{%
- \begin{minipage}[b]{\hvCapWidth}% minipage, to get hyphenation
- \ifhv@nonFloat
- \ifhv@onlyText#2
+ \begin{minipage}[b]{\hvCapWidth}% minipage, to get hyphenation
+ \ifhv@nonFloat
+ \ifhv@onlyText\hv@longCap
\else
\ifx\hv@floatType\hv@figure
- \ifx\relax#1\relax \figcaption{#2}\else\figcaption[#1]{#2}\fi
+ \ifx\relax\hv@shortCap\relax \figcaption{\hv@longCap}\else\figcaption[\hv@shortCap]{\hv@longCap}\fi
\else
- \ifx\relax#1\relax \tabcaption{#2}\else\tabcaption[#1]{#2}\fi
+ \ifx\relax\hv@shortCap\relax \tabcaption{\hv@longCap}\else\tabcaption[\hv@shortCap]{\hv@longCap}\fi
\fi
\fi
\else
- \expandafter\ifx\expandafter\relax\hv@shortCap\relax \caption{#2}\else\caption[#1]{#2}\fi
+ \let\@captype\hv@floatType
+ \expandafter\ifx\expandafter\relax\hv@shortCap\relax \caption{\hv@longCap}\else\caption[\hv@shortCap]{\hv@longCap}\fi
\fi
- \label{#3}%
- \end{minipage}%
- }%
- }%
- \fi%
+ \label{\hv@label}%
+ \end{minipage}%
+ }% rotatebox
+ }% \sbox
+ \fi
+%
+% now we have the object and the caption with the right
+% rotated angles saved in different boxes
%%
\restoreCaptionSkip% save old values
- \ifx\hvSet@objectPos\hv@Right\raggedleft%
- \else
- \ifx\hvSet@objectPos\hv@Center
- \ifhv@nonFloat\hspace*{\fill}\else\centering\fi
- \fi
+ \def\fps@figure{\hvSet@floatPos}%
+ \ifhv@nonFloat
+ \begingroup% Start the nonfloat part
+ \checkoddpage
+ \else
+ \begin{\hv@floatType}% Start the floating environment
+ \checkoddpage
+ \fi
+ \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
+ \ifoddpage\raggedleft\fi
+ \fi
+ \ifx\hvSet@objectPos\hv@Inner
+ \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
+% 0 caption left, inner and odd page, oneside inner
+% 1 caption top
+% 2 caption right, inner and even page, oneside outer
+% 3 caption bottom
%
+ \ifx\hvSet@capPos\hv@Left\hv@@capPos=0\else
+ \ifx\hvSet@capPos\hv@Top\hv@@capPos=1\else
+ \ifx\hvSet@capPos\hv@Right\hv@@capPos=2\else
+ \ifx\hvSet@capPos\hv@Bottom\hv@@capPos=3\else
+ \ifx\hvSet@capPos\hv@Inner
+ \ifoddpageoroneside\hv@@capPos=0\else\hv@@capPos=2\fi
+ \else
+ \ifx\hvSet@capPos\hv@Outer
+ \ifoddpageoroneside\hv@@capPos=2\else\hv@@capPos=0\fi
+ \fi\fi\fi\fi\fi\fi
+%%%%
\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}}%
+ \expandafter\ifcase\the\hv@@capPos % 0 is LEFT START \ifcase
+ \ifx\hvSet@capVPos\hv@Center
+ \put@CaptionBox
+ \hspace{\hvSet@floatCapSep pt}% capfloatsep
+ \put@ObjectBox
+ \else
+ \ifx\hvSet@capVPos\hv@Top% caption and object at top aligned
+ \put@CaptionBox[1]
+ \hspace{\hvSet@floatCapSep pt}% capfloatsep
+ \put@ObjectBox[1]
+ \else% caption on bottom
+ \put@CaptionBox[2]
+ \hspace{\hvSet@floatCapSep pt}% capfloatsep
+ \put@ObjectBox[2]
+ \fi
+ \fi% end caption left
+ \or %1 is top
+ \ifdim\wd\hvCaptionBox>\wd\hvObjectBox
+ \begin{minipage}{\wd\hvCaptionBox}%
+ \else
+ \begin{minipage}{\wd\hvObjectBox}%
\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}}%
+ \centering
+ \ifhv@fbox
+ \fbox{\usebox{\hvCaptionBox}}\\[\hvBelowCaptionSkip]%
+ \fbox{\usebox{\hvObjectBox}}%
+ \else
+ \usebox{\hvCaptionBox}\\[\hvBelowCaptionSkip]%
+ \usebox{\hvObjectBox}%
\fi
- \hspace{\hvSet@floatCapSep pt}% capfloatsep
- \ifhv@fbox\fbox{\raisebox{-\height}{\usebox{\hvObjectBox}}}%
- \else \raisebox{-\height}{\usebox{\hvObjectBox}}%
+ \end{minipage}%
+ \or %2 is right
+ \ifx\hvSet@capVPos\hv@Center
+ \put@ObjectBox
+ \hspace{\hvSet@floatCapSep pt}%
+ \put@CaptionBox
+ \else
+ \ifx\hvSet@capVPos\hv@Top
+ \put@ObjectBox[1]
+ \hspace{\hvSet@floatCapSep pt}% capfloatsep
+ \put@CaptionBox[1]
+ \else
+ \put@ObjectBox[2]
+ \hspace{\hvSet@floatCapSep pt}% capfloatsep
+ \put@CaptionBox[2]
+ \fi
\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}%
+ \or %3 bottom
+ \ifdim\wd\hvCaptionBox>\wd\hvObjectBox
+ \begin{minipage}{\wd\hvCaptionBox}%
+ \else
+ \begin{minipage}{\wd\hvObjectBox}%
\fi
- \fi
- \fi
- \else
- \ifx\hvSet@capPos\hv@Top
- \ifdim\wd\hvCaptionBox>\wd\hvObjectBox
- \begin{minipage}{\wd\hvCaptionBox}%
- \else
- \begin{minipage}{\wd\hvObjectBox}%
- \fi
- \centering
- \ifhv@fbox
- \fbox{\usebox{\hvCaptionBox}}\\[\hvBelowCaptionSkip]
- \fbox{\usebox{\hvObjectBox}}%
- \else
- \usebox{\hvCaptionBox}\\[\hvBelowCaptionSkip]
- \usebox{\hvObjectBox}%
- \fi
- \end{minipage}%
- \else
- \ifx\hvSet@capPos\hv@Bottom
- \ifdim\wd\hvCaptionBox>\wd\hvObjectBox
- \begin{minipage}{\wd\hvCaptionBox}
- \else
- \begin{minipage}{\wd\hvObjectBox}
- \fi
- \centering
- \ifhv@fbox
- \fbox{\usebox{\hvObjectBox}}\\[\hvAboveCaptionSkip]
- \fbox{\usebox{\hvCaptionBox}}
- \else
- \usebox{\hvObjectBox}\\[\hvAboveCaptionSkip]
- \usebox{\hvCaptionBox}
- \fi%
- \end{minipage}
- \else% the last option: put the caption on the right
- \ifx\hvSet@capVPos\hv@Center%
- \ifhv@fbox
- \fbox{\parbox{\wd\hvObjectBox}{\usebox{\hvObjectBox}}}
- \else
- \parbox{\wd\hvObjectBox}{\usebox{\hvObjectBox}}
- \fi%
- \hspace{\hvSet@floatCapSep pt}%
- \ifhv@fbox
- \fbox{\parbox{\wd\hvCaptionBox}{\usebox{\hvCaptionBox}}}%
- \else
- \parbox{\wd\hvCaptionBox}{\usebox{\hvCaptionBox}}
- \fi%
- \else%
- \ifx\hvSet@capVPos\hv@Top
- \ifhv@fbox
- \fbox{\raisebox{-\height}{\usebox{\hvObjectBox}}}%
- \else
- \raisebox{-\height}{\usebox{\hvObjectBox}}%
- \fi%
- \hspace{\hvSet@floatCapSep pt}%
- \ifhv@fbox
- \fbox{\raisebox{-\height}{\usebox{\hvCaptionBox}}}%
- \else
- \raisebox{-\height}{\usebox{\hvCaptionBox}}%
- \fi
- \else
- \ifhv@fbox
- \fbox{\usebox{\hvObjectBox}}%
- \else
- \usebox{\hvObjectBox}%
- \fi
- \hspace{\hvSet@floatCapSep pt}%
- \ifhv@fbox
- \fbox{\usebox{\hvCaptionBox}}%
- \else
- \usebox{\hvCaptionBox}%
- \fi%
- \fi%
- \fi
- \fi
- \fi
- \fi
- }% End savebox Object and caption
+ \centering
+ \ifhv@fbox
+ \fbox{\usebox{\hvObjectBox}}\\[\hvAboveCaptionSkip]%
+ \fbox{\usebox{\hvCaptionBox}}%
+ \else
+ \ifhv@objectFrame\frame{\usebox{\hvObjectBox}}\else\usebox{\hvObjectBox}\fi\\[\hvAboveCaptionSkip]%
+ \usebox{\hvCaptionBox}%
+ \fi
+ \end{minipage}
+ \fi% \ifcase\the\hv@@capPos
+ }% End savebox Object and caption
%
% now we rotate the object and caption, if needed
%
- \ifx\hvSet@rotAngle\hv@Zero
- \usebox{\@tempboxa}
- \else
- \rotatebox{\hvSet@rotAngle}{\usebox{\@tempboxa}}
- \fi
- \ifhv@nonFloat
- \ifx\hvSet@objectPos\hv@Center
- \ifhv@nonFloat
- \hspace{\fill}
- \fi
- \fi
- \endgroup% End the nonfloat part
- \else
- \end{\hv@floatType}% End the floating environment
+ \ifhv@wide
+ \ifoddpageoroneside\else\ifoddpage\else\hspace*{-\marginparwidth}\fi\fi% <- for wide and left page
+ \fi
+ \ifx\hvSet@rotAngle\hv@Zero
+ \usebox{\@tempboxa}%
+ \else
+ \rotatebox{\hvSet@rotAngle}{\usebox{\@tempboxa}}%
+ \fi
+ \ifhv@nonFloat
+ \ifx\hvSet@objectPos\hv@Center
+ \ifhv@nonFloat
+ \hspace{\fill}%
\fi
+ \fi
+ \endgroup% End the nonfloat part
+ \else
+ \end{\hv@floatType}% End the floating environment
+ \fi
+ \endgroup% startet at main \hvFloat
}
%
\newenvironment{hvFloatEnv}[1][\textwidth]
{\minipage{#1}\center}
{\endcenter\endminipage}
%
+\newcounter{hvpfigure}
+\newcounter{hvptable}
+
+\def\drawSepLine{%
+ \noindent
+ \if@twocolumn\rule{\columnwidth}{0.4pt}\else\rule{\linewidth}{0.4pt}\fi
+ \vspace{0pt}%
+}
+
+\def\set@caption@object{% first caption, then object
+ \begin{\hv@floatType}[!b]
+ \capstart
+ \belowcaptionskip=0pt% local change
+ \ifhv@separatorLine\drawSepLine\fi
+ \expandafter\ifx\expandafter\relax\hv@shortCap\relax
+ \caption{\hv@longCap}%
+ \else
+ \caption[\hv@shortCap]{\hv@longCap}%
+ \fi
+ \expandafter\ifx\expandafter\relax\hv@label\relax\else
+ \label{\hv@label-cap}\fi
+ \end{\hv@floatType}%
+%
+ \if@hvstar
+ \begin{\hv@floatType*}[!p]
+ \else
+ \begin{\hv@floatType}[!p]
+ \fi
+ \edef\@captype{hvp\@captype}%
+ \capstart
+ \refstepcounter{\@captype}%
+ \expandafter\ifx\expandafter\relax\hv@label\relax\else
+ \expandafter\label\expandafter{\hv@label}%
+ \fi
+ \ifhv@objectFrame\frame{\hv@floatObject}\else\hv@floatObject\fi
+ \if@hvstar
+ \end{\hv@floatType*}%
+ \else
+ \end{\hv@floatType}%
+ \fi
+}
+\def\set@object@caption{% first object, then caption
+ \if@hvstar
+ \begin{\hv@floatType*}[!p]
+ \else
+ \begin{\hv@floatType}[!p]
+ \fi
+ \edef\@captype{hvp\@captype}%
+ \capstart
+ \refstepcounter{\@captype}%
+ \expandafter\ifx\expandafter\relax\hv@label\relax\else
+ \expandafter\label\expandafter{\hv@label}%
+ \fi
+ \ifhv@objectFrame\frame{\hv@floatObject}\else\hv@floatObject\fi
+ \if@hvstar
+ \end{\hv@floatType*}%
+ \else
+ \end{\hv@floatType}%
+ \fi
+%
+ \begin{\hv@floatType}[!b]
+ \capstart
+ \belowcaptionskip=0pt% local change
+ \ifhv@separatorLine\drawSepLine\fi
+ \expandafter\ifx\expandafter\relax\hv@shortCap\relax
+ \caption{\hv@longCap}%
+ \else
+ \caption[\hv@shortCap]{\hv@longCap}%
+ \fi
+ \expandafter\ifx\expandafter\relax\hv@label\relax\else
+ \label{\hv@label-cap}
+ \fi
+ \end{\hv@floatType}%
+}
+%
+\def\do@@@@hvFloat{% special float page: caption <-> fullpage image
+% \typeout{hvfloat: \hvSet@capPos}%
+% \ifoddpage\typeout{hvfloat: Oddpage}\else\typeout{hvfloat: Evenpage}\fi
+ \ifx\hvSet@capPos\hv@Right \hv@@capPos=1
+ \else
+ \ifx\hvSet@capPos\hv@Even \hv@@capPos=2
+ \else
+ \ifx\hvSet@capPos\hv@Odd \hv@@capPos=3
+ \else
+ \ifx\hvSet@capPos\hv@Inner \hv@@capPos=4
+ \else
+ \ifx\hvSet@capPos\hv@Outer \hv@@capPos=5
+ \else
+ \hv@@capPos=0
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \checkoddpage
+ \ifcase\hv@@capPos% caption before object 0->left
+ \if@twocolumn
+ \if@firstcolumn
+ \ifhv@FullPage\afterpage{\set@caption@object}\else\set@caption@object\fi
+ \else
+ \afterpage{\set@caption@object}%
+ \fi
+ \else
+ \set@caption@object
+ \fi
+ \or% caption after object 1->right
+ \if@twocolumn
+ \if@firstcolumn
+ \afterpage{\null\afterpage{\set@object@caption}}%
+ \else
+ \set@object@caption%
+ \fi
+ \else
+ \set@object@caption
+ \fi
+ \or% caption on even page 2->left page
+ \ifoddpage\set@object@caption\else\set@caption@object\fi
+ \or% caption on odd page 3->right page
+ \ifoddpage\set@caption@object\else\afterpage{\set@caption@object}\fi
+ \or% caption on the inner column 4->inner
+ \if@twocolumn
+ \ifoddpage
+ \if@firstcolumn
+ \set@caption@object
+ \else
+ \afterpage{\set@object@caption}%
+ \fi
+ \else% even page (left)
+ \afterpage{%
+ \if@firstcolumn
+ \set@caption@object
+ \else
+ \afterpage{\set@caption@object}%
+ \fi
+ }%
+ \fi
+ \fi
+ \or% caption on the outer column
+ \if@twocolumn
+ \ifoddpage
+ \afterpage{\if@firstcolumn\set@caption@object\else\afterpage{\set@caption@object}\fi}%
+ \else% even page (left)
+ \if@firstcolumn
+ \set@caption@object
+ \else
+ \afterpage{\set@object@caption}%
+ \fi
+ \fi
+ \fi
+ \fi
+ \endgroup% startet at main \hvFloat
+}%
+%
+
+
\endinput