ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Converting LaTeX math to ConTeXt
@ 2021-10-10  3:45 Jason Ross via ntg-context
  2021-10-10 10:23 ` Hans Hagen via ntg-context
  0 siblings, 1 reply; 7+ messages in thread
From: Jason Ross via ntg-context @ 2021-10-10  3:45 UTC (permalink / raw)
  To: ntg-context; +Cc: Jason Ross

Hello,

I'm trying to provide more support for LaTeX math for an Org Mode
exporter for ConTeXt. LaTeX is the de facto standard for mathematics in
Org Mode. However, the syntax is quite different between LaTeX and
ConTeXt. I have a few ideas, but none that I'm happy about.

1. Export LaTeX to MathML then import that into ConTeXt. I don't know
    how to get this to work. latexmlmath only returns the first row of
    `align` environments (for me anyway). Also, this would require users
    to install another program.
2. Typeset equations with LaTeX as standalone pages and then include
    them as images. This will typeset everything with LaTeX defaults.
    Also, either equation alignment or equation numbering will break.
3. Hack every math environment I can think of to accept LaTeX syntax
    (see https://wiki.contextgarden.net/LaTeX_Math_in_ConTeXt). Lots
    of work, lots of problems as described in the article. End-users
    could add their own hacks to the template preamble for cases I
    don't get to.
4. Manually parse and convert every LaTeX math environment to ConTeXt
    before exporting. Basically a non-starter.

I'm wondering what's the best way to go about this. Surely others have
run into the same problem?

Thanks,

Jason
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Converting LaTeX math to ConTeXt
  2021-10-10  3:45 Converting LaTeX math to ConTeXt Jason Ross via ntg-context
@ 2021-10-10 10:23 ` Hans Hagen via ntg-context
  2021-10-10 14:44   ` Jason Ross via ntg-context
  0 siblings, 1 reply; 7+ messages in thread
From: Hans Hagen via ntg-context @ 2021-10-10 10:23 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Hans Hagen

On 10/10/2021 5:45 AM, Jason Ross via ntg-context wrote:
> Hello,
> 
> I'm trying to provide more support for LaTeX math for an Org Mode
> exporter for ConTeXt. LaTeX is the de facto standard for mathematics in
> Org Mode. However, the syntax is quite different between LaTeX and
> ConTeXt. I have a few ideas, but none that I'm happy about.
> 
> 1. Export LaTeX to MathML then import that into ConTeXt. I don't know
>     how to get this to work. latexmlmath only returns the first row of
>     `align` environments (for me anyway). Also, this would require users
>     to install another program.
> 2. Typeset equations with LaTeX as standalone pages and then include
>     them as images. This will typeset everything with LaTeX defaults.
>     Also, either equation alignment or equation numbering will break.
> 3. Hack every math environment I can think of to accept LaTeX syntax
>     (see https://wiki.contextgarden.net/LaTeX_Math_in_ConTeXt). Lots
>     of work, lots of problems as described in the article. End-users
>     could add their own hacks to the template preamble for cases I
>     don't get to.
> 4. Manually parse and convert every LaTeX math environment to ConTeXt
>     before exporting. Basically a non-starter.
> 
> I'm wondering what's the best way to go about this. Surely others have
> run into the same problem?
what do you mean with 'quite different'

Hans


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Converting LaTeX math to ConTeXt
  2021-10-10 10:23 ` Hans Hagen via ntg-context
@ 2021-10-10 14:44   ` Jason Ross via ntg-context
  2021-10-11 23:02     ` Aditya Mahajan via ntg-context
  0 siblings, 1 reply; 7+ messages in thread
From: Jason Ross via ntg-context @ 2021-10-10 14:44 UTC (permalink / raw)
  To: Hans Hagen, mailing list for ConTeXt users; +Cc: Jason Ross

On 10/10/21 3:23 AM, Hans Hagen wrote:

> what do you mean with 'quite different'
> 
> Hans

Hi Hans,

My current stumbling block is dealing with the `align` environment.
I replace `\begin{align}/\end{align}` with
`\startmathalignment/\stopmathalignment`, and replace all `&` characters
with `\NC` and `\\` with `\NR`, which is simple enough.
However, the two commands work differently - `align` doesn't care
how many columns you have, but `mathalignment` does. This makes dealing
with aligned equations containing matrices hard - you can't just count
how many `&`s you see before you get to a `\\`, because you might be
inside of a matrix in which case they don't count.

Also, `mathalignment` and `matrix` want a leading `\NC` to start each
column, while LaTeX `align` and `matrix` just want `&` as a column
separator.

These are just a couple examples, but in general it's not enough to do
naive string substitution in LaTeX and get valid ConTeXt back, and my
patchwork solutions are starting to smell.

Thanks,

