emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Replace EMAIL keyword by some LaTeX command


From: Rasmus
Subject: Re: [O] Replace EMAIL keyword by some LaTeX command
Date: Tue, 15 Oct 2013 02:11:53 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Hi Xavier,

Xavier Garrido <address@hidden> writes:

But you have to be certain that this command is present.

You could use etoolbox to test it.  That brings in another dependency,
tho.

> The only point is that I do not know how to translate =#+EMAIL= org
> keyword into =\email= LaTeX command. Can a export filter do it ?

Of course.  Should it?  Up to you. . .

Here's an example that you can work on.  It's not well-tested and it
has limitations and evident from the example.  E.g. you disable it by
setting #+EMAIL: .

Hope it helps,
Rasmus

#+BEGIN_SRC Org
#+TITLE:  LaTeX test
#+AUTHOR: toto
#+EMAIL:  address@hidden
#+LATEX_HEADER: \usepackage{nopkg}
#+OPTIONS: with-email: t
Note that 
  1. email is inserted after other =latex_headers=
  2. with-email is ignored and only the presence of email matters.
     - You could add a check to =(plist-get options :with-email)= in
       the =(and ...)= statement below and remove the =\thanks{.}= in
       a final output filter.

#+begin_src emacs-lisp
  (defun rasmus/force-insert-email (options backend)
    "Insert EMAIL as \email{EMAIL} in the latex backend when EMAIL is present."
    (when (and (org-export-derived-backend-p backend 'latex)
               (plist-get options :email))
      (plist-put options :latex-header
                 (mapconcat 'identity 
                            (remove nil
                                    (list
                                     (plist-get options :latex-header)
                                     (format "\\email{%s}" 
                                             (plist-get options :email))))
                            "\n"))
      ;; don't insert email in \thanks{.}
      (plist-put options :with-email nil))
    options)
  
  (add-to-list 'org-export-filter-options-functions 'rasmus/force-insert-email)
#+end_src
#+END_SRC 


-- 
Enough with the bla bla!




reply via email to

[Prev in Thread] Current Thread [Next in Thread]