emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Rasmus <rasmus@gmx.us>
To: emacs-orgmode@gnu.org
Subject: Re: Replace EMAIL keyword by some LaTeX command
Date: Tue, 15 Oct 2013 02:11:53 +0200	[thread overview]
Message-ID: <87hacj2y0m.fsf@gmx.us> (raw)
In-Reply-To: 525BA939.8060804@gmail.com

Hi Xavier,

Xavier Garrido <xavier.garrido@gmail.com> 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:  toto@toto.org
#+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	other threads:[~2013-10-15  0:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-14  8:20 Replace EMAIL keyword by some LaTeX command Xavier Garrido
2013-10-15  0:11 ` Rasmus [this message]
2013-10-15  6:08   ` Xavier Garrido
2013-10-15 19:19   ` Marcin Borkowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87hacj2y0m.fsf@gmx.us \
    --to=rasmus@gmx.us \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).