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.
To transform your markdown file into an HTML, PDF, or Word document, click the “Knit” icon that appears above your file in the scripts editor. A drop down menu will let you select the type of output that you want. When you click the button, rmarkdown will duplicate your text in the new file format.
You can create a horizontal rule ( <hr /> ) by placing 3 or more hyphens, asterisks, or underscores on a single line by themselves.
By default, Pandoc will preserve raw LaTeX code in Markdown documents when converting the document to LaTeX, so you can use LaTeX commands or environments in Markdown.
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
---
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With