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.