My markdown file won't knit to PDF and returns the following error:
Unmatched ( in regex; marked by <-- HERE in m//( <-- HERE .sty/ at
/usr/local/bin/tlmgr line 1778. Error in grep(paste0("/", x[j], "$"),
l) : invalid regular expression '/(.sty$', reason 'Missing ')''
Calls: ... system2_quiet -> on_error -> parse_packages ->
grep
I am on a Mac and everything was working yesterday, and then I installed tinytex (I may have installed it twice) and now I cannot knit to PDF. Has anyone seen this error before? Or worked with tmlr?
I have tried uninstalling tinytex and reinstalling Rstudio.
If it helps, my YAML heading is:
---
title: \vspace{2in}"**Borrower Feedback Analysis**"
date: "`r Sys.Date()`"
#output: html_document
output:
pdf_document:
latex_engine : xelatex
toc: true
toc_depth: 1
header-includes:
- \usepackage(tinytex)
- \usepackage{sectsty}
- \usepackage{xcolor}
- \definecolor{blendHeaderBlue}{HTML}{00146b}
- \definecolor{blendParahraphBlue}{HTML}{4a578f}
- \sectionfont{\color{blendHeaderBlue}}
- \subsectionfont{\color{blue}}
- \paragraphfont{\color{blue}}
geometry: margin= .9in
fontsize: 10pt
---
Related
My document is simply this
---
title: "The Visual Speech (VISP) Handbook"
author: "Fredrik Karlsson & Linda Sandström"
site: bookdown::bookdown_site
documentclass: book
output:
bibliography: references.bib
#bookdown::pdf_book: default
bookdown::gitbook: default
biblio-style: "apalike"
link-citations: true
---
# Preface {-}
[#R-base]
and I have a reference file:
> dir(pattern = "*.bib")
[1] "references.bib"
but I am unable to find this bib file when knitting the book:
Error in eval(parse(text = name)) : object 'references.bib' not found
Calls: ... create_output_format ->
create_output_format_function -> eval -> eval Please delete _main.Rmd
after you finish debugging the error. Execution halted
Any ideas on how to set this up properly (in Rstudio)
Thanks!
Fredrik
It's just a location problem in the code (see more information here).
You could try:
---
title: "The Visual Speech (VISP) Handbook"
author: "Fredrik Karlsson & Linda Sandström"
site: bookdown::bookdown_site
documentclass: book
output:
#bookdown::pdf_book: default
bookdown::gitbook: default
bibliography: references.bib
biblio-style: "apalike"
link-citations: true
---
# Preface {-}
[#R-base]
As demonstrated in 4.7 Verbatim code chunks in #Yihui 's R Markdown Cookbook, we can show a verbatim inline expression,
`r knitr::inline_expr("coef(summary(model))")`, for example, in our output of RMarkdown.
However, this knitr::inline_expr() would not be able to parse a code with double quotation marks, such as
`r knitr::inline_expr("coef(summary(model))["(Intercept)", "Estimate"]")`.
Then, what should I do when I want to demonstrate the verbatim which contains such a special characters?
---
title: "Untitled"
author: "CLRR"
date: "2020/6/20"
documentclass: article
output:
bookdown::pdf_document2:
latex_engine: xelatex
keep_tex: TRUE
---
This verbatim can appear in the output:
`` `r knitr::inline_expr("coef(summary(model))")` ``
<!--
But, if the code contains `"`, the evaluation fails.
`r knitr::inline_expr("coef(summary(model))["(Intercept)", "Estimate"]")`
```
Quitting from lines 2-16 (test.Rmd)
Error in parse(text = code, keep.source = FALSE) :
<text>:1:54: unexpected string constant
1: knitr::inline_expr("coef(summary(model))["(Intercept)", "
^
Calls: <Anonymous> ... hook_eval -> withVisible -> eval -> parse_only -> parse
Execution halted
```
-->
You can escape the double quotes:
---
title: "Untitled"
author: "CLRR"
date: "2020/6/20"
documentclass: article
output:
bookdown::pdf_document2:
latex_engine: xelatex
keep_tex: TRUE
---
This verbatim can appear in the output:
`r knitr::inline_expr("coef(summary(model))[\"(Intercept)\", \"Estimate\"]")`
In the comments, #monte provides the other solution, which is alternating single and double quotes: knitr::inline_expr('coef(summary(model))["(Intercept)", "Estimate"]')
I am learning how to use bookdown package and right now I am practicing with Yihui Xie minimal example. In my test I want a gitbook and a pdf output.
What I would like to do is to specifying some options for pdf output with LuaLaTeX engine. So if I do something like that :
bookdown::gitbook:
css: style.css
config:
toc:
before: |
<li>A Minimal Book Example</li>
after: |
<li>Published with bookdown</li>
download: ["pdf", "epub"]
bookdown::pdf_book:
includes:
in_header: preamble.tex
latex_engine: lualatex
fontsize: 12pt
citation_package: natbib
keep_tex: yes
bookdown::epub_book: default
I have this error when I try to build the book :
Error in base_format(toc = toc, number_sections = number_sections, fig_caption = fig_caption, :
unused argument (fontsize = "12pt")
Calls: <Anonymous> ... <Anonymous> -> create_output_format -> do.call -> <Anonymous>
Execution stoped
Exited with status 1.
If I put fontsize: 12pt in the YAML header of the index.Rmd, I don't have this error. If I use bookdown::pdf_document2: I don't have this error either.
I really don't know what I am missing here... Should I place LaTeX configuration options only in the YAML header of my index.Rmdfile ?
I'm trying to set and resize an image as a footer in the title page of a markdown document.
I got the desired results in LaTex with:
\documentclass{article}
\title{Test}
\author{}
\date{}
\usepackage{graphicx}
\usepackage{fancyhdr}
\fancypagestyle{plain}{
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\lfoot{\includegraphics[width=400px]{footer.png}}
}
\begin{document}
\maketitle
\end{document}
But when I try to do the same thing in the Markdown document I get the following error:
Error in yaml::yaml.load(string, ...) :
Scanner error: while scanning a plain scalar at line 6, column 5 found a tab character that violate intendation at line 7, column 1
Calls: ... parse_yaml_front_matter -> yaml_load_utf8 ->
Execution halted
The code I have is:
---
title: "Test"
author: ""
header-includes:
- \usepackage{graphicx}
- \usepackage{fancyhdr}
- \fancypagestyle{plain}{
- \fancyhf{}
- \renewcommand{\headrulewidth}{0pt}
- \renewcommand{\footrulewidth}{0pt}
- \lfoot{\includegraphics[width=400px]{footer.png}}}
output: pdf_document
---
I've tried solutions like Creating a footer for every page using R markdown but it does't do the job for the title page.
Try:
---
title: "Test"
author: ""
header-includes: |
\usepackage{graphicx}
\usepackage{fancyhdr}
\fancypagestyle{plain}{
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\lfoot{\includegraphics[width=400px]{footer.png}}}
output: pdf_document
---
Yaml is a beast for escaping quotes and suchlike. You might want to create a separate file containing your latex header and just include that.
---
header-includes: yourfile.tex
---
I am trying to create an R markdown file but when I do I get the following error:
Line 2:
Error in .Call(C_str Sub_replacement, str, from, to, NULL, value) :
Incorrect number of arguments (5), expecting 6 for 'C_str Sub Replacement'
Calls: <Anonymous> ... indir -> inline exec -> <Anonymous> -> str_sub<- -> .Call
I have tried searching the internet and can not find an answer to this specific error. I am running R-3.3.0 and using R Studio.
I have updated the packages - knitr, markdown and yaml.
The following is my set up:
---
title: "Setting up a DQASS PC"
author: "DKMillington"
date: "`r format(Sys.Date(), '%d/%m/%Y')`"
header-includes:
- \usepackage{amsmath}
output:
rmarkdown::html_vignette:
css: mystyle.css
toc: true
number_sections: true
---
```{r, echo = FALSE, message = FALSE}
knitr::opts_chunk$set(collapse = TRUE, comment = "#>")
library(dqass)
```
Thank you for your time in advance.
Dale