summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/math-fen.mkiv
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-04-08 00:43:40 +0000
committerKarl Berry <karl@freefriends.org>2013-04-08 00:43:40 +0000
commit824f7b0903de8ad7f6ee3d7656005e4c59155e06 (patch)
treeabfc8673ef9916f3ab7074e811207384c301492b /Master/texmf-dist/tex/context/base/math-fen.mkiv
parent689aefb0727676ed3cddf331337b4be226495e72 (diff)
context import for TL13, from www.pragma-ade.com/context/beta/cont-tmf.zip
git-svn-id: svn://tug.org/texlive/trunk@29731 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/math-fen.mkiv')
-rw-r--r--Master/texmf-dist/tex/context/base/math-fen.mkiv108
1 files changed, 108 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/context/base/math-fen.mkiv b/Master/texmf-dist/tex/context/base/math-fen.mkiv
new file mode 100644
index 00000000000..9080ffedf53
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/math-fen.mkiv
@@ -0,0 +1,108 @@
+%D \module
+%D [ file=math-fen,
+%D version=2012.02.18,
+%D title=\CONTEXT\ Math Macros,
+%D subtitle=Fences,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\writestatus{loading}{ConTeXt Math Macros / Fences}
+
+\unprotect
+
+% todo: mathstyle
+
+% \definemathfence [fancybracket] [bracket] [command=yes,color=blue]
+%
+% test $|x|$ test \par
+% test $||x||$ test (okay) \par
+% test $a\left|\frac{1}{b}\right|c$ test \par
+% test $a\left||\frac{1}{b}\right||c$ test (not okay) \par
+%
+% \setupmathfences [color=red]
+%
+% test $a\fenced[bar]{\frac{1}{b}}c$ test \par
+% test $a\fenced[doublebar]{\frac{1}{b}}c$ test \par
+% test $a\fenced[bracket]{\frac{1}{b}}c$ test \par
+% test $a\fancybracket{\frac{1}{b}}c$ test \par
+
+\installcorenamespace{mathfences}
+\installcorenamespace{mathfencesleft}
+\installcorenamespace{mathfencesmiddle}
+\installcorenamespace{mathfencesright}
+
+\installcommandhandler \??mathfences {mathfence} \??mathfences
+
+\let\setupmathfences\setupmathfence
+
+\setupmathfences
+ [\c!left="002E,
+ \c!right="002E,
+ \c!middle="002E,
+ \c!mathstyle=,
+ \c!color=,
+ \c!command=]
+
+\appendtoks
+ \edef\p_command{\mathfenceparameter\c!command}%
+ \ifx\p_command\v!yes
+ \setuevalue\currentmathfence{\math_fenced_fenced[\currentmathfence]}%
+ \fi
+\to \everydefinemathfence
+
+\def\math_fenced_left {\normalleft \utfchar{\mathfenceparameter\c!left }} % no Uchar here
+\def\math_fenced_middle{\normalmiddle\utfchar{\mathfenceparameter\c!middle}} % no Uchar here
+\def\math_fenced_right {\normalright \utfchar{\mathfenceparameter\c!right }} % no Uchar here
+
+\let\fence \relax
+\let\fenced\relax
+
+\unexpanded\def\math_fenced_fenced[#1]%
+ {\begingroup
+ \edef\currentmathfence{#1}%
+ \startusemathstyleparameter\mathfenceparameter
+ \let\fence\math_fenced_middle
+ \edef\p_math_fenced_color{\mathfenceparameter\c!color}%
+ \ifx\p_math_fenced_color\empty
+ \expandafter\math_fenced_normal
+ \else
+ \expandafter\math_fenced_colored
+ \fi}
+
+\def\math_fenced_normal#1%
+ {\math_fenced_left
+ #1%
+ \math_fenced_right
+ \stopusemathstyleparameter
+ \endgroup}
+
+\def\math_fenced_colored#1%
+ {\pushcolor[\p_math_fenced_color]%
+ \math_fenced_left
+ \popcolor
+ #1%
+ \pushcolor[\p_math_fenced_color]%
+ \math_fenced_right
+ \popcolor
+ \stopusemathstyleparameter
+ \endgroup}
+
+\appendtoks
+ \let\fenced\math_fenced_fenced
+\to \everymathematics
+
+\definemathfence [parenthesis] [\c!left="0028,\c!right="0029]
+\definemathfence [bracket] [\c!left="005B,\c!right="005D]
+\definemathfence [braces] [\c!left="007B,\c!right="007D]
+\definemathfence [bar] [\c!left="007C,\c!right="007C]
+\definemathfence [doublebar] [\c!left="2016,\c!right="2016]
+\definemathfence [angle] [\c!left="003C,\c!right="003E]
+
+%definemathfence [fancybracket] [bracket] [command=yes,color=red]
+
+\protect