diff options
author | Karl Berry <karl@freefriends.org> | 2011-07-31 18:27:40 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-07-31 18:27:40 +0000 |
commit | 1b26357f303f48ae0b233a5fee9c2e5b8c3d8647 (patch) | |
tree | 7fc300fb4b7a180433559b69e8f2362d1cfe5ac7 /Master/texmf-dist/tex/latex/l3packages/xfrac | |
parent | dac945b204407dae96f70ec228206516093156d7 (diff) |
l3packages (5jun11)
git-svn-id: svn://tug.org/texlive/trunk@23283 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/l3packages/xfrac')
-rw-r--r-- | Master/texmf-dist/tex/latex/l3packages/xfrac/xfrac.sty | 438 |
1 files changed, 438 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/l3packages/xfrac/xfrac.sty b/Master/texmf-dist/tex/latex/l3packages/xfrac/xfrac.sty new file mode 100644 index 00000000000..d53d6d62bcb --- /dev/null +++ b/Master/texmf-dist/tex/latex/l3packages/xfrac/xfrac.sty @@ -0,0 +1,438 @@ +%% +%% This is file `xfrac.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% xfrac.dtx (with options: `package') +%% +%% EXPERIMENTAL CODE +%% +%% Do not distribute this file without also distributing the +%% source files specified above. +%% +%% Do not distribute a modified version of this file. +%% +%% File: xfrac.dtx Copyright (C) 2004, 2008-2010 Morten Hoegholm +%% (C) 2011 The LaTeX3 Project +%% +%% It may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License (LPPL), either version 1.3c of this +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This file is part of the "l3packages bundle" (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% The released version of this bundle is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX Project Team. +%% +%% ----------------------------------------------------------------------- +%% +\RequirePackage{amstext,graphicx,l3keys2e,textcomp,xparse,xtemplate} +\GetIdInfo$Id: xfrac.dtx 2349 2011-05-11 18:44:37Z joseph $ + {L3 Experimental split-level fractions} +\ProvidesExplPackage + {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} +\keys_define:nn { xfrac } + { + cm-recommended .choice:, + cm-recommended / + false .code:n = + { \bool_set_true:N \l_xfrac_cm_std_bool }, + cm-recommended / + true .code:n = + { \bool_set_false:N \l_xfrac_cm_std_bool }, + cm-recommended .default:n = { true }, + cm-standard .bool_set:N = \l_xfrac_cm_std_bool + } +\ProcessKeysOptions { xfrac } +\box_new:N \l_xfrac_slash_box +\box_new:N \l_xfrac_tmp_box +\cs_new:Npn \xfrac_tmp:w { } +\dim_new:N \l_xfrac_denominator_bot_sep_dim +\dim_new:N \l_xfrac_numerator_bot_sep_dim +\dim_new:N \l_xfrac_numerator_top_sep_dim +\dim_new:N \l_xfrac_slash_left_sep_dim +\dim_new:N \l_xfrac_slash_right_sep_dim +\muskip_new:N \l_xfrac_slash_left_muskip +\muskip_new:N \l_xfrac_slash_right_muskip +\fp_new:N \l_xfrac_hscale_fp +\fp_new:N \l_xfrac_scale_factor_fp +\fp_new:N \l_xfrac_vscale_fp +\tl_new:N \l_xfrac_denominator_font_tl +\tl_new:N \l_xfrac_numerator_font_tl +\tl_new:N \l_xfrac_phantom_tl +\tl_new:N \l_xfrac_slash_symbol_tl +\tl_new:N \l_xfrac_slash_symbol_font_tl +\cs_new_nopar:Npn \xfrac_fontscale: +\cs_new:Npn \xfrac_math:n #1 { } +\cs_new_nopar:Npn \xfrac_denominator_font_change: { } +\cs_new:Npn \xfrac_denominator_format:n #1 { } +\cs_new_nopar:Npn \xfrac_numerator_font_change: { } +\cs_new:Npn \xfrac_numerator_format:n #1 { } +\cs_new_nopar:Npn \xfrac_relscale: { } +\cs_new_nopar:Npn \xfrac_slash_symbol_font_change: { } +\cs_new:Npn \xfrac_slash_symbol_format:n #1 { } +\cs_new:Npn \xfrac_text_or_math:n #1 { } +\DeclareObjectType { xfrac } { 3 } +\DeclareTemplateInterface { xfrac } { text } { 3 } + { + denominator-bot-sep : length = \c_max_dim , + denominator-font : tokenlist = \f@family , + denominator-format : function 1 = #1 , + h-scale : real = 1 , + math-mode : choice { false , true } + = false , + numerator-font : tokenlist = \f@family , + numerator-format : function 1 = #1 , + numerator-bot-sep : length = \c_max_dim , + numerator-top-sep : length = \c_max_dim , + phantom : tokenlist = 8 , + scale-factor : real = 0.83333 , + scale-relative : choice { false , true } + = true , + scaling : choice { false , true } + = true , + slash-left-kern : length = 0 pt , + slash-left-mkern : muskip = -2 mu , + slash-right-kern : length = 0 pt , + slash-right-mkern : muskip = -1 mu , + slash-symbol : tokenlist = \textfractionsolidus , + slash-symbol-font : tokenlist = \f@family , + slash-symbol-format : function 1 = #1 , + v-scale : real = 1 , + } +\DeclareTemplateCode { xfrac } { text } { 3 } + { + denominator-bot-sep = \l_xfrac_denominator_bot_sep_dim , + denominator-font = \l_xfrac_denominator_font_tl , + denominator-format = \xfrac_denominator_format:n , + h-scale = \l_xfrac_hscale_fp , + math-mode = + { + false = \cs_set_eq:NN \xfrac_math:n \use:n, + true = \cs_set_eq:NN \xfrac_math:n \ensuremath + }, + numerator-font = \l_xfrac_numerator_font_tl , + numerator-format = \xfrac_numerator_format:n , + numerator-bot-sep = \l_xfrac_numerator_bot_sep_dim , + numerator-top-sep = \l_xfrac_numerator_top_sep_dim , + phantom = \l_xfrac_phantom_tl , + scale-factor = \l_xfrac_scale_factor_fp , + scale-relative = + { + false = + \cs_set_nopar:Npn \xfrac_relscale: + { + \dim_eval:w + \box_ht:N \l_xfrac_tmp_box + \box_dp:N \l_xfrac_tmp_box + \dim_eval_end: + }, + true = + \cs_set_nopar:Npn \xfrac_relscale: + { \box_ht:N \l_xfrac_slash_box } + }, + scaling = + { + false = \cs_set_eq:NN \xfrac_fontscale: \prg_do_nothing:, + true = + \cs_set_nopar:Npn \xfrac_fontscale: + { + \fontsize + { \fp_use:N \l_xfrac_scale_factor_fp \xfrac_relscale: } + { \c_zero_dim } + \selectfont + } + }, + slash-left-kern = \l_xfrac_slash_left_sep_dim , + slash-left-mkern = \l_xfrac_slash_left_muskip , + slash-right-kern = \l_xfrac_slash_right_sep_dim , + slash-right-mkern = \l_xfrac_slash_right_muskip , + slash-symbol = \l_xfrac_slash_symbol_tl , + slash-symbol-font = \l_xfrac_slash_symbol_font_tl , + slash-symbol-format = \xfrac_slash_symbol_format:n , + v-scale = \l_xfrac_vscale_fp + } + { + \AssignTemplateKeys + \mode_if_math:TF + { + \cs_set_eq:NN \xfrac_text_or_math:n \text + \cs_set_nopar:Npx \xfrac_denominator_font_change: + { \tex_fam:D \l_xfrac_denominator_font_tl } + \cs_set_nopar:Npx \xfrac_numerator_font_change: + { \tex_fam:D \l_xfrac_numerator_font_tl } + \cs_set_nopar:Npx \xfrac_slash_symbol_font_change: + { \tex_fam:D \l_xfrac_slash_symbol_font_tl } + } + { + \cs_set_eq:NN \xfrac_text_or_math:n \mbox + \cs_set_nopar:Npn \xfrac_denominator_font_change: + { + \fontfamily { \l_xfrac_denominator_font_tl } + \selectfont + } + \cs_set_nopar:Npn \xfrac_numerator_font_change: + { + \fontfamily { \l_xfrac_numerator_font_tl } + \selectfont + } + \cs_set_nopar:Npn \xfrac_slash_symbol_font_change: + { + \fontfamily { \l_xfrac_slash_symbol_font_tl } + \selectfont + } + } + \xfrac_text_or_math:n + { + \m@th + \hbox_set:Nn \l_xfrac_tmp_box + { \xfrac_math:n { \vphantom { ( ) } } } + \hbox_set:Nn \l_xfrac_slash_box + { + \xfrac_math:n + { + \xfrac_slash_symbol_format:n + { + \xfrac_math:n + { + \xfrac_slash_symbol_font_change: + \IfNoValueTF {#2} + { \l_xfrac_slash_symbol_tl } {#2} + } + } + } + } + \cs_set_nopar:Npn \xfrac_tmp:w + { + \raisebox + { + \box_ht:N \l_xfrac_slash_box + - \box_dp:N \l_xfrac_slash_box + - \height + } + } + \dim_compare:nNnTF + { \l_xfrac_numerator_top_sep_dim } = { \c_max_dim } + { + \dim_compare:nNnF + { \l_xfrac_numerator_bot_sep_dim } = { \c_max_dim } + { + \cs_set_nopar:Npn \xfrac_tmp:w + { + \raisebox + { \dim_use:N \l_xfrac_numerator_bot_sep_dim } + } + } + } + { + \dim_compare:nNnTF + { \l_xfrac_numerator_bot_sep_dim } = { \c_max_dim } + { + \cs_set_nopar:Npn \xfrac_tmp:w + { + \raisebox + { + \box_ht:N \l_xfrac_slash_box + - \dim_use:N \l_xfrac_numerator_top_sep_dim + - \height + } + } + } + { + \msg_error:nn { xfrac } + { over-specified-numerator-sep } + } + } + \xfrac_tmp:w + { + \xfrac_fontscale: + \xfrac_numerator_format:n + { + \scalebox + { \fp_use:N \l_xfrac_hscale_fp } + [ \fp_use:N \l_xfrac_vscale_fp ] + { + \xfrac_math:n + { + \xfrac_numerator_font_change: + { + \vphantom { \l_xfrac_phantom_tl } + #1 + } + } + } + } + } + \xfrac_math:n + { % THIS IS JUST WRONG! + \mode_if_math:TF + { \tex_mskip:D \l_xfrac_slash_right_muskip } + { \tex_hskip:D \l_xfrac_slash_right_sep_dim } + } + \box_use:N \l_xfrac_slash_box + \xfrac_math:n + { + \mode_if_math:TF + { \tex_mskip:D \l_xfrac_slash_left_muskip } + { \tex_hskip:D \l_xfrac_slash_left_sep_dim } + } + \dim_compare:nNnTF + { \l_xfrac_denominator_bot_sep_dim } = { \c_max_dim } + { + \cs_set_nopar:Npn \xfrac_tmp:w + { \raisebox { - \box_dp:N \l_xfrac_slash_box } } + } + { + \cs_set_nopar:Npn \xfrac_tmp:w + { + \raisebox + { \dim_use:N \l_xfrac_denominator_bot_sep_dim } + } + } + \xfrac_tmp:w + { + \xfrac_fontscale: + \xfrac_denominator_format:n + { + \scalebox + { \fp_use:N \l_xfrac_hscale_fp } + [ \fp_use:N \l_xfrac_vscale_fp ] + { + \xfrac_math:n + { + \xfrac_denominator_font_change: + { + \vphantom { \l_xfrac_phantom_tl } + #3 + } + } + } + } + } + } + } +\DeclareRestrictedTemplate { xfrac } { text } { math } + { + 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 = 0 pt , + denominator-bot-sep = 0 pt , + math-mode = true , + phantom = ( % ) + } +\DeclareInstance { xfrac } { default } { text } { } +\DeclareInstance { xfrac } { mathdefault } { math } { } +\DeclareCollectionInstance { plainmath } { xfrac } { mathdefault } { math } + { + denominator-bot-sep = 0 pt , + numerator-bot-sep = 0 pt , + numerator-top-sep = \c_max_dim , + scale-factor = 1 , + scale-relative = false , + scaling = true , + slash-right-mkern = 0 mu , + slash-left-mkern = 0 mu + } +\DeclareInstance { xfrac } { cmr } { text } + { + denominator-bot-sep = 0 pt , + numerator-top-sep = 0.2 ex , + slash-left-kern = -0.1 em , + slash-right-kern = -0.1 em + } +\DeclareInstance { xfrac } { cmss } { text } + { + denominator-bot-sep = 0 pt , + numerator-top-sep = 0.2 ex , + slash-left-kern = -0.1 em , + slash-right-kern = -0.1 em + } +\DeclareInstance { xfrac } { cmtt } { text } + { + denominator-bot-sep = 0 pt , + numerator-top-sep = 0.2 ex , + slash-left-kern = -0.1 em , + slash-right-kern = -0.1 em + } +\bool_if:NF \l_xfrac_cm_std_bool + { + \DeclareInstance { xfrac } { cmr } { text } + { slash-symbol-font = ptm } + \DeclareInstance { xfrac } { cmss } { text } + { slash-symbol-font = ptm } + \DeclareInstance { xfrac } { cmtt } { text } + { slash-symbol-font = ppl } + } +\DeclareInstance { xfrac } { lmr } { text } + { + denominator-bot-sep = 0 pt , + numerator-top-sep = 0.1 ex , + slash-left-kern = -0.15 em , + slash-right-kern = -0.15 em + } +\DeclareInstance { xfrac } { lmss } { text } + { + denominator-bot-sep = 0 pt , + numerator-top-sep = 0 pt , + slash-left-kern = -0.15 em , + slash-right-kern = -0.15 em + } +\DeclareInstance { xfrac } { lmtt } { text } + { + denominator-bot-sep = 0 pt , + numerator-top-sep = 0 pt , + slash-left-kern = -0.15 em , + slash-right-kern = -0.15 em + } +\NewDocumentCommand \sfrac { o m o m } + { + \mode_if_math:TF + { + \IfInstanceExistTF { xfrac } { mathfam \number \fam } + { \UseInstance { xfrac } { mathfam \number \fam } } + { \UseInstance { xfrac } { mathdefault } } + {#2} {#3} {#4} + } + { + \IfInstanceExistTF { xfrac } {#1} + { \UseInstance { xfrac } {#1} } + { + \IfInstanceExistTF { xfrac } { \f@family } + { \UseInstance { xfrac } { \f@family } } + { \UseInstance { xfrac } { default } } + } + {#2} {#3} {#4} + } + } +\msg_new:nnnn { xfrac } { over-specified-numerator-sep } + { You have specified both numerator-top-sep and numerator-bot-sep} + {I will pretend that you didn't specify either of them} + +%% +%% +%% End of file `xfrac.sty'. |