Re: multiple EXPORT_LATEX_HEADER lines

2020-06-16 Thread Nick Dokos
Dominik Schrempf  writes:

> Hello,
>
> are you looking for, e.g.,
>
> #+latex_header: \addbibresource{bibliography.bib}
> #+latex_header_extra: do some stuff
> #+latex_header_extra: and even more
>
> I don't use the EXPORT keyword at the beginning, I am not sure if it is 
> needed.
>
> Best,
> Dominik

Just as a clarification: the "_extra" here does not mean "append to previous 
value".

The only difference between "#+latex_header: " and #+latex_header_extra: " is
that anything specified in the former is *also* used when constructing the 
header
for the LaTeX file for previewing LaTeX fragments, whereas anything specified 
in the
latter is only used when exporting: it is not used when previewing.

See

(info "(org) LaTeX header and sectioning")

which says:

,
|The LaTeX export back-end appends values from ‘LATEX_HEADER’ and
| ‘LATEX_HEADER_EXTRA’ keywords to the LaTeX header.  The docstring for
| ‘org-latex-classes’ explains in more detail.  Also note that LaTeX
| export back-end does not append ‘LATEX_HEADER_EXTRA’ to the header when
| previewing LaTeX snippets (see *note Previewing LaTeX fragments::).
`

and the code in ox-latex.el:org-latex-make-preamble.

>
> Alan Schmitt  writes:
>
>> Hello,
>>
>> I would like to have a multi-line export header when exporting a
>> subtree. I tried this:
>>
>> :EXPORT_LATEX_HEADER: \makeatletter
>> :EXPORT_LATEX_HEADER+: \@setplength{refvpos}{\useplength{toaddrvpos}}
>> :EXPORT_LATEX_HEADER+: \makeatother
>>
>> The problem is that it's exported on a single line, and as such it does
>> not work. Is there a way to have the multiple properties exported as
>> multiple lines, or to specify in the property there is a line break?
>>
>> Thanks,
>>
>> Alan
>
>
>

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: multiple EXPORT_LATEX_HEADER lines

2020-06-16 Thread Eric S Fraga
On Tuesday, 16 Jun 2020 at 10:46, Alan Schmitt wrote:
> You're right, it should work in a single line. I don't what I did that
> made it fail, and I no longer can reproduce it. Sorry for the noise.

Glad you solved it!   
-- 
: Eric S Fraga via Emacs 28.0.50, Org release_9.3.7-636-gaa32f6



Re: multiple EXPORT_LATEX_HEADER lines

2020-06-16 Thread Alan Schmitt
Hello Eric,

On 2020-06-15 10:20, Eric S Fraga  writes:

> On Saturday, 13 Jun 2020 at 17:02, Alan Schmitt wrote:
>> This is the crux of the issue: there does not seem to be any way to
>> generate a multi-line header. And this causes problems with LaTeX.
>
> Is the problem solvable in LaTeX?  Does \makeatletter expect to be on a
> single line?  As I said before, I've seldom played with @ variables or
> functions in LaTeX.  However, I had the impression that LaTeX was quite
> robust with respect to whitespace & newlines.

You're right, it should work in a single line. I don't what I did that
made it fail, and I no longer can reproduce it. Sorry for the noise.

Best,

Alan


signature.asc
Description: PGP signature


Re: multiple EXPORT_LATEX_HEADER lines

2020-06-15 Thread Eric S Fraga
On Saturday, 13 Jun 2020 at 17:02, Alan Schmitt wrote:
> This is the crux of the issue: there does not seem to be any way to
> generate a multi-line header. And this causes problems with LaTeX.

Is the problem solvable in LaTeX?  Does \makeatletter expect to be on a
single line?  As I said before, I've seldom played with @ variables or
functions in LaTeX.  However, I had the impression that LaTeX was quite
robust with respect to whitespace & newlines.

-- 
: Eric S Fraga via Emacs 28.0.50, Org release_9.3.7-636-gaa32f6



Re: multiple EXPORT_LATEX_HEADER lines

2020-06-13 Thread Alan Schmitt
Hello,

On 2020-06-12 16:01, Eric S Fraga  writes:

> The snippet from the OP will collate all three LaTeX header lines into a
> single line on export, which is expected in terms of org's
> behaviour.  This appears to cause problems with LaTeX, which is maybe
> expected or not; I don't know what LaTeX expects when working in @
> letter mode as I've seldom (if ever?) had to redefine @ variables.

This is the crux of the issue: there does not seem to be any way to
generate a multi-line header. And this causes problems with LaTeX.

There are two workarounds for this that I know of: put the latex in some
other file and \input it, or use a dedicated file and use multiple
#+LATEX_HEADER. I ended up doing it that way.

Thanks,

Alan


signature.asc
Description: PGP signature


Re: multiple EXPORT_LATEX_HEADER lines

2020-06-12 Thread Jeremie Juste


> I am not sure I understand your question.  Sorry.
You read my mind.
>
> The snippet from the OP will collate all three LaTeX header lines into a
> single line on export, which is expected in terms of org's
> behaviour.
This is exactly what I was referring to. If the behavior of
:EXPORT_LATEX_HEADER: and :EXPORT_LATEX_HEADER:+ and all the property
keys with a (+) prefix is to collate the line then it is the expected behavior.

Then keys such as :EXPORT_LATEX_HEADER: might be misleading for the
user as he may want to use multiple line header.

One solution might be to add another suffix say :EXPORT_LATEX_HEADER++:
to generate multiple lines during the export. But I'm must quickly add that I
don't have the knowledge to do it neither to  understand the implication
of this change.

Best regards,
Jeremie

PS:
> (setq message-citation-line-format "On %A, %e %b %Y at %R, %N wrote:")
Many thanks for the info. I was also given this precious reference:
(info "(sc) What Supercite Does")



Re: multiple EXPORT_LATEX_HEADER lines

2020-06-12 Thread Eric S Fraga
On Friday, 12 Jun 2020 at 16:47, Jeremie Juste wrote:
> Many thanks for the info. So, with respect the original post, the behavior of 
> the following
> code is to be expected?

I am not sure I understand your question.  Sorry.

The snippet from the OP will collate all three LaTeX header lines into a
single line on export, which is expected in terms of org's
behaviour.  This appears to cause problems with LaTeX, which is maybe
expected or not; I don't know what LaTeX expects when working in @
letter mode as I've seldom (if ever?) had to redefine @ variables.

> PS: The automatic time stamp of the sender when replying is a nice
> piece of technology. I guess, I have to read the gnus manual
> again. :-)

I use: 

(setq message-citation-line-format "On %A, %e %b %Y at %R, %N wrote:")

eric

-- 
: Eric S Fraga via Emacs 28.0.50, Org release_9.3.7-636-gaa32f6



Re: multiple EXPORT_LATEX_HEADER lines

2020-06-12 Thread Jeremie Juste


Eric S Fraga  writes:
>
> This is a standard syntax for adding values to a property.  From the info 
> manual:
>
> If you want to add to the value of an existing property, append a ‘+’ to
> the property name.  The following results in the property ‘var’ having
> the value ‘foo=1 bar=2’.
>
>  #+PROPERTY: var  foo=1
>  #+PROPERTY: var+ bar=2

Many thanks for the info. So, with respect the original post, the behavior of 
the following
code is to be expected?

* hello
  :PROPERTIES:
  :EXPORT_LATEX_HEADER: \makeatletter
  :EXPORT_LATEX_HEADER+: \@setplength{refvpos}{\useplength{toaddrvpos}} 
  :EXPORT_LATEX_HEADER+: \makeatother
  :END:

Best regards,
Jeremie

PS: The automatic time stamp of the sender when replying is a nice piece
of technology. I guess, I have to read the gnus manual again. :-)
> On Friday, 12 Jun 2020 at 14:01, Jeremie Juste wrote:




Re: multiple EXPORT_LATEX_HEADER lines

2020-06-12 Thread Eric S Fraga
On Friday, 12 Jun 2020 at 14:01, Jeremie Juste wrote:
> But I have some more questions. I can see the :EXPORT_LATEX_HEADER in
> the properties menu. (C-x p) but how did you even find :EXPORT_LATEX_HEADER+
> property name?

This is a standard syntax for adding values to a property.  From the info 
manual:

If you want to add to the value of an existing property, append a ‘+’ to
the property name.  The following results in the property ‘var’ having
the value ‘foo=1 bar=2’.

 #+PROPERTY: var  foo=1
 #+PROPERTY: var+ bar=2

-- 
: Eric S Fraga via Emacs 28.0.50, Org release_9.3.7-636-gaa32f6



Re: multiple EXPORT_LATEX_HEADER lines

2020-06-12 Thread Jeremie Juste
Hello,

can reproduce the issue with

* hello
  :PROPERTIES:
  :EXPORT_LATEX_HEADER: \makeatletter
  :EXPORT_LATEX_HEADER+: \@setplength{refvpos}{\useplength{toaddrvpos}} 
  :EXPORT_LATEX_HEADER+: \makeatother
  :END:

But I have some more questions. I can see the :EXPORT_LATEX_HEADER in
the properties menu. (C-x p) but how did you even find :EXPORT_LATEX_HEADER+
property name?

I didn't see anything regarding this in the doc. It might well be
because I'm lagging behind - Org mode version 9.2.3.


Best regards,
Jeremie



Alan Schmitt  writes:

> Hello Dominik,
>
> On 2020-06-12 10:31, Dominik Schrempf  writes:
>
>> are you looking for, e.g.,
>>
>> #+latex_header: \addbibresource{bibliography.bib}
>> #+latex_header_extra: do some stuff
>> #+latex_header_extra: and even more
>>
>> I don't use the EXPORT keyword at the beginning, I am not sure if it is 
>> needed.
>
> To be more precise, I want to emulate
> #+LATEX_HEADER: \makeatletter
> #+LATEX_HEADER+: \@setplength{refvpos}{\useplength{toaddrvpos}}
> #+LATEX_HEADER+: \makeatother
>
> (as a full file export, which yields 3 separate lines), for a subtree
> export, were the property :EXPORT_LATEX_HEADER: is used.
>
> Best,
>
> Alan



Re: multiple EXPORT_LATEX_HEADER lines

2020-06-12 Thread Alan Schmitt
Hello Dominik,

On 2020-06-12 10:31, Dominik Schrempf  writes:

> are you looking for, e.g.,
>
> #+latex_header: \addbibresource{bibliography.bib}
> #+latex_header_extra: do some stuff
> #+latex_header_extra: and even more
>
> I don't use the EXPORT keyword at the beginning, I am not sure if it is 
> needed.

To be more precise, I want to emulate
#+LATEX_HEADER: \makeatletter
#+LATEX_HEADER+: \@setplength{refvpos}{\useplength{toaddrvpos}}
#+LATEX_HEADER+: \makeatother

(as a full file export, which yields 3 separate lines), for a subtree
export, were the property :EXPORT_LATEX_HEADER: is used.

Best,

Alan


signature.asc
Description: PGP signature


Re: multiple EXPORT_LATEX_HEADER lines

2020-06-12 Thread Dominik Schrempf
Hello,

are you looking for, e.g.,

#+latex_header: \addbibresource{bibliography.bib}
#+latex_header_extra: do some stuff
#+latex_header_extra: and even more

I don't use the EXPORT keyword at the beginning, I am not sure if it is needed.

Best,
Dominik

Alan Schmitt  writes:

> Hello,
>
> I would like to have a multi-line export header when exporting a
> subtree. I tried this:
>
> :EXPORT_LATEX_HEADER: \makeatletter
> :EXPORT_LATEX_HEADER+: \@setplength{refvpos}{\useplength{toaddrvpos}}
> :EXPORT_LATEX_HEADER+: \makeatother
>
> The problem is that it's exported on a single line, and as such it does
> not work. Is there a way to have the multiple properties exported as
> multiple lines, or to specify in the property there is a line break?
>
> Thanks,
>
> Alan