2

I'm using the IEEEtran document class for LaTex in org-mode, and to define authors I need to use some IEEEtran-specific commands. My \author command should look something like this in the .tex file:

\author{
  \IEEEauthorblockN{A. Subject}
  \IEEEauthorblockA{University of X\\
                    Department of Applied Y\\
                    City of Z, Country\\
                    Email: \href{mailto:asubject@duck.com 
                                {asubject@duck.com}}
    \and

  \IEEEauthorblockN{B. Subject}
  \IEEEauthorblockA{University of X\\
                    Department of Applied Y\\
                    City of Z, Country\\
                    Email: \href{mailto:bsubject@duck.com 
                                {bsubject@duck.com}}
}

I don't see how can I add this option in org-mode. I tried using #+AUTHOR:, but I couldn't find a way to make it work.

If I don't define an #+AUTHOR: in org-mode, and I try to define \author{IEEE...} as a #+LATEX_HEADER:, the .tex file just takes my name as \author anyway and ignores everything I put as a #+LATEX_HEADER:.

How can I configure the \author block?

NickD
  • 27,023
  • 3
  • 23
  • 42
riedaug
  • 23
  • 2

1 Answers1

2

This will probably involve a couple of steps, one of them to defeat the default behavior of the Org mode LaTeX exporter, and some of them to satisfy your requirements.

The first step is to add an empty #+AUTHOR: setting at the top of your file. That will prevent the Org mode LaTeX exporter from producing an \author LaTeX block at all.

The second step is to introduce your own \author environment. Probably the best way to deal with that is to use an external file, so that all the mess is squirreled away in that file (call it "author.tex" for definiteness):

\author{
  \IEEEauthorblockN{A. Subject}
  \IEEEauthorblockA{University of X\\
                    Department of Applied Y\\
                    City of Z, Country\\
                    Email: \href{mailto:asubject@duck.com 
                                {asubject@duck.com}}}
    \and

  \IEEEauthorblockN{B. Subject}
  \IEEEauthorblockA{University of X\\
                    Department of Applied Y\\
                    City of Z, Country\\
                    Email: \href{mailto:bsubject@duck.com 
                                {bsubject@duck.com}}}
}

N.B. Some closing braces were missing, so I added them here.

The next step is to add the contents of this file into your LaTeX file. LaTeX has an \input mechanism that allows you to interpolate the contents of a file at a particular place. The only trick is then to do that through the Org mode file. Assuming that the \author environment has to be in the preamble, then all you have to do in your Org mode file is this:

#+LATEX_CLASS: IEEEtran
#+AUTHOR:
#+TITLE: My IEEE article
#+LATEX_HEADER: \input{author.tex}

* foo

bar

This will insert \input{author.tex} at the end of all the \usepackage declarations.

I also added a #+TITLE: directive to make sure that a \maketitle is emitted into the LaTeX file, since you mentioned (in a comment) that it's needed.

You also need to define the IEEEtran class and add it to org-latex-classes, by adding something like this to your init file:

(eval-after-load 'ox-latex
  (add-to-list 'org-latex-classes
     '("IEEEtran" "\\documentclass[11pt]{IEEEtran}"
       ("\\section{%s}" . "\\section*{%s}")
       ("\\subsection{%s}" . "\\subsection*{%s}")
       ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
       ("\\paragraph{%s}" . "\\paragraph*{%s}")
       ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))))

That's what I think you should do, but I have not tried it out, so there are probably holes in the above. I'll try it out at some point and fill in the holes as I (or you) find them.

EDIT: I had to do some edits to the above, but I have now installed the IEEEtran class and I have tried this out and it seems to be (mostly) working. Let me know if you disagree.

NickD
  • 27,023
  • 3
  • 23
  • 42