diff options
author | Karl Berry <karl@freefriends.org> | 2012-04-19 16:52:44 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-04-19 16:52:44 +0000 |
commit | a2b539be57596e35eac0c7860004eec5b838c447 (patch) | |
tree | 78fbee81bd9887db4d1ead7248289514ff128ee7 /Master/texmf-dist/tex/latex/bidi/hvfloat-xetex-bidi.def | |
parent | e1be519f38bb37eeadbe6360c90f85a16d5bbe8c (diff) |
bidi (18apr12)
git-svn-id: svn://tug.org/texlive/trunk@26044 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/bidi/hvfloat-xetex-bidi.def')
-rw-r--r-- | Master/texmf-dist/tex/latex/bidi/hvfloat-xetex-bidi.def | 410 |
1 files changed, 153 insertions, 257 deletions
diff --git a/Master/texmf-dist/tex/latex/bidi/hvfloat-xetex-bidi.def b/Master/texmf-dist/tex/latex/bidi/hvfloat-xetex-bidi.def index 8b3da5961b2..52b363eecb0 100644 --- a/Master/texmf-dist/tex/latex/bidi/hvfloat-xetex-bidi.def +++ b/Master/texmf-dist/tex/latex/bidi/hvfloat-xetex-bidi.def @@ -12,284 +12,159 @@ %% License information appended. %% %% -\ProvidesFile{hvfloat-xetex-bidi.def}[2011/06/11 v0.1 bidi adaptations for hvfloat package for XeTeX engine] +\ProvidesFile{hvfloat-xetex-bidi.def}[2012/04/18 v0.2 bidi adaptations for hvfloat package for XeTeX engine] \def\do@@hvFloat[#1]#2#3{% \def\hv@shortCap{#1} \def\hv@longCap{#2} \def\hv@label{#3} -\def\@tempa{90}% -\ifx\hvSet@rotAngle\@tempa -\setlength{\hvMaxCapWidth}{\textheight} -\else -\setlength{\hvMaxCapWidth}{\linewidth} -\fi -\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@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 + \def\@tempa{90}% + \ifx\hvSet@rotAngle\@tempa \setlength{\hvMaxCapWidth}{\textheight} + \else \setlength{\hvMaxCapWidth}{\linewidth} + \fi + \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@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 + \else \setlength{\hvCapWidth}{\hvMaxCapWidth} -\fi -\fi -\fi -\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% - \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 + \fi + \fi + \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% \label{#3}% -\end{minipage}% -}% -\else% -\sbox{\hvCaptionBox}{% -\rotatebox{\hvSet@capAngle}{% -\begin{minipage}[b]{\hvCapWidth}% minipage, to get hyphenation + \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}}% + \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% -\else% -\ifx\hv@shortCap\empty\caption{#2}\else\caption[#1]{#2}\fi% -\fi% -\label{#3}% -\end{minipage}% -}% -}% -\fi% + \fi% %% -\restoreCaptionSkip% save old values - \if@RTL% - \ifx\hvSet@objectPos\hv@Left% -\raggedright% -\else% -\ifx\hvSet@objectPos\hv@Center% -\ifhv@nonFloat% -\hspace*{\fill}% -\else% -\centering -\fi% -\fi% -\fi% - \else -\ifx\hvSet@objectPos\hv@Right% -\raggedleft% -\else% -\ifx\hvSet@objectPos\hv@Center% -\ifhv@nonFloat% -\hspace*{\fill}% -\else% -\centering -\fi% -\fi% -\fi% - \fi -\savebox{\@tempboxa}{\if@RTL% - \ifx\hvSet@capPos\hv@Right % caption on left side + \restoreCaptionSkip% save old values + \ifx\hvSet@objectPos\hv@Right\bidi@raggedleft% + \else% + \ifx\hvSet@objectPos\hv@Center + \ifhv@nonFloat\hspace*{\fill}\else\centering\fi% + \fi% + \fi% + \savebox{\@tempboxa}{% + \ifx\hvSet@capPos\hv@Left % caption on left side +\if@RTL% \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% +\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@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 -\ifx\hvSet@capPos\hv@Top -\ifdim\wd\hvCaptionBox>\wd\hvObjectBox -\begin{minipage}{\wd\hvCaptionBox} -\else -\begin{minipage}{\wd\hvObjectBox} -\fi -\centering -\ifhv@framedCaption% -\fbox{\usebox{\hvCaptionBox}}\\[\hvBelowCaptionSkip] -\else -\usebox{\hvCaptionBox}\\[\hvBelowCaptionSkip]% -\fi% -\ifhv@framedObject% -\fbox{\usebox{\hvObjectBox}}% -\else -\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@framedObject -\fbox{\usebox{\hvObjectBox}}\\[\hvAboveCaptionSkip] -\else -\usebox{\hvObjectBox}\\[\hvAboveCaptionSkip] -\fi% -\ifhv@framedCaption -\fbox{\usebox{\hvCaptionBox}}% -\else -\usebox{\hvCaptionBox}% -\fi% -\end{minipage} -\else% the last option: put the caption on the right -\ifx\hvSet@capVPos\hv@Center% -\ifhv@framedObject -\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}% \fi% \fi% -\fi -\fi -\fi -\fi - \else -\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 +\else% not RTL + \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% end of RTL + \fi% + \else \ifx\hvSet@capPos\hv@Top \ifdim\wd\hvCaptionBox>\wd\hvObjectBox \begin{minipage}{\wd\hvCaptionBox} @@ -297,15 +172,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 @@ -316,61 +188,88 @@ \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 +\if@RTL% + \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% not RTL \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}% \fi% \fi% \fi +\fi% end of RTL \fi \fi \fi -\fi}% End savebox Object and caption +}% End savebox Object and caption \ifx\hvSet@rotAngle\hv@Zero \usebox{\@tempboxa} \else @@ -386,9 +285,6 @@ \else \end{\hv@floatType}% End the floating environment \fi -\ifhv@fbox % reset local settings - \setkeys{hvSet}{framedCaption=true, framedObject=true} -\fi } %% %% Copyright © 2009–2012 Vafa Khalighi <simurgh12@gmail.com> |