Assuming you don't need the verbatim to be highlighted you could use a span with a custom style instead of a Code element, and define that custom style however you want (search for "custom-style" in the manual!): ``````markdown # The [switch]{custom-style=H1-verb} keyword `````` Since that custom style attribute is a lot to type I would probably use a combination of a class and a Lua filter, especially since the heading text in Markdown has to fit on a single physical line, and so that it doesn't break if I change the level of a heading: ``````markdown # The [switch]{.hv} keyword ## The [ref]{.hv} and [out]{.hv} keywords ### The [far]{.hv} and [near]{.hv} modifiers #### The [printf()]{.hv} function `````` and then in "header-verb.lua": ``````lua -- Template for custom style, where %d will be filled in with -- the heading's level number local style_template = 'Heading %d Verbatim' -- Filter generator for walking a header and fix spans local function mk_span_filter (level) style_name = style_template:format(level) return { Span = function (span) if not span.classes:includes('hv') then return nil end span.attributes['custom-style'] = style_name return span end } end function Header (head) local filter = mk_span_filter(head.level) return pandoc.walk_block(head, filter) end `````` Then in your reference DOCX define the "Heading 1 Verbatim" "Heading 2 Verbatim" etc. styles, presumably as inheriting from "Verbatim Char" as you wish and you are good to go. An irritation is that you apparently can't override bold/italic set in the paragraph style, at least in LibreOffice. Files attached. Tested with pandoc 2.9.2 and LibreOffice 6.0.7.3 On 2020-08-06 22:17, Anton Shepelev wrote: > I asked: > >> As distinct from other Markdown processors and >> other output formats, while rendering DOCX output >> with Pandoc, inline `verbatim` text in headers >> does not work so well, because it inherits not on- >> ly the font, but also the font size from the >> `Verbatim Char' style. I do realise that it is the >> right thing to do for running text because most >> monospace fonts look better at a slightly de- >> creased size (e.g. 12pt Times New Roman and 11pt >> Courier New), but I still should like to see nice >> typewriter text in headers: >> >> ## The `switch` keyword > > I wonder who nobody replied. What is your method of > typsetting such headers: > > # The `switch` keyword > # The `ref` and `out` keywords > # The `far` and `near` modifiers > # The `printf()` function > > Do you fix them in your Lua filters? Is it better > to have this functionality in a Lua filters on in > Pandoc itself? > -- 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/14a2d64c-3044-5d89-0412-fc06c7f40a7c%40gmail.com.