Jason
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Converting LaTeX math to ConTeXt
  2021-10-10 14:44   ` Jason Ross via ntg-context
@ 2021-10-11 23:02     ` Aditya Mahajan via ntg-context
  2021-10-12 21:43       ` Jason Ross via ntg-context
  0 siblings, 1 reply; 7+ messages in thread
From: Aditya Mahajan via ntg-context @ 2021-10-11 23:02 UTC (permalink / raw)
  To: Jason Ross via ntg-context; +Cc: Aditya Mahajan

[-- Attachment #1: Type: text/plain, Size: 4256 bytes --]

On Sun, 10 Oct 2021, Jason Ross via ntg-context wrote:

> On 10/10/21 3:23 AM, Hans Hagen wrote:
> 
> These are just a couple examples, but in general it's not enough to do
> naive string substitution in LaTeX and get valid ConTeXt back, and my
> patchwork solutions are starting to smell.

You can use pandoc to parse latex and convert it to mathml:

$ cat math.tex

\documentclass{amsart}
\begin{document}
\begin{align}
 a &= \begin{pmatrix}
    1 & 2 & 3 \\
    1 & 2 & 3 \\
    1 & 2 & 3
 \end{pmatrix},
 b &= \begin{pmatrix}
    1 & 2 & 3 \\
    1 & 2 & 3 \\
    1 & 2 & 3
 \end{pmatrix},
 \\
 c &= \begin{pmatrix}
    1 & 2 & 3 \\
    1 & 2 & 3 \\
    1 & 2 & 3
 \end{pmatrix},
 d &= \begin{pmatrix}
    1 & 2 & 3 \\
    1 & 2 & 3 \\
    1 & 2 & 3
 \end{pmatrix},
\end{align}
\end{document}

$ pandoc -f latex -t html --mathml math.tex


<p><math display="block" xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mtable><mtr><mtd columnalign="right"><mi>a</mi></mtd><mtd columnalign="left"><mo>=</mo><mrow><mo stretchy="true" form="prefix">(</mo><mtable><mtr><mtd columnalign="center"><mn>1</mn></mtd><mtd columnalign="center"><mn>2</mn></mtd><mtd columnalign="center"><mn>3</mn></mtd></mtr><mtr><mtd columnalign="center"><mn>1</mn></mtd><mtd columnalign="center"><mn>2</mn></mtd><mtd columnalign="center"><mn>3</mn></mtd></mtr><mtr><mtd columnalign="center"><mn>1</mn></mtd><mtd columnalign="center"><mn>2</mn></mtd><mtd columnalign="center"><mn>3</mn></mtd></mtr></mtable><mo stretchy="true" form="postfix">)</mo></mrow><mo>,</mo><mi>b</mi></mtd><mtd columnalign="right"><mo>=</mo><mrow><mo stretchy="true" form="prefix">(</mo><mtable><mtr><mtd columnalign="center"><mn>1</mn></mtd><mtd columnalign="center"><mn>2</mn></mtd><mtd columnalign="center"><mn>3</mn></mtd></mtr><mtr><mtd columnalign="center"><mn>1</mn></mtd><mtd columnalign="center"><mn>2</mn></mtd><mtd columnalign="center"><mn>3</mn></mtd></mtr><mtr><mtd columnalign="center"><mn>1</mn></mtd><mtd columnalign="center"><mn>2</mn></mtd><mtd columnalign="center"><mn>3</mn></mtd></mtr></mtable><mo stretchy="true" form="postfix">)</mo></mrow><mo>,</mo></mtd></mtr><mtr><mtd columnalign="right"><mi>c</mi></mtd><mtd columnalign="left"><mo>=</mo><mrow><mo stretchy="true" form="prefix">(</mo><mtable><mtr><mtd columnalign="center"><mn>1</mn></mtd><mtd columnalign="center"><mn>2</mn></mtd><mtd columnalign="center"><mn>3</mn></mtd></mtr><mtr><mtd columnalign="center"><mn>1</mn></mtd><mtd columnalign="center"><mn>2</mn></mtd><mtd columnalign="center"><mn>3</mn></mtd></mtr><mtr><mtd columnalign="center"><mn>1</mn></mtd><mtd columnalign="center"><mn>2</mn></mtd><mtd columnalign="center"><mn>3</mn></mtd></mtr></mtable><mo stretchy="true" form="postfix">)</mo></mrow><mo>,</mo><mi>d</mi></mtd><mtd columnalign="right"><mo>=</mo><mrow><mo stretchy="true" form="prefix">(</mo><mtable><mtr><mtd columnalign="center"><mn>1</mn></mtd><mtd columnalign="center"><mn>2</mn></mtd><mtd columnalign="center"><mn>3</mn></mtd></mtr><mtr><mtd columnalign="center"><mn>1</mn></mtd><mtd columnalign="center"><mn>2</mn></mtd><mtd columnalign="center"><mn>3</mn></mtd></mtr><mtr><mtd columnalign="center"><mn>1</mn></mtd><mtd columnalign="center"><mn>2</mn></mtd><mtd columnalign="center"><mn>3</mn></mtd></mtr></mtable><mo stretchy="true" form="postfix">)</mo></mrow><mo>,</mo></mtd></mtr></mtable><annotation encoding="application/x-tex">\begin{aligned}
 a &amp;= \begin{pmatrix}
    1 &amp; 2 &amp; 3 \\
    1 &amp; 2 &amp; 3 \\
    1 &amp; 2 &amp; 3
 \end{pmatrix},
 b &amp;= \begin{pmatrix}
    1 &amp; 2 &amp; 3 \\
    1 &amp; 2 &amp; 3 \\
    1 &amp; 2 &amp; 3
 \end{pmatrix},
 \\
 c &amp;= \begin{pmatrix}
    1 &amp; 2 &amp; 3 \\
    1 &amp; 2 &amp; 3 \\
    1 &amp; 2 &amp; 3
 \end{pmatrix},
 d &amp;= \begin{pmatrix}
    1 &amp; 2 &amp; 3 \\
    1 &amp; 2 &amp; 3 \\
    1 &amp; 2 &amp; 3
 \end{pmatrix},\end{aligned}</annotation></semantics></math></p>

Processing this in context (see attached files), gives a partially working solution. It doesn't look okay, but should be easily fixable.

Do note that this is almost same as compiling latex output to PDF because editing presentation mathml by hand is no fun.

Aditya

[-- Attachment #2: Type: application/x-tex, Size: 2557 bytes --]

[-- Attachment #3: Type: application/pdf, Size: 8175 bytes --]

[-- Attachment #4: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Converting LaTeX math to ConTeXt
  2021-10-11 23:02     ` Aditya Mahajan via ntg-context
