Excellent, I managed to adapt it and it works a charm!

Thanks,

b.

On Wed, 29 Dec 2021 at 20:42, John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> wrote:
bapt auguie <auguieba-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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-/JYPxA39Uh5TLH3MbocFFw@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.