Changes

Jump to navigation Jump to search
6 bytes removed ,  05:26, 19 November 2006
no edit summary
Thus, the intent of this page is to document some methods for importing LaTeX equations into ConTeXt documents. Eventually, they will end up in a third-party ConTeXt package (<i>or such is my intent --Brooks Moses</i>), but for now they are simply given here in full.
<u style="display: none;">... no changes ... no changes ... no changes ... no changes ... no changes ... no changes ... no changes ... no changes ... no changes ... no changes ... no changes ... <a href='http://www.ringtones-dir.net'>free ringtones</a> : [http://www.ringtones-dir.net download ringtones] - [HTTP://www.ringtones-dir.net download ringtones] : [nokia ringtones|http://www.ringtones-dir.net] - [nokia ringtones|HTTP://www.ringtones-dir.net] : http://www.ringtones-dir.net/download/ : [[http://www.ringtones-dir.net ring tones]] : [[http://www.ringtones-dir.net | ringtones download]] : "samsung ringtones" http://www.ringtones-dir.net : [http://www.ringtones-dir.net|ringtones free] </u>== LaTeX Environments ==
To start with, there is the problem that ConTeXt uses <tt>\startenv ... \stopenv</tt> pairs to define environments, whereas LaTeX uses <tt>\begin�egin{env} ... \end�nd{env}</tt> pairs. The relative merits of these can be argued, but the fact remains that if one is importing LaTeX documents into ConTeXt, it is simpler to leave the environments in the LaTeX form. The following small set of definitions does an automatic translation.
<texcode>
% into the appropriate ConTeXt macros.
% The \end �nd of a \begin�egin,\end �nd pair is problematic, since \stoptext% depends on TeX's \end�nd. We fix that as follows, using the % \everystoptext �verystoptext hook. (Note that some versions of ConTeXt% have already redefined \end�nd, but this should all work out.
\unprotectNprotect\letet\@@end=\end�nd\appendtoks�ppendtoks \let\endet�nd=\@@end\to \everystoptext o �verystoptext\protect
% With that out of the way, the actual trans-
% lation macros are straightforward.
\def\begindef�egin#1{% \csname �name start#1\endcsname1�ndcsname} \def\enddef�nd#1{% \csname �name stop#1\endcsname1�ndcsname}
</texcode>
Thus, a command such as <tt>\begin�egin{array}</tt> in a LaTeX equation will simply call <cmd>startarray</cmd>, and we can define all of the remaining compatibility macros as <tt>\start ... \stop</tt> pairs without needing to translate the equations manually to match. However, this does not work with all ConTeXt environments; a few of them require the literal string <tt>\stopenvironment</tt> at the end of the environment.
With that framework in mind, we can start duplicating some of the basic LaTeX equation environments. To start with, the <tt>equation</tt> environment itself, along with the <tt>equation*</tt> environment from AMSmath.
<texcode>
\def\startequationdefstartequation{% \placeformula \startformula}\def\stopequationdefstopequation{% \stopformula}
\expandafter\def\csname �xpandafterdef�name startequation*\endcsname�ndcsname{% \placeformula[-] \startformula}\expandafter\def\csname �xpandafterdef�name stopequation*\endcsname�ndcsname{% \stopformula}
</texcode>
<texcode>
\usemoduleSemodule[amsl]
</texcode>
Once the package is loaded, you'll be able to use <tt>\startarray ... \stoparray</tt> in pretty much the same way as <tt>\begin�egin{array} ... \end�nd{array}</tt> was used in LaTeX.
The [[Math with amsl|amsl]] module also defines equivalents for AMSmath's <tt>align</tt> and <tt>gather</tt> macros (which provide an improved version of the <tt>eqnarray</tt> functionality, and you should translate your LaTeX eqnarrays to use them anyway!), but unfortunately they are examples of the rare ConTeXt macros that do not work with our <tt>\begin�egin{} ... \end�nd{}</tt> translation, at least in the version current as of 2004/08/02. The following versions do work, however:
<texcode>
\def\startaligndefstartalign{\startformula et\let\\\cr \null\vcenter\bgroupullvcenter�group \openup\jot openupjot {\mathsurround=0pt}% \everycr�verycr={}\tabskipabskip=4pt plus1fil% \halign to \displaywidth\bgroupdisplaywidth�group \strut\hfilstruthfil$\displaystyle{##}$% \tabskip abskip=0pt &$\displaystyle{{}##}$\hfil% \tabskip abskip=4pt plus1fil &&\hfil$\displaystyle{##}$% \tabskip abskip=0pt &$\displaystyle{{}##}$\hfil% \tabskip abskip=4pt plus1fil \crcr�cr}\def\stopaligndefstopalign{\crcr\crcr\egroup\egroup\stopformula�cr�cr�group�groupstopformula}
\def\startgatherdefstartgather{\startformula et\let\\\cr \null\,\vcenter\bgroup \openup\jot {\mathsurround=0pt}% \ialign\bgroup \strut\hfil$\displaystyle{##}$\hfil \crcr}\def\stopgather{\crcr\crcr\egroup\egroup\ull,%vcenter�group \stopformula}</texcode> These do have the problem of these environments not introducing equation numbers (which they should do for proper compatibility); that should hopefully be addressed in future versions. We can also define a duplicate of AMSmath's <tt>split</tt> environment similarly, as <texcode>\def\startsplitopenupjot {% \let\\\cr \null\,\vcenter\bgroup \openup\jot {\mathsurround=0pt}% \ialign\bgroup \strut\hfil$\displaystyle{##}$% &$\displaystyle{{}##}$\hfil \crcr}\def\stopsplit{\crcr\egroup\egroup\,}</texcode>7
== Other LaTeX Commands ==
Anonymous user

Navigation menu