Unable to knit PDF with custom styles

Trying to knit in pdf from RStudio using the custom mystyles.sty file. This works well, but now that I have upgraded to RStudio 1.044, I am getting an error.

Example:

---
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)
```

With this style file:

\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}{}

Gives me this error:

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

If I look at the tex file that it produces, I don't see any missing curly braces, and there is no 1290 line. It uses the latest versions of RStudio, R, and MacTex. According to AsI, this was used to work with the old version of RStudio, but nothing more. If I take it, it will turn on: ... a bit from YAML, which it displays without complaint. Who can help?

+4
source share
2 answers

rmarkdown latex template \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$

\subparagraph , , . :

---
title: "Test"
output:
  pdf_document:
    includes:
      in_header: mystyles.sty
subparagraph: true
---

: .

+8

. . . twsh. . .

, , "" true (--variable = ). titlesec.sty .

+1

Source: https://habr.com/ru/post/1659931/


All Articles