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

How to include in pdf markdown? #9

Open
billdenney opened this issue Aug 8, 2018 · 5 comments
Open

How to include in pdf markdown? #9

billdenney opened this issue Aug 8, 2018 · 5 comments

Comments

@billdenney
Copy link
Contributor

I see the format="pdf" option to qmd(), but I couldn't get it to work for with knitr/rmarkdown in Windows. What is required to insert modelviz output in a .pdf in Windows?

@bguiastr
Copy link
Owner

bguiastr commented Aug 8, 2018

Do you have DiagrammeRsvg installed?

@billdenney
Copy link
Contributor Author

I do. I got an informative error message saying that I needed to install it.

@bguiastr
Copy link
Owner

bguiastr commented Aug 8, 2018

Ok I just tried (it's been a while) and I needed to install the package rsvg to have it working. Then the following code should generate a PDF:

qmd(qmd_info = examples$onecomp, save_qmd = TRUE, format = "pdf", file_name = "one_comp.pdf")

@billdenney
Copy link
Contributor Author

Thanks! That pointed me in the right direction, and the following was able to insert the figure into .pdf output of knitr/rmarkdown. Note that the inclusion of the image file is outside of the code chunk.

    ```{r showmodel}
    foo <- modelviz::qmd(modelviz::examples$gitt,
                         save_qmd=TRUE,
                         format="pdf", file_name="c:/tmp/foo.pdf")
    ```
    
    ![](/tmp/foo.pdf)

@billdenney
Copy link
Contributor Author

Are the save_qmd and file_name arguments both needed? Could file_name be NULL by default (as it already is) and save_qmd becomes is.null(file_name)?

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