From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Abrahamsen Subject: Re: [suggest] We should import latex template system Date: Wed, 12 Jun 2013 21:28:01 +0800 Message-ID: <87fvwne9we.fsf@ericabrahamsen.net> References: <87zjuwb3w7.fsf@news.tumashu-localhost.org> <20130612064643.GA73033@kenny.local> <87vc5jbrnu.fsf@news.tumashu-localhost.org> <87r4g7bqib.fsf@news.tumashu-localhost.org> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:40760) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uml7p-0001Im-7a for emacs-orgmode@gnu.org; Wed, 12 Jun 2013 09:30:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uml7j-0006AR-Ue for emacs-orgmode@gnu.org; Wed, 12 Jun 2013 09:30:09 -0400 Received: from plane.gmane.org ([80.91.229.3]:41760) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uml5l-0005Ij-Qt for emacs-orgmode@gnu.org; Wed, 12 Jun 2013 09:28:01 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Uml5k-0003Vb-Iw for emacs-orgmode@gnu.org; Wed, 12 Jun 2013 15:28:00 +0200 Received: from 50.56.99.223 ([50.56.99.223]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 12 Jun 2013 15:28:00 +0200 Received: from eric by 50.56.99.223 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 12 Jun 2013 15:28:00 +0200 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: emacs-orgmode@gnu.org Feng Shu writes: > Feng Shu writes: > >> Viktor Rosenfeld 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