Horizontal rule in R Markdown / Bookdown causing errors

前端 未结 2 806
孤城傲影
孤城傲影 2020-12-03 22:04

Suddenly, I run into an error when knitting to PDF in Markdown/Bookdown. Nothing about my system has changed.

The error is being caused by a \'horzontal rule\' i.e

相关标签:
2条回答
  • 2020-12-03 22:38

    So, a temporary solution, that worked for me, until a more permanent solution is found is:

    \begin{center}\rule{3in}{0.4pt}\end{center}
    

    Used this instead of --- or ***

    0 讨论(0)
  • 2020-12-03 22:43

    Update: this issue has been fixed in rmarkdown v2.1, and should disappear if you (re)install the latest version of rmarkdown from CRAN.


    This is a known and fixed bug now in pandoc. https://github.com/jgm/pandoc/issues/5801

    it happened with newer version of TexLive.

    This will be fixed in next pandoc version. You'll have to wait or use the nightly build.

    you can also use a trick for now by adding this in the header of tex document.

    \renewcommand{\linethickness}{0.05em}
    

    With rmarkdown you can do

    ---
    title: "Untitled"
    output: 
      pdf_document:
        keep_tex: true
        includes:
          in_header: header.tex
    ---
    
    ```{r setup, include=FALSE}
    knitr::opts_chunk$set(echo = TRUE)
    ```
    
    
    ```{cat, engine.opts = list(file = "header.tex")}
    \renewcommand{\linethickness}{0.05em}
    ```
    
    
    lalalala
    
    ---
    
    lilili
    

    you can also write the header.tex file manually, or add it to your template.

    This works for me.

    0 讨论(0)
提交回复
热议问题