Re: [O] BEGIN_LATEX_HEADER [cont]

2014-06-22 Thread Nicolas Goaziou
Aaron Ecay aarone...@gmail.com writes:

 This is basically making the user do (something like) org-edit-special
 manually.

That is an interesting idea. `org-edit-special' could be improved to
edit clusters of export keywords (e.g. #+LATEX) in a dedicated buffer.

Recognizing a keyword as an export keyword is doable (i.e. iterate over
registered back-ends and check export keywords they define), but finding
the appropriate major-mode for the alternate buffer seems cumbersome. It
could be hard-coded, but that is not very practical. It could also be
decided in the export back-end definition.


Regards,

-- 
Nicolas Goaziou



Re: [O] BEGIN_LATEX_HEADER [cont]

2014-06-22 Thread Nicolas Goaziou
Ken Mankoff mank...@gmail.com writes:

 It is not a 1x operation, it is a per-document operation. For example,
 in my use-case that started this whole discussion, each publication
 requires tweaking a dozen or more lines of biblatex config.

Of course there are an amount of lines that depends on the document.
This is where #+LATEX keywords comes handy.


Regards,

-- 
Nicolas Goaziou



Re: [O] BEGIN_LATEX_HEADER [cont]

2014-06-21 Thread Nicolas Goaziou
Hello,

Aaron Ecay aarone...@gmail.com writes:

 The first is that editing non-trivial latex code embedded in an elisp
 string quickly becomes tedious, whereas it’s much pleasanter in org
 using org-edit-special, syntax highlighting of src blocks, etc.

This is a no-op since you only do it a limited number of times, i.e.
once for each document type.

 The second is that it’s impossible to share without distributing elisp
 code.  From the twin standpoints of reproducible research and security,
 I think org ought to maximize the degree to which export use cases are
 sharable without resorting to executing elisp code.

This is also a no-op. You cannot be serious about reproducible research
if you don't share `org-export-async-init-file' anyway.

Eventually, if you insist on writing your full preamble within the
document, you can start to write it in a LaTeX-mode buffer, copy it in
your Org document and add #+LATEX_HEADER:  in front of each line.
This last step is done easily with `string-rectangle' (C-x r t).


Regards,

-- 
Nicolas Goaziou



Re: [O] BEGIN_LATEX_HEADER [cont]

2014-06-21 Thread Aaron Ecay
Hi Nicolas,

2014ko ekainak 21an, Nicolas Goaziou-ek idatzi zuen:
 
 Hello,
 
 Aaron Ecay aarone...@gmail.com writes:
 
 The first is that editing non-trivial latex code embedded in an elisp
 string quickly becomes tedious, whereas it’s much pleasanter in org
 using org-edit-special, syntax highlighting of src blocks, etc.
 
 This is a no-op since you only do it a limited number of times, i.e.
 once for each document type.

If you do it once, then it’s not a no-op, by definition.  I think you
mean that you disagree in the amount which you weight this as a concern,
which is a reasonable opinion to have.  But phrasing it in the way you
did is inaccurate and rather curt.

FWIW, in my experience latex (or any) code rarely flows from mind to
keyboard perfectly in the first attempt; there is some period of
revision, during which convenient editing matters.

 
 The second is that it’s impossible to share without distributing elisp
 code.  From the twin standpoints of reproducible research and security,
 I think org ought to maximize the degree to which export use cases are
 sharable without resorting to executing elisp code.
 
 This is also a no-op. You cannot be serious about reproducible research
 if you don't share `org-export-async-init-file' anyway.

