【问题标题】:YAML issue when knitting to pdf编织到 pdf 时出现 YAML 问题
【发布时间】:2019-07-10 10:00:59
【问题描述】:

我有一篇用 rnotebook 写的论文,我想把它编成 pdf。 这是它的开始,包括 YAML:

---
title: "Are shifts between points of view challenging for readers? An examination of readers' eye movements in response to Woolf's *To the Lighthouse* and *Mrs Dalloway*"
author: "Giulia Grisot, Kathy Conklin, Violeta Sotirova - The University of Nottingham"
date: '`r format(Sys.time(), "%d %B %Y")`'
output:
  html_notebook:
    fig_caption: yes
    force_captions: yes
    #highlight: pygments
    number_sections: false
    theme: readable
# csl: sage-harvard.csl
csl: apa.csl
bibliography: library.bib
link-citations: yes
nocite: | 
  @Grisot2018

---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, warning=FALSE, message=FALSE)
```

```{r, include=F}
library(tidyverse)
library(ggpubr)
```

# Abstract

The emergence of empirical approaches within stylistics has increased interest in how literary texts are processed by readers. Techniques of speech and thought representation represent an area ripe for empirical investigation in this respect, especially when these cause interpretative ambiguities.

我已经安装了 tinytex,我已经安装了 miktex 和 pandoc。 我试图在 RStudio 中使用“knit to pdf”命令,但它给了我这个错误,我不知道该怎么做

Error in yaml::yaml.load(..., eval.expr = TRUE) : 
  Scanner error: while scanning for the next token at line 4, column 31 found character that cannot start any token at line 4, column 31
Calls: <Anonymous> ... parse_yaml_front_matter -> yaml_load -> <Anonymous>
Execution halted

【问题讨论】:

    标签: pdf yaml r-markdown rnotebook tinytex


    【解决方案1】:

    我认为这取决于您的 yaml 中的格式。当我编写您的代码时,R Studio 对标题进行了一些重新格式化,但在此过程中将您的日期中的 ' 替换为 ",导致错误。我没有您的 .bib 文件,所以我无法测试您的确切代码,但以下对我有用:

    ---
    title: Are shifts between points of view challenging for readers? An examination of
      readers' eye movements in response to Woolf's *To the Lighthouse* and *Mrs Dalloway*
    author: "Giulia Grisot, Kathy Conklin, Violeta Sotirova - The University of Nottingham"
    date: '`r format(Sys.time(), "%d %B %Y")`'
    output:
      pdf_document: default
      html_notebook:
        fig_caption: yes
        force_captions: yes
        number_sections: no
        theme: readable
    ---
    
    ```{r setup, include=FALSE}
    knitr::opts_chunk$set(echo = TRUE, warning=FALSE, message=FALSE)
    ```
    
    ```{r, include=F}
    library(tidyverse)
    #library(ggpubr)
    ```
    
    # Abstract
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-05-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-03-07
      • 2015-07-29
      • 2018-04-20
      • 2014-08-10
      相关资源
      最近更新 更多