Bug description
Unnumbered headers, e.g., # References {-}, are translated to \chapter* by pandoc. The starred sectioning commands in LaTeX have the side-effect of not updating the marks used for the page heads, which can have unintended effects. See., e.g., jgm/pandoc#1632 and rstudio/bookdown#1382. Pandoc tries to avoid an opinionated solution, as users may not want chapters and sections show up in the page headers, which is why it hasn't been fixed there yet. It might make sense to use a Lua filter as a temporary until this is resolved in pandoc. E.g.
--- Removes notes and links
local function clean (inlines)
return inlines:walk {
Note = function (_) return {} end,
Link = function (link) return link.content end,
}
end
--- Creates an Inlines singleton containing the raw LaTeX.
local function l(text)
return pandoc.Inlines{pandoc.RawInline('latex', text)}
end
function Header (h)
if h.level <= 2 and h.classes:includes 'unnumbered' then
local title = clean(h.content)
local secmark = h.level == 1
and l'\\markboth{' .. title .. l'}{' .. title .. l'}'
or l'\\markright{' .. title .. l'}' -- subsection, keep left mark unchanged
return {h, secmark}
end
end
Additional logic could be included, allowing users to configure headers via YAML settings.
Cc @cderv
Checklist
Bug description
Unnumbered headers, e.g.,
# References {-}, are translated to\chapter*by pandoc. The starred sectioning commands in LaTeX have the side-effect of not updating the marks used for the page heads, which can have unintended effects. See., e.g., jgm/pandoc#1632 and rstudio/bookdown#1382. Pandoc tries to avoid an opinionated solution, as users may not want chapters and sections show up in the page headers, which is why it hasn't been fixed there yet. It might make sense to use a Lua filter as a temporary until this is resolved in pandoc. E.g.Additional logic could be included, allowing users to configure headers via YAML settings.
Cc @cderv
Checklist