This is also not true (or it’s some kind of value judgment).  Org’s
default settings + #+bind + local variables can do quite a bit.

 
 Eventually, if you insist on writing your full preamble within the
 document, you can start to write it in a LaTeX-mode buffer, copy it in
 your Org document and add #+LATEX_HEADER:  in front of each line.
 This last step is done easily with `string-rectangle' (C-x r t).

This is basically making the user do (something like) org-edit-special
manually.  It can probably be automated somewhat – I’ll work on a patch.

Thanks,

-- 
Aaron Ecay



Re: [O] BEGIN_LATEX_HEADER [cont]

2014-06-21 Thread Ken Mankoff

On 2014-06-21 at 20:42, Aaron Ecay wrote:
 2014ko ekainak 21an, Nicolas Goaziou-ek idatzi zuen:
 
 Aaron Ecay aarone...@gmail.com writes:
 
 The first is that editing non-trivial latex code embedded in an
 elisp string quickly becomes tedious, whereas it’s much pleasanter
 in org using org-edit-special, syntax highlighting of src blocks,
 etc.
 
 This is a no-op since you only do it a limited number of times, i.e.
 once for each document type.

 If you do it once, then it’s not a no-op, by definition.  I think you
 mean that you disagree in the amount which you weight this as a
 concern, which is a reasonable opinion to have.  But phrasing it in
 the way you did is inaccurate and rather curt.

 FWIW, in my experience latex (or any) code rarely flows from mind to
 keyboard perfectly in the first attempt; there is some period of
 revision, during which convenient editing matters.

It is not a 1x operation, it is a per-document operation. For example,
in my use-case that started this whole discussion, each publication
requires tweaking a dozen or more lines of biblatex config.

  -k.



Re: [O] BEGIN_LATEX_HEADER [cont]

2014-06-20 Thread Sebastien Vauban
Aaron Ecay wrote:
 2014ko ekainak 19an, Ken Mankoff-ek idatzi zuen:
 I'm following up on a thread suggesting a method to easily include
 large amounts of LaTeX header material. See
 https://lists.gnu.org/archive/html/emacs-orgmode/2013-03/msg00480.html
 
 Is there a way to automatically tangle one just this section each
 time I export the file? Or automatically all sections (but just in
 this file)?

 Something like (untested):

 ,
 | #+begin_src emacs-lisp
 |   (org-babel-goto-named-src-block preamble)
 |   (org-babel-tangle)
 | #+end_src
 | 
 | #+name: preamble
 | #+begin_src latex :tangle preamble.tex
 |   % code goes here
 | #+end_src
 `

 You’ll need to use some combination of “:exports none” or a headline
 tagged :noexport: to avoid these src blocks showing up in the exported
 output.

Another solution which would be fine would be to have
‘#+BEGIN_LaTeX_HEADER ... #+END_LaTeX_HEADER’ blocks.

Dunno if easy, however; but it'd be more straightforward for most users
(no need to rely on Babel to tangle first).

Best regards,
  Seb

-- 
Sebastien Vauban




Re: [O] BEGIN_LATEX_HEADER [cont]

2014-06-20 Thread Nicolas Goaziou


Hello,

Sebastien Vauban sva-news-D0wtAvR13HarG/idocf...@public.gmane.org
writes:

 Another solution which would be fine would be to have
 ‘#+BEGIN_LaTeX_HEADER ... #+END_LaTeX_HEADER’ blocks.

 Dunno if easy, however; but it'd be more straightforward for most users
 (no need to rely on Babel to tangle first).

I suggest to use existing solutions instead: configure
`org-latex-classes'.


Regards,

-- 
Nicolas Goaziou




Re: [O] BEGIN_LATEX_HEADER [cont]

2014-06-20 Thread Ken Mankoff




On 2014-06-20 at 04:50, Nicolas Goaziou wrote:
 I suggest to use existing solutions instead: configure
 `org-latex-classes'.

I'm all for using existing solutions, but cannot see how I might use
this to easily customize export differently for different documents when
large amounts of LaTeX preamble code is being used.

The tangle to preamble.tex and then include works but I cannot automate
it as per the example from Aaron. It still works pretty well even if I
do it manually.

  -k.





Re: [O] BEGIN_LATEX_HEADER [cont]

2014-06-20 Thread Fabrice Popineau
2014-06-20 13:17 GMT+02:00 Ken Mankoff mank...@gmail.com:

 On 2014-06-20 at 04:50, Nicolas Goaziou wrote:
  I suggest to use existing solutions instead: configure
  `org-latex-classes'.

 I'm all for using existing solutions, but cannot see how I might use
 this to easily customize export differently for different documents when
 large amounts of LaTeX preamble code is being used.


I for long have defined my own LaTeX class (fp.cls file). It is quite easy
to handle options in there.
Now I use it in place of article or beamer etc.

\documentclass[slides]{fp}

for a beamer org document

\documentclass[exam]{fp}

for a pdf exam document


and so on.

I don't think that it is very effective to store a huge amount of TeX code
in org documents.
You end up in cuting/pasting these headers lines in each line.


My $0.02

Fabrice


Re: [O] BEGIN_LATEX_HEADER [cont]

2014-06-20 Thread Nicolas Goaziou


Hello,

Ken Mankoff mank...@gmail.com writes:

 On 2014-06-20 at 04:50, Nicolas Goaziou wrote:
 I suggest to use existing solutions instead: configure
 `org-latex-classes'.

 I'm all for using existing solutions, but cannot see how I might use
 this to easily customize export differently for different documents when
 large amounts of LaTeX preamble code is being used.

