Skip to content

Support SVG graphics in PDF output #658

Closed

Description

@jedbrown

As of jgm/pandoc@6b72c5e (2017), Pandoc automatically uses rsvg-convert to convert SVG images for PDF outputs. This allows

![Caption](nice-image.svg)

to produce high-quality content for both web and PDF. However, Pandoc does not do this conversion when the output format is LaTeX. (Perhaps it should, since \includegraphics{nice-image.svg} is known to not work.) Anyway, if I change bookdown's pandoc command from the generated

pandoc ... --to latex --output the-book.tex

to

pandoc ... --output the-book.pdf

then my SVG graphics process correctly and look good. Is this "direct to PDF" something that Bookdown can support, or is it unavoidable for it to process the tex output?

Related: https://stackoverflow.com/questions/50165404/how-to-make-a-pdf-using-bookdown-including-svg-images

> devtools::session_info('bookdown')
─ Session info ───────────────────────────────────────────────
 setting  value                       
 version  R version 3.5.1 (2018-07-02)
 os       Arch Linux                  
 system   x86_64, linux-gnu           
 ui       X11                         
 language (EN)                        
 collate  en_US.UTF-8                 
 ctype    en_US.UTF-8                 
 tz       America/Denver              
 date     2018-12-05                  

─ Packages ───────────────────────────────────────────────
 package   * version date       lib source                           
 backports   1.1.2   2017-12-13 [1] CRAN (R 3.5.1)                   
 base64enc   0.1-3   2015-07-28 [1] CRAN (R 3.5.1)                   
 bookdown    0.8.2   2018-12-06 [1] Github (rstudio/bookdown@7a0364b)
 digest      0.6.18  2018-10-10 [1] CRAN (R 3.5.1)                   
 evaluate    0.12    2018-10-09 [1] CRAN (R 3.5.1)                   
 glue        1.3.0   2018-07-17 [1] CRAN (R 3.5.1)                   
 highr       0.7     2018-06-09 [1] CRAN (R 3.5.1)                   
 htmltools   0.3.6   2017-04-28 [1] CRAN (R 3.5.1)                   
 jsonlite    1.5     2017-06-01 [1] CRAN (R 3.5.1)                   
 knitr       1.20    2018-02-20 [1] CRAN (R 3.5.1)                   
 magrittr    1.5     2014-11-22 [1] CRAN (R 3.5.1)                   
 markdown    0.8     2017-04-20 [1] CRAN (R 3.5.1)                   
 mime        0.6     2018-10-05 [1] CRAN (R 3.5.1)                   
 Rcpp        1.0.0   2018-11-07 [1] CRAN (R 3.5.1)                   
 rmarkdown   1.10    2018-06-11 [1] CRAN (R 3.5.1)                   
 rprojroot   1.3-2   2018-01-03 [1] CRAN (R 3.5.1)                   
 stringi     1.2.4   2018-07-20 [1] CRAN (R 3.5.1)                   
 stringr     1.3.1   2018-05-10 [1] CRAN (R 3.5.1)                   
 tinytex     0.9     2018-10-23 [1] CRAN (R 3.5.1)                   
 xfun        0.4     2018-10-23 [1] CRAN (R 3.5.1)                   
 yaml        2.2.0   2018-07-25 [1] CRAN (R 3.5.1)                   

[1] /home/jed/R/x86_64-pc-linux-gnu-library/3.5
[2] /usr/lib/R/library
> rmarkdown::pandoc_version()
[1] ‘2.5’
> system('pdflatex --version')
pdfTeX 3.14159265-2.6-1.40.19 (TeX Live 2018/Arch Linux)
kpathsea version 6.3.0
Copyright 2018 Han The Thanh (pdfTeX) et al.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Han The Thanh (pdfTeX) et al.
Compiled with libpng 1.6.35; using libpng 1.6.35
Compiled with zlib 1.2.11; using zlib 1.2.11
Compiled with poppler version 0.71.0

Activity

  1. kkmann commented on Apr 2, 2019

    @kkmann

    👍 I'd like to include build/codecov etc. badges and they are all .svg :(

  2. added this to the v0.10 milestone on May 8, 2019
  3. added
    question
    on May 8, 2019
  4. yihui commented on May 8, 2019

    @yihui
    Collaborator
  5. github-actions commented on Nov 6, 2020

    @github-actions

    This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.

  6. locked as resolved and limited conversation to collaborators on Nov 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    question

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions