From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alan Schmitt Subject: Re: How to include a very complicated latex head Date: Wed, 21 Mar 2012 11:51:27 +0100 Message-ID: <968EC7D4-7CEB-45F5-B683-E5D006798E5A@polytechnique.org> References: <87y5qu2us7.fsf@gmail.com> Mime-Version: 1.0 (Apple Message framework v1257) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([208.118.235.92]:55879) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SAJ8g-00054S-5o for emacs-orgmode@gnu.org; Wed, 21 Mar 2012 06:51:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SAJ8c-0007zz-RK for emacs-orgmode@gnu.org; Wed, 21 Mar 2012 06:51:33 -0400 Received: from mail4-relais-sop.national.inria.fr ([192.134.164.105]:2676) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SAJ8c-0007zY-IL for emacs-orgmode@gnu.org; Wed, 21 Mar 2012 06:51:30 -0400 In-Reply-To: <87y5qu2us7.fsf@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: FengShu Cc: emacs-orgmode@gnu.org On 21 mars 2012, at 10:00, FengShu wrote: > I want to set the latex-head for latex exporting, I use=20 > *org-export-latex-append-header*,but it seem not used by > *org-preview-latex-fragment* . is there any other way? > simple way? =20 I'm using this (I don't know if it's simpler or not). Hope this helps, Alan ;; using xelatex ;; from = http://orgmode.org/worg/org-faq.html#using-xelatex-for-pdf-export ;; Originally taken from Bruno Tavernier: = http://thread.gmane.org/gmane.emacs.orgmode/31150/focus=3D31432 ;; 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=3Dxelatex -pdf -quiet %f")) ;; 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) ("" "hyperref" 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) )) ;; 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) ;("american" "babel" t) ;("babel" "csquotes" t) ("" "soul" t) ))) (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)