[dev-context] Incorporating math ligatures in ConTeXt

Aditya Mahajan adityam at umich.edu
Tue Dec 5 03:21:34 CET 2006


Hi,

On Mon, 4 Dec 2006, Taco Hoekwater wrote:

> Aditya Mahajan wrote:
>>
>>
>> In ConTeXtize mathlig.tex I came across two macros...Is there any
>> ConTeXt equivalent of these?
>>
>> \def\mathlig at let@cs#1#2{\expandafter\let\expandafter#1\csname#2\endcsname}
>>
>> \def\mathlig at appendcs#1#2{\expandafter\edef\csname#1\endcsname{\csname#1\endcsname#2}}
>
> Check out the macros whose names start with \append.. in syst-new.tex

Thanks. There are two macros which I think should go somewhere in the 
core.

\def\actively#1#2%
   {\begingroup\uccode`\~=`#2\relax\uppercase{\endgroup#1~}}

\def\letexpandedvalue#1#2{\@EA\let\@EA#1\csname#2\endcsname}

I am attaching the complete module. This was just an excercise for me 
to see how such things can be done in vanilla tex. And since I just 
copy pasted most of the code, it was much easier to understand what is 
going on :) It may have taken less time to simply replace all the := 
with \colonequals, but thats an another story.

The present module will allow something like the following. Clearly 
not as powerful as what is possible with LuaTeX. Hans has already 
shown how to do this with LuaTeX about an year ago.

\definemathligature  [sin]    {\sin}
\definemathligature  [cos]    {\cos}
\definemathligature  [exp]    {e^}
\definemathligature  [sqrt]   {\sqrt}

% An ugly hack to get things to work: Notice the space
\definemathcommand [sin]     [nolop] {\mfunction{s in}}
\definemathcommand [cos]     [nolop] {\mfunction{c os}}

                                \startformula
  sqrt{sin(x^2) + cos(x^2)}
                                \stopformula
                                \startformula
  exp{x} + (exp{x})^2
                                \stopformula


Is anyone else interested in this module? If so, I may upload it on 
the garden.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: t-mathlig.tex
Type: application/octet-stream
Size: 8906 bytes
Desc: 
URL: <http://mailman.ntg.nl/pipermail/dev-context/attachments/20061204/64e6d18b/attachment.obj>


More information about the dev-context mailing list