R markdown
(RStudio) 문서를 만들었으므로 LaTeX 문서의 일부 (즉 첫 페이지)와 결합 된 pdf 출력을 보내고 싶습니다. 그래서 기본적으로 R Markdown (R 출력 생성)으로 비트를 작성하고 LaTeX에서 무언가를 작성하고이 두 가지를 PDF 문서 하나로 결합하고 싶습니다.LaTeX과 R markdown 및 pandoc 결합
단계는 무엇입니까? 고마워.
R markdown
(RStudio) 문서를 만들었으므로 LaTeX 문서의 일부 (즉 첫 페이지)와 결합 된 pdf 출력을 보내고 싶습니다. 그래서 기본적으로 R Markdown (R 출력 생성)으로 비트를 작성하고 LaTeX에서 무언가를 작성하고이 두 가지를 PDF 문서 하나로 결합하고 싶습니다.LaTeX과 R markdown 및 pandoc 결합
단계는 무엇입니까? 고마워.
pdfpages package을 사용하여 pdf 페이지를 삽입하는 방법을 시연하려면 먼저 pdf()
명령을 사용하여 4 페이지의 pdf 파일을 만듭니다.
.Rnw (Knitr) 스크립트는 문서의 모든 페이지를 포함 할 것이다 가장 간단한 \includepdf[pages=-]
될 외부 문서 사용
\includepdf[<key=val>]{<filename>}
에 대한 페이지를 삽입하려면
\documentclass[a4paper]{article}
\usepackage[final]{pdfpages}
\usepackage[pagestyles]{titlesec}
\usepackage{hyperref}
\title{An example on how to add external pdf pages}
\begin{document}
\maketitle
\tableofcontents
\section{First section}
\subsection{First subsection}
This is an empty section with a chunk to create one pdf with four pages
<<mtcarsplot, echo = TRUE, eval = TRUE, fig.show='hide'>>=
library(knitr)
pdf(file="figure/mtcarsplot.pdf",onefile=TRUE)
ggplot(mpg, aes(drv, model)) +
geom_point() +
facet_grid(manufacturer ~ ., scales = "free", space = "free") +
theme(strip.text.y = element_text(angle = 0))
ggplot(mtcars, aes(wt, mpg))+ geom_point(aes(colour=factor(cyl), size = qsec))
ggplot(mpg, aes(x=factor(cyl), y=hwy, fill=factor(cyl)))+ geom_violin(scale = "width")
mosaicplot(Titanic, color = TRUE)
dev.off()
@
\phantomsection
\addcontentsline{toc}{subsection}{Second subsection (phantom)}
\includepdf[pages={1-2,{},4},nup=2x2]{figure/mtcarsplot.pdf}
\end{document}
를 다음과 같습니다 . 페이지를 포함하는
코드는
\includepdf[pages={1-2,{},4}],nup=2x2]{figure/mtcarsplot.pdf}
이다 {1-2, {}, 4} 내가 2로 빈 페이지, 다음 페이지를 1 페이지를 포함한다는 것을 의미 4.
다른 명령은 nup = 2x2이고 두 페이지는 네 페이지, 두 페이지는 같은 페이지를 포함합니다. 하나 왼쪽으로,
이\phantomsection
\addcontentsline{toc}{subsection}{Second subsection (phantom)}
출력 한 페이지의 4 페이지를 보여줍니다
종종 섹션 외부 PDF를 포함하는 유용합니다또는 하위 생성 된 문서의이이 이루어집니다 공백 및 목차팬텀 섹션.
은'이를 유액 문서의 RMD ('pandoc -o stuff.tex의 stuff.rmd') 및 '\ 포함 {}에서 텍 생성? –
@Ben : 이것은 아마도 하나의 옵션 일 수 있지만 여전히 Rmd + tex = pdf가 가능한지 궁금해합니다. – Maximilian
두 개의 PDF 문서를 생성하고 병합하는 것이 더 좋습니까? –