public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* custom LaTeX writer example
@ 2022-11-15  3:30 bapt a
       [not found] ` <34e5e93b-8832-40d3-8803-8e5a12b5290an-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: bapt a @ 2022-11-15  3:30 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 1375 bytes --]

Hi,

I'm hoping to play around with custom writers, to understand a bit better 
how to turn pandoc's AST into a specific output format (for example, I'd 
like to use tabularray syntax for tables in LaTeX, and it seems "cleaner" 
to use a writer than to inject raw inline LaTeX via a filter into the AST). 
The html writer example is quite useful, but since I'm aiming for LaTeX 
output, it would be helpful to have something a little closer in syntax as 
a starting point.

I searched a bit and the closest thing I could find was a plain TeX writer 
at https://github.com/drehak/pandoc-to-markdown
but this is perhaps not as helpful for learning because most of the magic 
seems to be delegated to custom TeX macros. (A good strategy, but I 
wouldn't know (La)TeX well enough to perform some of the more complex 
processing)

I wonder if someone here has a minimal (or complete!) example of a custom 
Lua writer for LaTeX they could share?

Many thanks,

baptiste

-- 
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/34e5e93b-8832-40d3-8803-8e5a12b5290an%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 1798 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: custom LaTeX writer example
       [not found] ` <34e5e93b-8832-40d3-8803-8e5a12b5290an-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2022-11-15 19:48   ` John MacFarlane
       [not found]     ` <493DA04D-5B8D-4D3A-8A26-35A8A34E64AB-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: John MacFarlane @ 2022-11-15 19:48 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

I'd recommend using a "new style" writer and just replacing the code that formats tables.

https://pandoc.org/custom-writers.html#new-style



> On Nov 14, 2022, at 7:30 PM, bapt a <auguieba-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> 
> Hi,
> 
> I'm hoping to play around with custom writers, to understand a bit better how to turn pandoc's AST into a specific output format (for example, I'd like to use tabularray syntax for tables in LaTeX, and it seems "cleaner" to use a writer than to inject raw inline LaTeX via a filter into the AST). The html writer example is quite useful, but since I'm aiming for LaTeX output, it would be helpful to have something a little closer in syntax as a starting point.
> 
> I searched a bit and the closest thing I could find was a plain TeX writer at https://github.com/drehak/pandoc-to-markdown
> but this is perhaps not as helpful for learning because most of the magic seems to be delegated to custom TeX macros. (A good strategy, but I wouldn't know (La)TeX well enough to perform some of the more complex processing)
> 
> I wonder if someone here has a minimal (or complete!) example of a custom Lua writer for LaTeX they could share?
> 
> Many thanks,
> 
> baptiste
> 
> -- 
> 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/34e5e93b-8832-40d3-8803-8e5a12b5290an%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/493DA04D-5B8D-4D3A-8A26-35A8A34E64AB%40gmail.com.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: custom LaTeX writer example
       [not found]     ` <493DA04D-5B8D-4D3A-8A26-35A8A34E64AB-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2022-11-16 19:13       ` bapt a
  0 siblings, 0 replies; 3+ messages in thread
From: bapt a @ 2022-11-16 19:13 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 2598 bytes --]

Thanks – it does seem ideal; I wasn't sure from the description if one 
could only include the targets to be replaced from an existing format, or 
if everything had to be included to be a valid writer.

I think I'll start with a simpler case, because Tables seem too advanced 
for my level of understanding.

Best,

baptiste

On Wednesday, 16 November 2022 at 08:48:07 UTC+13 fiddlosopher wrote:

> I'd recommend using a "new style" writer and just replacing the code that 
> formats tables.
>
> https://pandoc.org/custom-writers.html#new-style
>
>
>
> > On Nov 14, 2022, at 7:30 PM, bapt a <augu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> > 
> > Hi,
> > 
> > I'm hoping to play around with custom writers, to understand a bit 
> better how to turn pandoc's AST into a specific output format (for example, 
> I'd like to use tabularray syntax for tables in LaTeX, and it seems 
> "cleaner" to use a writer than to inject raw inline LaTeX via a filter into 
> the AST). The html writer example is quite useful, but since I'm aiming for 
> LaTeX output, it would be helpful to have something a little closer in 
> syntax as a starting point.
> > 
> > I searched a bit and the closest thing I could find was a plain TeX 
> writer at https://github.com/drehak/pandoc-to-markdown
> > but this is perhaps not as helpful for learning because most of the 
> magic seems to be delegated to custom TeX macros. (A good strategy, but I 
> wouldn't know (La)TeX well enough to perform some of the more complex 
> processing)
> > 
> > I wonder if someone here has a minimal (or complete!) example of a 
> custom Lua writer for LaTeX they could share?
> > 
> > Many thanks,
> > 
> > baptiste
> > 
> > -- 
> > 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/34e5e93b-8832-40d3-8803-8e5a12b5290an%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/a327ba5a-21fe-4cae-85e5-4ce1c323154an%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 4303 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-11-16 19:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-15  3:30 custom LaTeX writer example bapt a
     [not found] ` <34e5e93b-8832-40d3-8803-8e5a12b5290an-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-11-15 19:48   ` John MacFarlane
     [not found]     ` <493DA04D-5B8D-4D3A-8A26-35A8A34E64AB-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2022-11-16 19:13       ` bapt a

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).