From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/27618 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Bernie Roesler Newsgroups: gmane.text.pandoc Subject: Re: Markdown Fenced Div to LaTeX Environment Date: Wed, 27 Jan 2021 19:17:01 -0800 (PST) Message-ID: References: <8ba84992-d792-4333-aae0-560147ef79d4n@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_102_624497058.1611803821279" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39701"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBDDZVXW5TUDRBLWZZCAAMGQEDC3AOMI-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Thu Jan 28 04:17:05 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 1l4xns-000AEH-Te for gtp-pandoc-discuss@m.gmane-mx.org; Thu, 28 Jan 2021 04:17:05 +0100 Original-Received: by mail-oi1-f187.google.com with SMTP id i9sf1801538oih.1 for ; Wed, 27 Jan 2021 19:17:04 -0800 (PST) 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=6Dfiy0cTS9JPrcA5snWveqTf/g/I94jxJgLTCCsNNT8=; b=cqu2VFzh2PoaVZjfSUGtoo7lY/rSeb8y/9BTiXMbqo4WMXAsdpW0do2pkwF2fTfgiB yRiNxXIGYJ8JGclq/1BIge5Z8DjW0x7eD+PtYAeNM3v4igkNt2UHvElBzXc8rDW5xFYI N995t9aTdDns09+114alPemuKlwOtW2ACO8fuzsv6bDO9FoQ20hTdjl2hxsWSRPXcrbS yfWvjK5iFAEXci7FQZRjlH6G3lbc3/rB/O3bIyeiUQeneqdmntKehvzWly29n+0MxV1N OYlb5+zrouyPMp2+urCXGJ7noLLbvt0y3D6lQf1s+Gvv1FCgFXwQJarfgjypBoeGbC2z ql/w== 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=6Dfiy0cTS9JPrcA5snWveqTf/g/I94jxJgLTCCsNNT8=; b=vUK28RXAjgsC+CsAztRYnRniAEM9/TgOGgMTd4oNcvp31Gji0sAwip5p/gPakYmSGr 85/iVRPCGp9RQ1Yeub1mLRsxPqqDd7yVJ3KZD0hqiuSWiOU9iHUieaRk9nvy1KYSl4Si ysl0cpGJX0EJleA1ZC+s3C6aWeULqhqx2gwmXP0v4XDKx1N8bwNkZHTAUFhH1bd8QJZd cN9rBtrpVlLw4LSy7Ia95OyjpnMBKGty8D9EIzhVA30DspY2N2UTL1fTVXeL0vFtxLjz oa/aFEL2CkKSa4AxskyNN8HP5isCpcgXsfb16FvFHD3S2eXNN7s2LXvM6bsSCH8L4xqT 6boA== 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=6Dfiy0cTS9JPrcA5snWveqTf/g/I94jxJgLTCCsNNT8=; b=iL9odC8x3yVWdP/gn84UZtEmlD/uO8GFTw7CPiBU8pgNWGpGVYzbrphIyXhNuS5gEM DvnEgTQCiZyjt//wB0W1rscrssB2tm89klS1DBz8I6n1M+81tYqTIDXNz7VVRVSQJ7DP YmhFSb7QImRZj9pHlOI9wn6CJBJBkYZxVIxMU5LVcKQpjMwQ9C+jLU8jiZe8Ko1fClEP GR7Usl9PMcavRnyLYbp9JusQVpPAVFVtajMpjKodlTUBGnKhR+JWdGn4d3O43dhp1k4V /REwCAeDAYeMtdJiJABm5L8AgKwCM7e5XfHII9A6A+9/rKM5IedTBowIgN3RMjgDYzC1 169A== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM530dmoECQp7C3K8x11REqNcSzbpRkz9s5BzOJX4lgJjC9mlC9zMn /HE4Ec+f5rwuvN7UEhbNfE4= X-Google-Smtp-Source: ABdhPJwnuMRC4ozv0lATCt8PZgjEU2uimcfirPVhKOjJpepyBljNvhOHrYPfCYmU808tXQYCbhNwNA== X-Received: by 2002:a05:6808:8fa:: with SMTP id d26mr5348868oic.6.1611803823854; Wed, 27 Jan 2021 19:17:03 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:6830:14a:: with SMTP id j10ls1018797otp.4.gmail; Wed, 27 Jan 2021 19:17:02 -0800 (PST) X-Received: by 2002:a05:6830:13ce:: with SMTP id e14mr9935462otq.356.1611803822205; Wed, 27 Jan 2021 19:17:02 -0800 (PST) In-Reply-To: X-Original-Sender: bernard.roesler-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:27618 Archived-At: ------=_Part_102_624497058.1611803821279 Content-Type: multipart/alternative; boundary="----=_Part_103_30222419.1611803821279" ------=_Part_103_30222419.1611803821279 Content-Type: text/plain; charset="UTF-8" Hi all, Is there a *reverse* of this solution? I'm trying to go from LaTeX to markdown/html for posting to a Jekyll blog, but pandoc parses out much of the algorithm/algorithmic environments, and does not put the contents in a div like it does for theorems/proofs. With the input: \begin{algorithm} \Require $x > 0$. \Procedure{SquareX}{$x$} \State $x \gets x^2$ \State \Return $x$ \EndProcedure \end{algorithm} Currently the output is: $x > 0$. $x \gets x^2$ $x$ I'd like to have to something like:
$x > 0$ SquareX($x$) $x \gets x^2$ $x$
or something to that effect to allow formatting of the individual elements. See also my StackOverflow question and Jekyll Talk discussion . I can do my own wrangling and add a verbatim environment before running it through pandoc and then parse that chunk of the markdown file afterwards, but I was curious if there was a more elegant solution to dealing with unknown environments. Thanks, Bernie On Sunday, January 24, 2021 at 2:51:02 PM UTC-5 chris....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote: > Thanks! Exactly what i needed to know. > > -Chris > > On Sun, Jan 24, 2021, 11:58 AM John MacFarlane wrote: > >> >> You need a filter, but it would be a simple one. >> >> Something like >> >> function latex(s) >> return pandoc.RawBlock('latex', s) >> end >> >> function Div(el) >> if el.classes[1] == 'solution' then >> return { latex('\begin{solution}'), el.content, >> latex('\end{solution}') } >> end >> end >> >> Chris Diaz writes: >> >> > Hello, >> > >> > I'm looking for advice on how to produce HTML and LaTeX from Markdown >> using >> > fenced divs (or something else) to apply custom styles to specific >> portions >> > of the document. >> > >> > For example, I'm hoping to write something like this: >> > >> > ::: solution >> > Solution text here. >> > ::: >> > >> > in order to produce this when HTML is the output (already works): >> > >> >
>> > Solution text here. >> >
>> > >> > and this when LaTeX/PDF is the output: >> > >> > \begin{solution} >> > Solution text here. >> > \end{solution} >> > >> > This idea comes from Bookdown's >> > Custom Blocks >> > feature, but I'm wondering if there's a way to do this with Pandoc, or >> if >> > this would require a Lua filter. >> > >> > Thanks, >> > Chris >> > >> > -- >> > 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/8ba84992-d792-4333-aae0-560147ef79d4n%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/e6363602-852a-45a1-a199-81553da1966bn%40googlegroups.com. ------=_Part_103_30222419.1611803821279 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi all,

