Insert a logo in a pdf report

I'd like to create a report, but my report need to be start with a logo. In my example, I try to do :

The .rmd file (cylinder.rmd) is:

    ```{r echo=FALSE, out.width = "30%", fig.align = "center"}
    title: "cylinder_report"
    author: "author_name"
    date: "2023-01-25"
    output: pdf_document
      cylinder: 0
    ```{r setup, include=FALSE}
    knitr::opts_chunk$set(echo = TRUE)
    df = mtcars
    ## Cylinder `r params$cylinder`
    ```{r output, echo=FALSE}
    knitr::kable(df[df$cyl == params$cylinder,])

And my separated file is:

    library (rmarkdown)
    cyls = unique(mtcars$cyl)
    for(cyl in cyls) {
        input = "cylinder.Rmd",
        output_file = paste0("cylinder_report_", cyl),
        params = list(cylinder = cyl)

This code doesn't work, but for better comprehension my desirable output must to be:

Please any help with it?

1 Like

This can be done by writing an extension with your own partials or using the titlepage template.

@technocrat we are here with an issue with rmarkdown - template partials is a Quarto feature, so it won't apply here. We need a more scoped answer to the current question.

@Leprechault please to read again some "Getting Started' section about how R Markdown is working, and what a Rmd is. You have the Definitive Guide, and the R Markdown Cookbook to help you.
Here, you can't add some code chunks in the YAML header part. That can't work - YAML needs to be YAML.
So obviously this won't work at all.

Also you may find in those resources your solutions. Example this recipe:


My bad. I think that shortly after starting to use qmd, the two merged in my page,

1 Like

Thanks very much, problem solved!!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.