From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/28925 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, 28 Jul 2021 13:17:02 -0700 (PDT) Message-ID: <35c2cafd-f1e2-401a-803b-ea8bac75753en@googlegroups.com> References: <733e0d35-b1c4-4380-bf9f-7d6523c55162n@googlegroups.com> <5e86f41a-1515-4843-a4bc-2cb2ef1d63dan@googlegroups.com> <7662f9b4-f4eb-45bb-bc0d-04d82bdf9505n@googlegroups.com> <0a0f727f-8001-40f9-84e6-4e60574b2af1n@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_3092_1065435010.1627503422273" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10834"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBCIMDCM26AARBP7WQ2EAMGQEADIUTWA-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Wed Jul 28 22:17:06 2021 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-ot1-f55.google.com ([209.85.210.55]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1m8pzF-0002ZD-Lh for gtp-pandoc-discuss@m.gmane-mx.org; Wed, 28 Jul 2021 22:17:05 +0200 Original-Received: by mail-ot1-f55.google.com with SMTP id r17-20020a0568301211b02904d078cdc9absf1336100otp.23 for ; Wed, 28 Jul 2021 13:17:05 -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=s1CdxsOdcKrrxU1A7zQNEKVwBtO5UDt3UlPcfXUV+jc=; b=MKO7OV0obwnAvZ7An6DI5SAPEOzrFXDcLHh1eEml24nWee7fsBSXeViPl+XpiGUNfF 0mUC3ZJ5X/KolAAheOOFmIpQsZDyrI+LTwyAvwUSZviSr6JEExWEmsIU2ZjHcg/0pJX7 8hYit/SkyF3AVF3DHytfST2vMrV/6VtGPwy3F6V+o3c18Pw0RX1aGIfl52DF1ul3wab8 6D7b+DAsOaX+UQvya1ihfoqOqLMOIYmqdFWxkNN3G3bzLbuKykEusy7nbtFQbZOHAj1K z6sLl4oOVU87rOxWGNlCeNdxIfJF7N/NpYpGjnJ2JKqtTEuGvSfFn72WbSO0uv13iMDc 0PCw== 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=s1CdxsOdcKrrxU1A7zQNEKVwBtO5UDt3UlPcfXUV+jc=; b=mskqqo7ahWfdd5x8yTdu2tfVFOy2HnU/leS28PWXJHokAIy0RpBX+2DpB1zRmA4H1Q MnQ2nBwwtmIFkh5Fw4H4VbRnYJJqKccEmHv/Elpgbq0I8aer3aK786rrtxKXn+HawkGg BWE8S1C7x+2TXFzulG4ECkCU7PJAY3R2bKmkqrLZi2qCzrntHB0lyeXU4Ls6nosbxPsA pAnOcd6WRoMdkVDnIxOG5gHQvJe6xZfYATwwIT/DBj8FadA218zPMTdbh6D04kaxl//k S40PXojhXDy2U/0FbfqP8GUpE48fNFBybCi7cF5o3gDzIFKFtB8aKCZZ2VE8CqswkeAq aGYQ== 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=s1CdxsOdcKrrxU1A7zQNEKVwBtO5UDt3UlPcfXUV+jc=; b=ibS9Gc+LfhxIba1YAuOmOd+u/CI82KAPhm5uuOKNO+TQLA98IseHuQ3PUNO2NMjKX5 pSDdRIeBsnxIwbTQ6POPTmgfjLTXLGApBfbMinLZARjgysgNKGrVQzxWGn5kPG27mq2V RgUqbC+pZZIDGR4V4V1xVxDUlTTjNuKJAYIECxEUo7BiTTcUEbU/kBmCS3s16Lt9VYLX Tdx6HrDhZhKwPqPi92PwrtEHsg8SYYNPT1o3riGZmUM59XRg0AvVnUF/b4ViFIECeG7L /HTkyrjeSjJdq73c+q6jpMeaJoqwEOftFjUwpp2eLPOMXpm5MFVmSuXvmKAXkT+nujSV lMOg== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM532hwaC8/mzbJ9402h1fyFzlfLXWexKk0GqTvtx8VzyKsKJDMXho eDOQtOSxCps6FtAelIP4sBA= X-Google-Smtp-Source: ABdhPJzrz5WvK3AxVfvU3/JsfxDs1sPvA7l+0MYHZl9c46r90+Eb+owMmWY45mUvfQ5WXa4mG88Oug== X-Received: by 2002:a9d:6753:: with SMTP id w19mr1183082otm.202.1627503424670; Wed, 28 Jul 2021 13:17:04 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:aca:4bc9:: with SMTP id y192ls983429oia.11.gmail; Wed, 28 Jul 2021 13:17:03 -0700 (PDT) X-Received: by 2002:aca:5a04:: with SMTP id o4mr797656oib.33.1627503422860; Wed, 28 Jul 2021 13:17:02 -0700 (PDT) In-Reply-To: <0a0f727f-8001-40f9-84e6-4e60574b2af1n-/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:28925 Archived-At: ------=_Part_3092_1065435010.1627503422273 Content-Type: multipart/alternative; boundary="----=_Part_3093_2090094513.1627503422273" ------=_Part_3093_2090094513.1627503422273 Content-Type: text/plain; charset="UTF-8" For others who might find it helpful this was resolved in pandoc-crossref issue 319 . On Friday, 23 July 2021 at 18:36:13 UTC-7 Leena Murgai wrote: > 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/35c2cafd-f1e2-401a-803b-ea8bac75753en%40googlegroups.com. ------=_Part_3093_2090094513.1627503422273 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable For others who might find it helpful this was resolved in pandoc-crossref i= ssue 319.

On Friday, 23 July 2021 at 18:36:13 UTC-7 Leena Murgai wrote:
Currently
\ref{eq:label}=
in LaTeX gives
<a h= ref=3D"#eq:label" data-reference-t= ype=3D"ref" data-reference=3D"eq:lab= el">[eq:label]</a>
in HTML.

On Friday, 23 July 2021 at 16:22:24 UTC-7= Leena Murgai wrote:
O= h and
\ref{eq:label<= /font>}
in LaTeX should give
<a href =3D"#eq:label"dat= a-reference-type=3D"ref" data-reference=3D"eq:label">chap#.value(eq:label)</a>
in HTML.
On Friday, 2= 3 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 t= he markdown.=C2=A0

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

I tried m= oving 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.=C2=A0\la= bel{eq:label}=C2=A0after \begin{equation}:

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

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

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

3.=C2=A0\label{eq:label}=C2=A0aft= er \end{equation}: Note that this will br= eak the LaTeX code

=C2=A0 <span class=3D"math display">equation</span><= /font><span>[eq:l= abel]</span>

So, none of the ab= ove seem to give pandoc-crossref what it needs. Honestly, I'm not massi= vely familiar with HTML and css - just figuring it out as I go. I imagine w= hatever pandoc-crossref would output (if I could get it to work) would be g= reat. 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><= /div>
<table width=3D100% style=3D"b= order: none;">
<tr&g= t;
<td style=3D"text-al= ign: center; border: none;"><span id=3D"eq:label" clas= s=3D"math display">equation<= /span></td>
<td sty= le=3D"text-align: right; border: none; width: 5%;">(chap#.value{eq:label})&= lt;/td>
</tr>
</table>
</div>

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

Thanks,
Leena

<= br>

On Wednesday, 21 July 2021 at 22:24:47 UTC-7 John MacFarlan= e 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 <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.
<= /div>

--
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/35c2cafd-f1e2-401a-803b-ea8bac75753en%40googlegroups.= com.
------=_Part_3093_2090094513.1627503422273-- ------=_Part_3092_1065435010.1627503422273--