summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/l3packages/xfrac/xfrac.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/l3packages/xfrac/xfrac.dtx')
-rw-r--r--Master/texmf-dist/source/latex/l3packages/xfrac/xfrac.dtx320
1 files changed, 162 insertions, 158 deletions
diff --git a/Master/texmf-dist/source/latex/l3packages/xfrac/xfrac.dtx b/Master/texmf-dist/source/latex/l3packages/xfrac/xfrac.dtx
index ad2da510576..1ee8b2a7088 100644
--- a/Master/texmf-dist/source/latex/l3packages/xfrac/xfrac.dtx
+++ b/Master/texmf-dist/source/latex/l3packages/xfrac/xfrac.dtx
@@ -1,7 +1,7 @@
% \iffalse meta-comment
%
%% File: xfrac.dtx Copyright (C) 2004, 2008-2010 Morten Hoegholm
-%% (C) 2011 The LaTeX3 Project
+%% (C) 2011,2012 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
@@ -37,7 +37,7 @@
%
%<*driver|package>
\RequirePackage{amstext,graphicx,l3keys2e,textcomp,xparse,xtemplate}
-\GetIdInfo$Id: xfrac.dtx 3465 2012-02-26 15:31:13Z bruno $
+\GetIdInfo$Id: xfrac.dtx 3875 2012-06-30 12:38:05Z joseph $
{L3 Experimental split-level fractions}
%</driver|package>
%<*driver>
@@ -530,13 +530,17 @@
% \begin{macrocode}
%<*package>
% \end{macrocode}
+%
+% \begin{macrocode}
+%<@@=xfrac>
+% \end{macrocode}
%
% \begin{macrocode}
\ProvidesExplPackage
{\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
% \end{macrocode}
%
-% \begin{variable}{\l_xfrac_cm_std_bool}
+% \begin{variable}{\l_@@_cm_std_bool}
% There is one option to support.
% \begin{macrocode}
\keys_define:nn { xfrac }
@@ -544,34 +548,34 @@
cm-recommended .choice:,
cm-recommended /
false .code:n =
- { \bool_set_true:N \l_xfrac_cm_std_bool },
+ { \bool_set_true:N \l_@@_cm_std_bool },
cm-recommended /
true .code:n =
- { \bool_set_false:N \l_xfrac_cm_std_bool },
+ { \bool_set_false:N \l_@@_cm_std_bool },
cm-recommended .default:n = { true },
- cm-standard .bool_set:N = \l_xfrac_cm_std_bool
+ cm-standard .bool_set:N = \l_@@_cm_std_bool
}
\ProcessKeysOptions { xfrac }
% \end{macrocode}
% \end{variable}
%
-% \begin{variable}{\l_xfrac_slash_box}
-% \begin{variable}{\l_xfrac_tmp_box}
+% \begin{variable}{\l_@@_slash_box}
+% \begin{variable}{\l_@@_tmp_box}
% In keeping with the \LaTeX3 philosophy, rather than use generic
% scratch boxes and get confused, \pkg{xfrac} reserves its own named
% working space.
% \begin{macrocode}
-\box_new:N \l_xfrac_slash_box
-\box_new:N \l_xfrac_tmp_box
+\box_new:N \l_@@_slash_box
+\box_new:N \l_@@_tmp_box
% \end{macrocode}
% \end{variable}
% \end{variable}
%
-% \begin{macro}[aux]{\xfrac_tmp:w}
+% \begin{macro}[aux]{\@@_tmp:w}
% Used for the raised boxes: weird as it does not take an argument
% but the \cs{raisebox} does.
% \begin{macrocode}
-\cs_new:Npn \xfrac_tmp:w { }
+\cs_new:Npn \@@_tmp:w { }
% \end{macrocode}
% \end{macro}
%
@@ -581,18 +585,18 @@
% Variables used in templates have to be set up: there is not
% much to say about these, other than that they must exist.
%
-% \begin{variable}{\l_xfrac_denominator_bot_sep_dim}
-% \begin{variable}{\l_xfrac_numerator_bot_sep_dim}
-% \begin{variable}{\l_xfrac_numerator_top_sep_dim}
-% \begin{variable}{\l_xfrac_slash_left_sep_dim}
-% \begin{variable}{\l_xfrac_slash_right_sep_dim}
+% \begin{variable}{\l_@@_denominator_bot_sep_dim}
+% \begin{variable}{\l_@@_numerator_bot_sep_dim}
+% \begin{variable}{\l_@@_numerator_top_sep_dim}
+% \begin{variable}{\l_@@_slash_left_sep_dim}
+% \begin{variable}{\l_@@_slash_right_sep_dim}
% Fixed lengths.
% \begin{macrocode}
-\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
+\dim_new:N \l_@@_denominator_bot_sep_dim
+\dim_new:N \l_@@_numerator_bot_sep_dim
+\dim_new:N \l_@@_numerator_top_sep_dim
+\dim_new:N \l_@@_slash_left_sep_dim
+\dim_new:N \l_@@_slash_right_sep_dim
% \end{macrocode}
% \end{variable}
% \end{variable}
@@ -600,42 +604,42 @@
% \end{variable}
% \end{variable}
%
-% \begin{variable}{\l_xfrac_slash_left_muskip}
-% \begin{variable}{\l_xfrac_slash_right_muskip}
+% \begin{variable}{\l_@@_slash_left_muskip}
+% \begin{variable}{\l_@@_slash_right_muskip}
% Math mode skips.
% \begin{macrocode}
-\muskip_new:N \l_xfrac_slash_left_muskip
-\muskip_new:N \l_xfrac_slash_right_muskip
+\muskip_new:N \l_@@_slash_left_muskip
+\muskip_new:N \l_@@_slash_right_muskip
% \end{macrocode}
% \end{variable}
% \end{variable}
%
-% \begin{variable}{\l_xfrac_hscale_fp}
-% \begin{variable}{\l_xfrac_scale_factor_fp}
-% \begin{variable}{\l_xfrac_vscale_fp}
+% \begin{variable}{\l_@@_hscale_fp}
+% \begin{variable}{\l_@@_scale_factor_fp}
+% \begin{variable}{\l_@@_vscale_fp}
% Floating point values.
% \begin{macrocode}
-\fp_new:N \l_xfrac_hscale_fp
-\fp_new:N \l_xfrac_scale_factor_fp
-\fp_new:N \l_xfrac_vscale_fp
+\fp_new:N \l_@@_hscale_fp
+\fp_new:N \l_@@_scale_factor_fp
+\fp_new:N \l_@@_vscale_fp
% \end{macrocode}
% \end{variable}
% \end{variable}
% \end{variable}
%
-% \begin{variable}{\l_xfrac_denominator_font_tl}
-% \begin{variable}{\l_xfrac_numerator_font_tl}
-% \begin{variable}{\l_xfrac_phantom_tl }
-% \begin{variable}{\l_xfrac_slash_symbol_tl}
-% \begin{variable}{\l_xfrac_slash_symbol_font_tl}
+% \begin{variable}{\l_@@_denominator_font_tl}
+% \begin{variable}{\l_@@_numerator_font_tl}
+% \begin{variable}{\l_@@_phantom_tl }
+% \begin{variable}{\l_@@_slash_symbol_tl}
+% \begin{variable}{\l_@@_slash_symbol_font_tl}
% Token lists, which include floating-point numbers and math(s)
% skips.
% \begin{macrocode}
-\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
+\tl_new:N \l_@@_denominator_font_tl
+\tl_new:N \l_@@_numerator_font_tl
+\tl_new:N \l_@@_phantom_tl
+\tl_new:N \l_@@_slash_symbol_tl
+\tl_new:N \l_@@_slash_symbol_font_tl
% \end{macrocode}
% \end{variable}
% \end{variable}
@@ -643,30 +647,30 @@
% \end{variable}
% \end{variable}
%
-% \begin{macro}{\xfrac_fontscale:}
-% \begin{macro}{\xfrac_math:n}
-% \begin{macro}{\xfrac_denominator_font_change:}
-% \begin{macro}{\xfrac_denominator_format:n}
-% \begin{macro}{\xfrac_numerator_font_change:}
-% \begin{macro}{\xfrac_numerator_format:n}
-% \begin{macro}{\xfrac_relscale:}
-% \begin{macro}{\xfrac_slash_symbol_font_change:}
-% \begin{macro}{\xfrac_slash_symbol_format:n}
-% \begin{macro}{\xfrac_text_or_math:n}
+% \begin{macro}{\@@_fontscale:}
+% \begin{macro}{\@@_math:n}
+% \begin{macro}{\@@_denominator_font_change:}
+% \begin{macro}{\@@_denominator_format:n}
+% \begin{macro}{\@@_numerator_font_change:}
+% \begin{macro}{\@@_numerator_format:n}
+% \begin{macro}{\@@_relscale:}
+% \begin{macro}{\@@_slash_symbol_font_change:}
+% \begin{macro}{\@@_slash_symbol_format:n}
+% \begin{macro}{\@@_text_or_math:n}
% Functions, either things which are calculated \enquote{on the fly}
% (no argument required) or are functions taking one argument in the
% code.
% \begin{macrocode}
-\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 { }
+\cs_new_nopar:Npn \@@_fontscale:
+\cs_new:Npn \@@_math:n #1 { }
+\cs_new_nopar:Npn \@@_denominator_font_change: { }
+\cs_new:Npn \@@_denominator_format:n #1 { }
+\cs_new_nopar:Npn \@@_numerator_font_change: { }
+\cs_new:Npn \@@_numerator_format:n #1 { }
+\cs_new_nopar:Npn \@@_relscale: { }
+\cs_new_nopar:Npn \@@_slash_symbol_font_change: { }
+\cs_new:Npn \@@_slash_symbol_format:n #1 { }
+\cs_new:Npn \@@_text_or_math:n #1 { }
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -724,54 +728,54 @@
% \begin{macrocode}
\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 ,
+ denominator-bot-sep = \l_@@_denominator_bot_sep_dim ,
+ denominator-font = \l_@@_denominator_font_tl ,
+ denominator-format = \@@_denominator_format:n ,
+ h-scale = \l_@@_hscale_fp ,
math-mode =
{
- false = \cs_set_eq:NN \xfrac_math:n \use:n,
- true = \cs_set_eq:NN \xfrac_math:n \ensuremath
+ false = \cs_set_eq:NN \@@_math:n \use:n,
+ true = \cs_set_eq:NN \@@_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 ,
+ numerator-font = \l_@@_numerator_font_tl ,
+ numerator-format = \@@_numerator_format:n ,
+ numerator-bot-sep = \l_@@_numerator_bot_sep_dim ,
+ numerator-top-sep = \l_@@_numerator_top_sep_dim ,
+ phantom = \l_@@_phantom_tl ,
+ scale-factor = \l_@@_scale_factor_fp ,
scale-relative =
{
false =
- \cs_set_nopar:Npn \xfrac_relscale:
+ \cs_set_nopar:Npn \@@_relscale:
{
- \dim_eval:w
- \box_ht:N \l_xfrac_tmp_box + \box_dp:N \l_xfrac_tmp_box
- \dim_eval_end:
+ \__dim_eval:w
+ \box_ht:N \l_@@_tmp_box + \box_dp:N \l_@@_tmp_box
+ \__dim_eval_end:
},
true =
- \cs_set_nopar:Npn \xfrac_relscale:
- { \box_ht:N \l_xfrac_slash_box }
+ \cs_set_nopar:Npn \@@_relscale:
+ { \box_ht:N \l_@@_slash_box }
},
scaling =
{
- false = \cs_set_eq:NN \xfrac_fontscale: \prg_do_nothing:,
+ false = \cs_set_eq:NN \@@_fontscale: \prg_do_nothing:,
true =
- \cs_set_nopar:Npn \xfrac_fontscale:
+ \cs_set_nopar:Npn \@@_fontscale:
{
\fontsize
- { \fp_use:N \l_xfrac_scale_factor_fp \xfrac_relscale: }
+ { \fp_use:N \l_@@_scale_factor_fp \@@_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
+ slash-left-kern = \l_@@_slash_left_sep_dim ,
+ slash-left-mkern = \l_@@_slash_left_muskip ,
+ slash-right-kern = \l_@@_slash_right_sep_dim ,
+ slash-right-mkern = \l_@@_slash_right_muskip ,
+ slash-symbol = \l_@@_slash_symbol_tl ,
+ slash-symbol-font = \l_@@_slash_symbol_font_tl ,
+ slash-symbol-format = \@@_slash_symbol_format:n ,
+ v-scale = \l_@@_vscale_fp
}
% \end{macrocode}
% The implementation part starts with applying all of the settings
@@ -782,29 +786,29 @@
\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 \@@_text_or_math:n \text
+ \cs_set_nopar:Npx \@@_denominator_font_change:
+ { \tex_fam:D \l_@@_denominator_font_tl }
+ \cs_set_nopar:Npx \@@_numerator_font_change:
+ { \tex_fam:D \l_@@_numerator_font_tl }
+ \cs_set_nopar:Npx \@@_slash_symbol_font_change:
+ { \tex_fam:D \l_@@_slash_symbol_font_tl }
}
{
- \cs_set_eq:NN \xfrac_text_or_math:n \mbox
- \cs_set_nopar:Npn \xfrac_denominator_font_change:
+ \cs_set_eq:NN \@@_text_or_math:n \mbox
+ \cs_set_nopar:Npn \@@_denominator_font_change:
{
- \fontfamily { \l_xfrac_denominator_font_tl }
+ \fontfamily { \l_@@_denominator_font_tl }
\selectfont
}
- \cs_set_nopar:Npn \xfrac_numerator_font_change:
+ \cs_set_nopar:Npn \@@_numerator_font_change:
{
- \fontfamily { \l_xfrac_numerator_font_tl }
+ \fontfamily { \l_@@_numerator_font_tl }
\selectfont
}
- \cs_set_nopar:Npn \xfrac_slash_symbol_font_change:
+ \cs_set_nopar:Npn \@@_slash_symbol_font_change:
{
- \fontfamily { \l_xfrac_slash_symbol_font_tl }
+ \fontfamily { \l_@@_slash_symbol_font_tl }
\selectfont
}
}
@@ -812,22 +816,22 @@
% Everything is now either inside \cs{text} or an \cs{mbox}, depending
% upon the surroundings. First, there are some boxes to set up.
% \begin{macrocode}
- \xfrac_text_or_math:n
+ \@@_text_or_math:n
{
\m@th
- \hbox_set:Nn \l_xfrac_tmp_box
- { \xfrac_math:n { \vphantom { ( ) } } }
- \hbox_set:Nn \l_xfrac_slash_box
+ \hbox_set:Nn \l_@@_tmp_box
+ { \@@_math:n { \vphantom { ( ) } } }
+ \hbox_set:Nn \l_@@_slash_box
{
- \xfrac_math:n
+ \@@_math:n
{
- \xfrac_slash_symbol_format:n
+ \@@_slash_symbol_format:n
{
- \xfrac_math:n
+ \@@_math:n
{
- \xfrac_slash_symbol_font_change:
+ \@@_slash_symbol_font_change:
\IfNoValueTF {#2}
- { \l_xfrac_slash_symbol_tl } {#2}
+ { \l_@@_slash_symbol_tl } {#2}
}
}
}
@@ -838,43 +842,43 @@
% set up a default, which is also used when both values are set
% erroneously.
% \begin{macrocode}
- \cs_set_nopar:Npn \xfrac_tmp:w
+ \cs_set_nopar:Npn \@@_tmp:w
{
\raisebox
{
- \dim_eval:w
- \box_ht:N \l_xfrac_slash_box
- - \box_dp:N \l_xfrac_slash_box
+ \__dim_eval:w
+ \box_ht:N \l_@@_slash_box
+ - \box_dp:N \l_@@_slash_box
- \height
- \dim_eval_end:
+ \__dim_eval_end:
}
}
\dim_compare:nNnTF
- { \l_xfrac_numerator_top_sep_dim } = { \c_max_dim }
+ { \l_@@_numerator_top_sep_dim } = { \c_max_dim }
{
\dim_compare:nNnF
- { \l_xfrac_numerator_bot_sep_dim } = { \c_max_dim }
+ { \l_@@_numerator_bot_sep_dim } = { \c_max_dim }
{
- \cs_set_nopar:Npn \xfrac_tmp:w
+ \cs_set_nopar:Npn \@@_tmp:w
{
\raisebox
- { \dim_use:N \l_xfrac_numerator_bot_sep_dim }
+ { \dim_use:N \l_@@_numerator_bot_sep_dim }
}
}
}
{
\dim_compare:nNnTF
- { \l_xfrac_numerator_bot_sep_dim } = { \c_max_dim }
+ { \l_@@_numerator_bot_sep_dim } = { \c_max_dim }
{
- \cs_set_nopar:Npn \xfrac_tmp:w
+ \cs_set_nopar:Npn \@@_tmp:w
{
\raisebox
{
- \dim_eval:w
- \box_ht:N \l_xfrac_slash_box
- - \dim_use:N \l_xfrac_numerator_top_sep_dim
+ \__dim_eval:w
+ \box_ht:N \l_@@_slash_box
+ - \dim_use:N \l_@@_numerator_top_sep_dim
- \height
- \dim_eval_end:
+ \__dim_eval_end:
}
}
}
@@ -886,73 +890,73 @@
% \end{macrocode}
% Typeset the numerator.
% \begin{macrocode}
- \xfrac_tmp:w
+ \@@_tmp:w
{
- \xfrac_fontscale:
- \xfrac_numerator_format:n
+ \@@_fontscale:
+ \@@_numerator_format:n
{
\scalebox
- { \fp_use:N \l_xfrac_hscale_fp }
- [ \fp_use:N \l_xfrac_vscale_fp ]
+ { \fp_use:N \l_@@_hscale_fp }
+ [ \fp_use:N \l_@@_vscale_fp ]
{
- \xfrac_math:n
+ \@@_math:n
{
- \xfrac_numerator_font_change:
+ \@@_numerator_font_change:
{
- \vphantom { \l_xfrac_phantom_tl }
+ \vphantom { \l_@@_phantom_tl }
#1
}
}
}
}
}
- \xfrac_math:n
+ \@@_math:n
{ % THIS IS JUST WRONG!
\scan_align_safe_stop:
\mode_if_math:TF
- { \tex_mskip:D \l_xfrac_slash_right_muskip }
- { \tex_hskip:D \l_xfrac_slash_right_sep_dim }
+ { \tex_mskip:D \l_@@_slash_right_muskip }
+ { \tex_hskip:D \l_@@_slash_right_sep_dim }
}
% \end{macrocode}
% Typeset the separator.
% \begin{macrocode}
- \box_use:N \l_xfrac_slash_box
- \xfrac_math:n
+ \box_use:N \l_@@_slash_box
+ \@@_math:n
{
\mode_if_math:TF
- { \tex_mskip:D \l_xfrac_slash_left_muskip }
- { \tex_hskip:D \l_xfrac_slash_left_sep_dim }
+ { \tex_mskip:D \l_@@_slash_left_muskip }
+ { \tex_hskip:D \l_@@_slash_left_sep_dim }
}
% \end{macrocode}
% Typeset the denominator.
% \begin{macrocode}
\dim_compare:nNnTF
- { \l_xfrac_denominator_bot_sep_dim } = { \c_max_dim }
+ { \l_@@_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 \@@_tmp:w
+ { \raisebox { - \box_dp:N \l_@@_slash_box } }
}
{
- \cs_set_nopar:Npn \xfrac_tmp:w
+ \cs_set_nopar:Npn \@@_tmp:w
{
\raisebox
- { \dim_use:N \l_xfrac_denominator_bot_sep_dim }
+ { \dim_use:N \l_@@_denominator_bot_sep_dim }
}
}
- \xfrac_tmp:w
+ \@@_tmp:w
{
- \xfrac_fontscale:
- \xfrac_denominator_format:n
+ \@@_fontscale:
+ \@@_denominator_format:n
{
\scalebox
- { \fp_use:N \l_xfrac_hscale_fp }
- [ \fp_use:N \l_xfrac_vscale_fp ]
+ { \fp_use:N \l_@@_hscale_fp }
+ [ \fp_use:N \l_@@_vscale_fp ]
{
- \xfrac_math:n
+ \@@_math:n
{
- \xfrac_denominator_font_change:
+ \@@_denominator_font_change:
{
- \vphantom { \l_xfrac_phantom_tl }
+ \vphantom { \l_@@_phantom_tl }
#3
}
}
@@ -1041,7 +1045,7 @@
% We can do better for the Computer Modern fonts. For cmr and cmss
% we choose Times, and for cmtt use Palatino.
% \begin{macrocode}
-\bool_if:NF \l_xfrac_cm_std_bool
+\bool_if:NF \l_@@_cm_std_bool
{
\DeclareInstance { xfrac } { cmr } { text }
{ slash-symbol-font = ptm }