如何在Rmarkdown中制作图形标题? [英] How to make a figure caption in Rmarkdown?

查看:148
本文介绍了如何在Rmarkdown中制作图形标题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在考虑用rmarkdown和Latex撰写论文.但是,当我尝试在文本中添加图形(而不是R图)并将其呈现为pdf时,标题和文本参考都消失了,这使我无法理解其全部工作原理.

I am thinking about writing my thesis with rmarkdown and latex. I'm getting the hang of how it all works, however, when I try to add a figure (not an R plot) to the text and render it to pdf, the caption and in-text reference dissappear.

这是我用来添加图形的代码段:

This is the code snippet I use to add a figure:

---
title: "Untitled"
output: pdf_document
---

see figure \ref{fig1}.

![picture \label{fig1}](figure1.png)

这是knitr创建的:

This is what knitr creates:

这是pandoc创建的:

This is what pandoc creates:

问题: 我如何对Rmarkdown中的图形进行图形标题和文字引用,将其渲染为pdf时显示?

OR

我如何告诉pandoc Rmarkdown是什么,以便它呈现R代码和绘图?

推荐答案

请参阅R Markdown的文档以获取 PDF输出,尤其是寻找fig_caption.在R Markdown中,图形标题默认情况下是关闭的,您必须将其打开(fig_caption: true).您还可以从RStudio IDE工具栏上的齿轮按钮中找到此设置.

Please see the documentation of R Markdown for PDF output, and in particular, look for fig_caption. Figure captions are turned off by default in R Markdown, and you have to turn them on (fig_caption: true). You can also find this setting from the gear button on the toolbar of RStudio IDE.

这篇关于如何在Rmarkdown中制作图形标题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