1

I am trying to add email address in my org mode document which has to be exported to PDF.

This is my header tags.

#+TITLE: Main Title
#+SUBTITLE: Sub Title
#+AUTHOR: Author Name
#+EMAIL: author@email.com

All the first three tags are getting exported except email header. I tried the option

#+OPTIONS: toc:nil email:t

but still it is not working.

Could anyone throw light on where I am doing the mistake?

2

Exporting to PDF is via LaTeX and there is no standard entry for email in the LaTeX export. In other words, the standard LaTeX article class, used by the exporter by default, does not know what to do with an email address.

However, org creates a macro, email, which you can use to place the email address in any place you wish within the document by using {{{email}}}, including, for instance, after the author name on the #+AUTHOR line.

3
  • Thanks. However, using {{{email}}} is arbitrarily putting the email address outside the \maketitle. May 29 at 4:15
  • If you use the {{{email}}} macro in the #+author: field, e.g. as , {{{email}}} after Author Name in your example, it will appear in the author part of the document's title. I'm not sure what you mean by arbitrarily putting it outside.
    – éric
    Jun 3 at 16:02
  • The subtitle will come at the very top of the page without any connection to the document. However, I solved the problem. Please see my answer below. Thanks for your help. Jun 5 at 1:44
0

I got the solution from emacs-orgmode mailing list. Accessing #+EMAIL in latex export.

We need to create a filter function to replace @EMAIL@ in the contents (I don't what's the content we are getting) and add this function to org-export-filter-final-output-functions. The code snippet is:

(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))

(setq amsart-class
        '("amsart"
          "\\documentclass{amsart}
            [DEFAULT-PACKAGES]
            [PACKAGES]
            [EXTRA]
            {@EMAIL@}"
            ("\\section{%s}" . "\\section{%s}")
             ("\\subsection{%s}" . "\\subsection{%s}")
             ("\\subsubsection{%s}" . "\\subsubsection{%s}")))
  
(add-to-list 'org-latex-classes amsart-class)

Then, within our latex class definition as shown above, we can use @EMAIL@ where ever, we want the email to be displayed.

I used it as follows:

(add-to-list 'org-latex-classes
             '("ethz"
               "\\documentclass[a4paper,11pt,article]{memoir}
                \\usepackage[utf8]{inputenc}
                ...
                \\usepackage{parskip}
                \\makeatletter
                \\renewcommand{\\maketitle}{%
                \\begingroup\\parindent0pt
                \\Small{Aum Tat Sat!}\\par\\bigskip
                \\Huge{\\bfseries\\@title}\\par
                \\LARGE{\\@subtitle}\\par\\bigskip
                \\small{\\@author}\\par\\smallskip
                \\small{@EMAIL@}\\par\\smallskip
                \\normalsize\\@date\\par\\bigskip
                \\endgroup\\@afterindentfalse\\@afterheading}
                \\makeatother
                      [PACKAGES]
                      [EXTRA]
                \\linespread{1.1}
                 ...
               ("\\subparagraph{%s}" . "\\subparagraph*{%s}")))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.