Collect packages to a variable
This commit is contained in:
parent
cc2d79d5ac
commit
a6544ef711
|
@ -91,86 +91,30 @@
|
|||
|
||||
(defcustom org-export-latex-classes
|
||||
'(("article"
|
||||
"\\documentclass[11pt]{article}
|
||||
\\usepackage[AUTO]{inputenc}
|
||||
\\usepackage[T1]{fontenc}
|
||||
\\usepackage{graphicx}
|
||||
\\usepackage{longtable}
|
||||
\\usepackage{float}
|
||||
\\usepackage{wrapfig}
|
||||
\\usepackage{soul}
|
||||
\\usepackage{t1enc}
|
||||
\\usepackage{textcomp}
|
||||
\\usepackage{marvosym}
|
||||
\\usepackage{wasysym}
|
||||
\\usepackage{latexsym}
|
||||
\\usepackage{amssymb}
|
||||
\\usepackage{hyperref}"
|
||||
"\\documentclass[11pt]{article}"
|
||||
("\\section{%s}" . "\\section*{%s}")
|
||||
("\\subsection{%s}" . "\\subsection*{%s}")
|
||||
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
|
||||
("\\paragraph{%s}" . "\\paragraph*{%s}")
|
||||
("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
|
||||
("report"
|
||||
"\\documentclass[11pt]{report}
|
||||
\\usepackage[AUTO]{inputenc}
|
||||
\\usepackage[T1]{fontenc}
|
||||
\\usepackage{graphicx}
|
||||
\\usepackage{longtable}
|
||||
\\usepackage{float}
|
||||
\\usepackage{wrapfig}
|
||||
\\usepackage{soul}
|
||||
\\usepackage{t1enc}
|
||||
\\usepackage{textcomp}
|
||||
\\usepackage{marvosym}
|
||||
\\usepackage{wasysym}
|
||||
\\usepackage{latexsym}
|
||||
\\usepackage{amssymb}
|
||||
\\usepackage{hyperref}"
|
||||
"\\documentclass[11pt]{report}"
|
||||
("\\part{%s}" . "\\part*{%s}")
|
||||
("\\chapter{%s}" . "\\chapter*{%s}")
|
||||
("\\section{%s}" . "\\section*{%s}")
|
||||
("\\subsection{%s}" . "\\subsection*{%s}")
|
||||
("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
|
||||
("book"
|
||||
"\\documentclass[11pt]{book}
|
||||
\\usepackage[AUTO]{inputenc}
|
||||
\\usepackage[T1]{fontenc}
|
||||
\\usepackage{graphicx}
|
||||
\\usepackage{longtable}
|
||||
\\usepackage{float}
|
||||
\\usepackage{wrapfig}
|
||||
\\usepackage{soul}
|
||||
\\usepackage{t1enc}
|
||||
\\usepackage{textcomp}
|
||||
\\usepackage{marvosym}
|
||||
\\usepackage{wasysym}
|
||||
\\usepackage{latexsym}
|
||||
\\usepackage{amssymb}
|
||||
\\usepackage{hyperref}"
|
||||
"\\documentclass[11pt]{book}"
|
||||
("\\part{%s}" . "\\part*{%s}")
|
||||
("\\chapter{%s}" . "\\chapter*{%s}")
|
||||
("\\section{%s}" . "\\section*{%s}")
|
||||
("\\subsection{%s}" . "\\subsection*{%s}")
|
||||
("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
|
||||
("beamer"
|
||||
"\\documentclass{beamer}
|
||||
\\usepackage[AUTO]{inputenc}
|
||||
\\usepackage[T1]{fontenc}
|
||||
\\usepackage{graphicx}
|
||||
\\usepackage{longtable}
|
||||
\\usepackage{float}
|
||||
\\usepackage{wrapfig}
|
||||
\\usepackage{soul}
|
||||
\\usepackage{t1enc}
|
||||
\\usepackage{textcomp}
|
||||
\\usepackage{marvosym}
|
||||
\\usepackage{wasysym}
|
||||
\\usepackage{latexsym}
|
||||
\\usepackage{amssymb}
|
||||
\\usepackage{hyperref}"
|
||||
"\\documentclass{beamer}"
|
||||
org-beamer-sectioning
|
||||
))
|
||||
))
|
||||
"Alist of LaTeX classes and associated header and structure.
|
||||
If #+LaTeX_CLASS is set in the buffer, use its value and the
|
||||
associated information. Here is the structure of each cell:
|
||||
|
@ -184,16 +128,17 @@ The header string
|
|||
-----------------
|
||||
|
||||
The HEADER-STRING is the header that will be inserted into the LaTeX file.
|
||||
It should contain the \\documentclass macro, package call via \\usepackage
|
||||
and anything else you would always like to have in the header. Note that
|
||||
the header will be augmented with additional usepackage statements
|
||||
according to the variable `org-export-latex-packages-alist', and also with
|
||||
lines specified via \"#+LaTeX_HEADER:\".
|
||||
If the header definition contains \"\\usepackage[AUTO]{inputenc}\", AUTO
|
||||
will automatically be replaced with a coding system derived from
|
||||
`buffer-file-coding-system'. See also the variable
|
||||
`org-export-latex-inputenc-alist' for a way to influence this mechanism.
|
||||
|
||||
It should really only contain the contain the \\documentclass macro.
|
||||
If can also contain package calls via \\usepackage, but it should only
|
||||
do so if any packages absolutely must be loaded before the packages given
|
||||
in `org-export-latex-default-packages-alist' and
|
||||
`org-export-latex-packages-alist'. Lines specified via \"#+LaTeX_HEADER:\"
|
||||
are also added.
|
||||
`org-export-latex-default-packages-alist' contains
|
||||
\"\\usepackage[AUTO]{inputenc}\", AUTO will automatically be replaced with
|
||||
a coding system derived from `buffer-file-coding-system'. See also the
|
||||
variable `org-export-latex-inputenc-alist' for a way to influence this
|
||||
mechanism.
|
||||
|
||||
The sectioning structure
|
||||
------------------------
|
||||
|
@ -1172,14 +1117,17 @@ OPT-PLIST is the options plist for current buffer."
|
|||
(org-export-apply-macros-in-string org-export-latex-header)
|
||||
"\n"
|
||||
;; insert information on LaTeX packages
|
||||
(when org-export-latex-packages-alist
|
||||
(when (or org-export-latex-default-packages-alist
|
||||
org-export-latex-packages-alist)
|
||||
(concat
|
||||
(mapconcat (lambda(p)
|
||||
(if (equal "" (car p))
|
||||
(format "\\usepackage{%s}" (cadr p))
|
||||
(format "\\usepackage[%s]{%s}"
|
||||
(car p) (cadr p))))
|
||||
org-export-latex-packages-alist "\n")
|
||||
(append org-export-latex-default-packages-alist
|
||||
org-export-latex-packages-alist)
|
||||
"\n")
|
||||
"\n"))
|
||||
;; insert additional commands in the header
|
||||
(org-export-apply-macros-in-string
|
||||
|
|
50
lisp/org.el
50
lisp/org.el
|
@ -2907,10 +2907,8 @@ When nil, just push out a message."
|
|||
:type 'boolean)
|
||||
|
||||
(defcustom org-format-latex-header "\\documentclass{article}
|
||||
\\usepackage{amssymb}
|
||||
\\usepackage[usenames]{color}
|
||||
\\usepackage{amsmath}
|
||||
\\usepackage{latexsym}
|
||||
\\usepackage[mathscr]{eucal}
|
||||
\\pagestyle{empty} % do not remove
|
||||
% The settings below are copied from fullpage.sty
|
||||
|
@ -2934,16 +2932,45 @@ appears on the page."
|
|||
|
||||
(defvar org-format-latex-header-extra nil)
|
||||
|
||||
;; The following variable is defined here because is it also used
|
||||
;; The following variables are defined here because is it also used
|
||||
;; when formatting latex fragments. Originally it was part of the
|
||||
;; LaTeX exporter, which is why the name includes "export".
|
||||
(defcustom org-export-latex-packages-alist nil
|
||||
"Alist of packages to be inserted in the header.
|
||||
Each cell is of the format \( \"option\" . \"package\" \)."
|
||||
(defcustom org-export-latex-default-packages-alist
|
||||
'(("AUTO" . "inputenc")
|
||||
("T1" . "fontenc")
|
||||
("" . "graphicx")
|
||||
("" . "longtable")
|
||||
("" . "float")
|
||||
("" . "wrapfig")
|
||||
("" . "soul")
|
||||
("" . "t1enc")
|
||||
("" . "textcomp")
|
||||
("" . "marvosym")
|
||||
("" . "wasysym")
|
||||
("" . "latexsym")
|
||||
("" . "amssymb")
|
||||
("" . "hyperref"))
|
||||
"Alist of default packages to be inserted in the header. DON'T CHANGE THIS.
|
||||
Unless abslutely necessary that is.
|
||||
All the packages in this list are needed by one part or another of Org-mode
|
||||
to function properly. Therefore you should, not modify this variable unless
|
||||
you know what you are doing. The one reason to change it anyway is that
|
||||
you might be loading some other package that conflicts with one of the default
|
||||
packages.
|
||||
Each cell is of the format \( \"options\" . \"package\" \)."
|
||||
:group 'org-export-latex
|
||||
:type '(repeat
|
||||
(list
|
||||
(string :tag "option")
|
||||
(string :tag "options")
|
||||
(string :tag "package"))))
|
||||
|
||||
(defcustom org-export-latex-packages-alist nil
|
||||
"Alist of packages to be inserted in the header.
|
||||
Each cell is of the format \( \"options\" . \"package\" \)."
|
||||
:group 'org-export-latex
|
||||
:type '(repeat
|
||||
(list
|
||||
(string :tag "options")
|
||||
(string :tag "package"))))
|
||||
|
||||
(defgroup org-appearance nil
|
||||
|
@ -15141,6 +15168,7 @@ Some of the options can be changed using the variable
|
|||
(setq hash (sha1 (prin1-to-string
|
||||
(list org-format-latex-header
|
||||
org-format-latex-header-extra
|
||||
org-export-latex-default-packages-alist
|
||||
org-export-latex-packages-alist
|
||||
org-format-latex-options
|
||||
forbuffer txt)))
|
||||
|
@ -15213,14 +15241,18 @@ Some of the options can be changed using the variable
|
|||
(if (eq bg 'default) (setq bg (org-dvipng-color :background)))
|
||||
(with-temp-file texfile
|
||||
(insert org-format-latex-header
|
||||
(if org-export-latex-packages-alist
|
||||
(if (or org-export-latex-default-packages-alist
|
||||
org-export-latex-packages-alist)
|
||||
(concat "\n"
|
||||
(mapconcat (lambda(p)
|
||||
(if (equal "" (car p))
|
||||
(format "\\usepackage{%s}" (cadr p))
|
||||
(format "\\usepackage[%s]{%s}"
|
||||
(car p) (cadr p))))
|
||||
org-export-latex-packages-alist "\n"))
|
||||
(append
|
||||
org-export-latex-default-packages-alist
|
||||
org-export-latex-packages-alist)
|
||||
"\n"))
|
||||
"")
|
||||
(if org-format-latex-header-extra
|
||||
(concat "\n" org-format-latex-header-extra)
|
||||
|
|
Loading…
Reference in New Issue