From: "Charles C. Berry" <ccberry@ucsd.edu>
To: Jacob Gerlach <jacobgerlach@gmail.com>
Cc: Org-mode <emacs-orgmode@gnu.org>
Subject: Re: Latex code before maketitle
Date: Wed, 11 Feb 2015 16:24:41 -0800 [thread overview]
Message-ID: <alpine.OSX.2.00.1502111537130.1142@charles-berrys-macbook.local> (raw)
In-Reply-To: <CAA6UvuEoxTRzyC4boFd=6DcnFfQgpc28yHcnFTndn5DA=D0imA@mail.gmail.com>
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
next prev parent reply other threads:[~2015-02-12 0:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-11 20:42 Latex code before maketitle Jacob Gerlach
2015-02-11 21:01 ` Rasmus
2015-02-12 0:24 ` Charles C. Berry [this message]
2015-02-12 8:38 ` Eric S Fraga
2015-02-12 16:14 ` Jacob Gerlach
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.OSX.2.00.1502111537130.1142@charles-berrys-macbook.local \
--to=ccberry@ucsd.edu \
--cc=emacs-orgmode@gnu.org \
--cc=jacobgerlach@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).