From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sebastian Hofer Subject: Re: [PATCH] latex export - title placement Date: Thu, 02 Jun 2011 10:36:43 +0200 Message-ID: <87zkm0ljdw.wl%sebhofer@gmail.com> References: <87wrhbdmjk.wl%sebhofer@gmail.com> <11174.1306965928@alphaville.dokosmarshall.org> <12177.1306972551@alphaville.dokosmarshall.org> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([140.186.70.92]:58185) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QS3Os-0004oa-5l for emacs-orgmode@gnu.org; Thu, 02 Jun 2011 04:37:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QS3Oq-0005KP-Av for emacs-orgmode@gnu.org; Thu, 02 Jun 2011 04:37:05 -0400 Received: from lo.gmane.org ([80.91.229.12]:45057) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QS3Op-0005Jh-Mn for emacs-orgmode@gnu.org; Thu, 02 Jun 2011 04:37:04 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1QS3Oo-00064w-5r for emacs-orgmode@gnu.org; Thu, 02 Jun 2011 10:37:02 +0200 Received: from ahgate1.aei.uni-hannover.de ([130.75.117.49]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 02 Jun 2011 10:37:02 +0200 Received: from sebhofer by ahgate1.aei.uni-hannover.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 02 Jun 2011 10:37:02 +0200 In-Reply-To: <12177.1306972551@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 To: emacs-orgmode@gnu.org Cc: Sebastian Hofer At Wed, 01 Jun 2011 19:55:51 -0400, Nick Dokos wrote: > > Nick Dokos 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. > | \collaboration@sw > | {\advance \c@collab \@ne \@argswap {\CO@grp \CO... > | l.21 \author{nick} > | ... > `---- > > Basically, \author{nick} got expanded into something involving \collaboration@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 -> \collaboration@sw -> ... > > So let's see where the latter is initialized: > > ,---- > | \def\collaboration{% implicit #1 > | \@author@def{\@booleantrue\collaboration@sw}% implicit #2 > | }% > | > | \appdef\frontmatter@init{% > | \@booleanfalse\collaboration@sw > | }% > | > | \def\@author@init{% > | \let\@author\@author@cleared > | \@booleanfalse\collaboration@sw > | }% > `---- > > > So \collaboration@sw is a boolean (when it is defined) and I gueesed that the most likely place > was the \frontmatter@init 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 > \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Ă : 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... Unfortunately I couldn't get this to work just right now, also not for the minimal example you provided. I will probably look into it when I have more time on my hands. The real problem, however, is a different one: I use the revtex class to submit research papers to the American Physical Society. And I don't think they will be happy with me providing my own package which works around one of the "features" of their own class. So unless we can get them to fix the class, we (or I for that matter) are out of luck. I haven't consider reporting this to them as I thought it would be useless, but of course one could always try... I still think that we should implement a way to handle this situation in org, I'm pretty sure this is not the only class which doesn't conform to the standards out there. Sebastian