Changes

Jump to navigation Jump to search
2,879 bytes added ,  21:38, 22 June 2005
no edit summary
MathML support in ConTeXt is very extensive, but some features are rather hidden for now.

<cmd>setupMMLappearance</cmd> allows you to adjust various things. For example, the layout of presentational markup which uses mtables for alignment can be changed via <cmd>setupMMLappearance[mtable][alternative=a|b|c]</cmd>. Experiment with the different alternatives to see the effects.

When embedding XML inside normal ConTeXt code, remember that <cmd>stopXMLdata</cmd> gobbles up any following white-space. You'll need to explicitly put it back in if you want it (with <cmd>space</cmd>.

== Current bugs and workarounds ==

To use UTF inside MathML currently requires this workaround:

<texcode>
\unprotect

\long\def\doXMLremapdata[#1]#2#3#4%
{\bgroup
\startXMLmapping[#1]%
% enable unknown elements (should be macro)
\doifsomething{#1}
{\doifdefinedelse{\@@XML#1:\s!unknown:M}
{\remapXMLunknowntrue}{\remapXMLunknownfalse}}%
%
\pushmacro\doXMLentity % needed ?
% this will change, proper split in element itself
\ifx\currentXMLnamespace\empty
\let\parseXMLelement\remapXMLelement
\else
% here we need to get rid of the namespace; we also
% have to preserve the leaqding / if present
\@EA\long\@EA\def\@EA\parseXMLelement\@EA
##\@EA1\currentXMLnamespace:{\remapXMLelement##1}%
% ##2 removes leading spaces
\fi
%
\let\parseXMLescape \remapXMLescape
\let\parseXMLprocess\remapXMLprocess
%
\let\doXMLentity \remapXMLentity
%
\enableXML % sets entities
\enableXMLexpansion
\let\par\XMLremappedpar
\the\everyXMLremapping
%\ignorelines
\catcode`\^^I=\@@space
\catcode`\^^M=\@@space
\catcode`\^^L=\@@space
\catcode`\^^Z=\@@space
\pushmacro\unicodechar
\let\unicodechar\relax
\xdef\remappedXMLdata{#4\empty}%
\popmacro\unicodechar
\let\par\endgraf
\popmacro\doXMLentity % needed ?
\disableXMLexpansion
\catcode`\{=\@@begingroup
\catcode`\}=\@@endgroup
\catcode`\\=\@@escape
\iftraceXMLremapping
\ifmmode\vbox\fi\bgroup
\convertcommand\remappedXMLdata\to\ascii
\tttf\veryraggedright\ascii\par
\writestatus{xml-remap}{\ascii}%
\egroup
\fi
#2\scantokens\@EA{\remappedXMLdata\empty\empty}#3%
\stopXMLmapping
\egroup}

\protect

\def\MMLpTEXT#1#2%
{\hbox
{\tf
\getXMLarguments{mstyle}{#1}%
\doMMPpbackground{mstyle}
{\doMMPpcolor{mstyle}
{\setMMLptextstyle{mstyle}%
\ignorespaces#2\unskip\unskip}}}}
</texcode>



Additional space appears in front of an inline equation (tagged as an imath element). The fix (from Hans) is made in xtag-ini.tex: locate the line

<pre> .unexpanded.def<B.doXMLelementE</pre>

and add a <tt>*</tt> immediately following it, to produce

<pre>.unexpanded.def<B.doXMLelementE*</pre>

The * (comment token) prevents the spurious space.
Anonymous user

Navigation menu