summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-01-13 00:11:38 +0000
committerKarl Berry <karl@freefriends.org>2006-01-13 00:11:38 +0000
commit05e898e69b631bb62d157201e0ca9fa7cc027f67 (patch)
tree77173ddde2a022b824f69c4bca66ba91c1b205bf /Master
parentf838b85c3a4cac820a92a9e2982572bf90b36650 (diff)
xfrac
git-svn-id: svn://tug.org/texlive/trunk@1458 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/tex/latex/xfrac/xfrac.sty258
1 files changed, 258 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/xfrac/xfrac.sty b/Master/texmf-dist/tex/latex/xfrac/xfrac.sty
new file mode 100644
index 00000000000..ac9712776ca
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/xfrac/xfrac.sty
@@ -0,0 +1,258 @@
+%%
+%% This is file `xfrac.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% xfrac.dtx (with options: `package')
+%%
+%% It may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2003/12/01 or later.
+%%
+%% This work has the LPPL maintenance status "maintained".
+%%
+%% The Current Maintainer of this work is Morten H\o gholm.
+%%
+%% This work consists of the files xfrac.dtx, xfrac.ins and the
+%% derived file xfrac.sty.
+%%
+\NeedsTeXFormat{LaTeX2e}[2003/12/01]
+\ProvidesPackage{xfrac}
+ [2004/10/10 v0.11b Slashed Fractions (MH)]
+\RequirePackage{textcomp,graphicx,amstext}
+\RequirePackage{template}[2001/07/25]
+\RequirePackage{xparse}[2000/01/29]
+\InternalSyntaxOn
+\@ifundefined{else:}{\let\else:=\else}{}
+\@ifundefined{fi:}{\let\fi:=\fi}{}
+\@ifundefined{if_dim:w}{\let\if_dim:w =\ifdim}{}
+\@ifundefined{if_mathmode:}{\let\if_mathmode: =\ifmmode}{}
+\def\xfrac_namelet:cN #1#2{%
+ \expandafter\let\csname#1\endcsname#2}
+\def\xfrac_new_boolean:c #1{
+ \expandafter\@ifdefinable\csname if_boolean_#1:\endcsname{
+ \@namedef{boolean_#1_true:}
+ {\xfrac_namelet:cN{if_boolean_#1:}\iftrue}%
+ \@namedef{boolean_#1_false:}
+ {\xfrac_namelet:cN{if_boolean_#1:}\iffalse}%
+ \@nameuse{boolean_#1_false:}%
+ }
+}
+\def\xfrac_set_boolean:cc #1#2{ \@nameuse{boolean_#1_#2:}}
+\def\if_boolean:cTF #1{
+ \@nameuse{if_boolean_#1:}
+ \expandafter\@firstoftwo
+ \else:
+ \expandafter\@secondoftwo
+ \fi:
+}
+\def\if_boolean:cT #1#2{ \if_boolean:cTF {#1}{#2}{} }
+\def\if_boolean:cF #1#2{ \if_boolean:cTF {#1}{}{#2} }
+\xfrac_new_boolean:c {cm_recommended}
+\DeclareOption{cm-recommended}
+ { \xfrac_set_boolean:cc {cm_recommended}{true} }
+\DeclareOption{cm-standard}
+ { \xfrac_set_boolean:cc {cm_recommended}{false} }
+\ExecuteOptions{cm-recommended}
+\ProcessOptions\relax
+\newsavebox\l_xfrac_temp_box
+\newsavebox\l_xfrac_slash_box
+\DeclareTemplateType{xfrac}{3}
+\DeclareTemplate{xfrac}{text}{3}{
+ numerator-font = n [\f@family] \xfrac_numeratorfont:,
+ numerator-format = f1 [#1] \xfrac_numeratorformat:n,
+ slash-symbol = n [\textfractionsolidus]
+ \xfrac_slashsymbol:,
+ slash-symbol-font = n [\f@family] \xfrac_slashsymbolfont:,
+ slash-symbol-format = f1 [#1] \xfrac_slashsymbolformat:n,
+ denominator-font = n [\f@family] \xfrac_denominatorfont:,
+ denominator-format = f1 [#1] \xfrac_denominatorformat:n,
+ h-scale = n [1] \xfrac_hscale:,
+ v-scale = n [1] \xfrac_vscale:,
+ scale-factor = n [.83333] \xfrac_scalefactor:,
+ scale-relative = s [true]
+ { \def \xfrac_relscale: {\ht\l_xfrac_slash_box}}
+ { \def \xfrac_relscale: {
+ \dimexpr \ht\l_xfrac_temp_box + \dp\l_xfrac_temp_box\relax} },
+ scaling = s [true]
+ {\def\xfrac_fontscale: {
+ \fontsize{\xfrac_scalefactor: \xfrac_relscale:}{\z@}\selectfont}}
+ { \let\xfrac_fontscale: \relax },
+ numerator-top-sep = L [\maxdimen] \l_xfrac_numeratortopsep_fdim,
+ numerator-bot-sep = L [\maxdimen] \l_xfrac_numeratorbotsep_fdim,
+ denominator-bot-sep = L [\maxdimen] \l_xfrac_denominatorbotsep_fdim,
+ slash-right-kern = L [0pt] \l_xfrac_slashrightsep_fdim,
+ slash-left-kern = L [0pt] \l_xfrac_slashleftsep_fdim,
+ slash-right-mkern = n [-2mu] \l_xfrac_slashrightmsep_fmu,
+ slash-left-mkern = n [-1mu] \l_xfrac_slashleftmsep_fmu,
+ math-mode = s [false] { \let\xfrac_math: \ensuremath }
+ { \let\xfrac_math: \@firstofone },
+ phantom = n [8] \xfrac_phantom:,
+}{
+ \DoParameterAssignments
+ \if_mathmode:
+ \let\xfrac_textormath: \text
+ \edef\xfrac_slashfontchange: {\fam\xfrac_slashsymbolfont: }
+ \edef\xfrac_numeratorfontchange: {\fam\xfrac_numeratorfont: }
+ \edef\xfrac_denominatorfontchange: {\fam\xfrac_denominatorfont: }
+ \else:
+ \let\xfrac_textormath: \mbox
+ \def\xfrac_slashfontchange: {
+ \fontfamily{\xfrac_slashsymbolfont: }\selectfont}
+ \def\xfrac_numeratorfontchange: {
+ \fontfamily{\xfrac_numeratorfont: }\selectfont}
+ \def\xfrac_denominatorfontchange: {
+ \fontfamily{\xfrac_denominatorfont: }\selectfont}
+ \fi:
+ \xfrac_textormath: {
+ \m@th
+ \sbox\l_xfrac_temp_box {\xfrac_math: {\vphantom{(}}}
+ \sbox\l_xfrac_slash_box {
+ \xfrac_math: {
+ \xfrac_slashsymbolformat:n {
+ \xfrac_math: {
+ \xfrac_slashfontchange:
+ \IfValueTF{#2}{#2}{\xfrac_slashsymbol: }
+ }
+ }
+ }
+ }
+ \if_dim:w \l_xfrac_numeratortopsep_fdim = \maxdimen
+ \if_dim:w \l_xfrac_numeratorbotsep_fdim = \maxdimen
+ \def\xfrac_next: {\raisebox{\ht\l_xfrac_slash_box
+ -\dp\l_xfrac_slash_box-\height}}
+ \else:
+ \def\xfrac_next: {\raisebox{\l_xfrac_numeratorbotsep_fdim }}
+ \fi:
+ \else:
+ \if_dim:w \l_xfrac_numeratorbotsep_fdim = \maxdimen
+ \def\xfrac_next: {
+ \raisebox{
+ \ht\l_xfrac_slash_box - \l_xfrac_numeratortopsep_fdim
+ - \height
+ }
+ }
+ \else:
+ \PackageError{xfrac}
+ {You~ have~ specified~ both~ numerator-top-sep~ and~
+ numerator-bot-sep}
+ {I~ will~ pretend~ you~ didn't~ specify~ any~ of ~them}
+ \def\xfrac_next: {\raisebox{\ht\l_xfrac_slash_box
+ -\dp\l_xfrac_slash_box-\height}}
+ \fi:
+ \fi:
+ \xfrac_next: {
+ \xfrac_fontscale:
+ \xfrac_numeratorformat:n {
+ \scalebox{\xfrac_hscale: }[\xfrac_vscale: ]
+ { \xfrac_math:{ \xfrac_numeratorfontchange:
+ {\vphantom{\xfrac_phantom: }#1} } }
+ }
+ }
+ \xfrac_math: {
+ \if_mathmode:
+ \mskip \l_xfrac_slashrightmsep_fmu
+ \else:
+ \hskip \l_xfrac_slashrightsep_fdim
+ \fi: }
+ \usebox\l_xfrac_slash_box
+ \xfrac_math: {
+ \if_mathmode:
+ \mskip \l_xfrac_slashleftmsep_fmu
+ \else:
+ \hskip \l_xfrac_slashleftsep_fdim
+ \fi: }
+ \if_dim:w \l_xfrac_denominatorbotsep_fdim=\maxdimen\relax
+ \def\xfrac_next: {\raisebox{-\dp\l_xfrac_slash_box}}
+ \else:
+ \def\xfrac_next: {\raisebox{\l_xfrac_denominatorbotsep_fdim}}
+ \fi:
+ \xfrac_next: {
+ \xfrac_fontscale:
+ \xfrac_denominatorformat:n {
+ \scalebox{\xfrac_hscale:}[\xfrac_vscale:]
+ { \xfrac_math: { \xfrac_denominatorfontchange:
+ {\vphantom{\xfrac_phantom: }#3} } }
+ }
+ }
+ }
+}
+\DeclareRestrictedTemplate{xfrac}{math}{text}{
+ numerator-font = \number\fam,
+ slash-symbol = /,
+ slash-symbol-font = \number\fam,
+ denominator-font = \number\fam,
+ scale-factor = 0.7,
+ scale-relative = false,
+ scaling = true,
+ numerator-top-sep = 0pt,
+ denominator-bot-sep = 0pt,
+ math-mode = true,
+ phantom = (,
+}
+\DeclareInstance{xfrac}{default}{text}{ }
+\DeclareInstance{xfrac}{mathdefault}{math}{ }
+\DeclareCollectionInstance{plainmath}{xfrac}{mathdefault}{math}{
+ denominator-bot-sep=0pt,
+ numerator-bot-sep=0pt,
+ numerator-top-sep=\maxdimen,
+ scale-factor = 1,
+ scale-relative = false,
+ scaling = true,
+ slash-right-mkern=0mu,
+ slash-left-mkern=0mu,
+}
+\DeclareInstance{xfrac}{cmr}{text}{
+ denominator-bot-sep=0pt,
+ numerator-top-sep=\DelayEvaluation{.2ex},
+ slash-left-kern=\DelayEvaluation{-.1em},
+ slash-right-kern=\DelayEvaluation{-.1em},
+}
+\DeclareInstance{xfrac}{cmss}{text}{
+ denominator-bot-sep=0pt,
+ numerator-top-sep=\DelayEvaluation{.2ex},
+ slash-left-kern=\DelayEvaluation{-.1em},
+ slash-right-kern=\DelayEvaluation{-.1em},
+}
+\DeclareInstance{xfrac}{cmtt}{text}{
+ denominator-bot-sep=0pt,
+ numerator-top-sep=\DelayEvaluation{.2ex},
+ slash-left-kern=\DelayEvaluation{-.1em},
+ slash-right-kern=\DelayEvaluation{-.1em},
+}
+\DeclareCollectionInstance{cm-recommended}{xfrac}{cmr}{text}{
+ slash-symbol-font = ptm,
+}
+\DeclareCollectionInstance{cm-recommended}{xfrac}{cmss}{text}{
+ slash-symbol-font = ptm,
+}
+\DeclareCollectionInstance{cm-recommended}{xfrac}{cmtt}{text}{
+ slash-symbol-font = ppl,
+}
+\if_boolean:cT {cm_recommended}
+ {\UseCollection{xfrac}{cm-recommended}}
+\DeclareDocumentCommand \sfrac {o mom}{
+ \if_mathmode:
+ \edef\xfrac_next: {mathfam\number\fam}
+ \IfExistsInstanceTF{xfrac}{\xfrac_next: }
+ {\UseInstance{xfrac}{\xfrac_next: }}
+ {\UseInstance{xfrac}{mathdefault}}
+ {#2}{#3}{#4}
+ \else:
+ \IfExistsInstanceTF{xfrac}{#1}
+ {\UseInstance{xfrac}{#1}{#2}{#3}{#4}}
+ {\IfExistsInstanceTF{xfrac}{\f@family}
+ {\UseInstance{xfrac}{\f@family}}
+ {\UseInstance{xfrac}{default}}
+ {#2}{#3}{#4}
+ }
+ \fi:
+}
+\endinput
+%%
+%% End of file `xfrac.sty'.