use*_*624 4 latex pandoc rstudio r-markdown
尝试使用自定义mystyles.sty文件从RStudio编织为pdf.这曾经工作正常,但现在我已升级到RStudio 1.044我得到一个错误.
例:
---
title: "Test"
output:
pdf_document:
includes:
in_header: mystyles.sty
---
## 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)
```
Run Code Online (Sandbox Code Playgroud)
使用此样式文件:
\usepackage{titlesec}
\definecolor{airforceblue}{rgb}{0.36, 0.54, 0.66}
\definecolor{coolblack}{rgb}{0.0, 0.18, 0.39}
\titleformat{\title}
{\color{airforceblue}\normalfont\Large\bfseries}
{\color{airforceblue}\thesection}{1em}{}
\titleformat{\section}
{\color{coolblack}\normalfont\Large\bfseries}
{\color{coolblack}\thesection}{1em}{}
Run Code Online (Sandbox Code Playgroud)
给我这个错误:
output file: test.knit.md
! Argument of \paragraph has an extra }.
<inserted text>
\par
l.1290 \ttl@extract\paragraph
pandoc: Error producing PDF
Error: pandoc document conversion failed with error 43
Execution halted
Run Code Online (Sandbox Code Playgroud)
如果我查看它生成的tex文件,我看不到任何丢失的大括号,并且没有1290行.这是使用最新版本的RStudio,R和MacTex.正如我所说,这曾经与旧版本的RStudio一起使用,但不多了.如果我拿出包括:......在YAML之外,它会毫无怨言地呈现.有人能帮忙吗?
问题与rmarkdown乳胶模板的重新定义有关\subparagraph{},这种方式不同titlesec,正如tex.SE上的这个答案所暗示的那样.这是导致问题的模板的一部分:
$if(subparagraph)$
$else$
% Redefines (sub)paragraphs to behave more like sections
\ifx\paragraph\undefined\else
\let\oldparagraph\paragraph
\renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}
\fi
\ifx\subparagraph\undefined\else
\let\oldsubparagraph\subparagraph
\renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
\fi
$endif$
Run Code Online (Sandbox Code Playgroud)
由于\subparagraph重新定义仅在没有子变量集的情况下发生,因此一个简单的解决方法是在yaml前端设置它.编译好:
---
title: "Test"
output:
pdf_document:
includes:
in_header: mystyles.sty
subparagraph: true
---
Run Code Online (Sandbox Code Playgroud)
但这可能不是最佳解决方案:最好从模板中修复子段定义.
| 归档时间: |
|
| 查看次数: |
453 次 |
| 最近记录: |