|
From: | R. Michael Weylandt <address@hidden> |
Subject: | Re: [O] Accessing #+EMAIL in LaTeX Export |
Date: | Tue, 4 Feb 2014 16:46:39 -0500 |
Hi Nick, Thanks for the example; the filter seems to work well. Two possible issues: 1. I only want to use it for some latex classes 2. When using \email{} I want to get rid of the \thanks{} in \author{}. I came up with the following: <----------------------> (require 'cl-lib) (defun any (x) (cl-reduce (lambda (x y) (if x x y)) x))
;; For certain latex classes, the org-mode default of \author{NAME\thanks{EMAIL}} ;; isn't what the class wants (defvar org-latex-classes-with-email '("amsart" "amsbook"))
;; After completing latex export, check if we are in one of the classes listed in 'org-latex-classes-with-email; ;; if we are, we need to ;; 1) Remove the \thanks{} macro inside \author{} ;; 2) Add an \email{} macro ;; This can be done with a single regex replace using captures. (defun org-latex-classes-with-email-filter (contents backend info) (if (any (mapcar (lambda (x) (string-match x contents)) org-latex-classes-with-email)) (replace-regexp-in-string "\\\\author{\\(.*\\)\\\\thanks{\\(.*\\)}}" "\\\\author{\\1}\n\\\\email{\\2}" contents)))
;; Thanks to Nick Dokos for the filter setup help --http://lists.gnu.org/archive/html/emacs-orgmode/2014-02/msg00130.html (add-to-list 'org-export-filter-final-output-functions (function org-latex-classes-with-email-filter)) <-------------------> It's regex based so there may be some false positives, but it seems to work well enough for me. Michael |
[Prev in Thread] | Current Thread | [Next in Thread] |