From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Charles C. Berry" Subject: Re: Latex code before maketitle Date: Wed, 11 Feb 2015 16:24:41 -0800 Message-ID: References: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36252) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLhaS-0003Lu-RU for emacs-orgmode@gnu.org; Wed, 11 Feb 2015 19:24:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YLhaO-0005oz-Q7 for emacs-orgmode@gnu.org; Wed, 11 Feb 2015 19:24:56 -0500 Received: from iport-acv5-out.ucsd.edu ([132.239.0.10]:54797) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLhaO-0005nn-H2 for emacs-orgmode@gnu.org; Wed, 11 Feb 2015 19:24:52 -0500 In-Reply-To: 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: Jacob Gerlach Cc: Org-mode On Wed, 11 Feb 2015, Jacob Gerlach wrote: > Hi List, > > I am using a custom Latex class that requires some code between > \begin{document} and \maketitle. > > It seems from looking at ox-latex.el that there is nothing between document > start and title command available for me to customize. > > I suppose I could customize the title command to include the extra code, > but I'd like to find an alternate approach if possible so I don't have to > manage org-latex-title-command on a per-document basis. > > Are there any convenient alternatives? (info "(org) Advanced configuration") has a heading called 'Filters' that may interest you. If you always export that custom class using the same boilerplate between the \begin{document} and the \maketitle , you can install your own `final-output' filter. All it needs to do is check if the custom class is operative and if it is insert the needed text before \maketitle. As a start, put something like this in your init file: #+BEGIN_SRC emacs-lisp :exports results :results none (defun my-final-filter (s backend info) (when (eq backend 'latex) (let ((class (plist-get info :latex-class))) (message "class: %s" class) (when (string= class "report") (replace-regexp-in-string "\\maketitle" "% put special stuff here\n\\maketitle" s nil t))))) (add-to-list 'org-export-filter-final-output-functions 'my-final-filter) #+END_SRC Change "report" to your special class and the % comment to whatever you need. To make it more robust, you might want to fiddle with the regexp in case there is a \maketitle someplace else in your document. HTH, Chuck