emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [suggest] We should import latex template system
@ 2013-06-11 23:53 Feng Shu
  2013-06-12  6:46 ` Viktor Rosenfeld
  0 siblings, 1 reply; 11+ messages in thread
From: Feng Shu @ 2013-06-11 23:53 UTC (permalink / raw)
  To: orgmode


Hi:

org-mode odt exporter are using 'org-odt-styles-file, which are odt
templetes, I think latex exporter should do like this. for example:

   
org-latex-styles-file  or  org-latex-templete-file


we can include many different language's templates into org, and no need
touch the ox-latex.el and the user can write theirs template easily,



we can use "locale" to determine which template will be used



converting latex fragements can use templates too, like:


org-latex-fragment-templete-file



-- 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [suggest] We should import latex template system
  2013-06-11 23:53 [suggest] We should import latex template system Feng Shu
@ 2013-06-12  6:46 ` Viktor Rosenfeld
  2013-06-12  9:32   ` Feng Shu
  2013-06-13 22:09   ` Marcin Borkowski
  0 siblings, 2 replies; 11+ messages in thread
From: Viktor Rosenfeld @ 2013-06-12  6:46 UTC (permalink / raw)
  To: Feng Shu; +Cc: orgmode

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.

I've been wanting to learn how to do it but I did not find the time yet.
(Any pointers to good tutorials would be appreciated.)

Cheers,
Viktor

> 
>    
> org-latex-styles-file  or  org-latex-templete-file
> 
> 
> we can include many different language's templates into org, and no need
> touch the ox-latex.el and the user can write theirs template easily,
> 
> 
> 
> we can use "locale" to determine which template will be used
> 
> 
> 
> converting latex fragements can use templates too, like:
> 
> 
> org-latex-fragment-templete-file
> 
> 
> 
> -- 
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [suggest] We should import latex template system
  2013-06-12  6:46 ` Viktor Rosenfeld
@ 2013-06-12  9:32   ` Feng Shu
  2013-06-12  9:57     ` Feng Shu
  2013-06-12 12:41     ` Nicolas Goaziou
  2013-06-13 22:09   ` Marcin Borkowski
  1 sibling, 2 replies; 11+ messages in thread
From: Feng Shu @ 2013-06-12  9:32 UTC (permalink / raw)
  To: emacs-orgmode

Viktor Rosenfeld <listuser36@gmail.com> 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!

>
> I've been wanting to learn how to do it but I did not find the time yet.
> (Any pointers to good tutorials would be appreciated.)
>
> Cheers,
> Viktor
>
>> 
>>    
>> org-latex-styles-file  or  org-latex-templete-file
>> 
>> 
>> we can include many different language's templates into org, and no need
>> touch the ox-latex.el and the user can write theirs template easily,
>> 
>> 
>> 
>> we can use "locale" to determine which template will be used
>> 
>> 
>> 
>> converting latex fragements can use templates too, like:
>> 
>> 
>> org-latex-fragment-templete-file
>> 
>> 
>> 
>> -- 
>> 

-- 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [suggest] We should import latex template system
  2013-06-12  9:32   ` Feng Shu
@ 2013-06-12  9:57     ` Feng Shu
  2013-06-12 13:28       ` Eric Abrahamsen
  2013-06-12 12:41     ` Nicolas Goaziou
  1 sibling, 1 reply; 11+ messages in thread
From: Feng Shu @ 2013-06-12  9:57 UTC (permalink / raw)
  To: emacs-orgmode

Feng Shu <tumashu@gmail.com> writes:

> Viktor Rosenfeld <listuser36@gmail.com> 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've been wanting to learn how to do it but I did not find the time yet.
>> (Any pointers to good tutorials would be appreciated.)
>>
>> Cheers,
>> Viktor
>>
>>> 
>>>    
>>> org-latex-styles-file  or  org-latex-templete-file
>>> 
>>> 
>>> we can include many different language's templates into org, and no need
>>> touch the ox-latex.el and the user can write theirs template easily,
>>> 
>>> 
>>> 
>>> we can use "locale" to determine which template will be used
>>> 
>>> 
>>> 
>>> converting latex fragements can use templates too, like:
>>> 
>>> 
>>> org-latex-fragment-templete-file
>>> 
>>> 
>>> 
>>> -- 
>>> 

-- 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [suggest] We should import latex template system
  2013-06-12  9:32   ` Feng Shu
  2013-06-12  9:57     ` Feng Shu
@ 2013-06-12 12:41     ` Nicolas Goaziou
  2013-06-12 13:29       ` Feng Shu
  1 sibling, 1 reply; 11+ messages in thread
From: Nicolas Goaziou @ 2013-06-12 12:41 UTC (permalink / raw)
  To: Feng Shu; +Cc: emacs-orgmode

Hello,

Feng Shu <tumashu@gmail.com> writes:

> 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

I don't see why customizing `org-latex-classes' _once_ would be
a nightmare.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [suggest] We should import latex template system
  2013-06-12  9:57     ` Feng Shu
@ 2013-06-12 13:28       ` Eric Abrahamsen
  2013-06-12 15:11         ` Feng Shu
  0 siblings, 1 reply; 11+ messages in thread
From: Eric Abrahamsen @ 2013-06-12 13:28 UTC (permalink / raw)
  To: emacs-orgmode

Feng Shu <tumashu@gmail.com> writes:

> Feng Shu <tumashu@gmail.com> writes:
>
>> Viktor Rosenfeld <listuser36@gmail.com> 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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [suggest] We should import latex template system
  2013-06-12 12:41     ` Nicolas Goaziou
