[R-pkg-devel] Including fonts in an rmarkdown vignette

David Gohel d@v|d@gohe| @end|ng |rom @rd@t@@|r
Wed Jun 3 11:03:33 CEST 2020


David

If you are ok to use one of the fonts available on google font, you could use package gfonts (in Suggests):
https://cran.r-project.org/web/packages/gfonts/vignettes/gfonts.html <https://cran.r-project.org/web/packages/gfonts/vignettes/gfonts.html>

As it will be « inline », your document size could inflate (I guess it could be an issue with CRAN) - if only one font, size should be ok.

Otherwise, you also could add a css chunk to import the font from a public server - if no internet connexion, nothing will break.

David


> Le 3 juin 2020 à 08:46, Maëlle SALMON via R-package-devel <r-package-devel using r-project.org> a écrit :
> 
> Hi,
> 
> I've recently seen an example of a package that provides its own fonts for a vignette. See links in https://blog.r-hub.io/2020/06/03/vignettes/#pretty-vignettes 
> 
> 
> In that same post I link to a workaround I saw on this list https://www.mail-archive.com/r-package-devel@r-project.org/msg02921.html for changing the vignette format based on the versions of dependencies. Maybe something similar is possible for fonts (I have no idea).
> 
> Maëlle.
> 
> Den tisdag 2 juni 2020 20:14:24 CEST, David Hugh-Jones <davidhughjones using gmail.com> skrev: 
> 
> 
> 
> 
> 
> Hi,
> 
> I'd like to build a rmarkdown vignette with my own choice of fonts – I'm
> pernickety about look and feel.
> 
> R CMD check will rebuild vignettes in the vignettes/ directory, and if
> relevant fonts aren't on the build machine, it'll give a warning.
> 
> Here are the options I can think of:
> * build vignettes on my machine and put them in inst/doc. Don't mention the
> specific fonts in the Rmd file in vignettes/. So the file built by "R CMD
> check" won't look quite like the pre-built version.  This might work, but
> it seems against open source principle.
> * put font files in vignettes/ and refer to them in the rmarkdown file. I'm
> not sure how to do this.
> * limit myself to the fonts preinstalled on win-builder or CRAN machines.
> I'm not sure what these are
> 
> Has anyone got any advice or examples?
> 
> Cheers,
> David
> 
>     [[alternative HTML version deleted]]
> 
> ______________________________________________
> R-package-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
> 
> ______________________________________________
> R-package-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel


	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list