My package has a PDF file which I'd like to include as a vi.nette. There are guides on the inte.net for doing that with Sweave and R.rsp , but I'd like to use knitr as the vi.nette engine because we are writing another vi.nette in Rmd.
My latest attempt has file.pdf
and file.pdf.asis
inside the vi.nettes/
folder, with the latter containing these two lines:
%\VignetteIndexEntry{title}
%\VignetteEngine{knitr::asis_output}
FWIW, if I use R.rsp as an engine, the second line above can simply contain %\Vi.netteEngine{R.rsp::asis}
and that vi.nette builds fine, so one suspicion I have is that I am simply using the wrong knitr equivalent.
I've also tried some monstrosities involving a mix of a YAML header and LaTeX inclusion of the PDF, which didn't work either:
---
title: "title"
author: "yes"
output: pdf_document
vignette: >
%\VignetteIndexEntry{title}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
\includepdf{file.pdf}
Thanks to the power of open-source software, I was able to run browseVi.nettes()
, go through my installed packages containing a mix of HTML and PDF vi.nettes, and eventually check out the source code for the jsonlite package. This led me to a simple solution I thought about but immediately dismissed because I thought it wasn't possible: declare both knitr
and R.rsp
as vi.nette engines.
So my package's DESCRIPTION
now includes:
VignetteBuilder: R.rsp, knitr
and I have an Rmd vi.nette containing %\Vi.netteEngine{knitr::rmarkdown}
on its YAML header and a file.pdf.asis
containing %\Vi.netteEngine{R.rsp::asis}
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.