Changes

Jump to navigation Jump to search
m
Reverted edits by 220.52.232.111 (Talk); changed back to last version by Mojca Miklavec
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>�egin\begin{env} ... �nd\end{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 �nd \end of a �egin\begin,�nd \end pair is problematic, since \stoptext% depends on TeX's �nd\end. We fix that as follows, using the % �verystoptext \everystoptext hook. (Note that some versions of ConTeXt% have already redefined �nd\end, but this should all work out.
Nprotect\unprotectet\let\@@end=�nd\end�ppendtoks\appendtoks et�nd\let\end=\@@end o �verystoptext\to \everystoptext\protect
% With that out of the way, the actual trans-
% lation macros are straightforward.
def�egin\def\begin#1{% �name \csname start#1�ndcsname1\endcsname} def�nd\def\end#1{% �name \csname stop#1�ndcsname1\endcsname}
</texcode>
Thus, a command such as <tt>�egin\begin{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>
defstartequation\def\startequation{% \placeformula \startformula}defstopequation\def\stopequation{% \stopformula}
�xpandafterdef�name \expandafter\def\csname startequation*�ndcsname\endcsname{% \placeformula[-] \startformula}�xpandafterdef�name \expandafter\def\csname stopequation*�ndcsname\endcsname{% \stopformula}
</texcode>
<texcode>
Semodule\usemodule[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>�egin\begin{array} ... �nd\end{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>�egin\begin{} ... �nd\end{}</tt> translation, at least in the version current as of 2004/08/02. The following versions do work, however:
<texcode>
defstartalign\def\startalign{\startformula et\let\\\cr ullvcenter�group\null\vcenter\bgroup openupjot \openup\jot {\mathsurround=0pt}% �verycr\everycr={} abskip\tabskip=4pt plus1fil% \halign to displaywidth�group\displaywidth\bgroup struthfil\strut\hfil$\displaystyle{##}$% abskip \tabskip=0pt &$\displaystyle{{}##}$\hfil% abskip \tabskip=4pt plus1fil &&\hfil$\displaystyle{##}$% abskip \tabskip=0pt &$\displaystyle{{}##}$\hfil% abskip \tabskip=4pt plus1fil �cr\crcr}defstopalign\def\stopalign{�cr�cr�group�groupstopformula\crcr\crcr\egroup\egroup\stopformula}
defstartgather\def\startgather{\startformula et\let\\\cr \null\,\vcenter\bgroup \openup\jot {\mathsurround=0pt}% \ialign\bgroupull \strut\hfil$\displaystyle{##}$\hfil \crcr}\def\stopgather{\crcr\crcr\egroup\egroup\,vcenter�group% openupjot \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\startsplit{% \let\\\cr \null\,\vcenter\bgroup \openup\jot {\mathsurround=0pt}% \ialign\bgroup \strut\hfil$\displaystyle{##}$%7 &$\displaystyle{{}##}$\hfil \crcr}\def\stopsplit{\crcr\egroup\egroup\,}</texcode>
== Other LaTeX Commands ==

Navigation menu