Excellent, I managed to adapt it and it works a charm! Thanks, b. On Wed, 29 Dec 2021 at 20:42, John MacFarlane wrote: > bapt auguie writes: > > > I would like to walk the AST, and immediately after headers with a > specific > > attribute, inject a \renewcommand{} based on the header's attributes, > such > > as (dummy example), > > > > \renewcommand\subsection[1]{\textbf{#1}} > > This is pretty easy. You would have a function > > function Header(el) > local attr = el.attributes > -- you can do attr['foo'] to get the value of the 'foo' attribute > -- now create a string with the macro: > local macro = ... > return { el, pandoc.RawBlock("latex", macro) } > end > > You can fill in the blanks. > > -- 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/CAGCXF2_r6G_sMQWmxyXKA5i29gRFLtOG5Z-WowKXkHASThsGqQ%40mail.gmail.com.