Pandoc : How to add a table before the table of content?

寵の児 提交于 2021-01-27 18:49:16

问题


I would like to add a table before the table of content generated by pandoc/markdown.

I've found the parameter "include-before". With this, I can add text before the table of content. But is there a way to add a table ?

Show my code below. I would like the toc to be between the two tables and the header1 and not before the tables.

Is there another way to achieve that ? I would like to use only one file for the generation.

Thanks for your help

---
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:


There are two options: you can either use the include-before field, it works for text as well as for lists or tables. Just make sure to indent the table.

---
toc: true
toc-title: Table des matières
include-before: |
    ----------------------------------------------------------------------
    **VERSION**  **DATE**      **MODIFICATION**                **AUTHOR**
    -----------  ------------- ------------------------------- -----------
    1.0          20-12-2018    Initial                         DGO 

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

Alternatively, you can disable pandoc's toc mechanism and manually add the LaTeX commands to generate the table of contents at the desired location:

---
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. 


来源:https://stackoverflow.com/questions/53882881/pandoc-how-to-add-a-table-before-the-table-of-content

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!