all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* ox-koma-letter: how to use @@LaTeX:@@ specific commands in #+ directives
@ 2015-06-17 17:32 Eric S Fraga
  2015-06-17 20:22 ` Rasmus
  0 siblings, 1 reply; 11+ messages in thread
From: Eric S Fraga @ 2015-06-17 17:32 UTC (permalink / raw)
  To: emacs-orgmode

Dear all,

I have started using ox-koma-letter from the contrib directory.  Very
nice.  Thanks Nicolas, Alan, Viktor, and Rasmus!

Everything works well so far except for one minor niggle: I would like
to introduce, sometimes, LaTeX specific inline directives in #+
lines.  E.g. for LaTeX export, I would use @@latex:\\@@ to get a line
break in a title or author entry.  I had expected the same to work with
ox-koma-letter given that it is a latex /derived/ backend and does work
in normal text, just not in #+ lines.

I guess the processing of #+ lines is handled directly by ox-koma-letter.

Would it be possible to extend @@...@@ processing to those lines?  Or am
I doing something silly?

Thanks,
eric

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 24.4.1, Org release_8.3beta-1216-gb856f6

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

* Re: ox-koma-letter: how to use @@LaTeX:@@ specific commands in #+ directives
  2015-06-17 17:32 ox-koma-letter: how to use @@LaTeX:@@ specific commands in #+ directives Eric S Fraga
@ 2015-06-17 20:22 ` Rasmus
  2015-06-17 22:03   ` Nicolas Goaziou
  0 siblings, 1 reply; 11+ messages in thread
From: Rasmus @ 2015-06-17 20:22 UTC (permalink / raw)
  To: emacs-orgmode

Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> Dear all,
>
> I have started using ox-koma-letter from the contrib directory.  Very
> nice.  Thanks Nicolas, Alan, Viktor, and Rasmus!
>
> Everything works well so far except for one minor niggle: I would like
> to introduce, sometimes, LaTeX specific inline directives in #+
> lines.  E.g. for LaTeX export, I would use @@latex:\\@@ to get a line
> break in a title or author entry.  I had expected the same to work with
> ox-koma-letter given that it is a latex /derived/ backend and does work
> in normal text, just not in #+ lines.
>
> I guess the processing of #+ lines is handled directly by ox-koma-letter.
>
> Would it be possible to extend @@...@@ processing to those lines?  Or am
> I doing something silly?

It also doesn't work with ox-beamer:

#+subtitle: subtitle @@latx:\LaTeX@@ @@beamer:BEAMER@@

I guess it's a feature.  Or a bug at a higher level than ox-koma-letter.

You can use the koma-letter snippet:

  #+subject: test @@koma-letter:\LaTeX@@

You can use a macro to combine several snippet types (not tested):

#+macro: latex @@latex:$1@@@@beamer:$1@@@@koma-letter:$1@@

Rasmus

-- 
. . . The proofs are technical in nature and provides no real understanding

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

* Re: ox-koma-letter: how to use @@LaTeX:@@ specific commands in #+ directives
  2015-06-17 20:22 ` Rasmus
@ 2015-06-17 22:03   ` Nicolas Goaziou
  2015-06-17 22:55     ` Rasmus
  2015-06-18  8:06     ` Eric S Fraga
  0 siblings, 2 replies; 11+ messages in thread
From: Nicolas Goaziou @ 2015-06-17 22:03 UTC (permalink / raw)
  To: Rasmus; +Cc: emacs-orgmode

Hello,

Rasmus <rasmus@gmx.us> writes:

> Eric S Fraga <e.fraga@ucl.ac.uk> writes:
>
>> Dear all,
>>
>> I have started using ox-koma-letter from the contrib directory.  Very
>> nice.  Thanks Nicolas, Alan, Viktor, and Rasmus!
>>
>> Everything works well so far except for one minor niggle: I would like
>> to introduce, sometimes, LaTeX specific inline directives in #+
>> lines.  E.g. for LaTeX export, I would use @@latex:\\@@ to get a line
>> break in a title or author entry.  I had expected the same to work with
>> ox-koma-letter given that it is a latex /derived/ backend and does work
>> in normal text, just not in #+ lines.

I cannot reproduce it. koma-letter back-ends explicitly allows latex
export snippets, e.g.,

  #+title: @@latex:\something@@

produces the expected \something.

> It also doesn't work with ox-beamer:
>
> #+subtitle: subtitle @@latx:\LaTeX@@ @@beamer:BEAMER@@
>
> I guess it's a feature.  Or a bug at a higher level than
> ox-koma-letter.

This is a feature. 

If @@latex:...@@ is supported in beamer export, you have no way to
insert latex-only code in a document that you plan to export using both
beamer and latex back-ends.

However, this doesn't apply in koma-letter.


Regards,

-- 
Nicolas Goaziou

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

* Re: ox-koma-letter: how to use @@LaTeX:@@ specific commands in #+ directives
  2015-06-17 22:03   ` Nicolas Goaziou
