簡體   English   中英

在 PDF output 中更改 Rmarkdown 中圖形標題的字體和顏色

[英]Change font and color for figure captions in Rmarkdown in PDF output

我想知道如何在 Rmarkdown 中專門為 PDF output 的圖形標題更改字體和顏色。 我知道如何為 word output 執行此操作(創建單獨的文檔),但通常將數字作為 PDF 提交給期刊。

請注意,這不是您是否可以更改 PDF 中文本的顏色,此處回答: 更改 RMarkdown pdf Z78E6221F6393D1356681DB398F14CE6D 中圖形標題的字體大小 如果我在fig.cap = "fig text here.\\label{...}"中嘗試此操作,則會收到以下錯誤:

! Undefined control sequence.
<recently read> \cellcolor 

This probably comes closest: Changing the font size of figure captions in RMarkdown pdf output , but I went to CTAN and downloaded the package and am not sure whether I have to find my R libraries and drag it to there, or what. 也許這是唯一/最簡單的解決方案,如果是這樣,您能否建議我應該如何繼續下載的 package。 在 latex 中沒有做很多事情,所以它可能會發現 colors 是如何在 latex 中定義的?

非常感謝!

詹姆士

這是我的 header:

output:
  pdf_document: 
    keep_tex: true
  html_document: default
header-includes:
  \usepackage{placeins}

---

你可以試試這個:

---
title: "Untitled"
author: "bttomio"
date: "6/13/2021"
output: pdf_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

```{r pressure, echo=FALSE, fig.cap="\\textcolor{red}{This is red} and \\textcolor{blue}{this is blue}"}
plot(pressure)
```

-輸出

在此處輸入圖像描述

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM