2016-04-14 53 views
3

我与tufte降价风格的一个问题...代码块漂浮到边缘区与塔夫特降价[R

我的一些代码块的格式不正确。换行符不被识别,文本是浮动的(这是正确的词?)到注释和图像所在的侧面区域。

例子:

--- 
title: "test" 
author: "user" 
date: "Now" 
output: 
    tufte::tufte_handout: 
    number_sections: yes 
    toc: yes 
    toc_depth: 1 
--- 

Some test lines 

```{r, eval=FALSE} 
re_quantify_setting <- 
    parameters[,'Value'][parameters[,'Parameter'] == 'Re-quantify'] 
if(re_quantify_setting != 'False') { 
    stop('Re-quantify was set to \'True\'! ',  
     'Please reanalyse data with correct MaxQuant settings.') 
} 
``` 

```{marginfigure} 
Also a common problem is that people often just mark all lines of code and then 
just executing (Run) it. Here it might happen that an error occured at the beginning 
of the script but was not seen by the user because code is executing so fast. 
This can be prevent by using the **Source**-button. The script will stop in case 
of an error message! 
``` 

而这里的结果:

pdf output

有没有人一个想法,为什么发生这种情况,以及如何得到正确的换行符?

回答

2

您可以禁用整理:

```{r, echo=FALSE} 
knitr::opts_chunk$set(tidy=FALSE) 
``` 
+0

嗯,不过这还是我哪里有后一个换行符例如不破的第一行'<-'。 – drmariod

+1

@drmariod对不起,我没有关注这一行。我用适合您例子的替代方案更新了我的答案 – scoa