Avoid \printbibliography being swallowed by Org-mode headings

前端 未结 5 591
梦谈多话
梦谈多话 2021-02-06 03:43

When using Org-mode and its LaTeX export BibTeX or Biblatex is often used to handle references. In that case the LaTeX command \\printbibliography is often included

5条回答
  •  抹茶落季
    2021-02-06 04:28

    One solution would be the following:

    #+macro: printbiblio        (add extra spaces here, but cannot add comment)
    
    * Test 2
      This is a test
    
    * {{{printbiblio}}}
      Test text
      \printbibliography
    * 
      asdf
    

    Like this you end up with a blank heading at the bottom of the document. The macro expands to a blank block of text so you end up with

    \section{Test 2}
    \label{sec-1}
    
    This is a test
    \section{}
    
    Test text
    \printbibliography
    \section{}
    
    asdf
    

    This also ensures you cannot accidentally add headlines after your bibliography, since it is it's own (empty) headline. It might be (seems to be actually) included in the table of contents, which is unfortunate but I would suspect the solution would be at worst run a post-export to remove the empty headline from the file (or manually do so before converting to PDF).

提交回复
热议问题