emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [suggest] We should import latex template system


From: Eric Abrahamsen
Subject: Re: [O] [suggest] We should import latex template system
Date: Wed, 12 Jun 2013 21:28:01 +0800
User-agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3 (gnu/linux)

Feng Shu <address@hidden> writes:

> Feng Shu <address@hidden> writes:
>
>> Viktor Rosenfeld <address@hidden> writes:
>>
>>> Hi,
>>>
>>> Feng Shu wrote:
>>>
>>>> org-mode odt exporter are using 'org-odt-styles-file, which are odt
>>>> templetes, I think latex exporter should do like this. for example:
>>>
>>> I would also like to have a template mechanism for my LaTeX exports.
>>> However, I think the way to do it in LaTeX is to write custom *.sty
>>> files which can then be included using #+LATEX_HEADER: \usepackage{...}
>>> for individual exports or more generally using org-latex-packages-alist.
>>
>> .sty can be easily resolved.
>>
>> The problem is that many template should be writen as "class" instead of
>> "style".   If I want to use a custom class , I need to do:
>>
>> 1. (add-to-list 'org-latex-classes ...)
>> 2. (setq org-latex-default-class ...)
>>
>>
>> I don't know other language users, for Chinese latex user, the first
>> thing of write a document may  change the document class, for example,
>> change "article" to "ctexart". If I want use org-mode ,I should add all
>> the "class" common used  to the "org-latex-classes", It will be  a
>> nightmare.
>>
>> In org-latex-class, "article"  and  "ctexart" elements are  very similar, the
>> only different may be their class names.
>>
>> I want such result:
>>
>> 1. I don't need customize 'org-latex-classes
>> 2. #+LATEX_CLASS: ctexart  can work!
>
> #+LATEX_ARTICLE_CLASS: ctexart   ?
> #+LATEX_CLASS:  article:ctexart  ?

I do Chinese documents using xelatex, and it works just fine (with the
xeCJK package). I make a "mychinesestylefile.sty" file with all my
xelatex and Chinese font stuff. Then:

(eval-after-load 'ox-latex
  '(add-to-list 'org-latex-classes
      '("myclass" "\\documentclass{article}
[NO-DEFAULT-PACKAGES]
[NO-PACKAGES]
[EXTRA]
\\usepackage{mychinesestylefile}"
        ("\\section{%s}" . "\\section*{%s}")
        ("\\subsection{%s}" . "\\subsection*{%s}")
        ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
        ("\\paragraph{%s}" . "\\paragraph*{%s}")
        ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))))

And then in any given document:

#+LaTeX_CLASS: myclass

If I need to layer another project-specific style file on top of that, I
add a second line in the header:

#+LaTeX_HEADER: \usepackage{someparticularpackage}

Any document that might require Chinese starts as a "myclass", and then
goes from there. I set this up a year ago, and haven't needed to mess
with it since.

Hope that helps,
Eric




reply via email to

[Prev in Thread] Current Thread [Next in Thread]