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.dtx215
1 files changed, 107 insertions, 108 deletions
diff --git a/Master/texmf-dist/source/latex/l3packages/xfrac/xfrac.dtx b/Master/texmf-dist/source/latex/l3packages/xfrac/xfrac.dtx
index a2b28d94bd8..ad2da510576 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 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 3341 2012-02-08 19:30:37Z joseph $
+\GetIdInfo$Id: xfrac.dtx 3465 2012-02-26 15:31:13Z bruno $
{L3 Experimental split-level fractions}
%</driver|package>
%<*driver>
@@ -50,13 +50,13 @@
\end{document}
%</driver>
% \fi
-%
+%
% \title{^^A
% The \textsf{xfrac} package\\ Split-level fractions^^A
% \thanks{This file describes v\ExplFileVersion,
% last revised \ExplFileDate.}^^A
% }
-%
+%
% \author{^^A
% The \LaTeX3 Project\thanks
% {^^A
@@ -71,7 +71,7 @@
% \maketitle
%
% \begin{documentation}
-%
+%
% The \pkg{xfrac} package defines a document command \cs{sfrac}
% with the following syntax:
% \begin{quote}
@@ -92,7 +92,7 @@
% You'll notice something interesting: not only does the \cs{sfrac}
% command work as it should in math mode, it also gets the job done
% for other fonts as well.
-%
+%
% \section{A Bit of History}
%
% \subsection{The Past}
@@ -106,7 +106,7 @@
% The proper symbol to use instead of the virgule is a \emph{solidus}
% which does not exist in Computer Modern. It is however available in
% the European Computer Modern fonts, but I'll get back to that.
-%
+%
% \subsection{The Present}
%
% The most common way to produce split level fractions within \LaTeXe{}
@@ -131,7 +131,7 @@
% quite well for Computer Modern which was pretty much what was widely
% available at the time it was developed. Users these days, however,
% have a choice of many fonts when they write their documents.
-%
+%
% \subsection{The Future}
%
% Fonts are wildly different; one macro that works fine for Computer
@@ -143,11 +143,11 @@
% totally generic interface for the fraction commands and then adjust
% parameters depending on the current font. What you see in this
% prototype implementation of \pkg{xfrac} is just that.
-%
+%
% \section{Advanced User Interface}
%
% \subsection{Text mode}
-%
+%
% The usual problem in text mode has a name: Computer Modern. The
% solidi of all the Computer Modern fonts leave a lot to be desired,
% although things are potentially looking better as the Latin Modern
@@ -306,7 +306,7 @@
% $\sfrac{8}{13}$ and just typing |$8/13$| gives the same result:
% $8/13$.
% \endgroup
-%
+%
% \section{The Template Interface}
%
% \begin{TemplateInterfaceDescription}{xfrac}
@@ -526,16 +526,16 @@
% \begin{implementation}
%
% \section{\pkg{xfrac} Implementation}
-%
+%
% \begin{macrocode}
%<*package>
% \end{macrocode}
-%
+%
% \begin{macrocode}
\ProvidesExplPackage
{\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
% \end{macrocode}
-%
+%
% \begin{variable}{\l_xfrac_cm_std_bool}
% There is one option to support.
% \begin{macrocode}
@@ -548,16 +548,16 @@
cm-recommended /
true .code:n =
{ \bool_set_false:N \l_xfrac_cm_std_bool },
- cm-recommended .default:n = { true },
+ cm-recommended .default:n = { true },
cm-standard .bool_set:N = \l_xfrac_cm_std_bool
}
\ProcessKeysOptions { xfrac }
% \end{macrocode}
% \end{variable}
-%
+%
% \begin{variable}{\l_xfrac_slash_box}
% \begin{variable}{\l_xfrac_tmp_box}
-% In keeping with the \LaTeX3 philosophy, rather than use generic
+% 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}
@@ -566,7 +566,7 @@
% \end{macrocode}
% \end{variable}
% \end{variable}
-%
+%
% \begin{macro}[aux]{\xfrac_tmp:w}
% Used for the raised boxes: weird as it does not take an argument
% but the \cs{raisebox} does.
@@ -574,13 +574,13 @@
\cs_new:Npn \xfrac_tmp:w { }
% \end{macrocode}
% \end{macro}
-%
+%
%
% \subsection{Initialisation of variables}
%
% 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}
@@ -599,7 +599,7 @@
% \end{variable}
% \end{variable}
% \end{variable}
-%
+%
% \begin{variable}{\l_xfrac_slash_left_muskip}
% \begin{variable}{\l_xfrac_slash_right_muskip}
% Math mode skips.
@@ -609,7 +609,7 @@
% \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}
@@ -633,7 +633,7 @@
% \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_phantom_tl
\tl_new:N \l_xfrac_slash_symbol_tl
\tl_new:N \l_xfrac_slash_symbol_font_tl
% \end{macrocode}
@@ -678,7 +678,7 @@
% \end{macro}
% \end{macro}
% \end{macro}
-%
+%
% \subsection{The template}
%
% There is only one object type in \pkg{xfrac}, rather unimaginatively
@@ -719,10 +719,10 @@
}
% \end{macrocode}
% Most of the variable binding is quite simple: of course, the choices
-% are a little more complicated. That is particularly true where
-% these have to set up \enquote{on the fly} functions.
+% are a little more complicated. That is particularly true where
+% these have to set up \enquote{on the fly} functions.
% \begin{macrocode}
-\DeclareTemplateCode { xfrac } { text } { 3 }
+\DeclareTemplateCode { xfrac } { text } { 3 }
{
denominator-bot-sep = \l_xfrac_denominator_bot_sep_dim ,
denominator-font = \l_xfrac_denominator_font_tl ,
@@ -741,26 +741,26 @@
scale-factor = \l_xfrac_scale_factor_fp ,
scale-relative =
{
- false =
+ false =
\cs_set_nopar:Npn \xfrac_relscale:
{
- \dim_eval:w
+ \dim_eval:w
\box_ht:N \l_xfrac_tmp_box + \box_dp:N \l_xfrac_tmp_box
- \dim_eval_end:
+ \dim_eval_end:
},
- true =
- \cs_set_nopar:Npn \xfrac_relscale:
+ 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 =
+ 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 }
+ { \c_zero_dim }
\selectfont
}
},
@@ -771,7 +771,7 @@
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
+ v-scale = \l_xfrac_vscale_fp
}
% \end{macrocode}
% The implementation part starts with applying all of the settings
@@ -793,17 +793,17 @@
{
\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
}
@@ -812,21 +812,21 @@
% 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
+ \xfrac_text_or_math:n
{
\m@th
- \hbox_set:Nn \l_xfrac_tmp_box
+ \hbox_set:Nn \l_xfrac_tmp_box
{ \xfrac_math:n { \vphantom { ( ) } } }
- \hbox_set:Nn \l_xfrac_slash_box
+ \hbox_set:Nn \l_xfrac_slash_box
{
- \xfrac_math:n
- {
- \xfrac_slash_symbol_format:n
+ \xfrac_math:n
+ {
+ \xfrac_slash_symbol_format:n
{
- \xfrac_math:n
+ \xfrac_math:n
{
\xfrac_slash_symbol_font_change:
- \IfNoValueTF {#2}
+ \IfNoValueTF {#2}
{ \l_xfrac_slash_symbol_tl } {#2}
}
}
@@ -835,12 +835,12 @@
% \end{macrocode}
% Check on the numerator separator dimensions. The code starts with the
% assumption that neither has been given, as this can then be used to
-% set up a default, which is also used when both values are set
+% set up a default, which is also used when both values are set
% erroneously.
% \begin{macrocode}
\cs_set_nopar:Npn \xfrac_tmp:w
{
- \raisebox
+ \raisebox
{
\dim_eval:w
\box_ht:N \l_xfrac_slash_box
@@ -849,37 +849,37 @@
\dim_eval_end:
}
}
- \dim_compare:nNnTF
+ \dim_compare:nNnTF
{ \l_xfrac_numerator_top_sep_dim } = { \c_max_dim }
{
\dim_compare:nNnF
- { \l_xfrac_numerator_bot_sep_dim } = { \c_max_dim }
+ { \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 }
+ {
+ \raisebox
+ { \dim_use:N \l_xfrac_numerator_bot_sep_dim }
}
}
}
{
\dim_compare:nNnTF
- { \l_xfrac_numerator_bot_sep_dim } = { \c_max_dim }
- {
+ { \l_xfrac_numerator_bot_sep_dim } = { \c_max_dim }
+ {
\cs_set_nopar:Npn \xfrac_tmp:w
- {
- \raisebox
- {
+ {
+ \raisebox
+ {
\dim_eval:w
\box_ht:N \l_xfrac_slash_box
- - \dim_use:N \l_xfrac_numerator_top_sep_dim
+ - \dim_use:N \l_xfrac_numerator_top_sep_dim
- \height
- \dim_eval_end:
+ \dim_eval_end:
}
}
}
- {
- \msg_error:nn { xfrac }
+ {
+ \msg_error:nn { xfrac }
{ over-specified-numerator-sep }
}
}
@@ -891,33 +891,33 @@
\xfrac_fontscale:
\xfrac_numerator_format:n
{
- \scalebox
+ \scalebox
{ \fp_use:N \l_xfrac_hscale_fp }
[ \fp_use:N \l_xfrac_vscale_fp ]
- {
- \xfrac_math:n
- {
+ {
+ \xfrac_math:n
+ {
\xfrac_numerator_font_change:
{
\vphantom { \l_xfrac_phantom_tl }
#1
}
- }
+ }
}
}
}
\xfrac_math:n
- { % THIS IS JUST WRONG!
+ { % 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 }
- }
+ }
% \end{macrocode}
% Typeset the separator.
% \begin{macrocode}
\box_use:N \l_xfrac_slash_box
- \xfrac_math:n
+ \xfrac_math:n
{
\mode_if_math:TF
{ \tex_mskip:D \l_xfrac_slash_left_muskip }
@@ -926,43 +926,43 @@
% \end{macrocode}
% Typeset the denominator.
% \begin{macrocode}
- \dim_compare:nNnTF
+ \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 } }
+ { \raisebox { - \box_dp:N \l_xfrac_slash_box } }
}
{
\cs_set_nopar:Npn \xfrac_tmp:w
- {
- \raisebox
+ {
+ \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_hscale_fp }
[ \fp_use:N \l_xfrac_vscale_fp ]
- {
- \xfrac_math:n
- {
+ {
+ \xfrac_math:n
+ {
\xfrac_denominator_font_change:
{
\vphantom { \l_xfrac_phantom_tl }
#3
}
- }
+ }
}
}
}
- }
+ }
}
% \end{macrocode}
-%
+%
% Since math(s) and text mode are wildly different entities we define a
% separate template for each. You already saw the \enquote{text}
% template, and here is the \enquote{math} template.
@@ -982,17 +982,17 @@
phantom = ( % )
}
% \end{macrocode}
-%
+%
%\subsection{The standard instances}
%
% For the default instances we just use the relevant templates with
% the default settings.
-%
+%
% The default \enquote{text} instance.
% \begin{macrocode}
\DeclareInstance { xfrac } { default } { text } { }
% \end{macrocode}
-%
+%
% The default \enquote{math(s)} instance.
% \begin{macrocode}
\DeclareInstance { xfrac } { mathdefault } { math } { }
@@ -1011,34 +1011,34 @@
slash-left-mkern = 0 mu
}
% \end{macrocode}
-%
+%
% Default Computer Modern setup. Far from optimal, but better than
% nothing.
% \begin{macrocode}
-\DeclareInstance { xfrac } { cmr } { text }
+\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
+ 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
+ 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
+ slash-right-kern = -0.1 em
}
% \end{macrocode}
-%
-% We can do better for the Computer Modern fonts. For cmr and cmss
+%
+% 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
@@ -1051,7 +1051,7 @@
{ slash-symbol-font = ppl }
}
% \end{macrocode}
-%
+%
% Things works slightly better with Latin Modern.
% \begin{macrocode}
\DeclareInstance { xfrac } { lmr } { text }
@@ -1059,24 +1059,24 @@
denominator-bot-sep = 0 pt ,
numerator-top-sep = 0.1 ex ,
slash-left-kern = -0.15 em ,
- slash-right-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
+ 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
+ slash-right-kern = -0.15 em
}
% \end{macrocode}
-%
+%
% \subsection{The user command}
%
% \begin{macro}{\sfrac}
@@ -1094,41 +1094,40 @@
% \begin{verbatim}
% \sfrac[cmr2]{7}{12}
% \end{verbatim}
-% and get the settings from \enquote{cmr2} instead of the settings of
+% and get the settings from \enquote{cmr2} instead of the settings of
% the current font family.
% \begin{macrocode}
\NewDocumentCommand \sfrac { o m o m }
{
- \mode_if_math:TF
+ \mode_if_math:TF
{
\IfInstanceExistTF { xfrac } { mathfam \number \fam }
{ \UseInstance { xfrac } { mathfam \number \fam } }
{ \UseInstance { xfrac } { mathdefault } }
- {#2} {#3} {#4}
+ {#2} {#3} {#4}
}
{
\IfInstanceExistTF { xfrac } {#1}
{ \UseInstance { xfrac } {#1} }
- {
+ {
\IfInstanceExistTF { xfrac } { \f@family }
{ \UseInstance { xfrac } { \f@family } }
{ \UseInstance { xfrac } { default } }
}
- {#2} {#3} {#4}
- }
+ {#2} {#3} {#4}
+ }
}
% \end{macrocode}
% \end{macro}
%
% \subsection{Messages}
%
-% Just the one.
+% Just the one.
% \begin{macrocode}
\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{macrocode}
-
+% \end{macrocode}
%
% \begin{macrocode}
%</package>