Customizing org-mode exports

前端 未结 4 939
醉话见心
醉话见心 2021-02-01 10:07

So, I have been using org-mode for taking my research notes for some time now. I love how I can seamlessly export to both latex (for my papers) and html (for my blog). However,

4条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-01 10:51

    I figured out how to do it myself. Note that this is perhaps not the most elegant solution since it does not place the latex part in the beginning of the latex file (i.e. outside \begin{document}), but it works well enough for me.

    (setq org-export-blocks
      (cons '(latexmacro org-export-blocks-latexmacro) org-export-blocks))
    
    (defun org-export-blocks-latexmacro (body &rest headers)
      (message "exporting latex macros")
      (cond
       ((eq org-export-current-backend 'html) (concat "\\(" body "\\)"))
       ((eq org-export-current-backend 'latex) body)
       (t nil))
    )
    

提交回复
热议问题