From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/28911 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: Fri, 23 Jul 2021 18:36:13 -0700 (PDT) Message-ID: <0a0f727f-8001-40f9-84e6-4e60574b2af1n@googlegroups.com> References: <733e0d35-b1c4-4380-bf9f-7d6523c55162n@googlegroups.com> <5e86f41a-1515-4843-a4bc-2cb2ef1d63dan@googlegroups.com> <7662f9b4-f4eb-45bb-bc0d-04d82bdf9505n@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_1658_1192983157.1627090573212" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14549"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBCIMDCM26AARBDW55WDQMGQEDYQGD6Q-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Sat Jul 24 03:36:17 2021 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-oo1-f59.google.com ([209.85.161.59]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1m76aO-0003Yc-I7 for gtp-pandoc-discuss@m.gmane-mx.org; Sat, 24 Jul 2021 03:36:16 +0200 Original-Received: by mail-oo1-f59.google.com with SMTP id z9-20020a4ade490000b029024c2413e5c6sf2193305oot.1 for ; Fri, 23 Jul 2021 18:36:16 -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=LRLSh3MtUiH29n+TDc07O9bCKp+Z0M1vw8LafEtrUgo=; b=gfKzepagAoyMxpNIbbC7HcRaFNSEij5QCwH2JAdlKLAMMI92r85Wthgw6dorTyNKBQ 6wJxugIeVRPOsHKfP4bCBQnRFkkr63nfyS3xYzJzqS104lVVa1u8PyXzpp0CYvlM0ol9 hzKBehsFUrk48tEa8vG2VdtzZkAGTpTvmxO42JE93KDurTRnHpAoPE45vBpwOQDDWyxf quKNTG4UPnSK3iGx4sW5f58s2BNj0WntBrk5Lv+N6BoqZmBKFkj7EUwJpG2t4JCa+jON /sD+f6JZkAbXCSGIF+py7q24QTcbOnGN26wvJ66JpwtfEg0aGQ2cQGWWr5IAoelX1xAx 3N2w== 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=LRLSh3MtUiH29n+TDc07O9bCKp+Z0M1vw8LafEtrUgo=; b=o5tCe/4YasoP5LywOGqWjQt391X9pqULHPVPyusOzsIxUed+qZUGO8Ac2Fj0HvAoX2 5TSm8u2EJ8Os67Pmm7szRi9QVO+giAELNWfb92JAaBJ4da0oi2VhbcG35p79NNCQhizO s/DYl9Q/tnKQNTKSHFGoZGP4pABx4YLKRkHvWW3c4wYltFswWtpgOTB1owO4/OdLu9Lz HsOIZonZXiRJu/i44IXeSZk9DNJ9BmpUly053bEXY3+7O96MU+Uxfs1SOWc/DUtOtADX y/dDl75i4+FfDSvzEcwLQn6IR1EelFHkiHTSmKsHOJnrnqCh9NKAb/FpvXMiWybiyx36 /d2w== 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=LRLSh3MtUiH29n+TDc07O9bCKp+Z0M1vw8LafEtrUgo=; b=lnlGqt5y72gnPo72mVlSy55XPGFId+88EQ6rCckmdbK/r++KvnE3LGM4MuZ4Jhp5f7 qao18ea6zbsonqxWYS3jenp1d4Ra/VNY+kqr8a99MvfmveKueBRQj3a3jhYiVRc15oRC 0BgG0sIQP6J0wBwp3BXXLMiS9MxY0pz9+gDZDas9XaRM5YzOAYdUTql7GOsYqn5mLZRT RONYBLiupZQBQm/6/h3RSdLsSSLbqTVGJ0YFi7/RfzVk7OOSWWlGfGSIUKyUzKjEUNXL YvFWA5aZzTX8A3gkX4MIqiJfx0AC7N/cEQcmpiHUHB5vjUtRoTJAgJ04VQJP9iDSoPFH wOSA== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM5331ATSpyfha1SsSO5iufSTP+z4bNrgKfL1eujGHJFua7mdFnsCO QuCoVcOo8vo2iOZ49HmLG2Y= X-Google-Smtp-Source: ABdhPJxhPC3MKJAdrPo0hY2/pAbkwQp8okLa4P0LTV53hX3LTgGBU+EnfNDuuauM92vMnDPFpJUb1w== X-Received: by 2002:a9d:3bc3:: with SMTP id k61mr4814887otc.355.1627090575524; Fri, 23 Jul 2021 18:36:15 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a9d:5a01:: with SMTP id v1ls3352119oth.3.gmail; Fri, 23 Jul 2021 18:36:14 -0700 (PDT) X-Received: by 2002:a05:6830:1d88:: with SMTP id y8mr4624862oti.95.1627090573801; Fri, 23 Jul 2021 18:36:13 -0700 (PDT) In-Reply-To: <7662f9b4-f4eb-45bb-bc0d-04d82bdf9505n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 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:28911 Archived-At: ------=_Part_1658_1192983157.1627090573212 Content-Type: multipart/alternative; boundary="----=_Part_1659_969439083.1627090573212" ------=_Part_1659_969439083.1627090573212 Content-Type: text/plain; charset="UTF-8" Currently \ref{eq:label} in LaTeX gives [ eq:label] in HTML. On Friday, 23 July 2021 at 16:22:24 UTC-7 Leena Murgai wrote: > Oh and > \ref{eq:label} > in LaTeX should give > > chap#.value(eq:label) > in HTML. > On Friday, 23 July 2021 at 16:06:31 UTC-7 Leena Murgai wrote: > >> Thanks for the reply John. >> >> I've been playing around with an equation in LaTeX and seeing what comes >> out in HTML5 and also looking at what pandoc-crossref expects to find in >> the markdown. >> >> LaTeX equation format: >> \begin{equation} \label{eq:label} >> equation >> \end{equation} >> Note: \label{eq:label} must be inside the equation environment, above is >> how I do it, but equally one can place the label after equation. >> >> I tried moving label around in my LaTeX to see if it made a difference to >> the output HTML since pandoc-crossref expects to find the label after >> the equation environment >> . Here's >> the HTML output in each case: >> >> 1. \label{eq:label} after \begin{equation}: >> >> \label{eq:label}equation >> >> 2. \label{eq:label} after equation: >> >> equation\label{eq:label} >> >> 3. \label{eq:label} after \end{equation}: Note that this will break the >> LaTeX code >> >> equation[eq:label] >> >> So, none of the above seem to give pandoc-crossref what it needs. >> Honestly, I'm not massively familiar with HTML and css - just figuring it >> out as I go. I imagine whatever pandoc-crossref would output (if I could >> get it to work) would be great. My quick and dirty approach (to get >> something like what LaTeX gives) would be to put the equation and its label >> in a table row. Something like >> >>
>> >> >> >> >> >>
> class="math display">equation(chap#.value{ >> eq:label})
>>
>> >> I'm open to suggestions if hard coding 5% for the label width seems like >> a bad idea or some such. >> >> Thanks, >> Leena >> >> >> >> On Wednesday, 21 July 2021 at 22:24:47 UTC-7 John MacFarlane wrote: >> >>> >>> As I said: >>> >>> Just let us know what you want to appear in the HTML, and we can >>> show you how to do it. >>> >>> >>> >>> Leena Murgai writes: >>> >>> > 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-discus...-/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. >>> >>> >> -- 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/0a0f727f-8001-40f9-84e6-4e60574b2af1n%40googlegroups.com. ------=_Part_1659_969439083.1627090573212 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Currently
\ref{= eq:label}
in LaTeX gives
<a href=3D"#eq:label" data-refer= ence-type=3D"ref" data-reference=3D"eq:label= ">[eq:label]</a>
=
in HTML.

On Friday, 23 July 2021 at 16:22:24 UTC-7 Leena Murgai = wrote:
Oh and=
\ref{eq:label}
in LaTeX should give
<a href =3D"#eq:label"data-ref= erence-type=3D"ref" data-reference=3D"eq:label">chap#.value(eq:label)</a>
in HTML.
On Friday, 23 Jul= y 2021 at 16:06:31 UTC-7 Leena Murgai wrote:
Thanks for the reply John.

I'= ve been playing around with an equation in LaTeX and seeing what comes out = in HTML5 and also looking at what pandoc-crossref expects to find in the ma= rkdown.=C2=A0

LaTeX equation format:
=C2=A0 \begin{equation} \label{eq:label}
=C2=A0 equ= ation
=C2=A0 \end{equation}
Note: \label{eq:label} must be inside the equation environment, above i= s how I do it, but equally one can=C2=A0place the label after=C2=A0equation.

I tried moving= label around in my LaTeX to see if it made a difference to the output HTML= since pandoc-crossref expects to find the = label after the equation environment. Here's the HTML output in eac= h case:

1.=C2=A0\label{= eq:label}=C2=A0after \begin{equation}:

=C2=A0 <span class=3D"math display">\labe= l{eq:label}equation</span>

2.=C2=A0\label{eq:label}=C2=A0after equation:

=C2=A0 <span class=3D"math display">equation\label{eq:label}</spa= n>

3.=C2=A0\label{eq:label}=C2=A0after \end{equation}: Note that this will break the = LaTeX code

=C2=A0 = <span class=3D"math display">equation</span><span>[eq:label]<= ;/span>

So, none of the above seem= to give pandoc-crossref what it needs. Honestly, I'm not massively fam= iliar with HTML and css - just figuring it out as I go. I imagine whatever = pandoc-crossref would output (if I could get it to work) would be great. My= quick and dirty approach (to get something like what LaTeX gives) would be= to put the equation and its label in a table row. Something like

<div>
<table width=3D100% style=3D"border: n= one;">
<tr>
<td style=3D"text-align: cen= ter; border: none;"><span id=3D"eq:label" class=3D&quo= t;math display">equation</span>= ;</td>
<td style=3D&qu= ot;text-align: right; border: none; width: 5%;">(chap#.value{eq:label})</td&g= t;
</tr>
</table>
</div>

I'm open= to suggestions if hard coding 5% for the label width seems like a bad idea= or some such.

Thanks,
Leena



On Wednesday, 21 July 2021 at 22:24:47 UTC-7 John MacFarlane wrote:<= br>

As I said:

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



Leena Murgai <leena...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> 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 a= nd \ref=20
> for equations don't work. I'd be super grateful for any ad= vice you could=20
> 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",&quo= t;ref"),("reference","foo")]) [Str=20
>> "[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 c= an
>> show you how to do it.
>>
>> Ian Price <ianpr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> w= rites:
>>
>> > Hello,
>> > My university is looking into the options for converting = various notes,=20
>> > exercises sheets, presentations, etc. from latex generate= d pdf into a=20
>> more=20
>> > accessible format. This basically means converting to htm= l + mathjax=20
>> > because this tends to work better for screen readers. Con= verting beamer=20
>> > seems to be impossible, but for notes pandoc (and some ot= hers like=20
>> 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 bl= ocks to other=20
>> > maths blocks, and pandoc can handle links to other parts = of pandoc=20
>> > documents, except when a document makes specific referenc= e to an=20
>> equation.
>> > For example, suppose we have the following mwe.tex cut ou= t from some=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 calculate= d by=20
>> integrating=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 calculate= d by=20
>> > integrating Eq.=20
>> >=20
>> ([\[volume-current-density\]](#volume-current-density){referen= ce-type=3D"ref"=20
>> > reference=3D"volume-current-density"}):
>> > ---
>> > The link to the label volume-current-density is clearly b= roken and when=20
>> I=20
>> > get my html file it does nothing in particular.
>> >
>> > One solution I've seen is to convert the label refere= nces to the syntax=20
>> > used by, e.g., pandoc-crossref, but this involves me edit= ing the=20
>> markdown=20
>> > by hand. Is there an automatic way to convert these?=20
>> >
>> > --=20
>> > You received this message because you are subscribed to t= he Google=20
>> Groups "pandoc-discuss" group.
>> > To unsubscribe from this group and stop receiving emails = from it, send=20
>> an email to pandoc-discus...@googlegroups.= com.
>> > To view this discussion on the web visit=20
>> https://groups= .google.com/d/msgid/pandoc-discuss/733e0d35-b1c4-4380-bf9f-7d6523c55162n%40= googlegroups.com
>> .
>>
>
> --=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...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/d= 3a1fa02-147c-45c2-8ee1-462db48baa44n%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/0a0f727f-8001-40f9-84e6-4e60574b2af1n%40googlegroups.= com.
------=_Part_1659_969439083.1627090573212-- ------=_Part_1658_1192983157.1627090573212--