使用Rmarkdown编织到PDF时如何防止Word丢失

时间:2019-09-21 17:23:24

标签: r pdf r-markdown

我必须说,当长文本或长句子持续出现并且没有进入下一行时,我遇到了一个问题。我的目标是通过Rmarkdown进行编织来创建专业的PDF文件。

下面是我的.rmd文件的示例:

---
title: "My work"
author: "It is me"
date: "`r format(Sys.time(), '%B %d, %Y')`"
output: 
  pdf_document:
header-includes:
- \usepackage{hyperref}
- \usepackage{mathtools}
- \usepackage{amssymb}
- \usepackage{lettrine}
- \usepackage{amsmath}
- \usepackage{yfonts,color}
- \usepackage {titling}
- \usepackage{setspace}\doublespacing
- \usepackage{fancyhdr}
- \pagestyle{fancy}
- \fancyhead[C,C]{It is me}
- \fancyfoot[C,C]{Where I do my things}
- \fancyfoot[L,R]{\thepage}
---


{r setup, include=FALSE, message=FALSE}
knitr::opts_chunk$set(echo = TRUE, fig.pos= "h")
library("Rfast")
library(MVA)
library(MASS)
library(kableExtra)
library(tidyverse)
library(Metrics)
library(Matrix)
library(factoextra)
library(CVTuningCov)
library("moments")
library(caret)
library("boot")

    \setlength{\headheight}{15pt}

    Below is an snapshot of the the dataset:
    {r, echo=FALSE, warning=FALSE, message=FALSE}
    attach(dataset)
    kable(head(dataset),booktabs = T,linesep = "") %>%
    kable_styling(full_width = F, position = "center")


    \textbf{\underline{Question 1:}} 

    (a) Produce a scatter plot matrix which includes the variables $\texttt{cylinders,     
    displacement, horsepower, weight, acceleration, year}$

当我编织成PDF文件时,这就是我得到的:

https://imgur.com/R8UArAW

如何解决此问题?

谢谢!

0 个答案:

没有答案