From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/28887 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Leena Murgai Newsgroups: gmane.text.pandoc Subject: Re: Equation labels/references when converting from latex to markdown/other Date: Wed, 21 Jul 2021 20:44:33 -0700 (PDT) Message-ID: References: <733e0d35-b1c4-4380-bf9f-7d6523c55162n@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_2140_719936779.1626925473001" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28958"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBCIMDCM26AARBIWT4ODQMGQE63S2OEQ-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Thu Jul 22 05:44:37 2021 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-oi1-f187.google.com ([209.85.167.187]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1m6PdU-0007IJ-6e for gtp-pandoc-discuss@m.gmane-mx.org; Thu, 22 Jul 2021 05:44:36 +0200 Original-Received: by mail-oi1-f187.google.com with SMTP id 64-20020aca06430000b0290240ce72dd5esf3139425oig.4 for ; Wed, 21 Jul 2021 20:44:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:date:from:to:message-id:in-reply-to:references:subject :mime-version:x-original-sender:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:list-subscribe :list-unsubscribe; bh=dzulUz/3Hc2cXfng8qaLjwMzC/hmFRSkovLwOH17sz4=; b=Vaeugb1REh5JiXx7c8UGmioBxaeN28QlkPM0qjqEHgJziqAWjTRcY4g57swm8HobPj VJz/tki5pM99EeADro3km7mH14hTiekJxQfQ2uF/+i9yL5VItUjwDnZgaKAaM0NmyE7h DATUMV+KWsP73RuBp9xjl1459sMSm/HB50relKgcjvT79BMholNIYjkNG2ahCQSyLO/q 8A9c9MPKAEA8WodGKcBr1I6R+uSWCJS7BA803o56EuxvFjjJNaLCmvrCuekATQ91LJXr gCJapjy9DQEoAN1aZn6ukaly0rM+66B07dSiTFy8Nj9HEpRC1JSZbJweMDfBrv8MeOeC M7Qg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:message-id:in-reply-to:references:subject:mime-version :x-original-sender:reply-to:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-subscribe:list-unsubscribe; bh=dzulUz/3Hc2cXfng8qaLjwMzC/hmFRSkovLwOH17sz4=; b=KzpptVOQpuDSDUUQjzr1T6L2j6HIMTXz6msBr0EFPK15kfxK6p4aMVcWCNzVXSHSfs wkJRYcDDExVt+XD9y8bum+ASogv+YOyf/QZcG3GT8VAZQfuT7KGqD1TmozxVFUWwLsOB thnJxUPykLzkJpRjuqICsWi5JTid/eifzd19LnGiVJdgzhHF/eJfh7fFGX/RpgLbFEmG jKAzmM08D3tIIsT404X9OWdOX9FpDoXeT8aNZiHV6HWG6w7WYR8pfC+0vE3t+/beMmRi Ncsb7BbotMaQATc8Gs/cc+8SWlOP5FphzcH9oErOT1hb1GRewT0wWokJSROpKbKiBCeq /MRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:date:from:to:message-id:in-reply-to :references:subject:mime-version:x-original-sender:reply-to :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=dzulUz/3Hc2cXfng8qaLjwMzC/hmFRSkovLwOH17sz4=; b=m7ynEGrHSoAkbLd+P1o7xy/EGa7nStdUgfaADSFmBDvX6MD0RBSOmd+6kOtUDSRMN3 qrMr3RjzudsQgGqfYlcMhvLn5iLCXYvdvAO24kTxxtDc7loDtRv/0lNZXGKQhItdqKaK HKAk4LINryuicIOFDsNABMEfgKX0Oh+BTcIpAUeGa84RGpbl4K0cXLNzQOZ/QS1eCoHy 8LJLWEgK8IMtzK9VQGZ4FgZnxOiuIcnzAWwPIpdpVI/xcaBUbJZZeESdWSr44vIXbDhK +jN5ybFL6LhIosmaHigyMUZlJMQDdczHD3YfBoceYxr/thrrEIRvyZS8qJxvZIAQ3SLl rQ6w== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM530WXmK3U8zuSy0X7gvM1Jg913QqJ+wzVuWka+rEy1DMRkXIdnw3 mOzPoROvcLGRf8kyvfUq4xM= X-Google-Smtp-Source: ABdhPJwxOqsf6GlHB4TxKdqfuYRLtmK+a33Itu98OjFWcgvU2ANxH3/F1IFAoL6G3Py5smuk7HRlLg== X-Received: by 2002:a9d:7982:: with SMTP id h2mr26483104otm.291.1626925475171; Wed, 21 Jul 2021 20:44:35 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:6830:2a05:: with SMTP id y5ls1387042otu.2.gmail; Wed, 21 Jul 2021 20:44:34 -0700 (PDT) X-Received: by 2002:a05:6830:2458:: with SMTP id x24mr9696957otr.312.1626925473719; Wed, 21 Jul 2021 20:44:33 -0700 (PDT) In-Reply-To: X-Original-Sender: leenamurgai-Re5JQEeQqe8AvxtiuMwx3w@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.io gmane.text.pandoc:28887 Archived-At: ------=_Part_2140_719936779.1626925473001 Content-Type: multipart/alternative; boundary="----=_Part_2141_2136519712.1626925473001" ------=_Part_2141_2136519712.1626925473001 Content-Type: text/plain; charset="UTF-8" Hi John, Can you clarify your work around here? I wasn't able to follow. I have a similar problem converting from LaTeX to HTML5 - \label and \ref for equations don't work. I'd be super grateful for any advice you could offer. Thanks! Leena On Tuesday, 29 June 2021 at 11:23:40 UTC-7 John MacFarlane wrote: > > This isn't yet supported, really. But you might be able to > work around it. > > Note: > > % pandoc -f latex -t native > \ref{foo} > ^D > [Para [Link ("",[],[("reference-type","ref"),("reference","foo")]) [Str > "[foo]"] ("#foo","")]] > > So when pandoc parses \ref{foo}, it doesn't just create a string > [foo]; it creates a link with attributes. You could use a lua > filter to turn this into something that mathjax can consume > (raw tex, I would imagine). > > Just let us know what you want to appear in the HTML, and we can > show you how to do it. > > Ian Price writes: > > > Hello, > > My university is looking into the options for converting various notes, > > exercises sheets, presentations, etc. from latex generated pdf into a > more > > accessible format. This basically means converting to html + mathjax > > because this tends to work better for screen readers. Converting beamer > > seems to be impossible, but for notes pandoc (and some others like > latexml) > > is generally giving good output, however the major issue is cross > > referencing between text and maths blocks. > > > > In short, mathjax can handle internal links from maths blocks to other > > maths blocks, and pandoc can handle links to other parts of pandoc > > documents, except when a document makes specific reference to an > equation. > > For example, suppose we have the following mwe.tex cut out from some > > electromagnetism notes > > --- > > \documentclass[12pt]{article} > > \begin{document} > > \begin{equation} > > J \equiv \frac{dI}{da_{\perp}} = \rho v. > > \label{volume-current-density} > > \end{equation} > > The total current crossing a surface $S$ can be calculated by > integrating > > Eq. (\ref{volume-current-density}): > > \end{document} > > --- > > When converted to markdown, we get the following > > --- > > $$J \equiv \frac{dI}{da_{\perp}} = \rho v. > > \label{volume-current-density}$$ > > > > The total current crossing a surface $S$ can be calculated by > > integrating Eq. > > > ([\[volume-current-density\]](#volume-current-density){reference-type="ref" > > reference="volume-current-density"}): > > --- > > The link to the label volume-current-density is clearly broken and when > I > > get my html file it does nothing in particular. > > > > One solution I've seen is to convert the label references to the syntax > > used by, e.g., pandoc-crossref, but this involves me editing the > markdown > > by hand. Is there an automatic way to convert these? > > > > -- > > 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 pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To view this discussion on the web visit > https://groups.google.com/d/msgid/pandoc-discuss/733e0d35-b1c4-4380-bf9f-7d6523c55162n%40googlegroups.com > . > -- 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 pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/d3a1fa02-147c-45c2-8ee1-462db48baa44n%40googlegroups.com. ------=_Part_2141_2136519712.1626925473001 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi John,

Can you clarify your work around here? I wasn't able to fol= low.

I have a similar problem converting from LaTeX to HTML5 - \labe= l and \ref for equations don't work. I'd be super grateful for any advice y= ou could offer.

Thanks!
Leena

On Tuesday, = 29 June 2021 at 11:23:40 UTC-7 John MacFarlane wrote:

This isn't yet supported, really. But you might be able to
work around it.

Note:

% pandoc -f latex -t native
\ref{foo}
^D
[Para [Link ("",[],[("reference-type","ref&quo= t;),("reference","foo")]) [Str "[foo]"] (&quo= t;#foo","")]]

So when pandoc parses \ref{foo}, it doesn't just create a string
[foo]; it creates a link with attributes. You could use a lua
filter to turn this into something that mathjax can consume
(raw tex, I would imagine).

Just let us know what you want to appear in the HTML, and we can
show you how to do it.

Ian Price <ianpr...@gmail= .com> writes:

> Hello,
> My university is looking into the options for converting various n= otes,=20
> exercises sheets, presentations, etc. from latex generated pdf int= o a more=20
> accessible format. This basically means converting to html + mathj= ax=20
> because this tends to work better for screen readers. Converting b= eamer=20
> seems to be impossible, but for notes pandoc (and some others like= latexml)=20
> is generally giving good output, however the major issue is cross= =20
> referencing between text and maths blocks.
>
> In short, mathjax can handle internal links from maths blocks to o= ther=20
> maths blocks, and pandoc can handle links to other parts of pandoc= =20
> documents, except when a document makes specific reference to an e= quation.
> For example, suppose we have the following mwe.tex cut out from so= me=20
> electromagnetism notes
> ---
> \documentclass[12pt]{article}=20
> \begin{document}=20
> \begin{equation}=20
> J \equiv \frac{dI}{da_{\perp}} =3D \rho v. =20
> \label{volume-current-density}=20
> \end{equation}=20
> The total current crossing a surface $S$ can be calculated by inte= grating=20
> Eq. (\ref{volume-current-density}): =20
> \end{document}
> ---
> When converted to markdown, we get the following
> ---
> $$J \equiv \frac{dI}{da_{\perp}} =3D \rho v. =20
> \label{volume-current-density}$$=20
> =20
> The total current crossing a surface $S$ can be calculated by=20
> integrating Eq.=20
> ([\[volume-current-density\]](#volume-current-density){reference-t= ype=3D"ref"=20
> reference=3D"volume-current-density"}):
> ---
> The link to the label volume-current-density is clearly broken and= when I=20
> get my html file it does nothing in particular.
>
> One solution I've seen is to convert the label references to t= he syntax=20
> used by, e.g., pandoc-crossref, but this involves me editing the m= arkdown=20
> by hand. Is there an automatic way to convert these?=20
>
> --=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 email to pandoc-discus..= .@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/7= 33e0d35-b1c4-4380-bf9f-7d6523c55162n%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups &= quot;pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to pand= oc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d= /msgid/pandoc-discuss/d3a1fa02-147c-45c2-8ee1-462db48baa44n%40googlegroups.= com.
------=_Part_2141_2136519712.1626925473001-- ------=_Part_2140_719936779.1626925473001--