- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试在RMarkdown文档中插入图形,但无法将其显示在正确的位置。下图显示了该问题:使用图标题时,该图显示在页面顶部而不是文档中相关段落的下面。
这是此最小工作示例的代码:
---
title: "Untitled"
author: "Author"
date: "27 February 2017"
output:
pdf_document:
fig_cap: yes
keep_tex: yes
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, fig.pos= "h")
```
## R Markdown
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.
\newpage
## Including Plots
You can also embed plots, for example:
```{r pressure, echo=FALSE, fig.cap = "Hello"}
plot(pressure)
```
Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.
fig.pos
选项将被忽略:
You can also embed plots, for example:
\begin{figure}
\centering
\includegraphics{test_files/figure-latex/pressure-1.pdf}
\caption{Hello}
\end{figure}
Note that the \texttt{echo\ =\ FALSE} parameter was added to the code
chunk to prevent printing of the R code that generated the plot.
> sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
locale:
[1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252
[3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] backports_1.0.5 magrittr_1.5 rprojroot_1.2 htmltools_0.3.5 tools_3.3.2
[6] yaml_2.1.14 Rcpp_0.12.9 stringi_1.1.2 rmarkdown_1.3 knitr_1.15.1
[11] stringr_1.2.0 digest_0.6.12 evaluate_0.10
最佳答案
块选项fig.pos
仅在 knitr 认为必须写出LaTeX figure
环境而非纯Markdown ![]()
时才使用,并且仅当指定了图形标题(fig.cap
)且至少其中一个具有已指定:fig.align
,out.width
,out.extra
。如果要强制编织程序编写图形的LaTeX代码并使用fig.pos
,则可以设置块选项out.extra = ''
。
关于r - 编织者忽略了fig.pos?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42486617/
我在编织我的 RMarkdown 文件时遇到以下错误。 Parser error: while parsing a block mapping at line 1, column 1 did not
有人在 Knitr 中使用 gridSVG 吗?我发现包“gridSVG”提供了一个名为“gridsvg”的设备,我编写的代码如下。 ```{r message=FALSE, echo=FALSE,
在下面的代码片段中,我有一段代码目前正在按我希望的方式运行: def weave_iterable(*iters): return ''.join('{}'.format('{}'*len(c
我有一个相当长的 R 代码,需要大约 2-3 小时才能运行并编织成 HTML。然而,即使出现小错误或警告......编织也会中止......在下面的示例中,由于保存历史错误,它已经这样做了。 proc
我想分享一个关于如何使用github页面在rstudio上在线发布工作的逐步说明。 如果不是来自计算机科学,包括我自己,很多服用Coursera courses on data的人都会有问题,所以我想
我最近开始使用 Sweave * 用于创建使用 R 运行的分析报告,现在我希望对我的 python 脚本做同样的事情。 我找到了对 embedding python in Sweave 的引用docs
我试过在谷歌上搜索来解决这个问题,但有用的解决方案很少。 我已经安装了 Miktex、R 和 R studio。我想使用 Sweave 在 Miktex 中创建 PDF 文档。每次我打开我的 .Rnw
我有一个用 MyEclipse 制作的 Spring MVC 应用程序,其中包含生成的源代码以及我自己的源代码,以及我在生成的类上定义的方面。一切都在 MyEclipse 中编译得很好,但我现在想切换
我正在考虑使用 Postsharp 框架来减轻应用程序方法日志记录的负担。它基本上允许我用日志属性装饰方法,并在编译时将所需的日志代码注入(inject)到 il 中。我喜欢这个解决方案,因为它可以将
docs解释一下,必须通过使用 来启用 LTW xml指令或使用@EnableLoadTimeWeaving注解。然而,我两者都没有做过,但我仍然看到我的项目中的方面是正确编织的! 在这种情况下,我
我正在尝试在运行时加载类,并在此时将它们与一些 AspectJ 方面编织在一起。我启用了加载时织入,当我更常规地使用它时它会起作用。 我的@Aspect 类中有以下内容: @Before("call(
我有一个 .Rmd 文件,以前编织过没有任何问题。现在我在执行此指令时收到以下错误 confusionMatrix(prediction1, ssTesting$classe) 错误是 Error i
我有一个项目 foo-instrumented这取决于 foo . 这个项目实际上仪器foo用额外的代码,并替换它。即,foo是 foo-instrumented 的编译时依赖项但它绝对不是运行时依赖
我有一个项目,它有多个 Maven 模块,其中一个包含我的方面。如何获取方面并编织多个 Maven 模块? AspectJ Maven 插件的文档有点稀疏,找不到很多示例。 我曾尝试将 aspectj
我正在尝试使用 DT::datatable在 R 中输出格式良好的交互式表格。 ...唯一的问题是我想要一份 heroku 工作来为我编写文档,而且我了解到 RStudio 和 rmarkdown::
我正在尝试让 AspectJ 编织在一个简单的 Maven 项目中工作,但不确定哪里出了问题:当我使用“mvn exec:java”运行代码时,我没有看到预期的输出。 我确信代码可以正常工作,因为我在
尝试为大量 DTO 编织默认的 toString() 方法,仅使用编译时编织。目标是使用 Jackson 库返回 JSON 表示。 遵循了 this article 中的建议, 变成了注解式的切面配置
我正在尝试从 RStudio 编织 PDf 文件,但出现以下错误: ! LaTeX Error: File `framed.sty' not found. R 版本:3.2.2 (2015-08-14
kableExtra 创建一个包含一些图表的表格,如 its manual演示。我们将在下表中使用 kableExtra::spec_pointrange() 绘制点范围图,运行本文底部的代码。 但是
假设我在 R 中有代码 not working ,即我运行该代码并得到一些错误和警告,我想通过 R markdown 与第三人共享显示错误和警告的代码和输出. 如果我在 r 代码块中有错误,是否可以编
我是一名优秀的程序员,十分优秀!