如何在knitr的fig.cap中使用表达式?

时间:2014-09-24 03:34:22

标签: r knitr

我需要在fig.cap中添加一些上标或符号。我试过“表达”功能,但对我没用。我怎么能实现它?

感谢您的任何建议。

这在我的Rmd文件中。例如。

---
title: "Untitled"
author: ""
date: "Wednesday, September 24, 2014"
output: 
    word_document:
        fig_caption: true

---

```{r, echo=1,fig.cap=expression('The unit (% y'^-1*')')}
plot(cars)
```

我的会话信息:

> sessionInfo()
R version 3.1.0 (2014-04-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_Australia.1252  LC_CTYPE=English_Australia.1252   
[3] LC_MONETARY=English_Australia.1252 LC_NUMERIC=C                      
[5] LC_TIME=English_Australia.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] digest_0.6.4     evaluate_0.5.5   formatR_0.10     htmltools_0.2.4 
[5] knitr_1.6        rmarkdown_0.2.46 stringr_0.6.2    tools_3.1.0     
[9] yaml_2.1.11     

0 个答案:

没有答案