
我在 Pandoc Markdown 文件中使用 inline-Latex 定義了一個表格。原因是我需要對錶行進行分組(僅在某些行之間使用水平線)。
我正在嘗試pandoc-tablenos
透過執行以下操作來使用此內聯乳膠表:
Table: Caption. {#tbl:id}
在表格下方新增(在此文字和內聯 Latex 的最後一行之間有一個換行符)(如所述這裡)- 結果:逐字文字
Table: Caption. {#tbl:id}
出現在輸出 PDF 中(表格下方),且未tbl:id
被識別為有效 ID
- 結果:逐字文字
帶有內嵌 Latex 表的 Pandoc Markdown 文件範例:
# Expressions
Test 123. Table:
\begin{footnotesize}
\begin{tabular}{ | l l l | } \hline
\textbf{Expression} & \textbf{Meaning} & \textbf{Associativity} \\ \hline
\texttt{e1 grouped by e2} & Add a group to a grouping & left \\
\texttt{e1 where e2} & Filter a grouping & left \\ \hline
\end{tabular}
\end{footnotesize}
Some more text. *I would like to reference the table here.*
我執行pandoc
如下來建立 Latex 文件:
pandoc --standalone --from markdown -F pandoc-tablenos --pdf-engine=xelatex <input-file>.md -o <output-file>.tex
答案1
您需要在乳膠表中新增標題和表 ID。由於您正在使用tabular
並且沒有浮動環境,因此您必須\captionof
從套件中使用caption
。您可以將其加載到 yaml-header 中:
---
header-includes: \usepackage{caption}
---
# Expressions
Test 123. Table:
\begin{footnotesize}
\captionof{table}{A \LaTeX-table. \label{tbl:latex}}
\begin{tabular}{ | l l l | } \hline
\textbf{Expression} & \textbf{Meaning} & \textbf{Associativity} \\ \hline
\texttt{e1 grouped by e2} & Add a group to a grouping & left \\
\texttt{e1 where e2} & Filter a grouping & left \\ \hline
\end{tabular}
\end{footnotesize}
Some more text. See table @tbl:latex
您可以忽略該警告:
pandoc-tablenos:錯誤參考:@tbl:latex。
pandoc-tablenos
這只是意味著,您還沒有在-syntax中定義標籤