@ 2015-06-17 22:55     ` Rasmus
  2015-06-18  8:06     ` Eric S Fraga
  1 sibling, 0 replies; 11+ messages in thread
From: Rasmus @ 2015-06-17 22:55 UTC (permalink / raw)
  To: emacs-orgmode

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> I cannot reproduce it. koma-letter back-ends explicitly allows latex
> export snippets, e.g.,
>
>   #+title: @@latex:\something@@
>
> produces the expected \something.

I agree.  I cannot reproduce either.  Typo.  Thanks.

Rasmus

-- 
Hvor meget poesi tror De kommer ud af et glas isvand?

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

* Re: ox-koma-letter: how to use @@LaTeX:@@ specific commands in #+ directives
  2015-06-17 22:03   ` Nicolas Goaziou
  2015-06-17 22:55     ` Rasmus
@ 2015-06-18  8:06     ` Eric S Fraga
  2015-06-18  8:47       ` Rasmus
  1 sibling, 1 reply; 11+ messages in thread
From: Eric S Fraga @ 2015-06-18  8:06 UTC (permalink / raw)
  To: Rasmus; +Cc: emacs-orgmode

On Thursday, 18 Jun 2015 at 00:03, Nicolas Goaziou wrote:

[...]

> I cannot reproduce it. koma-letter back-ends explicitly allows latex
> export snippets, e.g.,
>
>   #+title: @@latex:\something@@
>
> produces the expected \something.

Ummm, I thought I was going crazy as, for once, I had tested using emacs
-Q before posting something silly to the list...

You are correct in that it works with #+title:.  It also works with
#+subject:.  However, it does *not* work with #+author:.  I've not tried
any of the other org setting directives.  It was author I was playing
with yesterday...

thanks,
eric

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 24.4.1, Org release_8.3beta-1216-gb856f6

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

* Re: ox-koma-letter: how to use @@LaTeX:@@ specific commands in #+ directives
  2015-06-18  8:06     ` Eric S Fraga
@ 2015-06-18  8:47       ` Rasmus
  2015-06-18  9:09         ` Eric S Fraga
  2015-06-18 14:07         ` Nicolas Goaziou
  0 siblings, 2 replies; 11+ messages in thread
From: Rasmus @ 2015-06-18  8:47 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1025 bytes --]

Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> On Thursday, 18 Jun 2015 at 00:03, Nicolas Goaziou wrote:
>
> [...]
>
>> I cannot reproduce it. koma-letter back-ends explicitly allows latex
>> export snippets, e.g.,
>>
>>   #+title: @@latex:\something@@
>>
>> produces the expected \something.
>
> Ummm, I thought I was going crazy as, for once, I had tested using emacs
> -Q before posting something silly to the list...
>
> You are correct in that it works with #+title:.  It also works with
> #+subject:.  However, it does *not* work with #+author:.  I've not tried
> any of the other org setting directives.  It was author I was playing
> with yesterday...

Right.  #+author is not parsed.  In the patch I enable parsing on this and
others.

Nicolas: are there any of the keywords in the patch that shouldn't be
parsed?

Also, I left out FROM_ADDRESS as I remember it interprets newlines and I
don't have time ATM to properly check if this depends on the newline
behavior.

Rasmus

-- 
El Rey ha muerto. ¡Larga vida al Rey!

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ox-koma-letter-Parse-more-keywords.patch --]
[-- Type: text/x-diff, Size: 1995 bytes --]