It's quite simple. You add your large amount of LaTeX preamble code in
a new class, e.g., my-class, in `org-latex-classes'. Then, in all
documents needing this preamble code, you just add:

 #+latex_class: my-class

Rinse and repeat for each document type.


Regards,

-- 
Nicolas Goaziou




Re: [O] BEGIN_LATEX_HEADER [cont]

2014-06-20 Thread Aaron Ecay
Hi Nicolas,

2014ko ekainak 20an, Nicolas Goaziou-ek idatzi zuen:
 
 Hello,
 
 Ken Mankoff mank...@gmail.com writes:
 
 On 2014-06-20 at 04:50, Nicolas Goaziou wrote:
 I suggest to use existing solutions instead: configure
 `org-latex-classes'.
 
 I'm all for using existing solutions, but cannot see how I might use
 this to easily customize export differently for different documents when
 large amounts of LaTeX preamble code is being used.
 
 It's quite simple. You add your large amount of LaTeX preamble code in
 a new class, e.g., my-class, in `org-latex-classes'. Then, in all
 documents needing this preamble code, you just add:
 
  #+latex_class: my-class
 
 Rinse and repeat for each document type.

There are two issues with this solution.

The first is that editing non-trivial latex code embedded in an elisp
string quickly becomes tedious, whereas it’s much pleasanter in org
using org-edit-special, syntax highlighting of src blocks, etc.

The second is that it’s impossible to share without distributing elisp
code.  From the twin standpoints of reproducible research and security,
I think org ought to maximize the degree to which export use cases are
sharable without resorting to executing elisp code.  There’s a threshold
beyond which it’s impossible to keep these goals, of course.  But it’s
worth considering how org-latex-classes and friends might adapt to
increase the territory that falls within rather than outside the
Turing-complete boundary.

Just my 2 cents,

-- 
Aaron Ecay



[O] BEGIN_LATEX_HEADER [cont]

2014-06-19 Thread Ken Mankoff

Hi,

I'm following up on a thread suggesting a method to easily include 
large

amounts of LaTeX header material. See
https://lists.gnu.org/archive/html/emacs-orgmode/2013-03/msg00480.html 


Please consider this a +1 for that feature request.

One suggestion was:
You could have a LaTeX block and tangle it to preamble.tex and 
input

preamble.tex in a LATEX_HEADER.


Which seems like an OK work-around. 


I have two follow-up questions about this.

1) I can't seem to get

#+BEGIN_LATEX :tangle preamble.tex

to work. It needs to be

#+BEGIN_SRC latex :tangle preamble.tex

Is this correct?

Secondly, is there a way to automatically tangle one just this 
section
each time I export the file? Or automatically all sections (but 
just in

this file)?

Thanks,

 -k.



Re: [O] BEGIN_LATEX_HEADER [cont]

2014-06-19 Thread Aaron Ecay
Hi Ken,

2014ko ekainak 19an, Ken Mankoff-ek idatzi zuen:
 
 Hi,
 
 I'm following up on a thread suggesting a method to easily include 
 large
 amounts of LaTeX header material. See
 https://lists.gnu.org/archive/html/emacs-orgmode/2013-03/msg00480.html 
 
 Please consider this a +1 for that feature request.
 
 One suggestion was:
 You could have a LaTeX block and tangle it to preamble.tex and 
 input
 preamble.tex in a LATEX_HEADER.
 
 Which seems like an OK work-around. 
 
 I have two follow-up questions about this.
 
 1) I can't seem to get
 
 #+BEGIN_LATEX :tangle preamble.tex
 
 to work. It needs to be
 
 #+BEGIN_SRC latex :tangle preamble.tex

Correct.  The former is only for export, and doesn’t work with babel
features (incl. tangling)

 
 Is this correct?
 
 Secondly, is there a way to automatically tangle one just this 
 section
 each time I export the file? Or automatically all sections (but 
 just in
 this file)?

Something like (untested):

,
| #+begin_src emacs-lisp
|   (org-babel-goto-named-src-block preamble)
|   (org-babel-tangle)
| #+end_src
| 
| #+name: preamble
| #+begin_src latex :tangle preamble.tex
|   % code goes here
| #+end_src
`

You’ll need to use some combination of “:exports none” or a headline
tagged :noexport: to avoid these src blocks showing up in the exported
output.

HTH,

-- 
Aaron Ecay