admin管理员组文章数量:1399966
I am trying to explore the utility of quarto
and typst
for PDF output from R.
Unfortunately, I am unable to find in the documentation how to control the font size of the figure captions. When rendering the Quarto document, the figure caption appears to have the same font size than the normal body text.
On top of that, it appears that the cross-referencing of the figure captions to include the chapter, e.g. Figure 5.1 ..., does not react to the the YAML crossref: chapters: true
.
I am trying to explore the utility of quarto
and typst
for PDF output from R.
Unfortunately, I am unable to find in the documentation how to control the font size of the figure captions. When rendering the Quarto document, the figure caption appears to have the same font size than the normal body text.
On top of that, it appears that the cross-referencing of the figure captions to include the chapter, e.g. Figure 5.1 ..., does not react to the the YAML crossref: chapters: true
.
1 Answer
Reset to default 2The font size of figure captions could be adjusted by applying a custom show rule like this:
#show figure.caption: set text(size: 18pt)
Regarding the crossref: chapters: true
it seems to be a little bit more complex because, as you stated, with format: typst
Quarto does not seem to react and additionally, Typst currently has no built-in feature for this need (see e.g. typst/typst#1896 for more details). However, a solution as indicated in this comment should be applicable:
#set figure(numbering: num => {
locate(loc => {
let chap_num = counter(heading.where(level: 1)).at(loc).first()
let chap_loc = query(heading.where(level: 1).before(loc)).last().location()
let fig_offset = counter(figure).at(chap_loc).first()
str(chap_num) + "." + str(num - fig_offset)
})
})
---
title: Figure caption font size and numbering in Quarto Typst
format:
typst:
include-before-body:
- text: |
#set heading(numbering: "1")
#show figure.caption: set text(size: 18pt)
#set figure(numbering: num => {
locate(loc => {
let chap_num = counter(heading.where(level: 1)).at(loc).first()
let chap_loc = query(heading.where(level: 1).before(loc)).last().location()
let fig_offset = counter(figure).at(chap_loc).first()
str(chap_num) + "." + str(num - fig_offset)
})
})
---
# First chapter
# Second chapter
{#fig-elephant1 width=40%}
See @fig-elephant1 for an illustration.
本文标签: quartoHow to control the font size of figure captions and include chapter notationStack Overflow
版权声明:本文标题:quarto - How to control the font size of figure captions and include chapter notation? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744230088a2596287.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论