在我的YAML标题中,我想在我的文档中为sans头指定一个十六进制颜色,但是基于Quarto文档,还不清楚如何合并\fontspec选项。
在下面的代码中,我想将sans头设置为#ff7832,但是我得到了错误
"sansfontoptions有值文本:\ \fontspecColor="#ff7832",它必须是一个字符串“
我试过带引号和不带引号。有什么不同的方式我应该格式化这个吗?
format:
pdf:
mainfont: Calibri
sansfont: Overpass-ExtraBold
sansfontoptions:
text: |
\fontspec[Color="#ff7832"]我也试图定义一个自定义颜色,但没有取得任何成功。
\definecolor{Foo}{rgb}{0.3,0.4,0.5}
\fontspec[Color= Foo]{Overpass-ExtraBold}发布于 2022-09-09 18:23:30
您只需要传递fontspec的选项,方法是将它们列在由- (而不是latex )命令所加的单独行上。
---
format: pdf
mainfont: "Calibri"
sansfont: "Roboto"
sansfontoptions:
- Color=ff7832
- WordSpace=0.2
---
## This is Quarto
Quarto enables you to weave together content and executable code into a
finished document. To learn more about Quarto see <https://quarto.org>.
## Running Code
When you click the **Render** button a document will be generated that
includes both content and the output of embedded code. You can embed
code like this:
```{r}1+1

关于颜色代码,根据fontspec documentation,p-26
颜色被定义为两位十六进制RGB值的三重奏,还有另一个用于透明度的值(其中00完全透明,FF是不透明的)。
所以,只需使用十六进制颜色代码(也就是说,使用ff7832,而不是#ff7832)。
https://stackoverflow.com/questions/73664643
复制相似问题