From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: How to include a very complicated latex head Date: Wed, 21 Mar 2012 08:52:59 -0400 Message-ID: <3773.1332334379@alphaville> References: <87y5qu2us7.fsf@gmail.com> Reply-To: nicholas.dokos@hp.com Return-path: Received: from eggs.gnu.org ([208.118.235.92]:59726) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SAL2I-0000cG-4H for emacs-orgmode@gnu.org; Wed, 21 Mar 2012 08:53:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SAL2G-0003ch-5a for emacs-orgmode@gnu.org; Wed, 21 Mar 2012 08:53:05 -0400 Received: from g4t0017.houston.hp.com ([15.201.24.20]:15387) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SAL2F-0003cR-Tk for emacs-orgmode@gnu.org; Wed, 21 Mar 2012 08:53:04 -0400 In-Reply-To: Message from FengShu of "Wed, 21 Mar 2012 17:00:24 +0800." <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: nicholas.dokos@hp.com, emacs-orgmode@gnu.org FengShu wrote: > > I want to set the latex-head for latex exporting, I use > *org-export-latex-append-header*,but it seem not used by > *org-preview-latex-fragment* . is there any other way? > simple way? > You are right - org-preview-latex-fragment is independent of the latex exporter. The preview latex header is constructed (in org.el:org-create-formula-image) like this: ,---- | (with-temp-file texfile | (insert (org-splice-latex-header | org-format-latex-header | org-export-latex-default-packages-alist | org-export-latex-packages-alist t | org-format-latex-header-extra)) | (insert "\n\\begin{document}\n" string "\n\\end{document}\n") | ... `---- so you might want to experiment with the variable org-format-latex-header-extra (and maybe some of the others as well). Certainly far from simple: but if your trial-and-error succeed, then you might be able to propose a simpler mechanism. Let us know. Nick > #+begin_latex > \ifxetex % xelatex > \usepackage[xetex]{hyperref} > \else > \ifpdf % pdflatex > \usepackage[pdftex,unicode]{hyperref} > \else % dvipdfmx or dvips > \usepackage[dvipdfmx,unicode]{hyperref} > %\usepackage[ps2pdf,unicode]{hyperref} > \fi > \fi > > \ifxetex\else\ifpdf\else > % pdftex 3.1415926-1.40.10-2.2 has trouble with it > \InputIfFileExists{zhwinfonts.tex}{}{} > \fi\fi > #+end_latex > #+begin_src emacs-lisp > (setq org-export-latex-append-header > " > \\ifxetex % xelatex > \\usepackage[hyperref,UTF8,nofonts]{ctex} > \\setCJKmainfont[ItalicFont=3D{AR PL UKai CN}]{AR PL UMing CN}% =E6=96=87= > =E9=BC=8E=E5=AE=8B=E4=BD=93=E5=92=8C=E6=A5=B7=E4=B9=A6 > \\setCJKsansfont{WenQuanYi Zen Hei}% =E6=96=87=E6=B3=89=E9=A9=BF=E7=9A=84= > =E9=BB=91=E4=BD=93 > \\setCJKmonofont{WenQuanYi Zen Hei} > \\usepackage[xetex]{hyperref} > \\else > \\ifpdf % pdflatex > \\usepackage[pdftex,unicode]{hyperref} > \\else % dvipdfmx or dvips > \\usepackage[dvipdfmx,unicode]{hyperref} > %\\usepackage[ps2pdf,unicode]{hyperref} > \\fi > \\fi > > \\ifxetex\\else\\ifpdf\\else > % pdftex 3.1415926-1.40.10-2.2 has trouble with it > \\InputIfFileExists{zhwinfonts.tex}{}{} > \\fi\\fi > ") > #+end_src