diff options
author | Taco Hoekwater <taco@elvenkind.com> | 2011-06-01 08:54:21 +0000 |
---|---|---|
committer | Taco Hoekwater <taco@elvenkind.com> | 2011-06-01 08:54:21 +0000 |
commit | d7ccb42582f85acf30568913610ccf4d602023fb (patch) | |
tree | 7292e3545a420676878e7451b68892d360c62cb6 /Master/texmf-dist/tex/context/base/m-newmat.tex | |
parent | 2d62a6fe9b80def59c392268022f1f9a2d6e358f (diff) |
commit context 2011.05.18
git-svn-id: svn://tug.org/texlive/trunk@22719 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/m-newmat.tex')
-rw-r--r-- | Master/texmf-dist/tex/context/base/m-newmat.tex | 269 |
1 files changed, 6 insertions, 263 deletions
diff --git a/Master/texmf-dist/tex/context/base/m-newmat.tex b/Master/texmf-dist/tex/context/base/m-newmat.tex index 08ce33b4ce5..3fb75df5d3e 100644 --- a/Master/texmf-dist/tex/context/base/m-newmat.tex +++ b/Master/texmf-dist/tex/context/base/m-newmat.tex @@ -11,6 +11,12 @@ %C therefore copyrighted by \PRAGMA. See licen-en.pdf for %C details. +\unprotect + +%D Code has been integrated. + +\protect \endinput + %D This module collects macros that \TEX\ users kind of expect %D to be available when typesetting math. Most of them %D originate in the \AMS\ macro packages. We have taken the @@ -19,269 +25,6 @@ %D derived from AMS math modules) and adapted|/|extended by %D Hans Hagen. -%D Here we will add code on demand. So, just let us know what -%D should go in here. - -%M \usemodule[newmat] - -\unprotect - -%D \macros -%D {qedsymbol} -%D -%D [HH] The general Quod Erat Domonstrandum symbol is defined -%D in such a way that we can configure it. Because this symbol -%D is also used in text mode, we make it a normal text symbol -%D with special behavior. - -\def\qedsymbol#1% - {\ifhmode - \unskip~\hfill#1\par - \else\ifmmode - \eqno#1\relax % Do we really need the \eqno here? - \else - \leavevmode\hbox{}\hfill#1\par - \fi\fi} - -\definesymbol [qed] [\qedsymbol{\mathematics{\square}}] - -%D \macros -%D {QED} -%D -%D [HH] For compatbility reasons we also provide the \type -%D {\QED} command. In case this command is overloaded, we still -%D have the symbol available. \symbol[qed] - -\def\QED{\symbol[qed]} - -%D \macros -%D {genfrac} -%D -%D [TH] The definition of \type {\genfrac} \& co. is not -%D trivial, because it allows some flexibility. This is -%D supposed to be a user||level command, but will fail quite -%D desparately if called outside math mode (\CONTEXT\ redefines -%D \type {\over}) -%D -%D [HH] We clean up this macro a bit and (try) to make it -%D understandable. The expansion is needed for generating -%D the second argument to \type {\dogenfrac}, which is to -%D be a control sequence like \type {\over}. - -\unexpanded\def\genfrac#1#2#3#4% - {\edef\!!stringa - {#1#2}% - \expanded - {\dogenfrac{#4}% - \csname - \ifx @#3@% - \ifx\!!stringa\empty - \strippedcsname\normalover - \else - \strippedcsname\normaloverwithdelims - \fi - \else - \ifx\!!stringa\empty - \strippedcsname\normalabove - \else - \strippedcsname\normalabovewithdelims - \fi - \fi - \endcsname}% - {#1#2#3}} - -\def\dogenfrac#1#2#3#4#5% - {{#1{\begingroup#4\endgroup#2#3\relax#5}}} - -%D \macros -%D {dfrac, tfrac, frac, dbinom, tbinom, binom} -%D -%D [TH] No need to make these \type {\unexpanded} as well. - -%\def\dfrac {\genfrac\empty\empty\empty\displaystyle} -%\def\tfrac {\genfrac\empty\empty\empty\textstyle} -%\def\frac {\genfrac\empty\empty\empty\donothing} - -\def\dfrac {\genfrac\empty\empty{}\displaystyle} -\def\tfrac {\genfrac\empty\empty{}\textstyle} -\def\frac {\genfrac\empty\empty{}\donothing} - -\def\dbinom{\genfrac()\zeropoint\displaystyle} -\def\tbinom{\genfrac()\zeropoint\textstyle} -\def\binom {\genfrac()\zeropoint\donothing} - -\def\xfrac {\genfrac\empty\empty{}\scriptstyle} -\def\xxfrac{\genfrac\empty\empty{}\scriptscriptstyle} - -%D Better: - -\unexpanded\def\frac#1#2{\mathematics{\genfrac\empty\empty{}\donothing{#1}{#2}}} - -%D [HH] This shows up as: -%D -%D \startbuffer -%D $\dfrac {1}{2} \tfrac {1}{2} \frac {1}{2}$ -%D $\dbinom{1}{2} \tbinom{1}{2} \binom{1}{2}$ -%D \stopbuffer -%D -%D \typebuffer -%D -%D \getbuffer - -%D \macros -%D {text} -%D -%D [TH] \type {\text} is a command to typeset more or less -%D ordinary text inside of super- and sub|-|scripts. It has to -%D do a full font switch to get the sides right, so it will be -%D quite slow. \type {\text} kind of replaces \CONTEXT's \type -%D {\mathstyle} command. - -%D [HH] This macro is now also moved to the core, but we -%D keep it here as well for completeness. -%D -%D \starttyping -%D \unexpanded\def\mathtext -%D {\mathortext\domathtext\hbox} % {\ifmmode\@EA\dotext\else\@EA\hbox\fi} -%D -%D \def\domathtext#1% -%D {\mathchoice -%D {\dodomathtext\displaystyle\textface {#1}}% -%D {\dodomathtext\textstyle \textface {#1}}% -%D {\dodomathtext\textstyle \scriptface {#1}}% -%D {\dodomathtext\textstyle \scriptscriptface{#1}}} -%D -%D \def\dodomathtext#1#2#3% no \everymath ! -%D %{\hbox{\everymath{#1}\switchtobodyfont [#2]#3}} % 15 sec -%D {\hbox{\everymath{#1}\setcurrentfontbody{#2}#3}} % 3 sec (no math) -%D \stoptyping - -%D [HH] We use the following indirectness because \type {\text} -%D is a natural candidate for user macros (actually, it is -%D used in some modules). -%D -%D \starttyping -%D \let\text\mathtext -%D \stoptyping - -%D [HH] Actually, the font switch is not that slow when -%D typefaces are used. If needed this macro can be sped up. -%D -%D \startbuffer -%D ordinary text $x^{\text{extra ordinary text}}$ -%D \stopbuffer -%D -%D \typebuffer -%D -%D \getbuffer - -%D \macros -%D {mathhexbox} -%D -%D [TH] \type {\mathhexbox} is also user||level (already -%D defined in Plain \TEX). It allows to get a math character -%D inserted as if it was a text character. - -\gdef\mathhexbox#1#2#3{\mathtext{$\mathsurround\zeropoint\mathchar"#1#2#3$}} - -%D \macros -%D {boxed} -%D -%D [HH] Another macro that users expect (slightly adapted): - -\def\boxed - {\ifmmode\expandafter\mframed\else\expandafter\framed\fi} - -%D \macros -%D {cfrac} -%D -%D [HH] Now let us see what this one does: -%D -%D \startbuffer -%D $\cfrac{12}{3} \cfrac[l]{12}{3} \cfrac[c]{12}{3} \cfrac[r]{12}{3}$ -%D $\cfrac{1}{23} \cfrac[l]{1}{23} \cfrac[c]{1}{23} \cfrac[r]{1}{23}$ -%D \stopbuffer -%D -%D \typebuffer -%D -%D \getbuffer - -\definecomplexorsimple\cfrac - -\def\simplecfrac - {\complexcfrac[c]} - -\def\complexcfrac[#1]#2#3% - {{\displaystyle - \frac - {\strut\ifx r#1\hfill\fi#2\ifx l#1\hfill\fi}% - {#3}}% - \kern-\nulldelimiterspace} - -%D [HH] The next alternative is nicer: - -\def\simplecfrac {\docfrac[cc]} -\def\complexcfrac[#1]{\docfrac[#1cc]} - -\def\docfrac[#1#2#3]#4#5% - {{\displaystyle - \frac - {\strut - \ifx r#1\hfill\fi#4\ifx l#1\hfill\fi}% - {\ifx r#2\hfill\fi#5\ifx l#2\hfill\fi}% - \kern-\nulldelimiterspace}} - -%D [HH] Now we can align every combination we want: -%D -%D \startbuffer -%D $\cfrac{12}{3} \cfrac[l]{12}{3} \cfrac[c]{12}{3} \cfrac[r]{12}{3}$ -%D $\cfrac{1}{23} \cfrac[l]{1}{23} \cfrac[c]{1}{23} \cfrac[r]{1}{23}$ -%D $\cfrac[cl]{12}{3} \cfrac[cc]{12}{3} \cfrac[cr]{12}{3}$ -%D $\cfrac[lc]{1}{23} \cfrac[cc]{1}{23} \cfrac[rc]{1}{23}$ -%D \stopbuffer -%D -%D \typebuffer -%D -%D \getbuffer - -%D \macros -%D {splitfrac, splitdfrac} -%D -%D Occasionally one needs to typeset multi||line fractions. -%D These commands use \tex{genfrac} to create such fractions. -%D -%D \startbuffer -%D \startformula -%D a=\frac{ -%D \splitfrac{xy + xy + xy + xy + xy} -%D {+ xy + xy + xy + xy} -%D } -%D {z} -%D =\frac{ -%D \splitdfrac{xy + xy + xy + xy + xy} -%D {+ xy + xy + xy + xy} -%D } -%D {z} -%D \stopformula -%D \stopbuffer -%D -%D \typebuffer \getbuffer -%D -%D These macros are based on Michael J.~Downes posting on -%D comp.text.tex on 2001/12/06 - -\def\splitfrac#1#2% - {\genfrac\empty\empty\zeropoint\textstyle% - {\textstyle#1\quad\hfill}% - {\textstyle\hfill\quad\mathstrut#2}} - -\def\splitdfrac#1#2% - {\genfrac\empty\empty\zeropoint\displaystyle% - {#1\quad\hfill} - {\hfill\quad\mathstrut #2}} - -\protect \endinput - %D \macros %D {startsubarray,substack,startsmallmatrix} %D |