From 0dc981a8d223a0f41dc5d1f7227ae1d32e7abf2d Mon Sep 17 00:00:00 2001
From: Rasmus <rasmus@gmx.us>
Date: Thu, 18 Jun 2015 10:34:17 +0200
Subject: [PATCH 1/2] ox-koma-letter: Parse more keywords

* ox-koma-letter.el (koma-letter): Parse author, phone-number,
  opening, closing and signature.

fix
---
 contrib/lisp/ox-koma-letter.el | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/contrib/lisp/ox-koma-letter.el b/contrib/lisp/ox-koma-letter.el
index 119ffe9..aeb8f01 100644
--- a/contrib/lisp/ox-koma-letter.el
+++ b/contrib/lisp/ox-koma-letter.el
@@ -381,17 +381,17 @@ e.g. \"title-subject:t\"."
   :options-alist
   '((:latex-class "LATEX_CLASS" nil org-koma-letter-default-class t)
     (:lco "LCO" nil org-koma-letter-class-option-file)
-    (:author "AUTHOR" nil (org-koma-letter--get-value org-koma-letter-author) t)
+    (:author "AUTHOR" nil (org-koma-letter--get-value org-koma-letter-author) parse)
     (:author-changed-in-buffer-p "AUTHOR" nil nil t)
     (:from-address "FROM_ADDRESS" nil org-koma-letter-from-address newline)
-    (:phone-number "PHONE_NUMBER" nil org-koma-letter-phone-number)
+    (:phone-number "PHONE_NUMBER" nil org-koma-letter-phone-number parse)
     (:email "EMAIL" nil (org-koma-letter--get-value org-koma-letter-email) t)
     (:to-address "TO_ADDRESS" nil nil newline)
-    (:place "PLACE" nil org-koma-letter-place)
+    (:place "PLACE" nil org-koma-letter-place parse)
     (:subject "SUBJECT" nil nil parse)
