import numpy as np
import matplotlib.pyplot as plt
= np.arange(0, 2, 0.01)
r = 2 * np.pi * r
theta = plt.subplots(
fig, ax = {'projection': 'polar'}
subplot_kw
)
ax.plot(theta, r)0.5, 1, 1.5, 2])
ax.set_rticks([True)
ax.grid( plt.show()

yangjh
2023年7月2日
创作Quarto文档时,除了markdown文档支持的特性外,还支持如下特性,详情参见:https://quarto.org/docs/authoring/markdown-basics.html。
Quarto 主要面向学术生产及技术创作群体,对参考文献的支持非常全面。要在Quarto文档中使用参考文献,需要提供参考文献内容并使用合适的方式进行引用,然后在指定的地方生成参考文献。
参考文献可以使用Zotero进行生成,后缀名通常为.bib
。Quarto 使用bibliography
字段,为文档指定参考文献的名称及所在位置,还可以在Quarto配置文件中以YAML数组的方式提供多个文献。
_quarto.yml
中使用bibliography
设置参考文献,参见1;_metadata.yml
使用bibliography
设置参考文献;bibliography
字段提供参考文献名称。在合适的地方,使用语法类似[@danesi2004]
进行引用,
例如:(Danesi 2004)
在项目设定文件中,通过csl选项设定引用样式。但是大多数中文csl使用了CSL-M
语法,而目前版本的Pandoc并不支持CSL-M
语法解析,故当使用中文csl时会报错。详见https://github.com/quarto-dev/quarto-cli/discussions/4598
---
title: "My Document"
bibliography: references.bib
csl: nature.csl
---
使用区块标记,可以指定参考文献生成的容器。
::: {#refs}
:::
使用[^2]
这样的语法插入脚注2。脚注的内容还可以是多行3,参见https://quarto.org/docs/authoring/footnotes-and-citations.html#fn2
Default | Left | Right | Center |
---|---|---|---|
12 | 12 | 12 | 12 |
123 | 123 | 123 | 123 |
1 | 1 | 1 | 1 |
| fruit | price |
| ------ | ----- |
| apple | 2.05 |
| pear | 1.37 |
| orange | 3.09 |
: Fruit prices {.striped .hover}
效果如下:
fruit | price |
---|---|
apple | 2.05 |
pear | 1.37 |
orange | 3.09 |
默认的markdown中,是无法设定列宽的。但在.qmd
中,可以使用类似{tbl-colwidths="[75,25]"}
的语句,指定表格各列的宽度。
| fruit | price |
| ------ | ----- |
| apple | 2.05 |
| pear | 1.37 |
| orange | 3.09 |
: Fruit prices {tbl-colwidths="[75,25]"}
效果如下:
fruit | price |
---|---|
apple | 2.05 |
pear | 1.37 |
orange | 3.09 |
Quarto中的表格,还可以使用代码生成、也可使用html生成。详见:https://quarto.org/docs/authoring/tables.html#computations
使用如下语法,可以在文档中内嵌视频(目前仅支持本地mp4、YouTube、Vimeo、BrightCove):
Quarto支持设置视频的播放位置、比例等功能,详见:https://quarto.org/docs/authoring/videos.html。
如果要插入B站的视频,可以采用嵌入代码的方式进行:
详细设置可参考:https://www.zeromes.cn/archives/%e7%a0%94%e7%a9%b6/451
使用如下语法,可以在文档转化为word、pdf等格式时,进行分页。
在Quarto文档中,可以添加区块或行内区块,类似与HTML中的div
和span
元素。
将生成一个class
值为hello
的div
区块。snippet为div
。
区块内容
区块还可以嵌套,还要内置的区块,详见:https://quarto.org/docs/authoring/markdown-basics.html#callout-blocks
Note that there are five types of callouts, including: note
, tip
, warning
, caution
, and important
.
使用<include>
短代码,可以实现文档的复用,在文档内容实现搭积木式的组合。详见https://quarto.org/docs/authoring/includes.html
---
title: "My Document"
---
这些内容来自独立的文档。使用`< include >`包含一个文档,相当于将文档中所有的内容复制到了父文档。
Use the data...
这些内容来自独立的文档。使用< include >
包含一个文档,相当于将文档中所有的内容复制到了父文档。
有时候,为了向读者展示代码,我们需要阻止代码运行。
使用````
标记内容即可实现展示但不运行的目的。
当内容的宽度超过默认宽度时,可通过设定布局大小的区域,比如:
:::{.column-page}
里面放图片、表格等需要增大宽度的内容
:::
https://quarto.org/docs/projects/quarto-projects.html#creating-projects↩︎
这是一个脚注。↩︎
长脚注内容可以是多段。
比如像这样。↩︎