文獻引用是透過 .bib 檔裡的書目資料以及 Pandoc’s Citation syntax 達成。.bib 檔的產生方式可以由 Endnote, Zotero, JabRef 等書目管理軟體匯出。匯出後,將檔名命名為 ref.bib 取代根目錄中原本的檔案。
下方是 .bib 內的一篇引用資料 (一個 .bib 可以有很多篇):
@book{mihaly1990,
address = {New York},
title = {Flow : the psychology of optimal experience},
isbn = {0-06-016253-8},
language = {English},
publisher = {Harper \& Row},
author = {Csikszentmihalyi, Mihaly},
year = {1990},
keywords = {Happiness},
}其中第一行的 mihaly1990 即為 citation key。Pandoc 透過 @citekey (e.g., @mihaly1990) 在 .md 檔中插入 citation。匯出論文時,Pandoc 會依據 cite-style.csl 的格式自動產生引用文獻。下方為一些文獻引用語法的範例,詳見 Pandoc’s Citation syntax。
| 內文 | 輸出 (根據 .csl 改變) |
|
|---|---|---|
| 單篇 | [@stanford2008] |
(Stanford, 2008) |
| 多篇 | [@stanford2008; @kassin2017] |
(Kassin et al., 2017; Stanford, 2008) |
| 文內引用 | @stanford2008 says ... |
Stanford (2008) says |
| 隱藏作者 | Stanford says blah [-@stanford2008] |
Stanford says blah (2008) |
| 其它註解 | see @kassin2017, pp. 33-35 |
seeKassin et al. (2017), pp. 33-35 |
通常圖書館或出版商所提供的書目資料 (e.g., .ris, .bib) 的 citation key 都長得相當醜陋。透過書目管理軟體 Zotero 以及其擴充套件 Beter BibTeX 能夠讓你自行定義 citation key 的格式。例如,模板中的 references.bib 皆是以「作者姓名 + 年份」([auth:lower][year]) 做為 citation key 的格式。
以 @fig:figure 交叉引用圖 2。前綴 (e.g., 圖/Figure、表/Table) 請於 setup.md 進行設定。
| 定義 | 引用 | |
|---|---|---|
| 段落 | Section Two {#sec:2} |
@sec:id |
| 圖片 | {#fig:id} |
@fig:id |
| 公式 | $$ y = mx + b $$ {#eq:id} |
@eq:id |
| 表格 | Table: Caption. {#tbl:id} |
@tbl:id |
關於 cross-reference 語法,見章節 1.2 的表 2。
\[ \begin{aligned} \frac{a}{b} &= 1 \\ c &= 1 \end{aligned} \qquad(1)\]
使用 @eq:equation-1 交叉引用公式 (1)。
程式碼 1: Python 程式碼
for c in "Hello World!":
print(c)使用 @lst:codeblock1 交叉引用程式碼 1。
Pandoc’s Markdown 支援一些簡約的表格語法,但有時候我們需要製作更複雜的表格 (例如,某些格子佔兩行或兩列以上),而 Pandoc’s Markdown 尚未1有語法支援。這時我們可以利用表格製作工具如 TablesGenerator.com 去製作出 LaTeX 以及 HTML 的表格,再使用 Pandoc 的擴充程式將這些表格自動插入輸出文件中。要使用這功能,
tbl:custom-table,見章節 1.2)chapters/tables.tex (LaTeX 語法) 以及 chapters/tables.html (HTML 語法)<COMMENT> tbl:table-id <COMMENT> (開頭) 與 <COMMENT> END <COMMENT> (結尾)。例如 HTML 的語法會是 <!-- tbl:custom-table --> (開頭) 與 <!-- END --> (結尾);LaTeX 的語法是 % tbl:custom-table % (開頭) 與 % END % (結尾)。例如,
| Heuristic | |||
|---|---|---|---|
| plausible | implausible | ||
| Syntax-driven | plausible | P600 N400 | X |
| implausible | P600 | N400 | |
| Column A | Column B | Column C |
|---|---|---|
| A1 | B1 | C1 |
| A2 | B2 | C2 |
| A3 | B3 | C3 |
| (1) | a. | Sentence a is correct? |
| b. | This is sentence b. | |
| c. | This is sentence c. |
| (2) | Throwing in a preamble for good measure | ||
| a. | * | This traditionally signals ungrammaticality. | |
| b. | ? | Question-marks indicate questionable grammaticality. | |
| c. | However, such long sequences sometimes lead to undesirable effects in the layout. | ||
Example (1) has no preamble, whereas example (2) has.
| (3) | paungwacilri kay Kui ka kamaja (header) | ||||
| pau-ngwa-cilri | kay | Kui | ka | kamaja | |
| caus-compl-COMPL-throw | nom | Kui | obl | mango | |
| ‘Kui makes the mango fall. (translation)’ | |||||
See example (3).
目前尚在開發中,相關討論參見 https://github.com/jgm/pandoc/issues/6317。↩︎