-    (:opening "OPENING" nil org-koma-letter-opening)
-    (:closing "CLOSING" nil org-koma-letter-closing)
-    (:signature "SIGNATURE" nil org-koma-letter-signature newline)
+    (:opening "OPENING" nil org-koma-letter-opening parse)
+    (:closing "CLOSING" nil org-koma-letter-closing parse)
+    (:signature "SIGNATURE" nil org-koma-letter-signature parse)
     (:special-headings nil "special-headings"
 		       org-koma-letter-prefer-special-headings)
     (:special-tags nil nil (append
-- 
2.4.4


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

* Re: ox-koma-letter: how to use @@LaTeX:@@ specific commands in #+ directives
  2015-06-18  8:47       ` Rasmus
@ 2015-06-18  9:09         ` Eric S Fraga
  2015-06-18 21:01           ` Rasmus
  2015-06-18 14:07         ` Nicolas Goaziou
  1 sibling, 1 reply; 11+ messages in thread
From: Eric S Fraga @ 2015-06-18  9:09 UTC (permalink / raw)
  To: Rasmus; +Cc: emacs-orgmode

On Thursday, 18 Jun 2015 at 10:47, Rasmus wrote:

[...]

> Right.  #+author is not parsed.  In the patch I enable parsing on this and
> others.
>
> Nicolas: are there any of the keywords in the patch that shouldn't be
> parsed?
>
> Also, I left out FROM_ADDRESS as I remember it interprets newlines and I
> don't have time ATM to properly check if this depends on the newline
> behavior.
>
> Rasmus

Rasmus,

with this patch, exporting to koma-letter doesn't work for me.  I've not
investigated properly yet but thought I'd give you a heads up on
this.  The LaTeX compilation fails:

,----
| Foot of first page
| Address (addressee)
| Location field: empty
| Title: yes
| (/usr/share/texlive/texmf-dist/tex/latex/base/t1cmss.fd)
| Subject: before opening
| ! Undefined control sequence.
| \@gnewline ...\@nolnerr \else \unskip \reserved@e 
|                                                   {\reserved@f #1}\nobreak \...
| l.59 \closing{nil}
|                   
| ? 
| ! Emergency stop.
| \@gnewline ...\@nolnerr \else \unskip \reserved@e 
|                                                   {\reserved@f #1}\nobreak \...
| l.59 \closing{nil}
`----

Without the patch, the compilation succeeds (although obviously I still
don't have @@latex:@@ working in the author field ;-).

Thanks,
eric

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 24.4.1, Org release_8.3beta-1154-g6ba251

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

* Re: ox-koma-letter: how to use @@LaTeX:@@ specific commands in #+ directives
  2015-06-18  8:47       ` Rasmus
  2015-06-18  9:09         ` Eric S Fraga
@ 2015-06-18 14:07         ` Nicolas Goaziou
  1 sibling, 0 replies; 11+ messages in thread
From: Nicolas Goaziou @ 2015-06-18 14:07 UTC (permalink / raw)
  To: Rasmus; +Cc: emacs-orgmode

Hello,

Rasmus <rasmus@gmx.us> writes:

> Nicolas: are there any of the keywords in the patch that shouldn't be
> parsed?

I don't think so.

Notwithstanding AUTHOR, which clearly is an overlook (ox.el parses it),
I wonder if it is a net gain, tho. In my experience, these values are
mostly constituted of LaTeX code anyway (e.g., \vspace and \hspace in
signature) and this change will not make them simpler.


> Also, I left out FROM_ADDRESS as I remember it interprets newlines and I
> don't have time ATM to properly check if this depends on the newline
> behavior.

Indeed, `parse' treats newline characters as spaces, so it is not
a replacement for `newline'.

Note that SIGNATURE has the same problem.


Regards,

-- 
Nicolas Goaziou

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

* Re: ox-koma-letter: how to use @@LaTeX:@@ specific commands in #+ directives
  2015-06-18  9:09         ` Eric S Fraga
@ 2015-06-18 21:01           ` Rasmus
  2015-06-19 14:24             ` Eric S Fraga
  2015-06-19 15:28             ` Eric S Fraga
  0 siblings, 2 replies; 11+ messages in thread
From: Rasmus @ 2015-06-18 21:01 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 427 bytes --]

Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> with this patch, exporting to koma-letter doesn't work for me.  I've not
> investigated properly yet but thought I'd give you a heads up on
> this.  

Thanks.  I don't really know where exactly it breaks with a minimal
example.  It works on my PC.  Anyway, this patch adds only a few parsed
keywords.  Does it work with your letter?

-- 
A page of history is worth a volume of logic

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-ox-koma-letter-Parse-more-keywords.patch --]
[-- Type: text/x-diff, Size: 2110 bytes --]

From fc999a651773353d105fca59a0044d4945a6241d Mon Sep 17 00:00:00 2001
From: Rasmus <rasmus@gmx.us>
Date: Thu, 18 Jun 2015 10:34:17 +0200
Subject: [PATCH 2/2] ox-koma-letter: Parse more keywords

* ox-koma-letter.el (koma-letter): Parse author, phone-number,
  opening, closing and signature.
  (org-koma-letter-template): parse closing.
---
 contrib/lisp/ox-koma-letter.el | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/contrib/lisp/ox-koma-letter.el b/contrib/lisp/ox-koma-letter.el
index 119ffe9..e907fd7 100644
--- a/contrib/lisp/ox-koma-letter.el
+++ b/contrib/lisp/ox-koma-letter.el
@@ -381,7 +381,7 @@ e.g. \"title-subject:t\"."
   :options-alist
   '((:latex-class "LATEX_CLASS" nil org-koma-letter-default-class t)
     (:lco "LCO" nil org-koma-letter-class-option-file)
-    (:author "AUTHOR" nil (org-koma-letter--get-value org-koma-letter-author) t)
+    (:author "AUTHOR" nil (org-koma-letter--get-value org-koma-letter-author) parse)
     (:author-changed-in-buffer-p "AUTHOR" nil nil t)
     (:from-address "FROM_ADDRESS" nil org-koma-letter-from-address newline)
     (:phone-number "PHONE_NUMBER" nil org-koma-letter-phone-number)
@@ -389,8 +389,8 @@ e.g. \"title-subject:t\"."
     (:to-address "TO_ADDRESS" nil nil newline)
     (:place "PLACE" nil org-koma-letter-place)
     (:subject "SUBJECT" nil nil parse)
-    (:opening "OPENING" nil org-koma-letter-opening)
-    (:closing "CLOSING" nil org-koma-letter-closing)
+    (:opening "OPENING" nil org-koma-letter-opening parse)
+    (:closing "CLOSING" nil org-koma-letter-closing parse)
     (:signature "SIGNATURE" nil org-koma-letter-signature newline)
     (:special-headings nil "special-headings"
 		       org-koma-letter-prefer-special-headings)
@@ -665,7 +665,7 @@ holding export options."
    ;; Letter body.
    contents
    ;; Closing.
-   (format "\n\\closing{%s}\n" (plist-get info :closing))
+   (format "\n\\closing{%s}\n" (org-export-data (plist-get info :closing) info))
    (org-koma-letter--special-contents-as-macro
     (plist-get info :with-after-closing))
    ;; Letter end.
-- 
2.4.4


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

* Re: ox-koma-letter: how to use @@LaTeX:@@ specific commands in #+ directives
  2015-06-18 21:01           ` Rasmus
@ 2015-06-19 14:24             ` Eric S Fraga
  2015-06-19 15:28             ` Eric S Fraga
  1 sibling, 0 replies; 11+ messages in thread
From: Eric S Fraga @ 2015-06-19 14:24 UTC (permalink / raw)
  To: Rasmus; +Cc: emacs-orgmode

On Thursday, 18 Jun 2015 at 23:01, Rasmus wrote:
> Eric S Fraga <e.fraga@ucl.ac.uk> writes:
>
>> with this patch, exporting to koma-letter doesn't work for me.  I've not
>> investigated properly yet but thought I'd give you a heads up on
>> this.  
>
> Thanks.  I don't really know where exactly it breaks with a minimal
> example.  It works on my PC.  Anyway, this patch adds only a few parsed
> keywords.  Does it work with your letter?

Strange thing: exporting to pdf (C-c C-e k p) does not work but
exporting to LaTeX (C-c C-e k l) and then running pdflatex on the LaTeX
works just fine.  I've tried playing with org-latex-pdf-process to no
avail, noting that ox-koma-letter uses org-latex-compile.

Something has changed along the way and I don't know what it is.  I'll
investigate further.

thanks,
eric

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.1, Org release_8.3beta-1231-ga0a883

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

* Re: ox-koma-letter: how to use @@LaTeX:@@ specific commands in #+ directives
  2015-06-18 21:01           ` Rasmus
  2015-06-19 14:24             ` Eric S Fraga
@ 2015-06-19 15:28             ` Eric S Fraga
  1 sibling, 0 replies; 11+ messages in thread
From: Eric S Fraga @ 2015-06-19 15:28 UTC (permalink / raw)
  To: Rasmus; +Cc: emacs-orgmode

On Thursday, 18 Jun 2015 at 23:01, Rasmus wrote:
> Eric S Fraga <e.fraga@ucl.ac.uk> writes:
>
>> with this patch, exporting to koma-letter doesn't work for me.  I've not
>> investigated properly yet but thought I'd give you a heads up on
>> this.  
>
> Thanks.  I don't really know where exactly it breaks with a minimal
> example.  It works on my PC.  Anyway, this patch adds only a few parsed
> keywords.  Does it work with your letter?

This works fine.  Both with emacs -Q and with my customisations.  Not
sure what was happening earlier but I must have got something out of
synch somewhere.

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.1, Org release_8.3beta-1231-ga0a883

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

end of thread, other threads:[~2015-06-19 15:29 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-17 17:32 ox-koma-letter: how to use @@LaTeX:@@ specific commands in #+ directives Eric S Fraga
2015-06-17 20:22 ` Rasmus
2015-06-17 22:03   ` Nicolas Goaziou
2015-06-17 22:55     ` Rasmus
2015-06-18  8:06     ` Eric S Fraga
2015-06-18  8:47       ` Rasmus
2015-06-18  9:09         ` Eric S Fraga
2015-06-18 21:01           ` Rasmus
2015-06-19 14:24             ` Eric S Fraga
2015-06-19 15:28             ` Eric S Fraga
2015-06-18 14:07         ` Nicolas Goaziou

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.