ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Giuseppe Bilotta <gip.bilotta@iol.it>
Subject: Re: Converting math from LaTeX to ConTeXt
Date: Sat, 7 Aug 2004 17:12:08 +0200	[thread overview]
Message-ID: <1716801547.20040807171208@iol.it> (raw)
In-Reply-To: <4.3.1.2.20040725215940.01876a88@cits1.stanford.edu>

Hi Brook,

sorry for the horrible delay with which I'm replying to you. I
think I have a part of the solution to your problems.

Monday, July 26, 2004 Brooks Moses wrote:

> Also, many of these equations run over multiple lines using the macros from
> the amsmath package (the "split" environment in particular, but also the
> "align" environment), and I haven't been able to find much documentation on
> how to do this in ConTeXt.

I've been working on a ConTeXt module that provides some
elementary AMS-compatible definitions, but for complex
equations I have a personal preference for the Nath package in
LaTeX, so for multiline you might have more luck using the
nath module, which is available on CTAN. There is no manual,
but you can use the LaTeX package manual as a reference.

> For an example of the sorts of things I end up
> doing:
>    \begin{equation}
>    \begin{split}
>    \lefteqn{
>      \frac{\partial (\rho (\phi u)_j)}{\partial t}
>         + \nabla_k (\rho (\phi u)_k u_j)
>    }\quad\quad
>    \\
>    = &\;
>      -\nabla_j (\phi p)
>      + \nabla_j (\lambda \nabla_k (\phi u_k))
>      + \nabla_k \left[\mu \left( \nabla_k (\phi u)_j
>      + (\nabla_j (\phi u)_k) \right) \right]
>    \\&\;
>      {} - \lambda (\nabla_j u_k) \nabla_k \phi
>      - \mu (\nabla_k \phi) \nabla_k u_j
>      - \mu (\nabla_k u_k) \nabla \phi_j
>      - \tau_{\text{surface, $jk$}} \nabla_k \phi
>    \end{split}
>    \end{equation}

With ConTeXt+nath, this could become something like

\[
\frac{\partial (\rho (\phi u)_j)}{\partial t}
    + \nabla_k (\rho (\phi u)_k u_j)
   = \wall
     -\nabla_j (\phi p)
     + \nabla_j (\lambda \nabla_k (\phi u_k))
     + \nabla_k [\mu ( \nabla_k (\phi u)_j
     + (\nabla_j (\phi u)_k) )] \\
     - \lambda (\nabla_j u_k) \nabla_k \phi
     - \mu (\nabla_k \phi) \nabla_k u_j
     - \mu (\nabla_k u_k) \nabla \phi_j
     - \tau_{\text{surface, $jk$}} \nabla_k \phi
     \return
\]

or something.

> Looking at that reminds me that I also rather heavily use the \text command
> from amsmath as well, and rely on its ability to properly size things in
> subscripts and such.  Does this (or an analogue) exist in ConTeXt?

Yes, there is a \text command in ConTeXt provided you use the
amsl or nath modules (note that the nath module needs amsl)

> Any suggestions?  I'd like to be able to simply cut and paste the equations
> like this one from my LaTeX documents into my ConTeXt documents with as
> little editing as possible (so that I can maintain consistency between
> documents in each format), but anything that produces the same output would
> be good to know about.

Well, if you can use the Nath module in your LaTeX documents
(the module is sadly incompatible with much of the AMS
features, so there are cases when it's impossible to convert an
AMS-LaTeX document to a LaTeX+Nath module) you can do it with
ease. Otherwise, some minor corrections will be necessary to
reduce the AMS forms into Nath forms; in some cases cleanups
are unnecessary (e.g., Nath will accept \left and \right which
are not necessary because of its auto-sizing features) so you
can often keep an extremely similar syntax for both forms.

Do keep in mind, in all this, that the nath package for ConTeXt
still has a few edges that needs smoothing, esp. when it comes
to arrays, multiline equations and numbering.

Hope this helps.

-- 
Giuseppe "Oblomov" Bilotta

      parent reply	other threads:[~2004-08-07 15:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-26  5:31 Brooks Moses
2004-07-27 11:42 ` Eckhart Guthöhrlein
2004-07-29 16:46   ` Brooks Moses
2004-08-07 15:12 ` Giuseppe Bilotta [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1716801547.20040807171208@iol.it \
    --to=gip.bilotta@iol.it \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).