4
votes

I am aware that *** is Pandoc's Markdown for a horizontal rule. This horizontal line looks good on HTML, but if I knit my Markdown into a pdf the horizontal rule only runs half the width of the pdf, and it is centered. This combination just makes the horizontal rule look plain ugly.

How do I properly put a horizontal rule in my R Markdown that can render properly to both HTML and pdf? Properly == full length/full width. And while I'm at it, can I format the horizontal rule (color, thickness, etc.) without getting into much CSS which I know nothing about.

1

1 Answers

5
votes

Make a tex file, say header.tex, containing:

\let\oldrule=\rule
\renewcommand{\rule}[1]{\oldrule{\linewidth}}

Then in your Rmd file:

---
title: "test"
author: "Stéphane Laurent"
date: "30 mars 2018"
output: 
  pdf_document:
    includes:
      in_header: header.tex
---