emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <nicholas.dokos@hp.com>
To: FengShu <tumashu@gmail.com>
Cc: nicholas.dokos@hp.com, emacs-orgmode@gnu.org
Subject: Re: How to include a very complicated latex head
Date: Wed, 21 Mar 2012 08:52:59 -0400	[thread overview]
Message-ID: <3773.1332334379@alphaville> (raw)
In-Reply-To: Message from FengShu <tumashu@gmail.com> of "Wed, 21 Mar 2012 17:00:24 +0800." <87y5qu2us7.fsf@gmail.com>

FengShu <tumashu@gmail.com> 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

      parent reply	other threads:[~2012-03-21 12:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-21  9:00 How to include a very complicated latex head FengShu
2012-03-21 10:51 ` Alan Schmitt
2012-03-21 12:52 ` Nick Dokos [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3773.1332334379@alphaville \
    --to=nicholas.dokos@hp.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=tumashu@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).