From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/15902 Path: news.gmane.org!.POSTED!not-for-mail From: John MacFarlane Newsgroups: gmane.text.pandoc Subject: Re: MathML to LaTeX producing extremely lossy output, especially with quotients Date: Wed, 2 Nov 2016 14:36:32 +0100 Message-ID: <20161102133632.GA5983@Administrateurs-iMac-3.local> References: <48401935-a82d-44e6-afa5-810c580f9edf@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1478093852 10106 195.159.176.226 (2 Nov 2016 13:37:32 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 2 Nov 2016 13:37:32 +0000 (UTC) User-Agent: Mutt/1.7.0 (2016-08-17) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBCJZJHG45QDBBAWY47AAKGQEU3DDWHQ-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Wed Nov 02 14:37:27 2016 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane.org Original-Received: from mail-pa0-f56.google.com ([209.85.220.56]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c1viz-0007h4-5L for gtp-pandoc-discuss@m.gmane.org; Wed, 02 Nov 2016 14:37:05 +0100 Original-Received: by mail-pa0-f56.google.com with SMTP id yw6sf6742879pac.0 for ; Wed, 02 Nov 2016 06:37:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=sender:from:date:to:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent:x-original-sender:x-original-authentication-results :reply-to:precedence:mailing-list:list-id:x-spam-checked-in-group :list-post:list-help:list-archive:list-subscribe:list-unsubscribe; bh=RCHsiBt/YQE0w2P1RoRGyNCmLpWXaxaYoDWqY9Srhm8=; b=vzPDR7m6fPljshotAtt14VV2zN72nf0f/3E/0sWeSf5P/WgtIBr+W8w2ynHy+zwtqQ kxJE5BB/Asgs1ZLaWtPYw340GF3qLEeugU/vFvV3Xo4xOaIszsucyLvC258mbTyurjrq ml94DhH39mKQkCHVOVg97vGWfI+il7pTkPvfrheJkfFA5bivsTAu2sZxX+VwHqqxjctf 1zoz6tlY1Ae4eRdR9pAGNYWYsHssxDu70+Cfmy9/KZJLbLFoqbGy4S2eHpS3PcONYZuO KalLS/O/L0W+Zxtxdydgl3W0aNzcj8k2ljzehIISN3w6+8cDyIiGinhwhMGqiFtr X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=sender:x-gm-message-state:from:date:to:subject:message-id :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=RCHsiBt/YQE0w2P1RoRGyNCmLpWXaxaYoDWqY9Srhm8=; b=DmjyCP+6EPmZG8kju7T/R8/uJRyEtdOlFTQaTVssimFEqWQHdbZ6XjsxdjsJIFpjtB ErRFTZwxNxeSz2G1sMXS62g3/GRXaw+7k67kJbIo1DBVvEKcCJBhdckZtx3ZIbkw8mOl QcOTDFuWieTpF0oneT1UbzbVtnXNPZEZfOXXKz9ETBDHyY3yBpn84786qa5ccvjhSOQw ZAxmmgkj8WKyIw0g52I7lssAIQK8t1IN3bjPBpNqwbCTatJd0jtSgLF57igj1hOfvX/I fRGGs8gtLDevFEss4rDvE2Y5JsYH5l8yA Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: ABUngvdjoZ5l4jYStMkF+BjCmz8hLwGXxTB9Sro5PuFXtfsu9lMbsWIx3ht64Ss3glNGyA== X-Received: by 10.36.196.86 with SMTP id v83mr147334itf.7.1478093827640; Wed, 02 Nov 2016 06:37:07 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 10.107.12.23 with SMTP id w23ls944622ioi.3.gmail; Wed, 02 Nov 2016 06:37:06 -0700 (PDT) X-Received: by 10.98.78.142 with SMTP id c136mr904555pfb.5.1478093826501; Wed, 02 Nov 2016 06:37:06 -0700 (PDT) Original-Received: from mail-pf0-x243.google.com (mail-pf0-x243.google.com. [2607:f8b0:400e:c00::243]) by gmr-mx.google.com with ESMTPS id z76si937205pff.1.2016.11.02.06.37.06 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Nov 2016 06:37:06 -0700 (PDT) Received-SPF: pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:400e:c00::243 as permitted sender) client-ip=2607:f8b0:400e:c00::243; Original-Received: by mail-pf0-x243.google.com with SMTP id i88so1826741pfk.2 for ; Wed, 02 Nov 2016 06:37:06 -0700 (PDT) X-Received: by 10.99.97.15 with SMTP id v15mr5907549pgb.10.1478093825851; Wed, 02 Nov 2016 06:37:05 -0700 (PDT) Original-Received: from johnmacfarlane.net (li55-134.members.linode.com. [74.82.3.134]) by smtp.gmail.com with ESMTPSA id j192sm4966277pfc.60.2016.11.02.06.37.04 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Nov 2016 06:37:05 -0700 (PDT) Original-Received: by johnmacfarlane.net (Postfix, from userid 1000) id 5132CA16A; Wed, 2 Nov 2016 09:37:04 -0400 (EDT) Content-Disposition: inline In-Reply-To: <48401935-a82d-44e6-afa5-810c580f9edf-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> X-PGP-Key: http://johnmacfarlane.net/jgm.asc X-Original-Sender: jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@berkeley-edu.20150623.gappssmtp.com; spf=pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:400e:c00::243 as permitted sender) smtp.mailfrom=jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org Precedence: list Mailing-list: list pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org; contact pandoc-discuss+owners-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org List-ID: X-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.org gmane.text.pandoc:15902 Archived-At: I see what's happening here. First, --mathml is only relevant to HTML output, so you can omit that. Second, pandoc will only interpret tags as mathml if they're marked with the MathML namespace, as they are supposed to be. If you add xmlns=3D"http://www.w3.org/1998/Math/MathML" to your math tags, you'll get real tex math in the output: Powers of X Rule\\ if \(f\left( x \right) =3D x^{n}\) then \(f^{\prime}\left( x \right) =3D n\left( x \right)^{n - 1}\)\\ Constant Rule\\ if \(f\left( x \right) =3D C\) then \(f^{\prime}\left( x \right) =3D 0\)\\ Coefficient Rules\\ if \(f(x) =3D c u(x)\) then \(f^{\prime}\left( x \right) =3D c u^{\prime}\left( x \right)\)\\ if\(f(x) =3D kx^{n}\) then\(f^{\prime}(x) =3D knx^{n - 1}\)\\ if\(f(x) =3D kx\) then \(f^{\prime}(x) =3D k\)\\ Sum Rule\\ if\(f\left( x \right) =3D u\left( x \right) + v\left( x \right)\) then\(f^{\prime}\left( x \right) =3D u^{\prime}\left( x \right) + v^{\prime= }\left( x \right)\)\\ Difference Rule\\ if\(f\left( x \right) =3D u\left( x \right) - v\left( x \right)\) then\(f^{\prime}\left( x \right) =3D u^{\prime}\left( x \right) - v^{\prime= }\left( x \right)\)\\ Product Rule\\ if\(f\left( x \right) =3D u\left( x \right) v\left( x \right)\) then\(f^{\prime}\left( x \right) =3D u\left( x \right) v^{\prime}\left( x \= right) + v\left( x \right) u^{\prime}\left( x \right)\)\\ Quotient Rule\\ if\(f\left( x \right) =3D \frac{u\left( x \right)}{v\left( x \right)}\) then\(f^{\prime}\left( x \right) =3D \frac{v\left( x \right) u^{\prime}\lef= t( x \right) - u\left( x \right) v^{\prime}\left( x \right)}{\left( {v\left= ( x \right)} \right)^{2}}\)\\ Chain Rule or Power Rule\\ if\(f\left( x \right) =3D \left( {u\left( x \right)} \right)^{n}\) then\(f^{\prime}\left( x \right) =3D n\left( {u\left( x \right)} \right)^{n= - 1} u^{\prime}\left( x \right)\)\\ Logarithms\\ \(\ln(MN) =3D \ln M + \ln N\)\\ \(\ln\left( \frac{M}{N} \right) =3D \ln M - \ln N\)\\ \(\ln\left( M^{N} \right) =3D N\ln M\)\\ Derivative of Natural Log\\ if y =3D ln(x) then \(y^{\prime} =3D \frac{1}{x}\)\\ if y =3D ln u(x) then\(y^{\prime} =3D \frac{1}{u(x)} u^{\prime}(x)\)\\ Derivative of Exponential Function\\ if \(y =3D e^{x}\) then \(y^{\prime} =3D e^{x}\)\\ if \(y =3D e^{u(x)}\) then \(y^{\prime} =3D e^{u(x)} u^{\prime}(x)\)\\[2\baselineskip] Better, right? If something is still wrong, please let us know (preferably by submitting a bug report to jgm/texmath on github). Perhaps we should be more relaxed about the math tags, and assume that they are MathML by default, even if not marked. Officially it is required, but apparently MathJax doesn't generate it... +++ Kevin Vilbig [Nov 01 16 13:38 ]: > I am attempting to translate some MathML snipped from .docx files in > Microsoft Word to LaTeX in order to make accessible materials for some > visually impaired students. I was hoping to do it this way so that we > could provide them with both a screen-readable HTML file AND a Nemeth > Braille Transcription so as to give them multiple forms of presentation > to avoid any issues with inaccurate translation or our mistakes. > I'm going to give up on this route and try something else, maybe trying > to translate the whole docx file directly, or copying the MathType > output straight to LaTeX. > $ pandoc --mathjax -f html -t latex exam2.htm > Powers of X Rule\\ > if f( x )=3D x n then f =E2=80=B2 ( x )=3Dn ( x ) n=E2=88=921\\ > Constant Rule\\ > if f( x )=3DC then f =E2=80=B2 ( x )=3D0\\ > Coefficient Rules\\ > if f(x)=3Dc=E2=80=A2u(x) then f =E2=80=B2 ( x )=3Dc=E2=80=A2 u =E2=80= =B2 ( x )\\ > if f(x)=3Dk x n then f =E2=80=B2 (x)=3Dkn x n=E2=88=921\\ > if f(x)=3Dkx then f =E2=80=B2 (x)=3Dk\\ > Sum Rule\\ > if f( x )=3Du( x )+v( x ) then f =E2=80=B2 ( x )=3D u =E2=80=B2 ( x )+ = v =E2=80=B2 ( x )\\ > Difference Rule\\ > if f( x )=3Du( x )=E2=88=92v( x ) then f =E2=80=B2 ( x )=3D u =E2=80=B2= ( x )=E2=88=92 v =E2=80=B2 ( x )\\ > Product Rule\\ > if f( x )=3Du( x )=E2=80=A2v( x ) then f =E2=80=B2 ( x )=3Du( x )=E2=80= =A2 v =E2=80=B2 ( x )+v( x )=E2=80=A2 u =E2=80=B2 ( > x > )\\ > Quotient Rule\\ > if f( x )=3D u( x ) v( x ) then f =E2=80=B2 ( x )=3D v( x )=E2=80=A2 u = =E2=80=B2 ( x )=E2=88=92u( x )=E2=80=A2 v =E2=80=B2 > ( > x ) ( v( x ) ) 2\\ > Chain Rule or Power Rule\\ > if f( x )=3D ( u( x ) ) n then f =E2=80=B2 ( x )=3Dn ( u( x ) ) n=E2=88= =921 =E2=80=A2 u =E2=80=B2 ( x )\\ > Logarithms\\ > ln(MN)=3DlnM+lnN\\ > ln( M N )=3DlnM=E2=88=92lnN\\ > ln( M N )=3DNlnM\\ > Derivative of Natural Log\\ > if y =3D ln(x) then y =E2=80=B2 =3D 1 x\\ > if y =3D ln u(x) then y =E2=80=B2 =3D 1 u(x) =E2=80=A2 u =E2=80=B2 (x)\= \ > Derivative of Exponential Function\\ > if y=3D e x then y =E2=80=B2 =3D e x\\ > if y=3D e u(x) then y =E2=80=B2 =3D e u(x) =E2=80=A2 u =E2=80=B2 (x)\\[= 2\baselineskip] > Here is the contents of exam2.htm > Powers of X Rule
> if > > f( > x > )=3D > x > n > > > > then > > > f > > > ( > x > )=3Dn > > ( > x > ) > > > n1 > > > > > >
> Constant Rule
> if > > f( > x > )=3DC > > then > > > f > > > ( > x > )=3D0 > > >
> Coefficient Rules
> if > > f(x stretchy=3D'false'>)=3Dcu< > mo stretchy=3D'false'>(x) > > then > > > f > > > ( > x > )=3Dc > u > > > ( > x > ) > > >
if > > f(x stretchy=3D'false'>)=3Dk > x > n > > > > > then > > > f > > > (x stretchy=3D'false'>)=3Dkn > x > > n1 > > > > > >
if > > f(x stretchy=3D'false'>)=3Dkx > > then > > > f > > > (x stretchy=3D'false'>)=3Dk > >
> Sum Rule
> if > > f( > x > )=3Du( > x > )+v( > x > ) > > > then > > > f > > > ( > x > )=3D > u > > > ( > x > )+ > v > > > ( > x > ) > > >
> Difference Rule
> if > > f( > x > )=3Du( > x > )v( > x > ) > > > then > > > f > > > ( > x > )=3D > u > > > ( > x > ) > v > > > ( > x > ) > > >
> Product Rule
> if > > f( > x > )=3Du( > x > )v( > x > ) > > > then > > > f > > > ( > x > )=3Du( > x > ) > v > > > ( > x > )+v( > x > ) > u > > > ( > x > ) > > >
> Quotient Rule
> if > > f( > x > )=3D > > u( > x > ) > > > v( > x > ) > > > > > > then > > > f > > > ( > x > )=3D > > v( > x > ) > u > > > ( > x > )u( > x > ) > v > > > ( > x > ) > > > > > ( > > v( > x > ) > > ) > > 2 > > > > > > > >
> Chain Rule or Power Rule
> if > > f( > x > )=3D > > ( > > u( > x > ) > > ) > > n > > > > > then > > > f > > > ( > x > )=3Dn > > ( > > u( > x > ) > > ) > > > n1 > > > > u > > > ( > x > ) > > >
> Logarithms
> > ln(MN stretchy=3D'false'>)=3DlnM+ln< > /mi>N > >
> > ln( > > > M > N > > > > )=3DlnMl > nN > >
> > ln( > > > M > N > > > > )=3DNlnM > >
> Derivative of Natural Log
> if y =3D ln(x) then > > > y > > > =3D > 1 > x > > > > >
> if y =3D ln u(x) then > > > y > > > =3D > 1 > > u(x stretchy=3D'false'>) > > > > u > > > (x) > > >
> Derivative of Exponential Function
> if > > y=3D > e > x > > > > > then > > > y > > > =3D > e > x > > > > >
> if > > y=3D > e > > u(x stretchy=3D'false'>) > > > > > > then > > > y > > > =3D > e > > u(x stretchy=3D'false'>) > > > > u > > > (x) > > >
>
> > > -- > You received this message because you are subscribed to the Google > Groups "pandoc-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send > an email to [1]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to > [2]pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit > [3]https://groups.google.com/d/msgid/pandoc-discuss/48401935-a82d-44e6- > afa5-810c580f9edf%40googlegroups.com. > For more options, visit [4]https://groups.google.com/d/optout. > >References > > 1. mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > 2. mailto:pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > 3. https://groups.google.com/d/msgid/pandoc-discuss/48401935-a82d-44e6-= afa5-810c580f9edf-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org?utm_medium=3Demail&utm_source=3Dfooter > 4. https://groups.google.com/d/optout --=20 You received this message because you are subscribed to the Google Groups "= pandoc-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an e= mail to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/= pandoc-discuss/20161102133632.GA5983%40Administrateurs-iMac-3.local. For more options, visit https://groups.google.com/d/optout.