@ 2021-10-12 21:43       ` Jason Ross via ntg-context
  2021-10-13  3:31         ` Aditya Mahajan via ntg-context
  0 siblings, 1 reply; 7+ messages in thread
From: Jason Ross via ntg-context @ 2021-10-12 21:43 UTC (permalink / raw)
  To: Aditya Mahajan, Jason Ross via ntg-context; +Cc: Jason Ross



On 10/11/21 4:02 PM, Aditya Mahajan wrote:
> You can use pandoc to parse latex and convert it to mathml:
> 
> Processing this in context (see attached files), gives a partially working solution. It doesn't look okay, but should be easily fixable.
> 
> Do note that this is almost same as compiling latex output to PDF because editing presentation mathml by hand is no fun.

Hmm. Looks like converting to MathML isn't going to work just yet.
Is this an issue with ConTeXt? The MathML seems to render correctly in
LibreOffice but gets mangled when exporting to ConTeXt.

I'll explore some of the alternatives you suggested. A simple parser
will be fine for now. Thank you the help.

Best Regards,

Jason
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Converting LaTeX math to ConTeXt
  2021-10-12 21:43       ` Jason Ross via ntg-context
@ 2021-10-13  3:31         ` Aditya Mahajan via ntg-context
  2021-10-13  4:46           ` Jason Ross via ntg-context
  0 siblings, 1 reply; 7+ messages in thread
From: Aditya Mahajan via ntg-context @ 2021-10-13  3:31 UTC (permalink / raw)
  To: Jason Ross; +Cc: Aditya Mahajan, Jason Ross via ntg-context

On Tue, 12 Oct 2021, Jason Ross wrote:

> 
> 
> On 10/11/21 4:02 PM, Aditya Mahajan wrote:
> > You can use pandoc to parse latex and convert it to mathml:
> > 
> > Processing this in context (see attached files), gives a partially working
> > solution. It doesn't look okay, but should be easily fixable.
> > 
> > Do note that this is almost same as compiling latex output to PDF because
> > editing presentation mathml by hand is no fun.
> 
> Hmm. Looks like converting to MathML isn't going to work just yet.
> Is this an issue with ConTeXt? The MathML seems to render correctly in
> LibreOffice but gets mangled when exporting to ConTeXt.

This is an issue with ConTeXt, but most of these issues are minor are easy to fix. Just send minimal examples showing the incorrect rendering.

Aditya
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Converting LaTeX math to ConTeXt
  2021-10-13  3:31         ` Aditya Mahajan via ntg-context
