From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: Accessing #+EMAIL in LaTeX Export Date: Tue, 04 Feb 2014 12:31:03 -0500 Message-ID: <87ppn2vl7s.fsf@alphaville.bos.redhat.com> References: <871tzj4e4c.fsf@gmail.com> <87wqhb2c08.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:59112) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WAjut-00026g-K9 for emacs-orgmode@gnu.org; Tue, 04 Feb 2014 12:40:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WAjq6-0002gp-TS for emacs-orgmode@gnu.org; Tue, 04 Feb 2014 12:36:11 -0500 Received: from plane.gmane.org ([80.91.229.3]:49773) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WAjq6-0002gh-N9 for emacs-orgmode@gnu.org; Tue, 04 Feb 2014 12:31:14 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1WAjq5-0008FP-Jc for emacs-orgmode@gnu.org; Tue, 04 Feb 2014 18:31:13 +0100 Received: from nat-pool-bos-t.redhat.com ([66.187.233.206]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 04 Feb 2014 18:31:13 +0100 Received: from ndokos by nat-pool-bos-t.redhat.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 04 Feb 2014 18:31:13 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Nick Dokos writes: > "R. Michael Weylandt" writes: > >> I want org-mode to export to the "amsart" class by default. In >> addition to the regular \title, \author, \date macros, amsart also >> allows for "email". >> >> (add-to-list 'org-latex-classes >> '("amsart" >> "\\documentclass{amsart} >> [DEFAULT-PACKAGES] >> [PACKAGES] >> [EXTRA] >> \\email{ {{{email}}} }" >> ("\\section{%s}" . "\\section{%s}") >> ("\\subsection{%s}" . "\\subsection{%s}") >> ("\\subsubsection{%s}" . "\\subsubsection{%s}"))) >> >> Running this on a document like: >> >> #+TITLE: Test 1 >> #+AUTHOR: Michael Weylandt >> #+EMAIL: Michael.Weylandt@gmail.com >> #+LATEX_CLASS: amsart >> * Header 1 >> Hello World >> >> leaves me with "\email{email}" in the resulting LaTeX instead of >> "\email{Michael.Weylandt@mail.com}". Since this is used as part of >> \maketitle, doing something in the body (like your example) is too >> late. >> >> The #+EMAIL: value is handled by ox-latex.el, but it's only placed >> inside the \author{} macro instead of in a stand alone \email{}. >> That's the behavior I'm hoping to tweak. >> >> Is that clearer? >> > > Much - thanks. I haven't thought much about it but my knee-jerk reaction > is to use a marker (something like \email{@EMAIL@}) when defining the > class and use a filter to replace it at the end. But there are might be > more elegant solutions around. So here's a brute-force solution along the above lines: --8<---------------cut here---------------start------------->8--- #+EMAIL: ndokos@gmail.com #+LATEX_CLASS: amsart * foo bar * code :noexport: This should probably go in some initialization file - for testing, I just executed the code blocks by hand: #+name: email-filter #+BEGIN_SRC elisp :results none (defun nd-email-filter (contents backend info) (let ((email (plist-get info :email))) (replace-regexp-in-string "@EMAIL@" email contents t))) (add-to-list 'org-export-filter-final-output-functions (function nd-email-filter)) #+END_SRC #+name: amsart #+BEGIN_SRC elisp :results none (setq amsart-class '("amsart" "\\documentclass{amsart} [DEFAULT-PACKAGES] [PACKAGES] [EXTRA] \\email{@EMAIL@ }" ("\\section{%s}" . "\\section{%s}") ("\\subsection{%s}" . "\\subsection{%s}") ("\\subsubsection{%s}" . "\\subsubsection{%s}"))) (add-to-list 'org-latex-classes amsart-class) #+END_SRC This deletes the amsart from the org-latex-classes list: #+BEGIN_SRC elisp (setq org-latex-classes (cdr org-latex-classes)) #+END_SRC --8<---------------cut here---------------end--------------->8--- Nick