quarto-dev / quarto-r Goto Github PK
View Code? Open in Web Editor NEWR interface to quarto-cli
Home Page: https://quarto-dev.github.io/quarto-r/
R interface to quarto-cli
Home Page: https://quarto-dev.github.io/quarto-r/
I have two more feature requests for quarto R package.
(1) In the quarto R package, can the message for quarto_version()
function be more informative? Currently it shows simple message like "1.2.15". Can it be changed to "Your quarto version is 1.2.15. The latest available version is 1.2.75."
(2) After such a message, if the user wants to update the quarto version, he/she has to manually update the version through quarto website. Is it possible to create a function within quarto package so that the user can directly update the quarto version right from within RStudio or VSCode? This is in line with function tinytex::tlmgr_update()
, which updates Latex packages from within RStudio.
Originally posted by @bhattmaulik in quarto-dev/quarto-cli#2374 (comment)
When quarto_render()
errors out due to an error in a code chunk, it would be helpful if the condition message were more informative. Tools like targets
would have an easier time logging and documenting errors. From ropensci/tarchetypes#99.
lines <- c(
"---",
"title: 'error'",
"format: html",
"editor: source",
"---",
"",
"```{r}",
"stop('true message')",
"```"
)
writeLines(lines, "report.qmd")
tryCatch(
quarto::quarto_render("report.qmd", quiet = TRUE),
error = function(condition) {
print(sprintf("Quarto error message: %s", conditionMessage(condition)))
}
)
#> [1] "Quarto error message: ! System command 'quarto' failed"
Created on 2022-07-01 by the reprex package (v2.0.1)
From render()
envir
The environment in which the code chunks are to be evaluated during knitting (can use new.env() to guarantee an empty new environment).
Can this be done from quarto?
I prefer using source mode to visual mode because of the differences in markdown syntax. However, there is one thing that I miss a lot from visual mode: conveniently creating and modifying markdown tables.
I think this problem can be addressed by adding an RStudio addin for creating and inserting a markdown table. Besides, there should also be an addin for parsing and modifying an existing markdown table.
By the way, I think there can also be addins for inserting special characters (emoji, unicode, etc.), but these are not as necessary.
Hi,
I am using a test.qmd
document to test rendering to HTML using the following command:
Rscript_call(
quarto_render,
list(input = "Rscripts/test.qmd",
output_format = "html",
output_file = "reports/test.html")
)
test.qmd
looks as follows:
test.txt
title: "Test"
format: htmlTest code
library(ggplot2) data(iris) summary(iris)
ggplot(iris, aes(x = Sepal.Length, y = Sepal.Width)) + geom_point()
The HTML file does generate but it doesn't have the expected formatting and the figures don't show (HTML saved as a PDF attached).
Am I doing something incorrectly here? This is the information that is printed when it renders.
output file: test.knit.md
pandoc --output ../reports/test.html
to: html
standalone: true
section-divs: true
html-math-method: mathjax
wrap: none
default-image-extension: pngmetadata
document-css: false
link-citations: true
date-format: long
lang: en
title: TestOutput created: ../reports/test.html
RStudio 2022.07.2 (build 576)
macOS 12.6
Best wishes,
Lucy
Here is a directory/repo with three files:
a-without-shiny.qmd
: Quarto doc without Shinyb-with-shiny.qmd
: Quarto doc with Shinyindex.qmd
: Quarto doc without ShinyIf I run quarto::quarto_publish_app("b-with-shiny.qmd", account = "minecr")
, the deployed doc is called b-with-shiny
but it actually contains the contents of index.qmd
: https://minecr.shinyapps.io/b-with-shiny/.
I have a-without-shiny.qmd
in this repo because my original guess was that it publishes the document that comes alphabetically first, but I think it just publishes index.qmd
if it exists, otherwise it publishes the correct one. This seems like a bug to me, it should publish the document provided in the call, despite index.qmd
being special.
Hi,
I'm using Fira Code as a monospace font, but the same is happening when trying with JetBrains Mono.
When I render to HTML, all ligatures and alternates are present and looking fine, e.g.:
However, knitting to PDF results in just one of them showing up, and several "standard" glyphs (letters) missing:
(it's missing opening brackets, and the whole echo: false
sentence in the last paragraph)
This is the code I'm using (note that the PDF output doesn't change whether I specify monofontoptions:
or not):
---
title: "Test"
author: "MB"
editor: visual
format:
html:
theme: journal
fontsize: 12pt
monofont: Fira Code
mainfont: SF Pro Display
pdf:
fontsize: 10pt
monofont: Fira Code
monofontoptions:
- Ligatures = TeX
mainfont: SF Pro Text
sansfont: SF Pro Text
highlight-style: github
papersize: a4
cite-method: biblatex
documentclass: article
---
```{r}
1 + 1
a <- 4
# 3 != 5
```
You can add options to executable code like this
```{r}
#| echo: false
2 * 2
```
Thanks,
—M
In theory it's possible to have different versions of quarto
available via the terminal versus what version the RStudio IDE + Render button or quarto::quarto_render()
default to.
quarto::quarto_path()
is a useful upstream step, but it would be great to also return the quarto version that R/RStudio are currently using.
File containing string r ** 2
fails to compile. File containing string s ** 2
renders A-OK
$ echo '`r ** 2`' > mre.qmd
~/bug
$ quarto render mre.qmd
Error in loadNamespace(x) : there is no package called ‘jsonlite’
Calls: .main ... loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
Execution halted
R installation:
Version: 4.2.1
Path: /usr/local/Cellar/r/4.2.1/lib/R
LibPaths:
- /usr/local/lib/R/4.2/site-library
- /usr/local/Cellar/r/4.2.1/lib/R/library
rmarkdown: (None)
The rmarkdown package is not available in this R installation.
Install with install.packages("rmarkdown")
~/bug ⍉
$ echo '`s ** 2`' > ok.qmd
~/bug
$ quarto render ok.qmd
pandoc
to: html
output-file: ok.html
standalone: true
section-divs: true
html-math-method: mathjax
wrap: none
default-image-extension: png
metadata
document-css: false
link-citations: true
date-format: long
lang: en
Output created: ok.html
There was an envir
argument in rmarkdown::render
, but now it is missing in quarto::quarto_render
.
A very important argument, please add.
So far we use RMarkdown to create analyses and related publications. For this purpose we have created several .rmd
documents, which are included one after the other in a bundling .rmd
file and together create the final document. Different variables are created in different places of the included files and sometimes used and included in multiple places (in different .rmd
files).
For example, the "data-wrangling" and "preprocessing" is done with little Markdown output in the first .rmd
files, and the text-heavy subsequent parts refer to the previously prepared data in several places and includes it dynamically in different places.
With the big announcement of Quarto and all the advantages that come with it, we would like to map the same in Quarto, but it seems that the transfer of variables from one to another .qmd
document is not possible, even if these documents are not rendered individually and separately but bundled together e.g. in a book.
Maybe this is related to #29.
I would expect that that if a variable is assigned in one "chapter" of the book, it can be used in another chapter that follows it, without having to re-source everything in each chapter manually. This would be a huge drawback.
Minimal quarto code example: https://github.com/joundso/quarto-book-test/tree/master/qmd-project
The book is defined here and sources intro.qmd
(here the variable object_from_intro
is created) and summary.qmd
(where the variable object_from_intro
is dynamically used).
The creation of this book fails because the variable object_from_intro
is not available when rendering summary.qmd
, although it was created in the previously rendered intro.qmd
.
Error:
Rendering:
[1/3] index.qmd
[2/3] qmd/intro.qmd
processing file: intro.qmd
|....................... | 33%
ordinary text without R code
|............................................... | 67%
label: unnamed-chunk-1
|......................................................................| 100%
ordinary text without R code
output file: intro.knit.md
[3/3] qmd/summary.qmd
processing file: summary.qmd
|......................................................................| 100%
inline R code fragments
Quitting from lines 2-3 (summary.qmd)
Error in eval(parse_only(code), envir = envir) :
object 'object_from_intro' not found
Calls: .main ... inline_exec -> hook_eval -> withVisible -> eval -> eval
Execution halted
The same with RMarkdown works perfectly:
Hi,
Does this package update together with quarto-cli?
When one runs quarto::quarto_render(".")
does it work on the R-package version or CLI version?
Thank you
Is there a way to reproduce the functionality of knitr::opts_knit$set(root.dir = '/path/to/dir')
from Rmarkdown (which does work in Quarto as well, when ran from a chunk) but straight from the YAML block? Something like:
---
knitr:
options:
root:
dir: "/path/to/dir"
---
(I've tried it, and also substituting options
with opts_knit
, and it doesn't work.
Thank you!
When I set output_file
in quarto::quarto_render()
, the function fails. This happens no matter output_file
preexists or not.
lines <- c(
"---",
"title: 'test'",
"format: html",
"---"
)
f <- tempfile(fileext = ".qmd")
writeLines(lines, f)
quarto::quarto_render(f)
#> �[1mpandoc �[22m
#> to: html
#> output-file: file8f826c66ae57.html
#> standalone: true
#> section-divs: true
#> html-math-method: mathjax
#> wrap: none
#> default-image-extension: png
#>
#> �[1mmetadata�[22m
#> document-css: false
#> link-citations: true
#> date-format: long
#> lang: en
#> title: test
#>
#> Output created: file8f826c66ae57.html
quarto::quarto_render(f, output_file = "test.html")
#> �[1mpandoc --output ../../../../../../private/var/folders/r2/ycy8hp_54yd7bxc_0kyb5trm0000gn/T/RtmpJSZSyR/reprex-8e845d74fc79-super-sable/test.html�[22m
#> to: html
#> standalone: true
#> section-divs: true
#> html-math-method: mathjax
#> wrap: none
#> default-image-extension: png
#>
#> �[1mmetadata�[22m
#> document-css: false
#> link-citations: true
#> date-format: long
#> lang: en
#> title: test
#>
#> pandoc: ../../../../../../private/var/folders/r2/ycy8hp_54yd7bxc_0kyb5trm0000gn/T/RtmpJSZSyR/reprex-8e845d74fc79-super-sable/test.html: openFile: does not exist (No such file or directory)
#> Error in "processx::run(quarto_bin, args, echo = TRUE)": ! System command 'quarto' failed
Created on 2022-08-25 with reprex v2.0.2
package and quarto version
packageVersion("quarto")
#> [1] '1.2.0.9000'
processx::run("quarto", c("--version"))$stdout
#> [1] "1.1.132\n"
Created on 2022-08-25 with reprex v2.0.2
A Quarto presentation in Rstudio created with a space in the filename doesn't render correctly in Windows. It produces the following error in the background jobs pane:
'C:/Program' is not recognized as an internal or external command,
operable program or batch file.
When the space is replaced by an underscore, the file will render. The filenames I tested were "demo script.Qmd", which does not render, vs "demo_script.Qmd", which renders. The file I tried to render was the basic template for a revealJS presentation.
Sorry if this is not the correct place to post this issue, Quarto seems to have lots of pieces and I am not sure what is causing this to break.
A function and/or RStudio Addin that allows users to create the skeleton for a new blog post. I used the new_post
functionality in blogdown
a lot and would love to incorporate a quarto version into my workflow.
Quarto comes with a "website:blog" project type, which signals a common-enough use case for this kind of functionality. For now, it could just create a new post in the posts
directory (by default). Eventually it might use a dedicated "website:blog" yaml parameter to indicate which directory the new post should be located in?
Something like:
(using quarto-web
directory as example)
website:
blog: docs/blog/posts
and then quarto::new_post("my_new_post")
would create docs/blog/posts/my_new_post/index.qmd
I tried to include a skeleton.qmd file as a skeleton file in an R package like I would with a skeleton.Rmd file.
Unfortunately, for the package user rmarkdown::draft()
doesn't behave as expected because the skeleton.Rmd filename is hardcoded here. All the files from the skeleton directory are copied but the skeleton.qmd file is not renamed.
An example is as follows.
remotes::install_github("remlapmot/mytestpackage", quiet = TRUE)
rmarkdown::draft("example.qmd", template = "quarto_template", package = "mytestpackage", edit = FALSE)
#> Warning in file.rename(file.path(dirname(file), "skeleton.Rmd"), file): cannot
#> rename file 'example/skeleton.Rmd' to 'example/example.Rmd', reason 'The system
#> cannot find the file specified'
dir("example")
#> [1] "skeleton.qmd"
Created on 2022-08-10 by the reprex package (v2.0.1)
Is there different advice how to include Quarto templates in R packages, or would you add the equivalent of rmarkdown::draft()
to this package, or maybe allow rmarkdown::draft()
to accept skeleton.qmd files?
I followed the isntructions: downloaded last RStudio version and sample QMD document.
I click on Render, but nothing happens. Is there any package I should install?
In the RStudio interface, there is a "Clear Knitr Cache" button under the Rmd document, but not in the qmd document or rmd/qmd document under the Quarto project. Can this similar function button be added in the future? Thanks!
Updating Quarto through R codes and auto setup the path can be helpful. I found when installing quarto separately as the Website suggests, Rstudio would not recognize that automatically. I installed the developed version in Linux Ubuntu as the README instructed and got this back in the terminal
$ quarto --version
99.9.9
But Rstudio still only recognized the old version:
> quarto::quarto_path()
[1] "/usr/local/bin/quarto"
> quarto::quarto_version()
[1] ‘0.9.640’
The same issue happened when I installed a stable version in Windows. I know it is probably again the path issue, although the path in Linux looks right. Anyway, a function that can update Quarto and set the path right would make quarto more user-friendly.
This would make it much nicer to use quarto_render()
with @wlandau's targets
package to produce large volumes of parameterized reports. Currently it's a bit painful to produce parameterized reports when there are multiple output formats and you would like to render to them all at once in a targets pipeline.
If there some other easy way to programmatically access the names/paths of rendered files, that would also be great.
It seems like, currently, the quarto PDF and HTML output only supports default
, kable
, tibble
, and paged
4 four ways for df-print
. And paged
is the only one option that centers the table in HTML only, and it's not visually pleasing to me.
In the .rmd
file, you can force the centering by !expr pander::pander
to utilize pander
print, which has the best looking! It would be lovely if this is in Quarto or force df-print
to be pander
.
Does anyone know how to create a function to make this happen?
One generally first plots via the interactive editor, iteratively running each cell block. However, the following does nothing to change the plot size produced in either source
or visual` mode in Rstudio:
#| fig-width:
#| fig-height:
How is one supposed determine the "optimal" width/height to visualize the figure (e.g., a large faceted figure) without constantly rendering the entire document or using both #| fig-*
and {r, fig.width=X, fig.height=X}
for each plot, which is overly cumbersome code, especially with a lot of figures?
I'm using quarto 1.0.36.
I'm afraid this is not a particularly reproducible issue as I can't share the code required to build the notebook, but I'm running into issues with heap allocation.
Some notes about the notebook setup:
_quarto.yml
panel-tabset
, {mapview}
dynamic maps, and {gt}
tables produced in map()
calls
#| output: asis
for map()
{gt}
tables massively slows down the rendering of the notebook{mapview}
maps to static {ggplot2}
maps stopped the issue, but it returned when I added a couple more {ggplot2}
plotsWhen the original Quarto notebook is rendered, all the chunks execute as expected in a reasonable time before spending 6+ minutes trying to convert the notebook.knit.md
document to html.
Rendering the exact same code in an RMarkdown document (with tabsets) works as expected.
Quarto version
❯ quarto --version
0.9.587
Sys.info()
r$> Sys.info()
sysname
"Darwin"
release
"21.5.0"
version
"Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:29 PDT 2022; root:xnu-8020.121.3~4/RELEASE_ARM64_T8101"
nodename
"user.local"
machine
"arm64"
login
"root"
user
"user"
effective_user
"user"
sessionInfo()
r$> sessionInfo()
R version 4.1.2 (2021-11-01)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Monterey 12.4
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices datasets utils methods base
other attached packages:
[1] glue_1.6.2 paletteer_1.4.0.9000 pak_0.3.0 sjlabelled_1.2.0.2 shiny_1.7.1 kableExtra_1.3.4 gt_0.6.0.9000 leafpop_0.1.0 leafem_0.2.0.9005 mapview_2.11.0.9000 sf_1.0-7
[12] testthat_3.1.4.9000 rlang_1.0.3 withr_2.5.0 skimr_2.1.4 janitor_2.1.0 ggforce_0.3.3 RColorBrewer_1.1-3 MetBrewer_0.2.0 ggridges_0.5.3 hrbrthemes_0.8.0 forcats_0.5.1
[23] stringr_1.4.0 dplyr_1.0.9 purrr_0.3.4 readr_2.1.2 tidyr_1.2.0 tibble_3.1.7 ggplot2_3.3.6 tidyverse_1.3.1 targets_0.12.1
loaded via a namespace (and not attached):
[1] readxl_1.4.0 uuid_1.1-0 backports_1.4.1 servr_0.24 systemfonts_1.0.4 plyr_1.8.7 igraph_1.3.2 repr_1.1.4 sp_1.5-0 splines_4.1.2
[11] crosstalk_1.2.0 leaflet_2.1.1 pryr_0.1.5 httpgd_1.3.0 digest_0.6.29 htmltools_0.5.2 leaflet.providers_1.9.0 fansi_1.0.3 checkmate_2.1.0 magrittr_2.0.3
[21] base64url_1.4 tzdb_0.3.0 modelr_0.1.8 extrafont_0.18 extrafontdb_1.0 svglite_2.1.0 prettyunits_1.1.1 colorspace_2.0-3 rvest_1.0.2 lobstr_1.1.2
[31] paint_0.1.5 haven_2.5.0 xfun_0.31 prismatic_1.1.0 callr_3.7.0 crayon_1.5.1 jsonlite_1.8.0 brew_1.0-7 polyclip_1.10-0 gtable_0.3.0
[41] webshot_0.5.3 Rttf2pt1_1.3.10 quarto_1.1.0.9000 scales_1.2.0 DBI_1.1.3 Rcpp_1.0.8.3 viridisLite_0.4.0 xtable_1.8-4 units_0.8-0 proxy_0.4-27
[51] stats4_4.1.2 htmlwidgets_1.5.4 httr_1.4.3 wk_0.6.0 ellipsis_0.3.2 pkgconfig_2.0.3 farver_2.1.0 sass_0.4.1 dbplyr_2.2.0 utf8_1.2.2
[61] here_1.0.1 tidyselect_1.1.2 labeling_0.4.2 later_1.3.0 cachem_1.0.6 munsell_0.5.0 cellranger_1.1.0 tools_4.1.2 cli_3.3.0 generics_0.1.2
[71] broom_0.8.0 evaluate_0.15 fastmap_1.1.0 yaml_2.3.5 rematch2_2.1.2 processx_3.6.1 knitr_1.39 fs_1.5.2 s2_1.0.7 satellite_1.0.4
[81] nlme_3.1-153 mime_0.12 xml2_1.3.3 brio_1.1.3 compiler_4.1.2 rstudioapi_0.13 png_0.1-7 e1071_1.7-11 reprex_2.0.1 tweenr_1.0.2
[91] bslib_0.3.1 stringi_1.7.6 highr_0.9 ps_1.7.1 gdtools_0.2.4 lattice_0.20-45 Matrix_1.3-4 classInt_0.4-7 vctrs_0.4.1 pillar_1.7.0
[101] lifecycle_1.0.1 jquerylib_0.1.4 insight_0.17.1 data.table_1.14.2 raster_3.5-15 httpuv_1.6.5 R6_2.5.1 promises_1.2.0.1 renv_0.15.4-44 KernSmooth_2.23-20
[111] codetools_0.2-18 MASS_7.3-54 assertthat_0.2.1 rprojroot_2.0.3 mgcv_1.8-40 hms_1.1.1 terra_1.5-34 grid_4.1.2 class_7.3-19 rmarkdown_2.14
[121] snakecase_0.11.0 lubridate_1.8.0 base64enc_0.1-3
_quarto.yml
project:
title: "title"
title-block-banner: true
toc: true
format:
html:
page-layout: full
theme: flatly
code-copy: true
code-fold: true
code-overflow: wrap
code-tools: true
code-link: true
anchor-sections: true
execute:
cache: false
Error Message
output file: notebook.knit.md
pandoc
to: html
output-file: notebook.html
standalone: true
section-divs: true
html-math-method: mathjax
wrap: none
default-image-extension: png
toc: true
metadata
document-css: false
link-citations: true
date-format: long
lang: en
title-block-banner: true
page-layout: full
theme: flatly
code-copy: true
anchor-sections: true
title: Notebook
author: Callum Arnold
date: today
{paint} masked print.data.frame
<--- Last few GCs --->
[57760:0x7fbda0038000] 372317 ms: Mark-sweep 1401.0 (1403.6) -> 1400.9 (1407.1) MB, 7.9 / 0.0 ms (average mu = 0.999, current mu = 0.954) allocation failure; scavenge might not succeed
<--- JS stacktrace --->
#
# Fatal javascript OOM in Reached heap limit
#
/usr/local/bin/quarto: line 106: 57760 Trace/BPT trap: 5 "${SCRIPT_PATH}/tools/deno" ${QUARTO_ACTION} ${QUARTO_DENO_OPTIONS} ${QUARTO_DENO_EXTRA_OPTIONS} "${QUARTO_IMPORT_ARGMAP}" "${QUARTO_TARGET}" "$@"
Previously, this feature was removed in rmarkdown, and it doesn't work in quatro either.
Could you bring this setting to a certain option, please? (preferably in the title section of the qmd file)
The released version, or development version.
When switching from source to visual editor, then back again to source, some of the formatting is dropped on some div chunks.
e.g. after all the switches, the speaker notes div is shown as:
::: notes
rather than
::: {.notes}
I have noticed the dropping of . and {} for .notes, some .fragments and .footer div sections (if additional parameters are in the div chunk, e.g. column width or fragment display types, the {} tend to stay).
Sometimes, missing the {.} has messed up subsequent chunks for me, where they are not formatted correctly/corresponding to their div type (indicated by what would be in {})
I am trying to render a README.md
file from a Quarto file, but due to the bug mentioned here, I have to call the Quarto doc read_me.qmd
and use output-file: "README"
in the header.
However, this seems to cause some problems, particularly with the interaction of the output-file
flag, R chunks in the Quarto doc, and the presence of a _quarto.yml
file.
If there is an output-file
set, the Quarto doc contains an R chunk, and there is a _quarto.yml
file in the directory, the following error occurs:
processing file: read_me.qmd
|....................... | 33%
ordinary text without R code
|............................................... | 67%
label: unnamed-chunk-1
|......................................................................| 100%
ordinary text without R code
output file: read_me.knit.md
pandoc
to: gfm+footnotes+tex_math_dollars-yaml_metadata_block
output-file: /Users/MJ/GitHub/testing_quarto_in_r/README.md
standalone: true
default-image-extension: png
metadata
editor: visual
ERROR: NotFound: No such file or directory (os error 2)
However, if any one of the R chunk, output-file
, or _quarto.yml
is removed, the Quarto document will render just fine.
I put together a small test repository that contains 3 Quarto docs with various combinations of these factors to demonstrate the error.
I'm running this with the latest versions of R, RStudio, and Quarto, on MacOS Monterey 12.4.
Using the layout option #| layout: l-page
(known from distill) to strech the content over a page leads to a lua error.
```{r}
#| label: diamonds
#| include: true
#| layout: l-page
ggplot2::ggplot(ggplot2::diamonds, ggplot2::aes(carat, price)) + ggplot2::geom_smooth() +
ggplot2::facet_grid( ~ cut)
```
ERROR: unexpected character 'l' at line 1 col 1
Error running filter /opt/quarto/share/filters/layout/layout.lua:
/opt/quarto/share/pandoc/datadir/_json.lua:167: bad 'for' initial value (number expected, got nil)
stack traceback:
/opt/quarto/share/pandoc/datadir/_json.lua:381: in function '_json.decode'
/opt/quarto/share/filters/layout/layout.lua:3598: in function 'parseLayoutWidths'
/opt/quarto/share/filters/layout/layout.lua:4231: in function 'layoutCells'
/opt/quarto/share/filters/layout/layout.lua:4055: in function </opt/quarto/share/filters/layout/layout.lua:4048>
I have a number of custom RMarkdown templates for rendering HTML. I would like to know if I can use these for Quarto.
Apologies if this is not the right place to submit this issue -- let me know and I can move it.
When rendering a Quarto document to PDF in RStudio, it works fine with the regular settings. However, when I change the font of the PDF document, the RStudio PDF viewer doesn't render the document properly.
The document itself is normal when viewed in another PDF viewer, like Preview on Mac. See below screenshots.
RStudio 2022.02.0 Build 431
Quarto 0.9.7
MacOS Monterey 12.1
.qmd
file---
title: "pdf_test"
format:
pdf:
mainfont: Times New Roman
---
Four score and seven years ago our fathers brought forth on this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal.
Now we are engaged in a great civil war, testing whether that nation, or any nation so conceived and so dedicated, can long endure. We are met on a great battle-field of that war. We have come to dedicate a portion of that field, as a final resting place for those who here gave their lives that that nation might live. It is altogether fitting and proper that we should do this.
But, in a larger sense, we can not dedicate -- we can not consecrate -- we can not hallow -- this ground. The brave men, living and dead, who struggled here, have consecrated it, far above our poor power to add or detract. The world will little note, nor long remember what we say here, but it can never forget what they did here. It is for us the living, rather, to be dedicated here to the unfinished work which they who fought here have thus far so nobly advanced. It is rather for us to be here dedicated to the great task remaining before us -- that from these honored dead we take increased devotion to that cause for which they gave the last full measure of devotion -- that we here highly resolve that these dead shall not have died in vain -- that this nation, under God, shall have a new birth of freedom -- and that government of the people, by the people, for the people, shall not perish from the earth.
Hi!
Recently, the post-render
functionality has been introduced. This is a great thing, thank you!
But I have a need to refine this functionality: I have a multi-module project with a lot of subdirectories where quarto is just one of many modules. I would like to be able to embed the post-render into the .qmd
-file in the header. For example:
---
title: 'test'
format:
html:
number-sections: TRUE
theme: cosmo
toc: TRUE
post-render: tmp.R
---
And accordingly,the file will be launched tmp.R
which is located in the folder where the .qmd
-file itself lies (the folder in knit/render mode is successfully located via getwd()
).
It is important for me to navigate in the current folder where the current .qmd
-file is located, and not in the entire project
So far, I have to use crutches at the level of the entire project, which is not very good.
I would be grateful if you think about such improvements, thank you!
`ERROR: Error executing 'Rscript': program not found
Unable to locate an installed version of R.
Install R from https://cloud.r-project.org/`
Could anyone tell me how to set up a customised path for R? I got R installed in the local drive (not in a system default folder as I don't have the Admin privilege). I couldn't find any place where I could reset my R path.
Hi! Thanks for this package.
I noticed that this package has no NEWS
or NEWS.md
file containing the changelog of the different versions of this package. That would be very helpful, since it is now unknown what a new package version (e.g., from 1.1 to 1.2) brings.
Furthermore, it is a strict requirement of the GPL >=2 license to document changes (see here for the explanation on choosealicense.com). That being said, this package also lacks a LICENSE
file, so the only hint that this package is licensed under GPL is in the DESCRIPTION
file. I suggest to use e.g. usethis::use_gpl3_license()
which will add the required license file automatically. Alternatively, the text can be copied from https://choosealicense.com/licenses/gpl-2.0/ for GPL-2.0 and from https://choosealicense.com/licenses/gpl-3.0/ for GPL-3.
I saw quarto::quarto::quarto_path()
I'm trying to include a figure into a .qmd file file as
![](
r here::here("data/F220416/F220416S2214/raw/IMG_1785.png"))
(here
library makes sures that the path is an absolute path)
But in the html file that is created, the resulting path looks like
<p><img src="./Users/onurcanbektas/junction/projects/apm.alim.raedler/data/F220416/F220416S2214/raw/IMG_1785.png" class="img-fluid"></p>
i.e the absolute path has .
in front of it.
During the rendering, quarto is warning me that I supplied an absolute path, so it is recognising that it is absolute, but still treats it as a relative path. I think this behaviour is unintendend, hence a bug.
On Windows, it appears the R package does not forward rendering errors from the CLI back to the R session. Works fine on a Mac. Tried with both 146bb4e and 1.1.
lines <- c(
"---",
"title: report",
"output_format: html",
"---",
"```{r}",
"stop(\"this is an error\")",
"```"
)
writeLines(lines, "report.qmd")
tryCatch({
quarto::quarto_render("report.qmd", as_job = FALSE, quiet = TRUE)
message("missed error")
},
error = function(condition) message("caught error")
)
#> missed error
Created on 2022-08-22 with reprex v2.0.2
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#> setting value
#> version R version 4.2.1 (2022-06-23 ucrt)
#> os Windows 10 x64 (build 19044)
#> system x86_64, mingw32
#> ui RTerm
#> language (EN)
#> collate English_United States.utf8
#> ctype English_United States.utf8
#> tz America/New_York
#> date 2022-08-22
#> pandoc 2.18 @ C:/Program Files/RStudio/bin/quarto/bin/tools/ (via rmarkdown)
#>
#> ─ Packages ───────────────────────────────────────────────────────────────────
#> package * version date (UTC) lib source
#> cli 3.3.0 2022-04-25 [1] CRAN (R 4.2.1)
#> digest 0.6.29 2021-12-01 [1] CRAN (R 4.2.1)
#> evaluate 0.16 2022-08-09 [1] CRAN (R 4.2.1)
#> fastmap 1.1.0 2021-01-25 [1] CRAN (R 4.2.1)
#> fs 1.5.2 2021-12-08 [1] CRAN (R 4.2.1)
#> glue 1.6.2 2022-02-24 [1] CRAN (R 4.2.1)
#> highr 0.9 2021-04-16 [1] CRAN (R 4.2.1)
#> htmltools 0.5.3 2022-07-18 [1] CRAN (R 4.2.1)
#> jsonlite 1.8.0 2022-02-22 [1] CRAN (R 4.2.1)
#> knitr 1.39 2022-04-26 [1] CRAN (R 4.2.1)
#> later 1.3.0 2021-08-18 [1] CRAN (R 4.2.1)
#> lifecycle 1.0.1 2021-09-24 [1] CRAN (R 4.2.1)
#> magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.2.1)
#> processx 3.7.0 2022-07-07 [1] CRAN (R 4.2.1)
#> ps 1.7.1 2022-06-18 [1] CRAN (R 4.2.1)
#> quarto 1.2.0.9000 2022-08-22 [1] Github (quarto-dev/quarto-r@146bb4e)
#> R6 2.5.1 2021-08-19 [1] CRAN (R 4.2.1)
#> Rcpp 1.0.9 2022-07-08 [1] CRAN (R 4.2.1)
#> reprex 2.0.2 2022-08-17 [1] CRAN (R 4.2.1)
#> rlang 1.0.4 2022-07-12 [1] CRAN (R 4.2.1)
#> rmarkdown 2.15 2022-08-16 [1] CRAN (R 4.2.1)
#> rstudioapi 0.13 2020-11-12 [1] CRAN (R 4.2.1)
#> sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.2.1)
#> stringi 1.7.8 2022-07-11 [1] CRAN (R 4.2.1)
#> stringr 1.4.1 2022-08-20 [1] CRAN (R 4.2.1)
#> withr 2.5.0 2022-03-03 [1] CRAN (R 4.2.1)
#> xfun 0.32 2022-08-10 [1] CRAN (R 4.2.1)
#> yaml 2.3.5 2022-02-21 [1] CRAN (R 4.2.1)
#>
#> [1] C:/Users/landau/AppData/Local/R/win-library/4.2
#> [2] C:/Program Files/R/R-4.2.1/library
#>
#> ──────────────────────────────────────────────────────────────────────────────
When running quarto::quarto_render
inside a docker container to render a PDF-document I get the following error:
....
|......................................................................| 100%
ordinary text without R code
output file: report.knit.md
pandoc --output report.tex
to: latex
standalone: true
pdf-engine: xelatex
variables:
graphics: true
tables: true
default-image-extension: pdf
metadata
block-headings: true
title: My Report
date: '`r format(Sys.Date(), ''%d-%m-%Y'')`'
documentclass: article
running xelatex - 1
This is XeTeX, Version 3.141592653-2.6-0.999994 (TeX Live 2022) (preloaded format=xelatex)
restricted \write18 enabled.
entering extended mode
running xelatex - 2
This is XeTeX, Version 3.141592653-2.6-0.999994 (TeX Live 2022) (preloaded format=xelatex)
restricted \write18 enabled.
entering extended mode
ERROR: Invalid cross-device link (os error 18), rename 'report.pdf' -> '/opt/output/report.pdf'
Error in `processx::run(quarto_bin, args, echo = TRUE)`:
! System command 'quarto' failed
---
Exit status: 1
stdout & stderr: <printed>
---
Backtrace:
1. quarto::quarto_render(input = "report.qmd", output_format = "pdf", …
2. processx::run(quarto_bin, args, echo = TRUE)
3. processx:::throw(new_process_error(res, call = sys.call(), echo = echo, …
Execution halted
It seems as if something is wrong when trying to place the final pdf report in the output folder. Any ideas to solve the issue would be highly appreciated! Thanks in advance.
Edit:
I do not fully understand the syntax, however, could it be that this part in quarto's source code somehow related because of renaming the file instead of moving it (as the call to Deno.renameSync
suggests)? (and: although affecting python , could this be related as well: core-api/python-client#176 ?)
Inside .qmd
's YAML front-matter. If I set code-fold: true
, the code-tools
would work just fine, but if I set code-fold: false
, I can no longer toggle the code-tools
in particular the code folding and showing button is no longer there, it would just pop up a source code page.
quarto_render
does not support data frames when parsed as a parameter - data frame is printed as list (with columns also lists). The issue occurs with html/pdf/docx outputs.
rmarkdown::render
does support data frames parsed as a parameter in Rmd files
test.qmd:
---
title: "My Document"
params:
mtcars: NULL
---
```{r}
params$mtcars
```
Code to render test.qmd:
quarto::quarto_render("test.qmd",
output_format = "docx",
output_file = "test.docx",
execute_params = list(mtcars=mtcars))
Output
test2.Rmd:
---
title: "My Document"
params:
mtcars: NULL
---
```{r}
params$mtcars
```
Code to render test2.Rmd:
rmarkdown::render("test2.Rmd",
output_format = "docx",
output_file = "test2.docx",
params = list(mtcars=mtcars))
Output
Follows #51 discussions.
This could be useful waiting for such feature in Quarto.
Here, the function would just be a wrapper around pagedown::chrome_print()
.
Not so hard to add support for .qmd
in chrome_print
though, or just do
quarto::quarto_render("myslides.qmd")
pagedown::chrome_print("myslides.html")
The following code can generate captions above the table.
#| label: tbl-iris
#| tbl-cap: "Iris Data"
library(knitr)
kable(head(iris))
However, when I try the same code with reactable, it just ignores the caption.
#| label: tbl-iris
#| tbl-cap: "Iris Data"
library(reactable)
reactable(head(iris))
How can I solve the problem?
As per the Quarto documentation (https://quarto.org/docs/authoring/markdown-basics.html#page-breaks) I'm trying to use the pagebreak
shortcode in order to insert a native break in a PDF document. However, during rendering, the following warning is issued before xelatex is called:
"WARNING: Shortcode pagebreak is not recognized."
To reproduce the issue, just create a new Quarto document in RStudio, with default settings for PDF documents. Add the {{< pagebreak <}}
shortcode anywhere you want, in either the visual or source view, and hit render.
Attached is the generated PDF
Quarto version is 0.9.80 (when calling quarto --version from the RStudio terminal). RStudio server version is 2022.02.3 Build 492 "Prairie Trillium" Release (1db809b8, 2022-05-20) for Ubuntu Bionic
I have been working with Quarto in RStudio to do some presentations.
I like to do the presentations with format: revealjs
and than convert the .html
output to .pdf to send to my students.
Can I render both formats at the same time?
---
title: "R and RStudio"
author: "RTheodoro"
institute: "USP"
format:
revealjs:
logo: img/usp_logo.png
slide-number: true
show-slide-number: all
preview-links: auto
width: 1280
height: 720
theme: default
editor: visual
execute:
echo: true
---
## What is R?
- R is.....
I am experiencing some issue with slides that have images included using knitr::include_graphics()
. Whenever these slides have no title or text, they are left out of the presentation. This doesn't happen if I put any text into that slide (or if I add a title). This doesn't happen with a slide that has no text or title but a regular print chunk (see second slide head(mtcars)
, which renders fine) I wonder if there's a particular chunk option that I have to select or whether this is a bug.
---
title: "Untitled"
format: revealjs
editor: visual
---
{r}
knitr::include_graphics("https://d33wubrfki0l68.cloudfront.net/521a038ed009b97bf73eb0a653b1cb7e66645231/8e3fd/assets/img/rstudio-icon.png")
---
{r}
head(mtcars)
This also happens when I add them via typical markdown (using the import widget on Rstudio).
This one won't get included (although it's showing nicely on the visual Rstudio editor)
##
![](img/path_to_img.png){fig-align="center"}
This one will render fine!
## .
![](img/path_to_img.png){fig-align="center"}
Related to quarto-dev/quarto-cli#275
I'd like to use a single Quarto configuration file for books in two different languages.
I can edit it via an orchestration script but I wonder whether one could override what's in the configuration file via an argument of quarto_render()
?
In a Quarto document, I want to be able to use more extensive math LaTeX features than are typical for simple equations, using some extensions presumably provided by mathjax, particularly for matrix expressions.
However, I find that some mathjax features just do not work as documented. In particular, the use of \newcommand
, \renewcommand
, etc. do not work.
I created a .qmd file to test this, published on Rpubs: https://rpubs.com/friendly/test-newcommand.
This uses the following to define some new latex commands:
::: {.hidden}
$$
\renewcommand*{\vec}[1]{\mathbf{#1}}
\newcommand*{\mat}[1]{\mathbf{#1}}
\newcommand{\trans}{^\mathsf{T}}
\newcommand*{\diag}[1]{\mathrm{diag}\, #1}}
\newcommand{\sizedmat}[2]{\underset{\mathbf{#1}}{(#2)}}
$$
Then this is used as:
$$
{\sizedmat{\mat{Y}}{n \times p}} =
{\sizedmat{\mat{X}}{n \times q}} \,
{\sizedmat{\mat{B}}{q \times p}} +
{\sizedmat{\mat{U}}{n \times p}} ,
$$
But the result appears in the HTML output as shown in this image:
I wanted to add an aside comment, as documented here: https://quarto.org/docs/authoring/article-layout.html
Putting the document below into a .qmd
and rendering (using cmd + shift + k
) in the RStudio IDE (2022.02.0 Build 435.pro1) yields all of the text in the body of the doc, not the margin.
---
title: "Untitled"
format: html
editor: visual
---
# My Test Doc
Test
[Go in the margin?]{.aside}
::: {.column-margin}
We know from *the first fundamental theorem of calculus* that for $x$ in $[a, b]$:
$$\frac{d}{dx}\left( \int_{a}^{x} f(u)\,du\right)=f(x).$$
:::
I am working on a quarto book project.
project:
type: book
The guide suggests Render Book command on the Build tab. This works, but what's the equivalent command to build from the R console? I am thinking of something similar to rmarkdown::build_site()
?
Hello,
In quarto_render()
, I am trying both to render multiple format types and to provide the output file with a different name to that of the Quarto document I am using. However, quarto_render()
does not adapt this supplied file name to each of the different file types. This results in a single document of type File, which gets overwritten each time the Quarto document renders each format type.
Example:
template.qmd
:
---
title: "Example title"
format:
html:
toc: true
docx:
toc: true
editor: source
---
This is a simple example file.
Code to render template.qmd
:
library(quarto)
quarto_render(input = "template.qmd",
output_format = "all",
output_file = "final_report")
Output:
A single final_report
document of type File.
Desired output:
A final_report.html
and a final_report.docx
.
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.