mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-12-04 08:47:03 +00:00
ox-latex: New function to generate header
* ox-latex.el (org-latex--make-header): New function. (org-latex-template): Use new function. * ox-koma-letter.el (org-koma-letter-template): Use new function.
This commit is contained in:
parent
309f15887a
commit
8d3bc7875f
@ -592,27 +592,7 @@ holding export options."
|
||||
(and (plist-get info :time-stamp-file)
|
||||
(format-time-string "%% Created %Y-%m-%d %a %H:%M\n"))
|
||||
;; Document class and packages.
|
||||
(let* ((class (plist-get info :latex-class))
|
||||
(class-options (plist-get info :latex-class-options))
|
||||
(header (nth 1 (assoc class org-latex-classes)))
|
||||
(document-class-string
|
||||
(and (stringp header)
|
||||
(if (not class-options) header
|
||||
(replace-regexp-in-string
|
||||
"^[ \t]*\\\\documentclass\\(\\(\\[[^]]*\\]\\)?\\)"
|
||||
class-options header t nil 1)))))
|
||||
(if (not document-class-string)
|
||||
(user-error "Unknown LaTeX class `%s'" class)
|
||||
(org-latex-guess-babel-language
|
||||
(org-latex-guess-inputenc
|
||||
(org-element-normalize-string
|
||||
(org-splice-latex-header
|
||||
document-class-string
|
||||
org-latex-default-packages-alist ; Defined in org.el.
|
||||
org-latex-packages-alist nil ; Defined in org.el.
|
||||
(concat (org-element-normalize-string (plist-get info :latex-header))
|
||||
(plist-get info :latex-header-extra)))))
|
||||
info)))
|
||||
(org-latex--make-header info)
|
||||
;; Settings. They can come from three locations, in increasing
|
||||
;; order of precedence: global variables, LCO files and in-buffer
|
||||
;; settings. Thus, we first insert settings coming from global
|
||||
|
@ -1467,21 +1467,10 @@ INFO is a plist used as a communication channel."
|
||||
(?L . ,(capitalize language))
|
||||
(?D . ,(org-export-get-date info)))))
|
||||
|
||||
|
||||
;;; Template
|
||||
|
||||
(defun org-latex-template (contents info)
|
||||
"Return complete document string after LaTeX conversion.
|
||||
CONTENTS is the transcoded contents string. INFO is a plist
|
||||
holding export options."
|
||||
(let ((title (org-export-data (plist-get info :title) info))
|
||||
(spec (org-latex--format-spec info)))
|
||||
(concat
|
||||
;; Time-stamp.
|
||||
(and (plist-get info :time-stamp-file)
|
||||
(format-time-string "%% Created %Y-%m-%d %a %H:%M\n"))
|
||||
;; Document class and packages.
|
||||
(let* ((class (plist-get info :latex-class))
|
||||
(defun org-latex--make-header (info)
|
||||
"Return a formatted LaTeX header.
|
||||
INFO is a plist used as a communication channel."
|
||||
(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))))
|
||||
(document-class-string
|
||||
@ -1504,7 +1493,23 @@ holding export options."
|
||||
(plist-get info :latex-header))
|
||||
(plist-get info :latex-header-extra)))))
|
||||
info)
|
||||
info)))
|
||||
info))))
|
||||
|
||||
|
||||
;;; Template
|
||||
|
||||
(defun org-latex-template (contents info)
|
||||
"Return complete document string after LaTeX conversion.
|
||||
CONTENTS is the transcoded contents string. INFO is a plist
|
||||
holding export options."
|
||||
(let ((title (org-export-data (plist-get info :title) info))
|
||||
(spec (org-latex--format-spec info)))
|
||||
(concat
|
||||
;; Time-stamp.
|
||||
(and (plist-get info :time-stamp-file)
|
||||
(format-time-string "%% Created %Y-%m-%d %a %H:%M\n"))
|
||||
;; Document class and packages.
|
||||
(org-latex--make-header info)
|
||||
;; Possibly limit depth for headline numbering.
|
||||
(let ((sec-num (plist-get info :section-numbers)))
|
||||
(when (integerp sec-num)
|
||||
|
Loading…
Reference in New Issue
Block a user