From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: [PATCH] latex export - title placement Date: Wed, 01 Jun 2011 19:55:51 -0400 Message-ID: <12177.1306972551@alphaville.dokosmarshall.org> References: <87wrhbdmjk.wl%sebhofer@gmail.com> <11174.1306965928@alphaville.dokosmarshall.org> Reply-To: nicholas.dokos@hp.com Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([140.186.70.92]:48078) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QRvGu-0005E7-EO for emacs-orgmode@gnu.org; Wed, 01 Jun 2011 19:56:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QRvGs-0002vN-SL for emacs-orgmode@gnu.org; Wed, 01 Jun 2011 19:56:20 -0400 Received: from vms173001pub.verizon.net ([206.46.173.1]:59039) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QRvGs-0002uH-E9 for emacs-orgmode@gnu.org; Wed, 01 Jun 2011 19:56:18 -0400 Received: from alphaville.dokosmarshall.org ([unknown] [173.76.32.106]) by vms173001.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0LM400DWKYH39H80@vms173001.mailsrvcs.net> for emacs-orgmode@gnu.org; Wed, 01 Jun 2011 18:56:04 -0500 (CDT) In-reply-to: Message from Nick Dokos of "Wed\, 01 Jun 2011 18\:05\:28 EDT." <11174.1306965928@alphaville.dokosmarshall.org> 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 Cc: Sebastian Hofer , nicholas.dokos@hp.com, emacs-orgmode@gnu.org Nick Dokos wrote: > IIUC, the only remaining thing is the position of the \title etc macros > in the preamble or the body (or both). >=20 > 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? >=20 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: |=20 | * foo |=20 | bar `---- I then added a definition for the revtex4-1 class to org-export-latex-class= es. 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. | \collaboration@sw=20 | {\advance \c@collab \@ne \@argswap {\CO@grp = \CO... | l.21 \author{nick} | ... `---- Basically, \author{nick} got expanded into something involving \collaborati= on@sw 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: \author -> \frontmatter@author -> \@author@def -> \move@AU -> \collabora= tion@sw -> ... So let's see where the latter is initialized: ,---- | \def\collaboration{% implicit #1 | \@author@def{\@booleantrue\collaboration@sw}% implicit #2 | }% |=20 | \appdef\frontmatter@init{% | \@booleanfalse\collaboration@sw | }% |=20 | \def\@author@init{% | \let\@author\@author@cleared | \@booleanfalse\collaboration@sw | }% `---- So \collaboration@sw is a boolean (when it is defined) and I gueesed that t= he most likely place was the \frontmatter@init macro. So what happens if we call the macro in th= e 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 \frontmatter@init \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: #+LATEX_HEADER: \usepackage{revtexbug} * foo bar --8<---------------cut here---------------end--------------->8--- Export to latex, process and voil=C3=A0: 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