From ce260ed2c9d8296539945a554ab27f0a3e310b09 Mon Sep 17 00:00:00 2001 From: TEC Date: Thu, 2 Mar 2023 19:11:13 +0800 Subject: [PATCH] org-latex-preview: Work around XeTeX misbehaviour * lisp/org-latex-preview.el (org-latex-preview--latex-preview-filter): Since XeLaTeX seems to misbehave with tightpage, we special-case the tightpage processing to account for it. --- lisp/org-latex-preview.el | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lisp/org-latex-preview.el b/lisp/org-latex-preview.el index 47e6b7816..7a5e2c27c 100644 --- a/lisp/org-latex-preview.el +++ b/lisp/org-latex-preview.el @@ -1772,8 +1772,11 @@ fragments in EXTENDED-INFO." (setq preview-marks (nreverse preview-marks)) (while preview-marks (goto-char (caar preview-marks)) - ;; Check for tightpage-info - (unless tightpage-info + ;; Check for tightpage-info, as long as XeLaTeX is not being used, + ;; as it seems to behave differently to pdfLaTeX and luaLaTeX and + ;; produces an image without the margins that tightpage reports. + (unless (or tightpage-info (equal (plist-get extended-info :latex-processor) + "xelatex")) (save-excursion (when (re-search-forward "^Preview: Tightpage \\(-?[0-9]+\\) *\\(-?[0-9]+\\) *\\(-?[0-9]+\\) *\\(-?[0-9]+\\)"