Re: [O] [PATCH] ox-latex: Add scrartcl LaTeX class

2015-09-27 Thread Sebastian Boehm
Hi,

On 24 September 2015 at 12:04, Eric S Fraga  wrote:
> I have done the following:
> […]

thanks for all the great suggestions! I haven't had the opportunity to
try out all proposed solutions yet, but Eric's snippet looks like a
great way to tackle my initial problem.

Best,
Sebastian



Re: [O] [PATCH] ox-latex: Add scrartcl LaTeX class

2015-09-24 Thread Eric S Fraga
On Wednesday, 23 Sep 2015 at 14:27, Ista Zahn wrote:
> On Wed, Sep 23, 2015 at 2:16 PM, Eric S Fraga  wrote:

[...]

>> One solution, but not an ideal one, is to use file local variables to
>> define org-latex-classes (and any other variables) as appropriate for
>> the document.  It's not ideal because unfortunately most of org's
>> variables (as well as many of emacs's own) are "global" and hence affect
>> the functionality of org visiting other buffers.  I find myself having
>> separate emacs instances for some org files for this reason.
>
> Doesn't "setq-local" solve this problem?

Seems to!  Thanks.  I have done the following:
#+begin_src org
  ,#+title: Testing setq-loccal
  ,#+latex_class: esftest
  ,* settings   
   :noexport:
  ,#+name: startup
  ,#+begin_src emacs-lisp :results none
(setq-local org-latex-classes '(("esftest" "\\documentclass{scrartcl}" 
("\\section*{%s}" . "\\section*{%s}") ("\\subsection{%s}" . 
"\\subsection*{%s}") ("\\subsubsection{%s}" . "\\subsubsection*{%s}") 
("\\paragraph{%s}" . "\\paragraph*{%s}") ("\\subparagraph{%s}" . 
"\\subparagraph*{%s}"
  ,#+end_src

  # Local Variables:
  # eval: (esf/execute-startup-block)
  # End:
#+end_src
where esf/execute-startup-block executes the src block named "startup".

The issue is complicated by the fact that exporters generate a new
buffer which has its own variables (hence the use of #+bind:) so some
variables should be set using bind but others potentially using
setq-local.

Thanks again,
eric
-- 
: Eric S Fraga (0xFFFCF67D), Emacs 24.5.1, Org release_8.3.1-203-g4ca3d3



Re: [O] [PATCH] ox-latex: Add scrartcl LaTeX class

2015-09-23 Thread Sebastian Boehm
Hi Nicolas,

On 21 September 2015 at 21:46, Nicolas Goaziou  wrote:
> But can't users needing a non-default class customize their
> own `org-latex-classes? Or is there an entitling reason to offer it out
> of the box?

you are of course right; users can always customise their own setup.
However, when sharing Org files with other people this kind of tight
coupling between the Org file and the user's Emacs configuration can
become quite problematic.

Granted, this is not a problem if you only work alone on all of your
projects, but it effectively prevents users from using document
classes other than the ones provided by Org mode for shared documents
(especially when sharing documents with less experienced users).

My intention was not to start a debate on "article" vs. "scrartcl",
but it would be great to see some more variety in the default document
classes or maybe even a way to specify the desired document class as
well as the desired sectioning style directly in an Org file without
having to rely on the document class definition being available in
another user's Emacs config.

Btw, since I am not on the list, it would be great if everybody could
CC me on replies.

Best,
Sebastian



Re: [O] [PATCH] ox-latex: Add scrartcl LaTeX class

2015-09-23 Thread Thomas S . Dye
Aloha Sebastian,

Sebastian Boehm  writes:

> Hi Nicolas,
>
> On 21 September 2015 at 21:46, Nicolas Goaziou  wrote:
>> But can't users needing a non-default class customize their
>> own `org-latex-classes? Or is there an entitling reason to offer it out
>> of the box?
>
> you are of course right; users can always customise their own setup.
> However, when sharing Org files with other people this kind of tight
> coupling between the Org file and the user's Emacs configuration can
> become quite problematic.
>
> Granted, this is not a problem if you only work alone on all of your
> projects, but it effectively prevents users from using document
> classes other than the ones provided by Org mode for shared documents
> (especially when sharing documents with less experienced users).
>
> My intention was not to start a debate on "article" vs. "scrartcl",
> but it would be great to see some more variety in the default document
> classes or maybe even a way to specify the desired document class as
> well as the desired sectioning style directly in an Org file without
> having to rely on the document class definition being available in
> another user's Emacs config.

Sharing documents that are highly configured, but don't rely on the
user's Emacs configuration, is one goal of "reproducible research"
carried out with Org mode.

In general, it is possible to move the configuration into the shared Org
mode document and then use Local Variables to load the configuration
when the document is opened, or when the user refreshes the setup.

The first step is to put the configuration into one or more Babel source
code blocks in the shared document and give each source code block a
name.  Then set up Local Variables to called the named source code
block(s) using the org-sbe (formerly, sbe) function.

Here is a fragment of the Local Variables section I'm using on a
self-contained Org mode document.

# Local Variables: 
# eval: (require 'ox-latex)
# org-hide-macro-markers: t
# org-entities-user: nil
# eval: (and (fboundp 'org-sbe) (not (fboundp 'sbe)) (fset 'sbe 'org-sbe))
# eval: (sbe "user-entities")
# End:

Where the source code block named "user-entities" is:

*** User Entities
The following source code block sets up user entities that are used frequently
in my work. I use the various =*macron= commands to typeset Hawaiian
language words with what is known in Hawaiian as a /kahak\omacron{}/.

#+name: user-entities
#+begin_src emacs-lisp
  (add-to-list 'org-entities-user '("amacron" "\\={a}" nil "" "a" "a" 
"ā"))
  (add-to-list 'org-entities-user '("emacron" "\\={e}" nil "" "e" "e" 
"ē"))
  (add-to-list 'org-entities-user '("imacron" "\\={\\i}" nil "" "i" "i" 
"ī"))
  (add-to-list 'org-entities-user '("omacron" "\\={o}" nil "" "o" "o" 
"ō"))
  (add-to-list 'org-entities-user '("umacron" "\\={u}" nil "" "u" "u" 
"ū"))
  (add-to-list 'org-entities-user '("Amacron" "\\={A}" nil "" "A" "A" 
"Ā"))
  (add-to-list 'org-entities-user '("Emacron" "\\={E}" nil "" "E" "E" 
"Ē"))
  (add-to-list 'org-entities-user '("Imacron" "\\={I}" nil "" "I" "I" 
"Ī"))
  (add-to-list 'org-entities-user '("Omacron" "\\={O}" nil "" "O" "O" 
"Ō"))
  (add-to-list 'org-entities-user '("Umacron" "\\={U}" nil "" "U" "U" 
"Ū"))
#+end_src

Let me know if you have questions.

hth,
Tom

-- 
Thomas S. Dye
http://www.tsdye.com



Re: [O] [PATCH] ox-latex: Add scrartcl LaTeX class

2015-09-23 Thread Ista Zahn
On Wed, Sep 23, 2015 at 2:16 PM, Eric S Fraga  wrote:
> On Wednesday, 23 Sep 2015 at 18:59, Sebastian Boehm wrote:
>> Hi Nicolas,
>>
>> On 21 September 2015 at 21:46, Nicolas Goaziou  
>> wrote:
>>> But can't users needing a non-default class customize their
>>> own `org-latex-classes? Or is there an entitling reason to offer it out
>>> of the box?
>>
>> you are of course right; users can always customise their own setup.
>> However, when sharing Org files with other people this kind of tight
>> coupling between the Org file and the user's Emacs configuration can
>> become quite problematic.
>
> Yes, this is a real problem.
>
> One solution, but not an ideal one, is to use file local variables to
> define org-latex-classes (and any other variables) as appropriate for
> the document.  It's not ideal because unfortunately most of org's
> variables (as well as many of emacs's own) are "global" and hence affect
> the functionality of org visiting other buffers.  I find myself having
> separate emacs instances for some org files for this reason.

Doesn't "setq-local" solve this problem?

>
> I had thought that maybe using #+bind: would solve this problem but the
> export engine looks for the LaTeX class before binding takes effect.
>
> --
> : Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.2, Org release_8.3.1-270-g256fef
>



Re: [O] [PATCH] ox-latex: Add scrartcl LaTeX class

2015-09-23 Thread Thomas S . Dye
Hi Eric,

Eric S Fraga  writes:

> One solution, but not an ideal one, is to use file local variables to
> define org-latex-classes (and any other variables) as appropriate for
> the document.  It's not ideal because unfortunately most of org's
> variables (as well as many of emacs's own) are "global" and hence affect
> the functionality of org visiting other buffers.  I find myself having
> separate emacs instances for some org files for this reason.

I've noticed this, too, but never investigated.

Is there some way to know which variables are "global" and which can be
set "locally"?

Also, (completely naively) is it difficult to make "global" variables
"local", or is it something simple, like making a function interactive?  

All the best,
Tom

-- 
Thomas S. Dye
http://www.tsdye.com



Re: [O] [PATCH] ox-latex: Add scrartcl LaTeX class

2015-09-23 Thread Eric S Fraga
On Wednesday, 23 Sep 2015 at 18:59, Sebastian Boehm wrote:
> Hi Nicolas,
>
> On 21 September 2015 at 21:46, Nicolas Goaziou  wrote:
>> But can't users needing a non-default class customize their
>> own `org-latex-classes? Or is there an entitling reason to offer it out
>> of the box?
>
> you are of course right; users can always customise their own setup.
> However, when sharing Org files with other people this kind of tight
> coupling between the Org file and the user's Emacs configuration can
> become quite problematic.

Yes, this is a real problem.

One solution, but not an ideal one, is to use file local variables to
define org-latex-classes (and any other variables) as appropriate for
the document.  It's not ideal because unfortunately most of org's
variables (as well as many of emacs's own) are "global" and hence affect
the functionality of org visiting other buffers.  I find myself having
separate emacs instances for some org files for this reason.

I had thought that maybe using #+bind: would solve this problem but the
export engine looks for the LaTeX class before binding takes effect.

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.2, Org release_8.3.1-270-g256fef



Re: [O] [PATCH] ox-latex: Add scrartcl LaTeX class

2015-09-23 Thread Rasmus
Nicolas Goaziou  writes:

> Hello,
>
> Rasmus  writes:
>
>> The long-term solution to this is a new "bundled org" file format
>> containing dependencies, such as org files, init.el etc.
>>
>> https://lists.gnu.org/archive/html/emacs-orgmode/2015-02/msg00765.html
>
> This was just an idea, not a long-term solution or a plan. Actually,
> using Babel, you may not even need to introduce a new file format, since
> a document can generate its own set-up.

I know.  I still think it's a great idea.  It also nice for pictures, css
etc.

-- 
Dung makes an excellent fertilizer



Re: [O] [PATCH] ox-latex: Add scrartcl LaTeX class

2015-09-23 Thread Nicolas Goaziou
Hello,

Rasmus  writes:

> The long-term solution to this is a new "bundled org" file format
> containing dependencies, such as org files, init.el etc.
>
> https://lists.gnu.org/archive/html/emacs-orgmode/2015-02/msg00765.html

This was just an idea, not a long-term solution or a plan. Actually,
using Babel, you may not even need to introduce a new file format, since
a document can generate its own set-up.


Regards,

-- 
Nicolas Goaziou



Re: [O] [PATCH] ox-latex: Add scrartcl LaTeX class

2015-09-23 Thread Rasmus
Sebastian Boehm  writes:
> My intention was not to start a debate on "article" vs. "scrartcl",
> but it would be great to see some more variety in the default document
> classes or maybe even a way to specify the desired document class as
> well as the desired sectioning style directly in an Org file without
> having to rely on the document class definition being available in
> another user's Emacs config.

The long-term solution to this is a new "bundled org" file format
containing dependencies, such as org files, init.el etc.

https://lists.gnu.org/archive/html/emacs-orgmode/2015-02/msg00765.html

Rasmus

-- 
Got mashed potatoes. Ain't got no T-Bone. No T-Bone




Re: [O] [PATCH] ox-latex: Add scrartcl LaTeX class

2015-09-22 Thread Rasmus
Eric S Fraga  writes:

>> Some people might hate the margin choices to the extend that they'd
>> need geometry to make KOMA-script bearable.  Now we have two new
>> dependencies...
>
> yes.  The real question is not the dependencies but what would we like
> new users to when they try exporting a document to PDF for the first
> time?  Is the LaTeX default article good enough or would using koma
> impress them more?  I don't know the answer to this...

Having to do a lot of work on a restricted system with e.g. a very old R,
I can tell you that dependencies matter!  I have to check dependencies and
install packages.

I'm not against ox-fancy-latex.el, but it's more work than adding
KOMA-scrip as a default class...

If we want to make a great first impression, libertine-pkg is more likely
to please drive-by testers than KOMA.

Rasmus


-- 
The Kids call him Billy the Saint



Re: [O] [PATCH] ox-latex: Add scrartcl LaTeX class

2015-09-22 Thread Eric S Fraga
On Tuesday, 22 Sep 2015 at 13:21, Rasmus wrote:
> Key word being 'arguably'.

indeed!

> Some people might hate the margin choices to the extend that they'd
> need geometry to make KOMA-script bearable.  Now we have two new
> dependencies...

yes.  The real question is not the dependencies but what would we like
new users to when they try exporting a document to PDF for the first
time?  Is the LaTeX default article good enough or would using koma
impress them more?  I don't know the answer to this...

For not so novice users, customising org-latex-classes is relatively
painless.

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 24.5.1, Org release_8.3.1-239-gd01560



Re: [O] [PATCH] ox-latex: Add scrartcl LaTeX class

2015-09-22 Thread Eric S Fraga
On Monday, 21 Sep 2015 at 21:46, Nicolas Goaziou wrote:

[...]

> Thank you. But can't users needing a non-default class customize their
> own `org-latex-classes? Or is there an entitling reason to offer it out
> of the box?

Only that the koma-script classes are arguably better defaults than the
actual defaults...  Personally, I cannot see any reason to use the
standard article/report/letter classes!

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 24.5.1, Org release_8.3.1-239-gd01560



Re: [O] [PATCH] ox-latex: Add scrartcl LaTeX class

2015-09-22 Thread Rasmus
Eric S Fraga  writes:

>> Thank you. But can't users needing a non-default class customize their
>> own `org-latex-classes? Or is there an entitling reason to offer it out
>> of the box?
>
> Only that the koma-script classes are arguably better defaults than the
> actual defaults...  Personally, I cannot see any reason to use the
> standard article/report/letter classes!

Key word being 'arguably'.  Some people might hate the margin choices to
the extend that they'd need geometry to make KOMA-script bearable.  Now we
have two new dependencies...

Rasmus

-- 
Need more coffee. . .




Re: [O] [PATCH] ox-latex: Add scrartcl LaTeX class

2015-09-22 Thread Grant Rettke
On Tue, Sep 22, 2015 at 2:20 AM, Eric S Fraga  wrote:
> On Monday, 21 Sep 2015 at 21:46, Nicolas Goaziou wrote:

> Only that the koma-script classes are arguably better defaults than the
> actual defaults...  Personally, I cannot see any reason to use the
> standard article/report/letter classes!

Good to know! I've never tried anything other than the default! :) Now
I'm curious.



Re: [O] [PATCH] ox-latex: Add scrartcl LaTeX class

2015-09-21 Thread Suvayu Ali
On Mon, Sep 21, 2015 at 11:45:08PM +0200, Rasmus wrote:
> Nicolas Goaziou  writes:
> 
> > Sebastian Boehm  writes:
> >
> >> I would like to propose adding the KOMA-script scrartcl class to the
> >> list of supported ox-latex classes. scrartcl is one of the most
> >> popular "article" alternatives out there and it would be great to be
> >> able to pass org files using scrartcl to other Org mode users without
> >> having to explain ox-latex custom settings.
> >>
> >> The attached patch changes ox-latex.el to include scrartcl in
> >> org-latex-classes.
> >
> > Thank you. But can't users needing a non-default class customize their
> > own `org-latex-classes? Or is there an entitling reason to offer it out
> > of the box?
> 
> It's absolutely a much more pleasant experience than article, at least if
> you agree with the KOMA-guys' margin opinion (e.g. top:bottom margin is
> fixed at 1:2).  [I've been using the KOMA-bundle for years and years].
> 
> The patch is also subjective, e.g. it does not feature \minisec[.]{.}.
> 
> ox-koma-article.el would be awesome but until then, there's no point in
> adding it.

I use scrartcl, but I think this should be left up to the end user.
ox-koma-article.el would be great though :).

-- 
Suvayu

Open source is the future. It sets us free.



Re: [O] [PATCH] ox-latex: Add scrartcl LaTeX class

2015-09-21 Thread Nicolas Goaziou
Hello,

Sebastian Boehm  writes:

> I would like to propose adding the KOMA-script scrartcl class to the
> list of supported ox-latex classes. scrartcl is one of the most
> popular "article" alternatives out there and it would be great to be
> able to pass org files using scrartcl to other Org mode users without
> having to explain ox-latex custom settings.
>
> The attached patch changes ox-latex.el to include scrartcl in
> org-latex-classes.

Thank you. But can't users needing a non-default class customize their
own `org-latex-classes? Or is there an entitling reason to offer it out
of the box?

Regards,

-- 
Nicolas Goaziou



Re: [O] [PATCH] ox-latex: Add scrartcl LaTeX class

2015-09-21 Thread Rasmus
Nicolas Goaziou  writes:

> Hello,
>
> Sebastian Boehm  writes:
>
>> I would like to propose adding the KOMA-script scrartcl class to the
>> list of supported ox-latex classes. scrartcl is one of the most
>> popular "article" alternatives out there and it would be great to be
>> able to pass org files using scrartcl to other Org mode users without
>> having to explain ox-latex custom settings.
>>
>> The attached patch changes ox-latex.el to include scrartcl in
>> org-latex-classes.
>
> Thank you. But can't users needing a non-default class customize their
> own `org-latex-classes? Or is there an entitling reason to offer it out
> of the box?

It's absolutely a much more pleasant experience than article, at least if
you agree with the KOMA-guys' margin opinion (e.g. top:bottom margin is
fixed at 1:2).  [I've been using the KOMA-bundle for years and years].

The patch is also subjective, e.g. it does not feature \minisec[.]{.}.

ox-koma-article.el would be awesome but until then, there's no point in
adding it.

Rasmus

-- 
I feel emotional landscapes they puzzle me