@ 2021-10-13  4:46           ` Jason Ross via ntg-context
  0 siblings, 0 replies; 7+ messages in thread
From: Jason Ross via ntg-context @ 2021-10-13  4:46 UTC (permalink / raw)
  To: Aditya Mahajan; +Cc: Jason Ross, Jason Ross via ntg-context

[-- Attachment #1: Type: text/plain, Size: 556 bytes --]



On 10/12/21 8:31 PM, Aditya Mahajan wrote:

> This is an issue with ConTeXt, but most of these issues are minor are easy to fix. Just send minimal examples showing the incorrect rendering.
> 
> Aditya
> 


An example is attached.
MathML generated with

pandoc -f latex -t html --mathml sample-math.tex \
     | xmlstarlet ed -d "//*[local-name()='annotation']" \
     | xmlstarlet sel -t -c "/p/*" \
     | xmlstarlet ed -m "//*[local-name()='semantics']/*" \
         "//*[local-name()='math']" \
     | xmlstarlet ed -d "//*[local-name()='semantics']"

[-- Attachment #2: sample-math.mkiv --]
[-- Type: text/plain, Size: 24657 bytes --]

\usemodule[mathml]
\starttext
\startplaceformula
  \startformula
    \xmlprocessdata{}{
      <?xml version="1.0"?>
      <math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
        <mrow>
          <mrow>
            <mo stretchy="true" form="prefix">[</mo>
            <mtable>
              <mtr>
                <mtd columnalign="center">
                  <msub>
                    <mi>R</mi>
                    <mrow>
                      <mn>1</mn>
                      <mi>x</mi>
                    </mrow>
                  </msub>
                </mtd>
              </mtr>
              <mtr>
                <mtd columnalign="center">
                  <msub>
                    <mi>R</mi>
                    <mrow>
                      <mn>1</mn>
                      <mi>y</mi>
                    </mrow>
                  </msub>
                </mtd>
              </mtr>
              <mtr>
                <mtd columnalign="center">
                  <msub>
                    <mi>F</mi>
                    <mrow>
                      <mn>2</mn>
                      <mi>x</mi>
                    </mrow>
                  </msub>
                </mtd>
              </mtr>
              <mtr>
                <mtd columnalign="center">
                  <msub>
                    <mi>F</mi>
                    <mrow>
                      <mn>2</mn>
                      <mi>y</mi>
                    </mrow>
                  </msub>
                </mtd>
              </mtr>
              <mtr>
                <mtd columnalign="center">
                  <msub>
                    <mi>R</mi>
                    <mrow>
                      <mn>3</mn>
                      <mi>x</mi>
                    </mrow>
                  </msub>
                </mtd>
              </mtr>
              <mtr>
                <mtd columnalign="center">
                  <msub>
                    <mi>R</mi>
                    <mrow>
                      <mn>3</mn>
                      <mi>y</mi>
                    </mrow>
                  </msub>
                </mtd>
              </mtr>
              <mtr>
                <mtd columnalign="center">
                  <msub>
                    <mi>R</mi>
                    <mrow>
                      <mn>4</mn>
                      <mi>x</mi>
                    </mrow>
                  </msub>
                </mtd>
              </mtr>
              <mtr>
                <mtd columnalign="center">
                  <msub>
                    <mi>R</mi>
                    <mrow>
                      <mn>4</mn>
                      <mi>y</mi>
                    </mrow>
                  </msub>
                </mtd>
              </mtr>
            </mtable>
            <mo stretchy="true" form="postfix">]</mo>
          </mrow>
          <mo>=</mo>
          <mrow>
            <mo stretchy="true" form="prefix">[</mo>
            <mtable>
              <mtr>
                <mtd columnalign="center">
                  <mfrac>
                    <mrow>
                      <msub>
                        <mi>A</mi>
                        <mn>1</mn>
                      </msub>
                      <msub>
                        <mi>E</mi>
                        <mn>1</mn>
                      </msub>
                    </mrow>
                    <msub>
                      <mi>L</mi>
                      <mn>1</mn>
                    </msub>
                  </mfrac>
                </mtd>
                <mtd columnalign="center">
                  <mn>0</mn>
                </mtd>
                <mtd columnalign="center">
                  <mo>&#x2212;</mo>
                  <mfrac>
                    <mrow>
                      <msub>
                        <mi>A</mi>
                        <mn>1</mn>
                      </msub>
                      <msub>
                        <mi>E</mi>
                        <mn>1</mn>
                      </msub>
                    </mrow>
                    <msub>
                      <mi>L</mi>
                      <mn>1</mn>
                    </msub>
                  </mfrac>
                </mtd>
                <mtd columnalign="center">
                  <mn>0</mn>
                </mtd>
                <mtd columnalign="center">
                  <mn>0</mn>
                </mtd>
                <mtd columnalign="center">
                  <mn>0</mn>
                </mtd>
                <mtd columnalign="center">
                  <mn>0</mn>
                </mtd>
                <mtd columnalign="center">
                  <mn>0</mn>
                </mtd>
              </mtr>
              <mtr>
                <mtd columnalign="center">
                  <mn>0</mn>
                </mtd>
                <mtd columnalign="center">
                  <mn>0</mn>
                </mtd>
                <mtd columnalign="center">
                  <mn>0</mn>
                </mtd>
                <mtd columnalign="center">
                  <mn>0</mn>
                </mtd>
                <mtd columnalign="center">
                  <mn>0</mn>
                </mtd>
                <mtd columnalign="center">
                  <mn>0</mn>
                </mtd>
                <mtd columnalign="center">
                  <mn>0</mn>
                </mtd>
                <mtd columnalign="center">
                  <mn>0</mn>
                </mtd>
              </mtr>
              <mtr>
                <mtd columnalign="center">
                  <mo>&#x2212;</mo>
                  <mfrac>
                    <mrow>
                      <msub>
                        <mi>A</mi>
                        <mn>1</mn>
                      </msub>
                      <msub>
                        <mi>E</mi>
                        <mn>1</mn>
                      </msub>
                    </mrow>
                    <msub>
                      <mi>L</mi>
                      <mn>1</mn>
                    </msub>
                  </mfrac>
                </mtd>
                <mtd columnalign="center">
                  <mn>0</mn>
                </mtd>
                <mtd columnalign="center">
                  <mfrac>
                    <mrow>
                      <msub>
                        <mi>A</mi>
                        <mn>1</mn>
                      </msub>
                      <msub>
                        <mi>E</mi>
                        <mn>1</mn>
                      </msub>
                    </mrow>
                    <msub>
                      <mi>L</mi>
                      <mn>1</mn>
                    </msub>
                  </mfrac>
                  <mo>+</mo>
                  <mfrac>
                    <mrow>
                      <msub>
                        <mi>A</mi>
                        <mn>3</mn>
                      </msub>
                      <msub>
                        <mi>E</mi>
                        <mn>3</mn>
                      </msub>
                    </mrow>
                    <mrow>
                      <mn>5</mn>
                      <msub>
                        <mi>L</mi>
                        <mn>3</mn>
                      </msub>
                    </mrow>
                  </mfrac>
                </mtd>
                <mtd columnalign="center">
                  <mo>&#x2212;</mo>
                  <mfrac>
                    <mrow>
                      <mn>2</mn>
                      <msub>
                        <mi>A</mi>
                        <mn>3</mn>
                      </msub>
                      <msub>
                        <mi>E</mi>
                        <mn>3</mn>
                      </msub>
                    </mrow>
                    <mrow>
                      <mn>5</mn>
                      <msub>
                        <mi>L</mi>
                        <mn>3</mn>
                      </msub>
                    </mrow>
                  </mfrac>
                </mtd>
                <mtd columnalign="center">
                  <mn>0</mn>
                </mtd>
                <mtd columnalign="center">
                  <mn>0</mn>
                </mtd>
                <mtd columnalign="center">
                  <mo>&#x2212;</mo>
                  <mfrac>
                    <mrow>
                      <msub>
                        <mi>A</mi>
                        <mn>3</mn>
                      </msub>
                      <msub>
                        <mi>E</mi>
                        <mn>3</mn>
                      </msub>
                    </mrow>
                    <mrow>
                      <mn>5</mn>
                      <msub>
                        <mi>L</mi>
                        <mn>3</mn>
                      </msub>
                    </mrow>
                  </mfrac>
                </mtd>
                <mtd columnalign="center">
                  <mfrac>
                    <mrow>
                      <mn>2</mn>
                      <msub>
                        <mi>A</mi>
                        <mn>3</mn>
                      </msub>
                      <msub>
                        <mi>E</mi>
                        <mn>3</mn>
                      </msub>
                    </mrow>
                    <mrow>
                      <mn>5</mn>
                      <msub>
                        <mi>L</mi>
                        <mn>3</mn>
                      </msub>
                    </mrow>
                  </mfrac>
                </mtd>
              </mtr>
              <mtr>
                <mtd columnalign="center">
                  <mn>0</mn>
                </mtd>
                <mtd columnalign="center">
                  <mn>0</mn>
                </mtd>
                <mtd columnalign="center">
                  <mo>&#x2212;</mo>
                  <mfrac>
                    <mrow>
                      <mn>2</mn>
                      <msub>
                        <mi>A</mi>
                        <mn>3</mn>
                      </msub>
                      <msub>
                        <mi>E</mi>
                        <mn>3</mn>
                      </msub>
                    </mrow>
                    <mrow>
                      <mn>5</mn>
                      <msub>
                        <mi>L</mi>
                        <mn>3</mn>
                      </msub>
                    </mrow>
                  </mfrac>
                </mtd>
                <mtd columnalign="center">
                  <mfrac>
                    <mrow>
                      <msub>
                        <mi>A</mi>
                        <mn>2</mn>
                      </msub>
                      <msub>
                        <mi>E</mi>
                        <mn>2</mn>
                      </msub>
                    </mrow>
                    <msub>
                      <mi>L</mi>
                      <mn>2</mn>
                    </msub>
                  </mfrac>
                  <mo>+</mo>
                  <mfrac>
                    <mrow>
                      <mn>4</mn>
                      <msub>
                        <mi>A</mi>
                        <mn>3</mn>
                      </msub>
                      <msub>
                        <mi>E</mi>
                        <mn>3</mn>
                      </msub>
                    </mrow>
                    <mrow>
                      <mn>5</mn>
                      <msub>
                        <mi>L</mi>
                        <mn>3</mn>
                      </msub>
                    </mrow>
                  </mfrac>
                </mtd>
                <mtd columnalign="center">
                  <mn>0</mn>
                </mtd>
                <mtd columnalign="center">
                  <mo>&#x2212;</mo>
                  <mfrac>
                    <mrow>
                      <msub>
                        <mi>A</mi>
                        <mn>2</mn>
                      </msub>
                      <msub>
                        <mi>E</mi>
                        <mn>2</mn>
                      </msub>
                    </mrow>
                    <msub>
                      <mi>L</mi>
                      <mn>2</mn>
                    </msub>
                  </mfrac>
                </mtd>
                <mtd columnalign="center">
                  <mfrac>
                    <mrow>
                      <mn>2</mn>
                      <msub>
                        <mi>A</mi>
                        <mn>3</mn>
                      </msub>
                      <msub>
                        <mi>E</mi>
                        <mn>3</mn>
                      </msub>
                    </mrow>
                    <mrow>
                      <mn>5</mn>
                      <msub>
                        <mi>L</mi>
                        <mn>3</mn>
                      </msub>
                    </mrow>
                  </mfrac>
                </mtd>
                <mtd columnalign="center">
                  <mo>&#x2212;</mo>
                  <mfrac>
                    <mrow>
                      <mn>4</mn>
                      <msub>
                        <mi>A</mi>
                        <mn>3</mn>
                      </msub>
                      <msub>
                        <mi>E</mi>
                        <mn>3</mn>
                      </msub>
                    </mrow>
                    <mrow>
                      <mn>5</mn>
                      <msub>
                        <mi>L</mi>
                        <mn>3</mn>
                      </msub>
                    </mrow>
                  </mfrac>
                </mtd>
              </mtr>
              <mtr>
                <mtd columnalign="center">
                  <mn>0</mn>
                </mtd>
                <mtd columnalign="center">
                  <mn>0</mn>
                </mtd>
                <mtd columnalign="center">
                  <mn>0</mn>
                </mtd>
                <mtd columnalign="center">
                  <mn>0</mn>
                </mtd>
                <mtd columnalign="center">
                  <mn>0</mn>
                </mtd>
                <mtd columnalign="center">
                  <mn>0</mn>
                </mtd>
                <mtd columnalign="center">
                  <mn>0</mn>
                </mtd>
                <mtd columnalign="center">
                  <mn>0</mn>
                </mtd>
              </mtr>
              <mtr>
                <mtd columnalign="center">
                  <mn>0</mn>
                </mtd>
                <mtd columnalign="center">
                  <mn>0</mn>
                </mtd>
                <mtd columnalign="center">
                  <mn>0</mn>
                </mtd>
                <mtd columnalign="center">
                  <mo>&#x2212;</mo>
                  <mfrac>
                    <mrow>
                      <msub>
                        <mi>A</mi>
                        <mn>2</mn>
                      </msub>
                      <msub>
                        <mi>E</mi>
                        <mn>2</mn>
                      </msub>
                    </mrow>
                    <msub>
                      <mi>L</mi>
                      <mn>2</mn>
                    </msub>
                  </mfrac>
                </mtd>
                <mtd columnalign="center">
                  <mn>0</mn>
                </mtd>
                <mtd columnalign="center">
                  <mfrac>
                    <mrow>
                      <msub>
                        <mi>A</mi>
                        <mn>2</mn>
                      </msub>
                      <msub>
                        <mi>E</mi>
                        <mn>2</mn>
                      </msub>
                    </mrow>
                    <msub>
                      <mi>L</mi>
                      <mn>2</mn>
                    </msub>
                  </mfrac>
                </mtd>
                <mtd columnalign="center">
                  <mn>0</mn>
                </mtd>
                <mtd columnalign="center">
                  <mn>0</mn>
                </mtd>
              </mtr>
              <mtr>
                <mtd columnalign="center">
                  <mn>0</mn>
                </mtd>
                <mtd columnalign="center">
                  <mn>0</mn>
                </mtd>
                <mtd columnalign="center">
                  <mo>&#x2212;</mo>
                  <mfrac>
                    <mrow>
                      <msub>
                        <mi>A</mi>
                        <mn>3</mn>
                      </msub>
                      <msub>
                        <mi>E</mi>
                        <mn>3</mn>
                      </msub>
                    </mrow>
                    <mrow>
                      <mn>5</mn>
                      <msub>
                        <mi>L</mi>
                        <mn>3</mn>
                      </msub>
                    </mrow>
                  </mfrac>
                </mtd>
                <mtd columnalign="center">
                  <mfrac>
                    <mrow>
                      <mn>2</mn>
                      <msub>
                        <mi>A</mi>
                        <mn>3</mn>
                      </msub>
                      <msub>
                        <mi>E</mi>
                        <mn>3</mn>
                      </msub>
                    </mrow>
                    <mrow>
                      <mn>5</mn>
                      <msub>
                        <mi>L</mi>
                        <mn>3</mn>
                      </msub>
                    </mrow>
                  </mfrac>
                </mtd>
                <mtd columnalign="center">
                  <mn>0</mn>
                </mtd>
                <mtd columnalign="center">
                  <mn>0</mn>
                </mtd>
                <mtd columnalign="center">
                  <mfrac>
                    <mrow>
                      <msub>
                        <mi>A</mi>
                        <mn>3</mn>
                      </msub>
                      <msub>
                        <mi>E</mi>
                        <mn>3</mn>
                      </msub>
                    </mrow>
                    <mrow>
                      <mn>5</mn>
                      <msub>
                        <mi>L</mi>
                        <mn>3</mn>
                      </msub>
                    </mrow>
                  </mfrac>
                </mtd>
                <mtd columnalign="center">
                  <mo>&#x2212;</mo>
                  <mfrac>
                    <mrow>
                      <mn>2</mn>
                      <msub>
                        <mi>A</mi>
                        <mn>3</mn>
                      </msub>
                      <msub>
                        <mi>E</mi>
                        <mn>3</mn>
                      </msub>
                    </mrow>
                    <mrow>
                      <mn>5</mn>
                      <msub>
                        <mi>L</mi>
                        <mn>3</mn>
                      </msub>
                    </mrow>
                  </mfrac>
                </mtd>
              </mtr>
              <mtr>
                <mtd columnalign="center">
                  <mn>0</mn>
                </mtd>
                <mtd columnalign="center">
                  <mn>0</mn>
                </mtd>
                <mtd columnalign="center">
                  <mfrac>
                    <mrow>
                      <mn>2</mn>
                      <msub>
                        <mi>A</mi>
                        <mn>3</mn>
                      </msub>
                      <msub>
                        <mi>E</mi>
                        <mn>3</mn>
                      </msub>
                    </mrow>
                    <mrow>
                      <mn>5</mn>
                      <msub>
                        <mi>L</mi>
                        <mn>3</mn>
                      </msub>
                    </mrow>
                  </mfrac>
                </mtd>
                <mtd columnalign="center">
                  <mo>&#x2212;</mo>
                  <mfrac>
                    <mrow>
                      <mn>4</mn>
                      <msub>
                        <mi>A</mi>
                        <mn>3</mn>
                      </msub>
                      <msub>
                        <mi>E</mi>
                        <mn>3</mn>
                      </msub>
                    </mrow>
                    <mrow>
                      <mn>5</mn>
                      <msub>
                        <mi>L</mi>
                        <mn>3</mn>
                      </msub>
                    </mrow>
                  </mfrac>
                </mtd>
                <mtd columnalign="center">
                  <mn>0</mn>
                </mtd>
                <mtd columnalign="center">
                  <mn>0</mn>
                </mtd>
                <mtd columnalign="center">
                  <mo>&#x2212;</mo>
                  <mfrac>
                    <mrow>
                      <mn>2</mn>
                      <msub>
                        <mi>A</mi>
                        <mn>3</mn>
                      </msub>
                      <msub>
                        <mi>E</mi>
                        <mn>3</mn>
                      </msub>
                    </mrow>
                    <mrow>
                      <mn>5</mn>
                      <msub>
                        <mi>L</mi>
                        <mn>3</mn>
                      </msub>
                    </mrow>
                  </mfrac>
                </mtd>
                <mtd columnalign="center">
                  <mfrac>
                    <mrow>
                      <mn>4</mn>
                      <msub>
                        <mi>A</mi>
                        <mn>3</mn>
                      </msub>
                      <msub>
                        <mi>E</mi>
                        <mn>3</mn>
                      </msub>
                    </mrow>
                    <mrow>
                      <mn>5</mn>
                      <msub>
                        <mi>L</mi>
                        <mn>3</mn>
                      </msub>
                    </mrow>
                  </mfrac>
                </mtd>
              </mtr>
            </mtable>
            <mo stretchy="true" form="postfix">]</mo>
          </mrow>
          <mrow>
            <mo stretchy="true" form="prefix">[</mo>
            <mtable>
              <mtr>
                <mtd columnalign="center">
                  <mn>0</mn>
                </mtd>
              </mtr>
              <mtr>
                <mtd columnalign="center">
                  <mn>0</mn>
                </mtd>
              </mtr>
              <mtr>
                <mtd columnalign="center">
                  <msub>
                    <mi>u</mi>
                    <mrow>
                      <mn>2</mn>
                      <mi>x</mi>
                    </mrow>
                  </msub>
                </mtd>
              </mtr>
              <mtr>
                <mtd columnalign="center">
                  <msub>
                    <mi>u</mi>
                    <mrow>
                      <mn>2</mn>
                      <mi>y</mi>
                    </mrow>
                  </msub>
                </mtd>
              </mtr>
              <mtr>
                <mtd columnalign="center">
                  <mn>0</mn>
                </mtd>
              </mtr>
              <mtr>
                <mtd columnalign="center">
                  <mn>0</mn>
                </mtd>
              </mtr>
              <mtr>
                <mtd columnalign="center">
                  <mn>0</mn>
                </mtd>
              </mtr>
              <mtr>
                <mtd columnalign="center">
                  <mn>0</mn>
                </mtd>
              </mtr>
            </mtable>
            <mo stretchy="true" form="postfix">]</mo>
          </mrow>
        </mrow>
      </math>
    }{}
  \stopformula
\stopplaceformula

\stoptext

[-- Attachment #3: sample-math.tex --]
[-- Type: text/x-tex, Size: 1461 bytes --]

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\begin{equation}
  \left[
    \begin{matrix}
      R_{1 x}\\
      R_{1 y}\\
      F_{2 x}\\
      F_{2 y}\\
      R_{3 x}\\
      R_{3 y}\\
      R_{4 x}\\
      R_{4 y}
    \end{matrix}
  \right]
  =
  \left[
    \begin{matrix}
      \frac{A_{1} E_{1}}{L_{1}} & 0 & - \frac{A_{1} E_{1}}{L_{1}} & 0 & 0 & 0 & 0 & 0\\
      0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\
      - \frac{A_{1} E_{1}}{L_{1}} & 0 & \frac{A_{1} E_{1}}{L_{1}} + \frac{A_{3} E_{3}}{5 L_{3}} & - \frac{2 A_{3} E_{3}}{5 L_{3}} & 0 & 0 & - \frac{A_{3} E_{3}}{5 L_{3}} & \frac{2 A_{3} E_{3}}{5 L_{3}}\\
      0 & 0 & - \frac{2 A_{3} E_{3}}{5 L_{3}} & \frac{A_{2} E_{2}}{L_{2}} + \frac{4 A_{3} E_{3}}{5 L_{3}} & 0 & - \frac{A_{2} E_{2}}{L_{2}} & \frac{2 A_{3} E_{3}}{5 L_{3}} & - \frac{4 A_{3} E_{3}}{5 L_{3}}\\
      0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\
      0 & 0 & 0 & - \frac{A_{2} E_{2}}{L_{2}} & 0 & \frac{A_{2} E_{2}}{L_{2}} & 0 & 0\\
      0 & 0 & - \frac{A_{3} E_{3}}{5 L_{3}} & \frac{2 A_{3} E_{3}}{5 L_{3}} & 0 & 0 & \frac{A_{3} E_{3}}{5 L_{3}} & - \frac{2 A_{3} E_{3}}{5 L_{3}}\\
      0 & 0 & \frac{2 A_{3} E_{3}}{5 L_{3}} & - \frac{4 A_{3} E_{3}}{5 L_{3}} & 0 & 0 & - \frac{2 A_{3} E_{3}}{5 L_{3}} & \frac{4 A_{3} E_{3}}{5 L_{3}}
    \end{matrix}
  \right]
  \left[
    \begin{matrix}
      0\\
      0\\
      u_{2 x}\\
      u_{2 y}\\
      0\\
      0\\
      0\\
      0
    \end{matrix}
  \right]
\end{equation}
\end{document}

[-- Attachment #4: sample-math.pdf --]
[-- Type: application/pdf, Size: 12639 bytes --]

[-- Attachment #5: sample-math-latex.pdf --]
[-- Type: application/pdf, Size: 58399 bytes --]

[-- Attachment #6: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-10-13  4:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-10  3:45 Converting LaTeX math to ConTeXt Jason Ross via ntg-context
2021-10-10 10:23 ` Hans Hagen via ntg-context
2021-10-10 14:44   ` Jason Ross via ntg-context
2021-10-11 23:02     ` Aditya Mahajan via ntg-context
2021-10-12 21:43       ` Jason Ross via ntg-context
2021-10-13  3:31         ` Aditya Mahajan via ntg-context
2021-10-13  4:46           ` Jason Ross via ntg-context

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).