【发布时间】:2015-05-28 08:21:41
【问题描述】:
我想在 Rmd/Knitr 文档中创建一个 threeparttable 并在表格底部添加一个注释。该表是由具有results = "asis" 的块内的 R 函数创建的。我没有将函数添加到工作示例中,因为它非常冗长,而且问题在纯 LaTeX 代码中很明显。
这很有效,结果看起来像预期的那样。
---
title: "Untitled"
output: pdf_document
header-includes:
- \usepackage{threeparttable}
- \usepackage{booktabs}
- \usepackage{longtable}
references:
- id: rao2001basic
title: Basic Research in Parapsychology
author:
- family: Rao
given: K.R.
issued:
year: 2001
publisher: McFarland
type: book
---
\begin{table}[h]
\centering
\begin{threeparttable}
\caption{A summary table of the cars dataset.}
\begin{tabular}{lrr}
\toprule
Descriptives & speed & dist\\
\midrule
Mean & 15.4 & 42.98\\
SD & 5.29 & 25.77\\
Min & 4 & 2\\
Max & 25 & 120\\
\bottomrule
\end{tabular}
\tablenotes{\item\textit{Note.} This table was created by @rao2001basic. }
\end{threeparttable}
\end{table}
很遗憾,表格标题中的引用无效。如果我把它从 LaTeX 环境中拿出来,它工作得很好,但不是在里面。有没有办法在 LaTeX 环境中解析 Markdown?
【问题讨论】:
-
我认为这是不可能的。 Pandoc 不解析原始 tex 块内的降价。是否可以让您的代码输出降价表而不是乳胶?
-
我认为这种类型的表格格式目前在 pandoc 中是不可能的。
-
由于您使用函数来生成表格,您可以将其分成两部分,在其中发出引用并写入两个文件,然后使用 `\input{part1.txt} [@ rao2001basic] \输入{part2.txt}。尽管使用外部 bib 文件可能更容易且可重现。
-
最近有人建议添加此功能github.com/jgm/pandoc/issues/2453
-
使用
knitcitations会是一个解决方案吗?
标签: r latex knitr r-markdown