5

When taking notes in Latex in org-mode, I use custom macros defined this way:

#+LaTeX_HEADER:\newcommand{\C}{\mathbb{C}}

I've got quite a few of these macros, so I'd like to put them all in a separate file that I include with

#+INCLUDE: "~/MyLatexMacros.org"

This works well when exporting my org file to latex, but doesn't work with latex preview.

Where can I set some macros to be used by latex preview ?

JadeSnail
  • 153
  • 3

1 Answers1

4

Check out the documentation:

In addition, you might want to customize the set of latex packages that will be needed in order to produce the preview. Most of these are probably already included.

The set of packages is specified using the variables org-latex-default-packages-alist and org-latex-packages-alist. The documentation strongly recommends that you leave the first one as is (unless you really know what you are doing - and even then, it's easy to shoot yourself in the foot). The second one is normally empty, but you can use it to add whatever packages are necessary for your line of work: Feynman diagrams anybody?

Which means you could write your macros in a package my-org-preview-config.sty, and add it to org-latex-packages-alist although this solution does seems a bit of an overhead considering the flexibility of Org.

Alternatively, try setting the macro within a buffer local org-format-latex-header variable.

Daniel
  • 3,563
  • 16
  • 41