diff --git a/compose-publish.el b/compose-publish.el index c192f1cc31715831d5bf7a998e1ddc934a74925b..b8fba36203eded85378a4086e6e66f46c9f03c83 100644 --- a/compose-publish.el +++ b/compose-publish.el @@ -75,6 +75,18 @@ ("\\subsection{%s}" . "\\subsection*{%s}") ("\\subsubsection{%s}" . "\\subsubsection*{%s}")))) +(defun remove-from-org-latex-default-packages-alist (package) + "Removes `package' from the list of packages that are included +by default when exporting from Org to LaTeX, i.e. from +`org-latex-default-packages-alist'. This is useful for controlling the order in +which some of the packages are loaded in order to prevent conflicts or other +undesirable behavior." + (let ((output '())) + (dolist (pkg org-latex-default-packages-alist) + (unless (string= package (nth 1 pkg)) + (add-to-list 'output pkg t))) + (setq org-latex-default-packages-alist output))) + ;; Load languages for code block evaluation. (org-babel-do-load-languages 'org-babel-load-languages diff --git a/latex-publish.el b/latex-publish.el index 4d0fb439685543130b126ef1b33712057f1d5317..ba1a13ebc09cfcacc5111dc0016c76c67edc1d72 100644 --- a/latex-publish.el +++ b/latex-publish.el @@ -6,6 +6,18 @@ ;; Preserve user-defined labels during the export to PDF via LaTeX. (setq org-latex-prefer-user-labels t) +(defun remove-from-org-latex-default-packages-alist (package) + "Removes `package' from the list of packages that are included +by default when exporting from Org to LaTeX, i.e. from +`org-latex-default-packages-alist'. This is useful for controlling the order in +which some of the packages are loaded in order to prevent conflicts or other +undesirable behavior." + (let ((output '())) + (dolist (pkg org-latex-default-packages-alist) + (unless (string= package (nth 1 pkg)) + (add-to-list 'output pkg t))) + (setq org-latex-default-packages-alist output))) + ;; Custom publishing function for LaTeX files. This is useful when we need to ;; publish a manually written LaTeX file to PDF (e. g. a poster). (defun latex-publish-to-pdf (plist filename pub-dir)