r - 在 Rmarkdwon 中编译 Latex 文档时读取 md/tex/Rmd 文件时出错
问题描述
在 Rmarkdown 中使用 Latex 时,我试图在引用之后添加一个或多个附录页。在尝试“ Pandoc insert appendix after bib ”和“ Insert Annex after references ”中的解决方案后,我收到一个对我来说没有任何意义的错误,因为它提供的解决方案与数字类型有关(我不是在处理和?)。
我的标题:
---
title: "A smart title here"
author: "Ashameed Person"
geometry: margin=1in
header-includes:
\usepackage{array}
\usepackage{tabularx}
\AtBeginDocument{\let\maketitle\relax} #to hide title
output:
bookdown::pdf_book:
fig_caption: yes
keep_tex: no
number_sections: yes
toc: yes
toc_bib: yes
toc_depth: 2
citation_package: natbib
pandoc_args: ["--include-after-body=appendix.md"]
fontsize: 12pt
bibliography: WorkCited.bib
biblio-style: humannat
link-citations: true
---
我的 Rmd 文件:
knitr::opts_chunk$set(echo = FALSE, message = FALSE, warning = FALSE, eval = TRUE)
\section{new section}
A lot of gibirish \citep{scottdamblon2010, hirth2010}.
See appendix for more info.
编译我的文档时出现以下错误:
! Missing $ inserted.
$
l.142 bookdown::pdf_
book:
Try to find the following text in Draft1.Rmd:
bookdown::pdf_
You may need to add $ $ around a certain inline R expression `r ` in Draft1.Rmd (see the above hint). See https://github.com/rstudio/rmarkdown/issues/385 for more info.
Error: LaTeX failed to compile Draft1.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See Draft1.log for more info.
Execution halted
我的appendix.md类似于上面的,它看起来像这样:
---
output:
bookdown::pdf_book:
keep_tex: yes
number_sections: no
citation_package: natbib
fontsize: 12pt
link-citations: true
---
\section{Appendix B - Raw Data}
\newpage
Raw data can be found at some repository
我还尝试使用文件扩展名 .Rmd 和 .tex 而不是在参数之后找到的 .md pandoc_args:
。另外,我尝试过更改pandoc_args:
,includes: after_body: appendix.md
但这会编译我的pdfbook,但不会添加附录部分。
您可以在这些 github 的链接中找到我的参考资料、我的原始 rmd、humannat 文件和附录文件。
解决方案
推荐阅读
- django - 如何在 django 中创建个人帐户?
- javascript - Js Countdown 文本不在边界中心内
- enterprise - 配置 Corda Enterprise 时如何避免使用纯文本密码?
- pdf - 将所有 Google 表单回复保存到单个 PDF 中
- google-app-engine - 如何以编程方式获取 GCP Compute API 的访问令牌
- javascript - 在子组件中反应登录身份验证
- r - 查找值最接近向量的列
- node.js - Heroku,在安装 buildpack 后触发部署
- javascript - 用 WebCryptoAPI 替换 cryptico.js - 如何获取公钥字符串?
- php - PHP回调有什么用?