emacs-orgmode
[Top][All Lists]

## Re: [O] [PATCH] latex export - title placement

 From: Nick Dokos Subject: Re: [O] [PATCH] latex export - title placement Date: Wed, 01 Jun 2011 19:55:51 -0400

Nick Dokos <address@hidden> wrote:

> IIUC, the only remaining thing is the position of the \title etc macros
> in the preamble or the body (or both).
>
> There are three categories of LaTeX classes: the ones that implement
> Lamport's dictum that \title etc can come anywhere before \maketitle,
> the ones like RevTeX that insist on having them in the body and the ones
> like the thesis document class at Suvayu's university, that insist on
> having them in the preamble. I consider both of the latter two as buggy:
> has anybody submitted a bug report on them?
>

I tried an experiment:

I cannot get at the thesis document class at Suvayu's university but I
most certainly can get to RevTeX. So I started with a simple org file:

,----
| #+LATEX_CLASS: revtex4-1
| #+TITLE: foo
| #+AUTHOR: nick
| #+DATE:
|
| * foo
|
| bar
----

I then added a definition for the revtex4-1 class to org-export-latex-classes.
I just copied the article class and renamed appropriately:

,----
|     ...
|     ("revtex4-1"
|      "\\documentclass[11pt]{revtex4-1}"
|      ("\\section{%s}" . "\\section*{%s}")
|      ("\\subsection{%s}" . "\\subsection*{%s}")
|      ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
|      ("\\paragraph{%s}" . "\\paragraph*{%s}")
|      ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
|     ...
----

Exporting to latex and compiling gives errors, the first one of which says:

,----
| ...
| *hyperref using default driver hpdftex*
| (/usr/share/texmf-texlive/tex/latex/hyperref/hpdftex.def)
| ! Undefined control sequence.
| l.21 \author{nick}
| ...
----

Basically, \author{nick} got expanded into something involving address@hidden
which
is currently undefined. So off to
/usr/share/texmf-texlive/tex/latex/revtex/revtex4-1.cls
I went and found the following expansion sequence:

So let's see where the latter is initialized:

,----
| \def\collaboration{% implicit #1
| }%
|
| }%
|
| }%
----

So address@hidden is a boolean (when it is defined) and I gueesed that the most
likely place
was the address@hidden macro. So what happens if we call the macro in the
preamble just before
the \title, \author and \date junk?
To do that, create a revtexbug.sty file with the following contents:

--8<---------------cut here---------------start------------->8---
\makeatletter
\makeatother
--8<---------------cut here---------------end--------------->8---

and modify the org file to

--8<---------------cut here---------------start------------->8---
#+LATEX_CLASS: revtex4-1
#+TITLE: foo
#+AUTHOR: nick
#+DATE:

* foo

bar
--8<---------------cut here---------------end--------------->8---

Export to latex, process and voilà: no errors.

I don't want to pretend of course that this solves the problem: it might
cause more problems than it solves, particularly since I know nothing about
revtex and all the above is (more-or-less informed) guesswork.

Nevertheless, it might be worth trying on a real document and seeing if
it resolves the problem without causing undue misery. If it does, you
can have a more-or-less permanent solution by just moving the
revtexbug.sty file to some directory where latex can find it (don't
forget to run texhash) and use the above as a template. You can probably
customize the class template to do the \usepackage for you.

Please report back whether it works or not. If it does, maybe you can
ask the RevTeX maintainers to fix the package: it's much more likely to
happen if you tell them how to fix it ;-) And we can add an item to the
FAQ. I just hope that there are no other classes that misbehave this way...

Nick