forked from mirrors/org-mode
org-latex-preview: Customisable preview width
* lisp/org-latex-preview.el (org-latex-preview--create-tex-file, org-latex-preview-width ): Introduce a new variable `org-latex-preview-width' for convenient setting of the preview width, and use it in the preamble generation. (org-latex-preview-header): Remove now-redundant content (thanks to the use of preview.sty).
This commit is contained in:
parent
35f97f07c9
commit
3a585e28a1
|
@ -290,23 +290,9 @@ See `org-latex-preview-processing-indicator'."
|
|||
t))))))
|
||||
|
||||
(defcustom org-latex-preview-preamble "\\documentclass{article}
|
||||
\\usepackage[usenames]{color}
|
||||
\[DEFAULT-PACKAGES]
|
||||
\[PACKAGES]
|
||||
\\pagestyle{empty} % do not remove
|
||||
% The settings below are copied from fullpage.sty
|
||||
\\setlength{\\textwidth}{\\paperwidth}
|
||||
\\addtolength{\\textwidth}{-3cm}
|
||||
\\setlength{\\oddsidemargin}{1.5cm}
|
||||
\\addtolength{\\oddsidemargin}{-2.54cm}
|
||||
\\setlength{\\evensidemargin}{\\oddsidemargin}
|
||||
\\setlength{\\textheight}{\\paperheight}
|
||||
\\addtolength{\\textheight}{-\\headheight}
|
||||
\\addtolength{\\textheight}{-\\headsep}
|
||||
\\addtolength{\\textheight}{-\\footskip}
|
||||
\\addtolength{\\textheight}{-3cm}
|
||||
\\setlength{\\topmargin}{1.5cm}
|
||||
\\addtolength{\\topmargin}{-2.54cm}"
|
||||
\\usepackage{xcolor}"
|
||||
"The document header used for processing LaTeX fragments.
|
||||
It is imperative that this header make sure that no page number
|
||||
appears on the page. The package defined in the variables
|
||||
|
@ -316,6 +302,20 @@ header, or they will be appended."
|
|||
:group 'org-latex-preview
|
||||
:type 'string)
|
||||
|
||||
(defcustom org-latex-preview-width 0.6
|
||||
"The text width when compiling LaTeX fragments.
|
||||
This can take a few forms, namely:
|
||||
- A string giving a LaTeX dimension (e.g. \"12cm\").
|
||||
- A floating point value between 0.0 and 1.0,
|
||||
this sets the text width to this ratio of the page width.
|
||||
- nil, in which case the default text width is unmodified."
|
||||
:group 'org-latex-preview
|
||||
:package-version '(Org . "9.7")
|
||||
:type '(choice
|
||||
(string :tag "LaTeX width")
|
||||
(float :tag "Proportional width")
|
||||
(const :tag "Unset" nil)))
|
||||
|
||||
(defcustom org-latex-preview-use-precompilation t
|
||||
"Use LaTeX header precompilation when previewing fragments.
|
||||
This causes a slight delay the first time `org-latex-pdf-process'
|
||||
|
@ -1335,6 +1335,12 @@ The path of the created LaTeX file is returned."
|
|||
(org-export-get-environment (org-export-get-backend 'latex))
|
||||
'(:time-stamp-file nil))
|
||||
org-latex-preview-preamble 'snippet))
|
||||
(let ((w org-latex-preview-width))
|
||||
(cond
|
||||
((stringp w)
|
||||
(format "\n\\setlength{\\textwidth}{%s}\n" w))
|
||||
((and (floatp w) (<= 0.0 w 1.0))
|
||||
(format "\n\\setlength{\\textwidth}{%s\\paperwidth}\n" w))))
|
||||
"\n\\usepackage[active,tightpage,auctex]{preview}\n")))
|
||||
(with-temp-file tex-temp-name
|
||||
(insert (if-let ((format-file
|
||||
|
|
Loading…
Reference in New Issue