@jcr - Brilliant, works like a charm. I had to make some trivial changes; the version I’m using right now with the LaTeX article or scrartcl classes is shown below. One thing that would be nice to have, though, would be the ability to switch automatically between a 'commands' list for book-like LaTeX classes (starting with 'chapter'), and article-like classes (starting with 'section'). I'll be trying to figure that out, but useful hints would be welcome. -- Print a formatted warning to stderr function warnf (...) io.stderr:write(string.format(...)) end function Header (el) -- Replace heading with raw LaTeX if pageheading is used to specify a -- shorter form of the title to use in page headers. if el.attributes.pageheading then -- local commands = {'chapter', 'section', 'subsection'} local commands = {'section', 'subsection'} if el.level > #commands then warnf('pageheading attribute not supported for level %d headings', el.level) return el end -- Produce LaTeX like pandoc does, but with two additional arguments -- to specify a short for of the page heading to memoir. local title = pandoc.utils.stringify(el) -- local latexStr = string.format('\\%s[%s][%s]{%s}', commands[el.level], title, el.attributes.pageheading, title) local latexStr = string.format('\\%s[%s]{%s}', commands[el.level], el.attributes.pageheading, title) local label = string.format('\\label{%s}', el.identifier) -- wrap in hypertarget latexStr = string.format('\\hypertarget{%s}{%%\n%s%s}', el.identifier, latexStr, label) return pandoc.RawBlock('latex', latexStr) end end -- 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/Jhsov6mz1SVLhbvImsIGtDSG8qg-4qI-Zd5Qbgheu2-1jaeqQqvZoCWtG8V50fuZTwajRjw07nWkok89_GCoZbdWOh2oZ6eo_T2uyFEWAcc%3D%40protonmail.com.