Search code examples
filelatexabstractpandoc

Use a separate file for abstract


I'm making a custom template for pandoc (Md -> LaTex) and I see that there is a variable for the abstract. The problem is that it is not possible to write markdown in the metadata, thus not possible to write the abstract in Markdown.

As there is the tag $abstract$ in my LaTex template, I want to write the abstract in a separate markdown file and then tell pandoc to use that file for the abstract.

How can I do this?


Solution

  • The problem is that it is not possible to write markdown in the metadata, thus not possible to write the abstract in Markdown.

    This is not quite right, text in YAML metadata blocks is read as Markdown:

    ---
    abstract: |
      This *is* Markdown.
    
      Multiple paragraphs are possible, too.
    ---
    

    Another option would be to use abstract-to-meta from the list of ready-made Lua filters. This allows to write the abstract just like any other top-level section:

    # Abstract
    
    Everything in this section will be put into the `$abstract$` template variable.
    

    There is no need to put either of this into a separate file – but you can, if you wish to do so.