From: Jason Ross via ntg-context <ntg-context@ntg.nl>
To: Aditya Mahajan <adityam@umich.edu>
Cc: Jason Ross <jasonross1024@gmail.com>,
Jason Ross via ntg-context <ntg-context@ntg.nl>
Subject: Re: Converting LaTeX math to ConTeXt
Date: Tue, 12 Oct 2021 21:46:22 -0700 [thread overview]
Message-ID: <58966454-1bee-d792-5655-af208f43962c@gmail.com> (raw)
In-Reply-To: <nycvar.YAK.7.78.908.2110122329490.3003350@nqv-guvaxcnq>
[-- 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>−</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>−</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>−</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>−</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>−</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>−</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>−</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>−</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>−</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>−</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>−</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>−</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
___________________________________________________________________________________
prev parent reply other threads:[~2021-10-13 4:46 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-10-10 3:45 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 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=58966454-1bee-d792-5655-af208f43962c@gmail.com \ --to=ntg-context@ntg.nl \ --cc=adityam@umich.edu \ --cc=jasonross1024@gmail.com \ /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: linkBe 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).