Is there a *reverse* of this solution? I'm tryin= g to go from LaTeX to markdown/html for posting to a Jekyll blog, but pando= c parses out much of the algorithm/algorithmic environments, and does not put the contents in a div like it does for theorems/proofs.

With the input:

\begin{algorithm}
    \Require $x > 0$.
    \Procedure{Squa= reX}{$x$}
      \State $x \gets x^2$
&nb= sp;     \State \Return $x$
    \EndProcedure<= /div>
\end{algorithm}

Currently the= output is:

$x > 0$. $x \gets x^2$ $x$

I'd like to have to something like:

<div class=3D"algorithm">
    <s= pan class=3D"Require">$x > 0$</span>
    &l= t;span class=3D"Procedure">SquareX</span>($x$)
  &n= bsp; <span class=3D"State">$x \gets x^2$</span>
 = ;   <span class=3D"State" class=3D"Return">$x$</span>
    <span class=3D"EndProcedure"></span>
<= /div>
</div>

or something to that effect= to allow formatting of the individual elements.

S= ee also my StackOverflow question&= nbsp;and Jekyll Talk discussion.

I can do my own wrangling and add a verbatim enviro= nment before running it through pandoc and then parse that chunk of the mar= kdown file afterwards, but I was curious if there was a more elegant soluti= on to dealing with unknown environments.

Thanks,
Bernie

On Sunday, January 24, 2021 at 2:51:02 PM UTC-5 chris..= ..@gmail.com wrote:
Thanks! Exactly what i needed to know.=C2=A0

-Chris

On Sun, Jan 24, 2021, 1= 1:58 AM John MacFarlane <j...= @berkeley.edu> wrote:

You need a filter, but it would be a simple one.

Something like

function latex(s)
=C2=A0 return pandoc.RawBlock('latex', s)
end

function Div(el)
=C2=A0 if el.classes[1] =3D=3D 'solution' then
=C2=A0 =C2=A0 return { latex('\begin{solution}'), el.content, latex= ('\end{solution}') }
=C2=A0 end
end

Chris Diaz <chris.= ...@gmail.com> writes:

> Hello,
>
> I'm looking for advice on how to produce HTML and LaTeX from Markd= own using
> fenced divs (or something else) to apply custom styles to specific por= tions
> of the document.
>
> For example, I'm hoping to write something like this:
>
> ::: solution
> Solution text here.
> :::
>
> in order to produce this when HTML is the output (already works):
>
> <div class=3D"solution">
> Solution text here.
> </div>
>
> and this when LaTeX/PDF is the output:
>
> \begin{solution}
> Solution text here.
> \end{solution}
>
> This idea comes from Bookdown's
> <https://bookdown.org/yihui/b= ookdown/custom-blocks.html> Custom Blocks
> feature, but I'm wondering if there's a way to do this with Pa= ndoc, or if
> this would require a Lua filter.
>
> Thanks,
> Chris
>
> --
> You received this message because you are subscribed to the Google Gro= ups "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send= an email to pandoc-d= iscus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
> To view this discussion on the web visit https://groups.google.com/d/msgid/pa= ndoc-discuss/8ba84992-d792-4333-aae0-560147ef79d4n%40googlegroups.com.<= br>

--
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/e6363602-852a-45a1-a199-81553da1966bn%40googlegroups.= com.
------=_Part_103_30222419.1611803821279-- ------=_Part_102_624497058.1611803821279--