如何解决编织R-Markdown文档会导致“!未定义控制序列”错误
我正在创建R Markdown文档,并在尝试打印数学公式时不断出错。我认为错误在标头中的某处,但我无法完全确定。这是文档的精简版本:
---
output:
pdf_document:
keep_tex: yes
latex_engine: xelatex
header-includes: |
\usepackage{nath}
\usepackage{amsmath}
title: "Test Report"
toc: true
number_sections: true
graphics: yes
toc_depth: 2
df_print: kable
fontsize: 13pt
editor_options:
chunk_output_type: console
---
```{r setup,include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## R Markdown
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML,PDF,and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.
When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
```{r cars}
summary(cars)
```
**`r 5 * 20`** entries in the dataset;
Testing mathematical symbols,$\varepsilon _{u,i}$.
The formula used for this is:
$$ Y_{u,i} = \mu + \varepsilon _{u,i} $$
Where $\Y_{u,i}$ is the predicted rating per user,per movie and $\mu$ is the "true" rating for all movies. Mu-hat -> $\hat{mu}$ .
## Including Plots
You can also embed plots,for example:
```{r pressure,echo=FALSE}
plot(pressure)
```
Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.
这是错误消息:
output file: final_testing.knit.md
! Undefined control sequence.
\mathop ...\o@mathop {#1}} \else \def \mathop@arg
{#1} \def \afterparse@ {\m...
l.112 \begin{document}
Error: LaTeX failed to compile final_testing.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See final_testing.log for more info.
Execution halted
对此事的任何投入,我们深表感谢。 TIA
解决方法
我做了以下事情:
- 评论了乳胶引擎(可能是让Rmarkdown自行选择)
- 在
services.AddAuthentication(options => { options.DefaultScheme = JwtBearerDefaults.AuthenticationScheme; }) .AddJwtBearer("ADB2C",jwtOptions => { jwtOptions.Authority = $"{appConfiguration.AppSettings.Adb2cInstance}/{appConfiguration.AppSettings.Adb2cDomain}/{appConfiguration.AppSettings.Adb2cPolicy}/v2.0/"; jwtOptions.Audience = appConfiguration.AppSettings.Adb2cClientId; jwtOptions.RequireHttpsMetadata = bool.Parse(configuration["AppSettings:RequireHttpsMetadata"]); //// NOTE:: This is set only for dev purposes. Remove for higher environments. jwtOptions.Events = new JwtBearerEvents { OnAuthenticationFailed = arg => { // invoked if authentication fails return Task.FromResult(0); } }; }); services.AddAuthorization(options => { options.DefaultPolicy = new AuthorizationPolicyBuilder().RequireAuthenticatedUser().AddAuthenticationSchemes("ADB2C").Build(); });
之后删除了|
- 在
header-includes:
之前插入-
- 注释了软件包
\usepackage{}
,因为它似乎没有加载 - 更改了
nath
,因为没有fontsize: 12pt
- 公式中已删除空格和几个反斜杠
现在为我工作,也希望你吗?
13pt
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。