I am using R Markdown and Latex with memoir to compile a book to pdf. The author has used the *** syntax for horizontal dividers. Checking the compiled .tex file I can see that the conversion from markdown is to:


How do I globally style \rule?

Just in case it helps, I found this snippet online that changes the color but have not idea how to modify it to affect the width and thickness:

  • How should the rule look like?
    – DG'
    Commented May 23, 2021 at 19:16

1 Answer 1


It would be best to use a lua filter for pandoc to modify the rules generated by ***.

First you have to look up, how the horizontal rule is represented in pandoc's AST. You can do that by using native as the output format:

echo "* * *" | pandoc --from markdown --lua-filter=hl.lua --to native

Which returns: [HorizontalRule], now you know the element is called HorizontalRule. To change the output, you need a small program that looks for the element in question and returns the code you want:

-- horizontalrule.lua

if FORMAT:match 'latex' then
  function HorizontalRule ()
    return {
      pandoc.RawBlock('latex', '\\rule'),

enter image description here

Change '\\rule' to whatever you want and call pandoc with the option --lua-filter=horizontalrule.lua

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .