diff options
author | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2017-02-11 02:35:00 +0100 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2017-02-11 02:35:00 +0100 |
commit | 9070b97f0e3d69a35f1cb2b809415e42c1170d7a (patch) | |
tree | 88f08aeaf7907644b305281b83bb6afefa56862b | |
parent | fd565d6e63b061e1ed3bc641606a9e88d68d9d64 (diff) | |
download | org-mode-9070b97f0e3d69a35f1cb2b809415e42c1170d7a.tar.gz |
Fix header in LaTeX snippets
* lisp/ox-latex.el (org-latex-make-preamble): Add optional argument.
* lisp/org.el (org-create-formula-image): Use it.
Reported-by: plus <ctre@users.sourceforge.net>
<http://permalink.gmane.org/gmane.emacs.orgmode/112015>
-rw-r--r-- | lisp/org.el | 3 | ||||
-rw-r--r-- | lisp/ox-latex.el | 9 |
2 files changed, 8 insertions, 4 deletions
diff --git a/lisp/org.el b/lisp/org.el index 1c514d4..37a00a5 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -19472,7 +19472,8 @@ a HTML file." (or (plist-get processing-info :latex-header) (org-latex-make-preamble (org-export-get-environment (org-export-get-backend 'latex)) - org-format-latex-header))) + org-format-latex-header + 'snippet))) (latex-compiler (plist-get processing-info :latex-compiler)) (image-converter (plist-get processing-info :image-converter)) (tmpdir temporary-file-directory) diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el index 6e00f57..92aa02f 100644 --- a/lisp/ox-latex.el +++ b/lisp/ox-latex.el @@ -1614,11 +1614,14 @@ INFO is a plist used as a communication channel." ;;; Template ;;;###autoload -(defun org-latex-make-preamble (info &optional template) +(defun org-latex-make-preamble (info &optional template snippet?) "Return a formatted LaTeX preamble. INFO is a plist used as a communication channel. Optional argument TEMPLATE, when non-nil, is the header template string, -as expected by `org-splice-latex-header'." +as expected by `org-splice-latex-header'. When SNIPPET? is +non-nil, only includes packages relevant to image generation, as +specified in `org-latex-default-packages-alist' or +`org-latex-packages-alist'." (let* ((class (plist-get info :latex-class)) (class-options (plist-get info :latex-class-options)) (header (nth 1 (assoc class (plist-get info :latex-classes)))) @@ -1638,7 +1641,7 @@ as expected by `org-splice-latex-header'." class-template (org-latex--remove-packages org-latex-default-packages-alist info) (org-latex--remove-packages org-latex-packages-alist info) - nil + snippet? (mapconcat #'org-element-normalize-string (list (plist-get info :latex-header) (plist-get info :latex-header-extra)) "")))) |