Discussion:
[O] customizing preamble for org-preview-latex-fragment
Julien Cubizolles
2013-09-15 13:59:13 UTC
Permalink
How can I change the default packages used in the latex file generated
by org-preview-latex-fragment ?

Julien.
Nick Dokos
2013-09-15 21:56:42 UTC
Permalink
Post by Julien Cubizolles
How can I change the default packages used in the latex file generated
by org-preview-latex-fragment ?
They are produced by the function org-create-formula--latex-header,
which uses the variables

org-latex-default-packages-alist
org-latex-packages-alist

to construct the header of the latex file. These two have the same
format: they are both lists of three-element sublists, where each
sublist is of the form:

("options" "package" snippet-flag)

Note the snippet-flag. See the docstrings of the variables for
more details.

If the package you want to include is missing completely from these two
lists, then add it to the second variable above with a snippet-flag
setting of ``t'':

--8<---------------cut here---------------start------------->8---
(add-to-list 'org-latex-packages-alist
'("options" "package" t))
--8<---------------cut here---------------end--------------->8---

If the package is included in one of them (probably the default list)
but has been banned from being included in a snippet (by setting its
snippet-flag to nil), then unban it by setting the flag to ``t''. It's
probably best to do that through the customize interface.

Untested, but I can't imagine anything going wrong - famous last words
:-) ...
--
Nick
Rasmus
2013-09-16 10:49:54 UTC
Permalink
Post by Nick Dokos
Post by Julien Cubizolles
How can I change the default packages used in the latex file generated
by org-preview-latex-fragment ?
They are produced by the function org-create-formula--latex-header,
which uses the variables
org-latex-default-packages-alist
org-latex-packages-alist
and If you want to get real dirty look at `org-format-latex-header`.

Any package you load with #+LATEX_HEADER should also be part of the
preview tex document.

–Rasmus
--
. . . It begins of course with The Internet. A Net of Peers.
Julien Cubizolles
2013-09-16 16:29:17 UTC
Permalink
Post by Rasmus
Post by Nick Dokos
Post by Julien Cubizolles
How can I change the default packages used in the latex file generated
by org-preview-latex-fragment ?
They are produced by the function org-create-formula--latex-header,
which uses the variables
org-latex-default-packages-alist
org-latex-packages-alist
and If you want to get real dirty look at `org-format-latex-header`.
Any package you load with #+LATEX_HEADER should also be part of the
preview tex document.
It's working, I think the best would be to make a custom tex including
all necessary packages and include it in this manner.

Julien C.

Loading...