org-latex-preview: Fix spacing before LaTeX envs

* lisp/org-latex-preview.el (org-latex-preview--create-tex-file): Set
the \abovedisplayskip length to zero to remove the default padding.
This commit is contained in:
TEC 2023-02-03 00:18:22 +08:00
parent 716e32492b
commit 0f1d2f0ca0
Signed by: tec
SSH Key Fingerprint: SHA256:eobz41Mnm0/iYWBvWThftS0ElEs1ftBr6jamutnXc/A
1 changed files with 7 additions and 1 deletions

View File

@ -1436,7 +1436,13 @@ The path of the created LaTeX file is returned."
(org-latex-preview-precompile processing-info header))))
(concat "%& " format-file)
header))
(insert "\n\\begin{document}\n")
;; The \abovedisplayskip length must be set after \begin{document} because
;; it is usually set during the font size intialisation that occurs at
;; \begin{document}. We can either modify the \normalsize command to set
;; the \abovedisplayskip length, or just set it after \begin{document}.
(insert "\n\\begin{document}\n\n"
"\\setlength\\abovedisplayskip{0pt}"
" % Remove padding before equation environments.\n\n")
(dolist (fragment-info fragments)
(insert
"\n\\begin{preview}\n"