2010/8/13 Christian Wittern <cwitt...@gmail.com>

> There are some more lines I did not ask for and do not want, like for
> example the \usepackage[utf8]{inputenc} which does not work with XeTeX.
> Now the number of possible relevant variables etc is just too complex for me
> to understand.  I would appreciate if some kind soul would explain to me how
> to trim this down to use only the packages I need.

Ain't that the truth.  The new LaTeX header system is very flexible,
but it multiplies the places you can put header stuff, and because of
the way XeLaTeX headers are structured, not all of them work.

This is what I do.  The following is a little hastily written.  I'm
happy to come back to anything that doesn't make sense.

First, I set org-export-latex-classes like so.  The relevant stanzas
are 5-7, staring with "mythesis"
Note that I explicitly exclude ORG's default set of loaded packages,
so i can include my own set.
Also note that it's a pretty small header.  For some reason I couldn't
get things to work if I put all of the XeTeX header stuff in there,
nor could I get it to work by putting in a bunch of #+Latex_header
lines (or whatever their syntax is).

(setq org-export-latex-classes
  '(("article"
     "\\documentclass[11pt, a4paper]{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}"
     ("\\part{%s}" . "\\part*{%s}")
     ("\\chapter{%s}" . "\\chapter*{%s}")
     ("\\section{%s}" . "\\section*{%s}")
     ("\\subsection{%s}" . "\\subsection*{%s}")
     ("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
    ("book"
     "\\documentclass[11pt, a4paper]{book}"
     ("\\part{%s}" . "\\part*{%s}")
     ("\\chapter{%s}" . "\\chapter*{%s}")
     ("\\section{%s}" . "\\section*{%s}")
     ("\\subsection{%s}" . "\\subsection*{%s}")
     ("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
    ("beamer"
     "\\documentclass{beamer}"
     org-beamer-sectioning)
  ;; Here starts my personal latex classes
  ;; use them with:  #+LaTeX_CLASS: mythesis
    ("mythesis"
     "%!TEX TS-program = xelatex\n%!TEX encoding = UTF-8
Unicode\n\\documentclass[12pt,oneside,a4paper]{book}\n\\usepackage{fontspec}\n\\usepackage{xunicode}\n\\usepackage{xltxtra}\n\n%
Load My Thesis Defaults\n\\input{/home/scot/lin/tex/thesis-header.tex}\n%
Don't Load Org's standard list for this
class\n[NO-DEFAULT-PACKAGES]\n\\defaultfontfeatures{Scale=MatchLowercase,Mapping=tex-text}
% converts LaTeX specials (``quotes'' --- dashes etc.) to
unicode\n\\setromanfont{Gentium}\n\\setsansfont{Liberation Sans}
%change this, if you even use it."
     ("\\chapter{%s}" . "\\chapter*{%s}")
     ("\\section{%s}" . "\\section*{%s}")
     ("\\subsection{%s}" . "\\subsection*{%s}")
     ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
     ("\\paragraph{%s}" . "\\paragraph*{%s}")
     ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
    ("mychapter"
     "%!TEX TS-program = xelatex\n%!TEX encoding = UTF-8
Unicode\n\\documentclass[12pt,oneside,a4paper]{book}\n\\usepackage{fontspec}\n\\usepackage{xunicode}\n\\usepackage{xltxtra}\n\n%
Load My Thesis Defaults\n\\input{/home/scot/lin/tex/thesis-header.tex}\n%
Don't Load Org's standard list for this
class\n[NO-DEFAULT-PACKAGES]\n\\defaultfontfeatures{Scale=MatchLowercase,Mapping=tex-text}
% converts LaTeX specials (``quotes'' --- dashes etc.) to
unicode\n\\setromanfont{Gentium}\n\\setsansfont{Liberation Sans}
%change this, if you even use it."
     ("\\section{%s}" . "\\section*{%s}")
     ("\\subsection{%s}" . "\\subsection*{%s}")
     ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
     ("\\paragraph{%s}" . "\\paragraph*{%s}")
     ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
    ("mytextchunk"
     "%!TEX TS-program = xelatex\n%!TEX encoding = UTF-8
Unicode\n\\documentclass[12pt,oneside,a4paper]{article}\n\\usepackage{fontspec}\n\\usepackage{xunicode}\n\\usepackage{xltxtra}\n\n%
Load My Thesis Defaults\n\\input{/home/scot/lin/tex/thesis-header.tex}\n%
Don't Load Org's standard list for this
class\n[NO-DEFAULT-PACKAGES]\n\\defaultfontfeatures{Scale=MatchLowercase,Mapping=tex-text}
% converts LaTeX specials (``quotes'' --- dashes etc.) to
unicode\n\\setromanfont{Gentium}\n\\setsansfont{Liberation Sans}
%change this, if you even use it."
     ("\\section{%s}" . "\\section*{%s}")
     ("\\subsection{%s}" . "\\subsection*{%s}")
     ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
     ("\\paragraph{%s}" . "\\paragraph*{%s}")
     ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))))

Then I have the following in my thesis-header.tex file.

% Standard org stuff which I have to include by hand
% since I didn't want the other (font handling, entities) bits:
\usepackage{fixltx2e}
\usepackage{graphicx}
\usepackage{longtable}
\usepackage{float}
\usepackage{wrapfig}
%\usepackage{soul}
\usepackage{hyperref}
\tolerance=1000

That seems to produce a header that works with xetex.

I haven't yet set org up to run xelatex automatically, but that's possible too.

Scot

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

Reply via email to