@ 2013-06-12 13:29       ` Feng Shu
  2013-06-12 14:38         ` Rasmus
  0 siblings, 1 reply; 11+ messages in thread
From: Feng Shu @ 2013-06-12 13:29 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode

Nicolas Goaziou <n.goaziou@gmail.com> writes:

> Hello,
>
> Feng Shu <tumashu@gmail.com> writes:
>
>> 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
>
> I don't see why customizing `org-latex-classes' _once_ would be
> a nightmare.

If all the CJKV org-mode users need customize this virable _once_ ,
It's a nightmare for org-mode, for all the CJKV org-mode users need to
know how to customize this virable!

If we add all the "class" common used in the world, `org-latex-classes
will be very very long!

>
>
> Regards,

-- 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [suggest] We should import latex template system
  2013-06-12 13:29       ` Feng Shu
@ 2013-06-12 14:38         ` Rasmus
  0 siblings, 0 replies; 11+ messages in thread
From: Rasmus @ 2013-06-12 14:38 UTC (permalink / raw)
  To: emacs-orgmode

Feng Shu <tumashu@gmail.com> writes:

>>> 1. I don't need customize 'org-latex-classes
>>
>> I don't see why customizing `org-latex-classes' _once_ would be
>> a nightmare.
>
> If all the CJKV org-mode users need customize this virable _once_ ,
> It's a nightmare for org-mode, for all the CJKV org-mode users need to
> know how to customize this virable!
>
> If we add all the "class" common used in the world, `org-latex-classes
> will be very very long!

Org ships with like three or four classes. . .  Not all classes in the
world. You can add your own.  With add-to-list it's not even
'dangerous'.  Are you looking for a system to your custom classes?

I have at least five classes that I use, e.g. #+LATEX_CLASS:
problemset loads lots of math stuff and tikz. . .  This seems pretty
close to optimal to me less the fact that you need to escape '\', but
that's just Emacs Lisp.

–Rasmus

-- 
May the Force be with you

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [suggest] We should import latex template system
  2013-06-12 13:28       ` Eric Abrahamsen
@ 2013-06-12 15:11         ` Feng Shu
  0 siblings, 0 replies; 11+ messages in thread
From: Feng Shu @ 2013-06-12 15:11 UTC (permalink / raw)
  To: emacs-orgmode

>
> (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

At the moment, I am using the similar solution!  

If you use this way,  org-mode fragement previewing  may be broken if
you setting \pagestyle{fancy}. 


>
> 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.

There are many, the first one is "ctex", which may be the most popular
latex solution of  chinese users.

All the university latex templates in China seem to be writen as
"class", instead of "style".

and nearly all  of them are derive from  class "article" or "book"

It is the reason that I want this feature:

#+LaTeX_CLASS: article:myclass

It will use default "article" template, and replace class name to myclass!

>
> Hope that helps,
> Eric

-- 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [suggest] We should import latex template system
  2013-06-12  6:46 ` Viktor Rosenfeld
  2013-06-12  9:32   ` Feng Shu
@ 2013-06-13 22:09   ` Marcin Borkowski
  2013-06-14  5:21     ` Viktor Rosenfeld
  1 sibling, 1 reply; 11+ messages in thread
From: Marcin Borkowski @ 2013-06-13 22:09 UTC (permalink / raw)
  To: emacs-orgmode

Dnia 2013-06-12, o godz. 08:46:43
Viktor Rosenfeld <listuser36@gmail.com> napisał(a):

> 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.
> 
> I've been wanting to learn how to do it but I did not find the time
> yet. (Any pointers to good tutorials would be appreciated.)

It's easier than you might think.

http://www.ctan.org/pkg/clsguide
http://tex.stackexchange.com/questions/2416/reference-guide-to-begin-writing-a-class-and-or-a-package

> Cheers,
> Viktor

Hth,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Adam Mickiewicz University

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [suggest] We should import latex template system
  2013-06-13 22:09   ` Marcin Borkowski
@ 2013-06-14  5:21     ` Viktor Rosenfeld
  0 siblings, 0 replies; 11+ messages in thread
From: Viktor Rosenfeld @ 2013-06-14  5:21 UTC (permalink / raw)
  To: Marcin Borkowski; +Cc: emacs-orgmode

Hi Marcin,

Marcin Borkowski wrote:

> Dnia 2013-06-12, o godz. 08:46:43
> Viktor Rosenfeld <listuser36@gmail.com> napisał(a):
> 
> > 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.
> > 
> > I've been wanting to learn how to do it but I did not find the time
> > yet. (Any pointers to good tutorials would be appreciated.)
> 
> It's easier than you might think.
> 
> http://www.ctan.org/pkg/clsguide
> http://tex.stackexchange.com/questions/2416/reference-guide-to-begin-writing-a-class-and-or-a-package

Thanks for these links!

Cheers,
Viktor

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2013-06-14  5:21 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-11 23:53 [suggest] We should import latex template system Feng Shu
2013-06-12  6:46 ` Viktor Rosenfeld
2013-06-12  9:32   ` Feng Shu
2013-06-12  9:57     ` Feng Shu
2013-06-12 13:28       ` Eric Abrahamsen
2013-06-12 15:11         ` Feng Shu
2013-06-12 12:41     ` Nicolas Goaziou
2013-06-12 13:29       ` Feng Shu
2013-06-12 14:38         ` Rasmus
2013-06-13 22:09   ` Marcin Borkowski
2013-06-14  5:21     ` Viktor Rosenfeld

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).