Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

render quarto in R not generate the title page #210

Open
caocloud opened this issue Sep 5, 2024 · 11 comments
Open

render quarto in R not generate the title page #210

caocloud opened this issue Sep 5, 2024 · 11 comments

Comments

@caocloud
Copy link

caocloud commented Sep 5, 2024

Hi,

I am writing a code to generate a document to pdf using Qarto- R with the set up of title page image.

YAML format is below:


---
format: 
  titlepage-pdf:
    titlepage-bg-image: "logo4.png"
    titlepage-theme:
      bg-image-size: "1.8\\textwidth"
      bg-image-left: "0\\paperwidth"
      documentclass: article
---
```{r}
for ( i in 1: 100){
quarto_render(
    input= "quarto3.qmd",
    output_format = "pdf",execute = TRUE,
    output_file =  stringr::str_glue("{Filename[i]}.pdf"),
    execute_params = list(ID = ID[i],RegionID=2))
}
```

So, I have created a file called "qarto3.qmd" with the YAML at the top. when I render the report by click "Render" button. Everything is fine. The document can be generated with the title page (the image need to cover all the first page, not just as in the middle of the page).

However, because I have multiple documents to run with the different params. In another file, I have used quarto_render. to run the code that can generate multiple documents. It did generate without any issues except for the title page.

My current environment is

"[>] Checking versions of quarto binary dependencies...
Pandoc version 3.1.1: OK
Dart Sass version 1.55.0: OK
[>] Checking versions of quarto dependencies......OK
[>] Checking Quarto installation......OK
Version: 1.3.433
Path: C:\Program Files\RStudio\resources\app\bin\quarto\bin
CodePage: 1252

[>] Checking basic markdown render....OK

[>] Checking Python 3 installation....(None)

  Unable to locate an installed version of Python 3.
  Install Python 3 from https://www.python.org/downloads/

[>] Checking R installation...........OK
Version: 4.4.0
Path: C:/PROGRA1/R/R-441.0
LibPaths:
- C:/Program Files/R/R-4.4.0/library
knitr: 1.48
rmarkdown: 2.28

[>] Checking Knitr engine render......OK"

Can you please help?

Thanks.

@cderv
Copy link
Collaborator

cderv commented Sep 5, 2024

Could you format your code correctly and with full reproducible example to have an example I can look at ?

See https://quarto.org/bug-reports.html#formatting-make-githubs-markdown-work-for-us

Thanks.

@caocloud
Copy link
Author

caocloud commented Sep 5, 2024

Hi, I have updated my question. Thanks

@cderv
Copy link
Collaborator

cderv commented Sep 5, 2024

Just to understand correctly: Are you calling quarto render on your qarto3.qmd file and this file is calling also quarto render itself ?

Just asking because there could be some side effect of having quarto render nested calls like that.

@caocloud
Copy link
Author

caocloud commented Sep 5, 2024 via email

@cderv
Copy link
Collaborator

cderv commented Sep 6, 2024

Sorry for all my questions. I am just trying to understand everything correctly so that I can reproduce.

Is this the content of quarto3.qmd ?

---
format: 
  titlepage-pdf:
    titlepage-bg-image: "logo4.png"
    titlepage-theme:
      bg-image-size: "1.8\\textwidth"
      bg-image-left: "0\\paperwidth"
      documentclass: article
---
```{r}
for ( i in 1: 100){
quarto_render(
    input= "quarto3.qmd",
    output_format = "pdf",execute = TRUE,
    output_file =  stringr::str_glue("{Filename[i]}.pdf"),
    execute_params = list(ID = ID[i],RegionID=2))
}
```

Which means your are calling quarto_render() from within a .qmd file, right ?
So you do quarto render quarto3.qmd (or call the render button), and then you expect the same document to also be rendered by knitr by calling quarto_render() in the cell ?

Do I get it right ?

@caocloud
Copy link
Author

caocloud commented Sep 6, 2024 via email

@caocloud
Copy link
Author

caocloud commented Sep 6, 2024 via email

@cderv
Copy link
Collaborator

cderv commented Sep 6, 2024

The Yaml is for the quarto3.qmd. I am not calling quarto_render within this
(I use "render" button to run this file only). The quarto_render
function is coded in a separate .RMD.

Ok it makes sense. So in your first post above, the code block is not a single block. It is first a YAML which is the only content of the .qmd
Then the R code of a cell in a Rmd file.

You could probably edit again to make this more clear.

In another .rmd file, I use quarto_render to render the document. It no
longer provides me the title page.

Is there a reason to use .Rmd and not .qmd ? Just trying to get the all use case.

I'll try to reproduce based on the information provided

@cderv
Copy link
Collaborator

cderv commented Sep 6, 2024

In fact you are also using an extension right ? where is titlepage-pdf coming from ?

If so, did you open an issue in the extension repo already ?

We ask you to provide reproducible example to save time and avoid all this back and forth. Please provide all the necessary information, that will really help us !

@caocloud
Copy link
Author

caocloud commented Sep 9, 2024 via email

@cderv
Copy link
Collaborator

cderv commented Sep 10, 2024

Thank for the clarification.

To be honest, it would really help me (and save time) if you can provide a github repo with an example of what you are trying to do, or share a bundle zip you upload in this issue. This way, I'll be sure to try the same thing as you and understand you problem correctly;

Right now, I feel I need to try a few things and guess with my best knownledge - which honestly is not efficient and not the best way to help.

Thank you very much !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants