Pandoc:如何在目录之前添加表格?

4
我想在pandoc/markdown生成目录表之前添加一个表格。
我发现了参数“include-before”。使用此参数,我可以在目录表之前添加文本。但是有没有办法添加一个表格?
下面是我的代码。我希望目录表位于两个表格和标题1之间,而不是在表格之前。
还有其他方法可以实现这一点吗?我希望只使用一个文件来生成。
感谢您的帮助。
---
geometry: margin=1in
fontfamily: qbookman
numbersections: true
toc: true
toc-title: Table des matières
header-includes: |
    \usepackage{graphicx}
    \usepackage{fancyhdr}
    \pagestyle{fancy}
    \setlength\headheight{20pt}
    \lhead{\includegraphics[width=4cm]{C:/logo.png}}
    \rhead{Doc generator}
---

+---------------+---------------------------------------------------------------+
| **Title**     | Markdown - Pandoc - Plantuml \                                
|
+---------------+---------------------------------------------------------------+
| **Customer**  | Customer \                                                      
|
+---------------+---------------------------------------------------------------+
| **Project**   | Doc generator                                                 
|
+---------------+---------------------------------------------------------------+


----------------------------------------------------------------------------------
**VERSION**  **DATE**      **MODIFICATION**                            **AUTHOR**
-----------  ------------- ------------------------------------------- -----------
1.0          20-12-2018    Initial                                     DGO 

----------------------------------------------------------------------------------


# Header 1
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. 
1个回答

5
有两个选项:你可以使用include-before字段,它适用于文本、列表或表格。只需确保缩进表格即可。
---
toc: true
toc-title: Table des matières
include-before: |
    ----------------------------------------------------------------------
    **VERSION**  **DATE**      **MODIFICATION**                **AUTHOR**
    -----------  ------------- ------------------------------- -----------
    1.0          20-12-2018    Initial                         DGO 

    ----------------------------------------------------------------------

或者,您可以禁用 Pandoc 的目录机制,并手动添加 LaTeX 命令以在所需位置生成目录:

---
geometry: margin=1in
fontfamily: qbookman
numbersections: true
toc: false
header-includes: |
    \usepackage{graphicx}
    \usepackage{fancyhdr}
    \pagestyle{fancy}
    \setlength\headheight{20pt}
    \lhead{\includegraphics[width=4cm]{C:/logo.png}}
    \rhead{Doc generator}
---

+---------------+---------------------------------------------------------------+
| **Title**     | Markdown - Pandoc - Plantuml \                                
|
+---------------+---------------------------------------------------------------+
| **Customer**  | Customer \                                                      
|
+---------------+---------------------------------------------------------------+
| **Project**   | Doc generator                                                 
|
+---------------+---------------------------------------------------------------+


----------------------------------------------------------------------------------
**VERSION**  **DATE**      **MODIFICATION**                            **AUTHOR**
-----------  ------------- ------------------------------------------- -----------
1.0          20-12-2018    Initial                                     DGO 

----------------------------------------------------------------------------------

\renewcommand*\contentsname{Table des matières}
\tableofcontents


# Header 1
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. 

1
谢谢,我的问题在于第一个解决方案,我的表格没有缩进。我真的很喜欢你的第二个解决方案。我会选择这个。谢谢! - Damgot
这个运行得很好。不过我仍然想要设置--toc-depth=2。你知道我该怎么做吗? - ajbraus
@ajbraus 我假设你是在指原始的LaTeX解决方案:只需在\tableofcontents之前添加\setcounter{tocdepth}{2} - tarleb

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接