Created
September 27, 2011 11:06
-
-
Save robertpfeiffer/1244824 to your computer and use it in GitHub Desktop.
XeTex für Org Mode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#+LATEX_CMD: xelatex | |
#+LATEX_HEADER: \setmainfont[Mapping=tex-text]{Gentium} | |
#+LATEX_HEADER: \setdefaultlanguage{german} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require 'org-latex) | |
(setq org-export-latex-listings t) | |
;; Originally taken from Bruno Tavernier: http://thread.gmane.org/gmane.emacs.orgmode/31150/focus=31432 | |
;; but adapted to use latexmk 4.20 or higher. | |
(defun my-auto-tex-cmd () | |
"When exporting from .org with latex, automatically run latex, | |
pdflatex, or xelatex as appropriate, using latexmk." | |
(let ((texcmd))) | |
;; default command: oldstyle latex via dvi | |
(setq texcmd "latexmk -dvi -pdfps -quiet %f") | |
;; pdflatex -> .pdf | |
(if (string-match "LATEX_CMD: pdflatex" (buffer-string)) | |
(setq texcmd "latexmk -pdf -quiet %f")) | |
;; xelatex -> .pdf | |
(if (string-match "LATEX_CMD: xelatex" (buffer-string)) | |
(setq texcmd "latexmk -pdflatex=xelatex -pdf -quiet %f")) | |
;;(setq texcmd "/home/rincewind/bin/latexmk.pl -pdflatex=xelatex -pdf -quiet %f")) ;; Hier habe ich die aktuelle Version 4.26 von latexmk hinentpackt | |
;; LaTeX compilation command | |
(setq org-latex-to-pdf-process (list texcmd))) | |
(add-hook 'org-export-latex-after-initial-vars-hook 'my-auto-tex-cmd) | |
;; Specify default packages to be included in every tex file, whether pdflatex or xelatex | |
(setq org-export-latex-packages-alist | |
'(("" "graphicx" t) | |
("" "longtable" nil) | |
("" "float" nil))) | |
(defun my-auto-tex-parameters () | |
"Automatically select the tex packages to include." | |
;; default packages for ordinary latex or pdflatex export | |
(setq org-export-latex-default-packages-alist | |
'(("AUTO" "inputenc" t) | |
("T1" "fontenc" t) | |
("" "fixltx2e" nil) | |
("" "wrapfig" nil) | |
("" "soul" t) | |
("" "textcomp" t) | |
("" "marvosym" t) | |
("" "wasysym" t) | |
("" "latexsym" t) | |
("" "amssymb" t) | |
("" "hyperref" nil))) | |
;; Packages to include when xelatex is used | |
(if (string-match "LATEX_CMD: xelatex" (buffer-string)) | |
(setq org-export-latex-default-packages-alist | |
'(("" "fontspec" t) | |
("" "xunicode" t) | |
("" "url" t) | |
("" "rotating" t) | |
("" "polyglossia" t) ;; Polyglossia statt babel | |
("" "soul" t) | |
("xetex" "hyperref" nil) | |
))) | |
(if (string-match "LATEX_CMD: xelatex" (buffer-string)) | |
(setq org-export-latex-classes | |
(cons '("article" | |
"\\documentclass[11pt,article,oneside]{memoir}" | |
("\\section{%s}" . "\\section*{%s}") | |
("\\subsection{%s}" . "\\subsection*{%s}") | |
("\\subsubsection{%s}" . "\\subsubsection*{%s}") | |
("\\paragraph{%s}" . "\\paragraph*{%s}") | |
("\\subparagraph{%s}" . "\\subparagraph*{%s}")) | |
org-export-latex-classes)))) | |
(add-hook 'org-export-latex-after-initial-vars-hook 'my-auto-tex-parameters) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment