R Markdown horizontal rule that will also work with LaTeX pdf?
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
---
pandoc related error on saving rmarkdown file
Hard to tell without seeing the input document. Error 64 is a PandocParseError
, and the most likely explanation is a problem in a YAML metadata block.
R Markdown reduce space between heading and horizontal rule
Remove Padding
If you want to remove the padding around the line, you can set a negative vspace
command within the line definition as shown here:
\let\oldrule=\rule
\renewcommand{\rule}[1]{\vspace{-25pt}\oldrule{\linewidth}}
And the .Rmd file:
---
output:
pdf_document:
includes:
in_header: header.tex
---
# Title
Test
Test
Underline Header
You are probably better off changing the styles of the header to include the underline as part of the # Title
command. This answer shows how it can be achieved in LaTeX
Firstly, the header.tex
file becomes:
\usepackage{titlesec}
\let\oldrule=\rule
\renewcommand{\rule}[1]{\oldrule{\linewidth}}
\titleformat{\section}
{\normalfont\Large\bfseries}{\thesection}{1em}{}[{\titlerule[0.8pt]}]
And a basic example. Note that subparagraph: yes
is included, and without it the titlesec
package cannot be used. See here for the explanation.
---
output:
pdf_document:
includes:
in_header: header.tex
subparagraph: yes
---
# Title
Test
Test
Related Topics
R Package Conflict Between Gam and Mgcv
Passing a List of Arguments to a Function with Quasiquotation
Remove Whiskers in Box-Whisker-Plot
Aggregating Rows for Multiple Columns in R
All Paths in Directed Tree Graph from Root to Leaves in Igraph R
Summing Multiple Columns in an R Data-Frame Quickly
How to Generate Multivariate Random Numbers with Different Marginal Distributions
Ggplot2 Equivalent of 'Factorization or Categorization' in Googlevis in R
The Fastest Way to Convert Numeric to Character in R
Select List Element Programmatically Using Name Stored as String
R - Carry Last Observation Forward N Times
Overlapped Density Plots in Ggplot2
R: Check If Value from Dataframe Is Within Range Other Dataframe