I am struggling with changing the font of my pdf files. I don't have Helvetica on my computer so I am unable to compile .pdf (html works perfectly). I believe my Rmarkdown coding is not working but it is identical to what is suggested here. LaTeX is installed and properly working, I can compile using XeLaTeX from Lyx.
---
title: "5_jan"
author: "Matias Andina"
date: "January 5, 2017"
output:
pdf_document:
latex_engine: xelatex
sansfont: Calibri Light
---
As far as I understand, Calibri font is loaded
fonts()[grepl('Calibri',fonts())]
[1] "Calibri" "Calibri Light"
I keep geting the cannot load afm file 'Helvetica.afm' error. This is my session
sessionInfo()
R version 3.3.0 (2016-05-03)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods
[7] base
other attached packages:
[1] extrafont_0.17 knitr_1.13 dplyr_0.4.3
loaded via a namespace (and not attached):
[1] Rcpp_0.12.7 digest_0.6.9 assertthat_0.1 R6_2.1.2
[5] Rttf2pt1_1.3.4 DBI_0.4-1 magrittr_1.5 highr_0.6
[9] lazyeval_0.2.0 extrafontdb_1.0 rmarkdown_0.9.6 tools_3.3.0
[13] yaml_2.1.13 parallel_3.3.0 htmltools_0.3.5
UPDATE
The error is with R code chunks. If I knit everything but the R chunk it works
---
title: "5_jan_hplc"
author: "Matias Andina"
date: "January 5, 2017"
output:
pdf_document:
latex_engine: xelatex
mainfont: Calibri Light
---
this is my test
I can write anything here and it will render **perfectly**
```{r}
plot(mtcars)
```
processing file: test.Rmd
Quitting from lines 16-17 (test.Rmd)
Error in grDevices::pdf(NULL, width, height, ...) :
failed to initialise default PDF font
Calls: <Anonymous> ... chunk_device -> dev_new -> do.call -> <Anonymous> -> <Anonymous>
In addition: Warning messages:
1: In grDevices::pdf(NULL, width, height, ...) :
afm file 'C:\PROGRA~1\R\R-33~1.0/library/grDevices/afm/Helvetica.afm' could not be opened
2: In grDevices::pdf(NULL, width, height, ...) :
cannot load afm file 'Helvetica.afm'
Execution halted
Related
My quarto documents have stopped rendering suddenly. I have reinstalled RStudio and the quarto package, but this issue persists.
When I open a new quarto document, I no longer see the boilerplate material in the new document. The document is empty as if I had selected Create Empty Document, but I haven't.
Then, the document renders when all I include is raw text, but when I include an r code chunk, I get the following message.
Error in xfun::normalize_path(path, ..., must_work = must_work, resolve_symlink = FALSE) :
unused argument (resolve_symlink = FALSE)
Calls: .main ... execute -> setwd -> dirname -> <Anonymous> -> normalize_path
Execution halted
Here is the quarto document I'm attempting to render.
---
title: "Testing"
---
```{r}
mtcars |> print()
```
Here is my session info:
R version 4.2.2 (2022-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 22621)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.utf8
[2] LC_CTYPE=English_United States.utf8
[3] LC_MONETARY=English_United States.utf8
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.utf8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] Rcpp_1.0.9 ps_1.7.2 digest_0.6.30 later_1.3.0
[5] jsonlite_1.8.4 pacman_0.5.1 evaluate_0.20 zip_2.2.2
[9] rlang_1.0.6 cli_3.4.1 rstudioapi_0.14 fs_1.5.2
[13] rmarkdown_2.20 tools_4.2.2 yaml_2.3.6 xfun_0.35
[17] fastmap_1.1.0 parallel_4.2.2 compiler_4.2.2 processx_3.8.0
[21] htmltools_0.5.4 knitr_1.41 quarto_1.2
I was having the exact same issue with knitr, this worked for me:
Remove the package "xfun" from the packages section, then reinstall it immediately after.
I'd tried changing the root install for R and everything. Turns out it was just xfun being weird.
Found the solution on the Posit Community forum.
Do you have any spaces in the filename or file path? That was preventing me from rendering for a bit.
My Problem
I've been using seamlessly R's bookdown for a couple of weeks now until I've encountered the following error when running it's default template (skeleton) in RStudio:
output file: _main.knit.md
! Paragraph ended before \MT#prot#l was complete.
<to be read again>
\par
l.141
Error: LaTeX failed to compile _main.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See _main.log for more info.
Execution halted
Error: bookdown::render_book() failed to render the output format 'bookdown::pdf_book'.
Execution halted
Exited with status 1.
My Initial Diagnosis
The html version bookdown::gitbook() is still working! When I commented-out as follows the bookdown::pdf_book() portion in the _output.yml file, the book rendered with all the LaTeX equations. Moreover, bookdown::epub_book() still also works.
bookdown::gitbook:
css: style.css
config:
toc:
before: |
<li>A Minimal Book Example</li>
after: |
<li>Published with bookdown</li>
edit: https://github.com/USERNAME/REPO/edit/BRANCH/%s
# download: ["pdf", "epub"]
# bookdown::pdf_book:
# includes:
# in_header: preamble.tex
# latex_engine: xelatex
# citation_package: natbib
# keep_tex: yes
# bookdown::epub_book: default
I have resintalled RStudio, R, Rtools (with path included) TinyTex and updated everything as suggested in https://yihui.org/tinytex/r/#debugging but still of no avail.
My _main.log File
For reference, my _main.log file is here: https://github.com/rvcuenca/default_bookdown_template/blob/main/_main.log
My sessionInfo()
R version 4.1.2 (2021-11-01)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] rstudioapi_0.13 knitr_1.36.9 magrittr_2.0.1 usethis_2.1.5 gert_1.4.3
[6] R6_2.5.1 rlang_0.4.12 fastmap_1.1.0 fansi_0.5.0 httr_1.4.2
[11] tools_4.1.2 sys_3.4 xfun_0.28.10 utf8_1.2.2 cli_3.1.0
[16] withr_2.4.3 gitcreds_0.1.1 htmltools_0.5.2 askpass_1.1 ellipsis_0.3.2
[21] rprojroot_2.0.2 openssl_1.4.5 yaml_2.2.1 digest_0.6.29 tibble_3.1.6
[26] lifecycle_1.0.1 crayon_1.4.2 bookdown_0.24.4 purrr_0.3.4 vctrs_0.3.8
[31] fs_1.5.2 credentials_1.3.2 curl_4.3.2 glue_1.5.1 evaluate_0.14
[36] rmarkdown_2.11.3 gh_1.3.0 pillar_1.6.4 compiler_4.1.2 jsonlite_1.7.2
[41] pkgconfig_2.0.3
My Question
Any thoughts where could have I went wrong?
I'm trying to type up some statistics notes for one of my classes in bookdown. bookdown is not rendering the text written for any chapter with subsections. There is a bunch of text within each subsection, but it is not showing up when I compile to pdf.
Any ideas about what could be causing the problem?
The only thing that shows up is the section headers for the chapter. Sometimes deleting the files in _book is a workaround, but I can't reproduce the error easily. Everything seems to work, then I add a little text, and then I have the rendering problem. The document seems to compile with no warnings. A screenshot of the what I'm getting is included.
I'm running the most current version of RStudio.
Session info:
R version 3.6.1 (2019-07-05)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18362)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics
[3] grDevices utils
[5] datasets methods
[7] base
loaded via a namespace (and not attached):
[1] compiler_3.6.1
[2] bookdown_0.13.2
[3] htmltools_0.3.6
[4] tools_3.6.1
[5] yaml_2.2.0
[6] Rcpp_1.0.2
[7] rmarkdown_1.15
[8] knitr_1.25
[9] xfun_0.9
[10] digest_0.6.20
[11] packrat_0.5.0
[12] evaluate_0.14
My yaml header is:
title: "A Book"
author: "Frida Gomam"
site: bookdown::bookdown_site
documentclass: book
output:
bookdown::pdf_book:
includes:
in_header: preamble-latex.tex
# bookdown::gitbook:
# includes:
# before_body: preamble-mathjax.tex
bibliography: [book.bib]
biblio-style: apalike
You should click the Build Book button, instead of the Knit button. The latter only previews the current chapter. See documentation here: https://bookdown.org/yihui/bookdown/rstudio-ide.html
Thank you in advance for any help! I have MikTeX installed on my computer (2.9.6) and the tinytex package but Rmarkdown will not knit to a pdf (it will however for html) no matter what engine I use. I updated the packages and the other solutions seem to suggest downgrading or updating the packages so Im not sure what to do!
Output created: ttest.pdf
Error in tools::file_path_as_absolute(output_file) :
file 'ttest.pdf' does not exist
Calls: <Anonymous> -> <Anonymous>
In addition: Warning message:
In readLines(logfile) : incomplete final line found on 'ttest.log'
Execution halted
Session info
> sessionInfo()
R version 3.5.0 (2018-04-23)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United
States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] tinytex_0.5
loaded via a namespace (and not attached):
[1] compiler_3.5.0 backports_1.1.2 magrittr_1.5 rprojroot_1.3-2
htmltools_0.3.6
[6] tools_3.5.0 yaml_2.1.19 Rcpp_0.12.17 stringi_1.1.7
rmarkdown_1.10
[11] knitr_1.20 stringr_1.3.1 digest_0.6.15 evaluate_0.10.1
RMD File
---
title: "ttest"
author: "Erik Maroney"
date: "June 22, 2018"
output: pdf_document
---
```{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)
```
I have a functioning Shiny interactive document (.Rmd) file that works fine locally and on shinyapps.io. I am trying to prerender it using instructions here (http://rmarkdown.rstudio.com/authoring_shiny_prerendered.html) but am running into an unusual error when I introduce a selectInput().
The error message I am getting is the following:
Here's a mininal code block that produces the error.
(app.Rmd)
---
title: 'a title'
output: html_document
runtime: shiny_prerendered
---
```{r, context = 'setup', include=FALSE}
library(shiny)
```
```{r, context='render'}
selectInput('hello','Hi',choices=c('1','2'))
```
```{r, context='server'}
```
Here is my sessionInfo():
R version 3.2.2 (2015-08-14)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] shiny_1.0.0
loaded via a namespace (and not attached):
[1] Rcpp_0.12.6 digest_0.6.10 rprojroot_1.1 mime_0.5 R6_2.1.2 xtable_1.8-2 backports_1.0.3
[8] magrittr_1.5 evaluate_0.10 stringi_1.1.1 rmarkdown_1.3 tools_3.2.2 stringr_1.1.0 httpuv_1.3.3
[15] yaml_2.1.13 htmltools_0.3.5 knitr_1.15.1
I've tried changing the encoding of my Rmd to UTF-8 with no luck. Changing the runtime to "shiny" (from "shiny_prerendered") seems to fix the problem. Is this a bug in the "shiny_prerendered" runtime or am I doing something wrong?