我已经成功地将一个胶乳标题页添加到我的Rmarkdown文件中,但是文档的其余部分没有出现。这是我的YAML:
---
output:
pdf_document:
includes:
in_header: title.tex
---我没有在Rmarkdown文件中更改任何其他内容,它有以以下内容开头的标准文本:这是一个Rmarkdown文档等等。我包括我的title.tex文件:
\usepackage{graphicx}
\begin{document}
\begin{titlepage}
\begin{center}
\includegraphics{UCTLogoLong.jpg}
\vspace*{2cm}
\textbf {\Huge Applied Spatial Data Analysis} % MAIN TITLE
\vspace{0.5cm}
{\LARGE Assignment 1} % SUBTITLE
\vspace{1cm}
\noindent\makebox[\linewidth]{\rule{\textwidth}{1pt}}
{\LARGE Geostatistics}
\noindent\makebox[\linewidth]{\rule{\textwidth}{1pt}}
\vspace{1cm}
{\Large NAME } % AUTHOR
{\Large STUDENT NUMBER}
\vspace{1cm}
\includegraphics[width=5cm,height=5cm,keepaspectratio]{statslogo.png}
\vspace{0.2cm}
Department of Statistical Sciences\\
University of Cape Town\\
South Africa\\
\today
\end{center}
\end{titlepage}
\end{document}我是相对较新的Rmarkdown和不知道为什么标准的Rmarkdown文本没有显示在针织pdf。任何帮助都将不胜感激。
发布于 2021-09-07 08:08:29
问题是,对于\begin{document}...\end{document},你告诉乳胶,它应该忽略之后的一切。相反,您可以发出标题页\AtBeginDocument{...}的内容。
title.tex
\usepackage{graphicx}
\AtBeginDocument{
\begin{titlepage}
\begin{center}
\includegraphics{example-image-duck}
\vspace*{2cm}
\textbf {\Huge Applied Spatial Data Analysis} % MAIN TITLE
\vspace{0.5cm}
{\LARGE Assignment 1} % SUBTITLE
\vspace{1cm}
\noindent\makebox[\linewidth]{\rule{\textwidth}{1pt}}
{\LARGE Geostatistics}
\noindent\makebox[\linewidth]{\rule{\textwidth}{1pt}}
\vspace{1cm}
{\Large John Doe } % AUTHOR
{\Large something}
\vspace{1cm}
\includegraphics[width=5cm,height=5cm,keepaspectratio]{example-image-duck}
\vspace{0.2cm}
Department of Statistical Sciences\\
University of Cape Town\\
South Africa\\
\today
\end{center}
\end{titlepage}
\clearpage
}此外,我还必须删除
---
output:
pdf_document:
includes:
in_header: title.tex
---

https://stackoverflow.com/questions/69083630
复制相似问题