Pandoc Markdown でインライン LaTeX テーブルを参照する

Pandoc Markdown でインライン LaTeX テーブルを参照する

私は Pandoc Markdown ドキュメントでインライン Latex を使用してテーブルを定義することにしました。その理由は、テーブル行をグループ化する必要があるためです (特定の行間にのみ水平線を使用)。

pandoc-tablenos私は次の操作を実行して、このインライン Latex テーブルを操作しようとしています。

  • Table: Caption. {#tbl:id}表の下に(このテキストとインラインLatexの最後の行の間に1つの改行を入れて)追加します(説明どおりここ
    • 結果: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.*

pandocLatex ドキュメントを作成するには、次のように実行します。

pandoc --standalone --from markdown -F pandoc-tablenos --pdf-engine=xelatex <input-file>.md -o <output-file>.tex

答え1

ラテックス テーブル内にキャプションとテーブル ID を追加する必要があります。フローティング環境を使用していないため、パッケージからtabularを使用する必要があります。これを yaml ヘッダーで読み込むことができます。\captionofcaption

---
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でラベルを定義していないことを意味します

関連情報