【问题标题】:Pandoc : How to add a table before the table of content?Pandoc:如何在目录之前添加一个表格?
【发布时间】:2019-05-21 19:31:41
【问题描述】:

我想在 pandoc/markdown 生成的目录之前添加一个表格。

我找到了参数“include-before”。有了这个,我可以在目录之前添加文本。但是有没有办法添加表格?

在下面显示我的代码。我希望目录位于两个表和 header1 之间,而不是在表之前。

还有其他方法可以实现吗?我想只使用一个文件来生成。

感谢您的帮助

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

【问题讨论】:

    标签: markdown pandoc tableofcontents


    【解决方案1】:

    有两个选项:您可以使用 include-before 字段,它适用于文本以及列表或表格。只需确保缩进表格即可。

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

    或者,您可以禁用 pandoc 的 toc 机制并手动添加 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. 
    

    【讨论】:

    • 谢谢,这是我第一个解决方案的问题,我的表格没有缩进。我真的很喜欢你的第二个解决方案。我会去这个。谢谢!
    • 这很好用。但是我仍然想设置--toc-depth=2。你知道我会怎么做吗?
    • @ajbraus 我假设您指的是原始 LaTeX 解决方案:只需在 \tableofcontents 之前添加 \setcounter{tocdepth}{2}
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-10
    • 1970-01-01
    • 1970-01-01
    • 2019-08-08
    • 1970-01-01
    • 2020-09-27
    相关资源
    最近更新 更多