emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Latex code before maketitle
@ 2015-02-11 20:42 Jacob Gerlach
  2015-02-11 21:01 ` Rasmus
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Jacob Gerlach @ 2015-02-11 20:42 UTC (permalink / raw)
  To: Org-mode

[-- Attachment #1: Type: text/plain, Size: 498 bytes --]

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?

Regards,
Jake

[-- Attachment #2: Type: text/html, Size: 658 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Latex code before maketitle
  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
  2015-02-12  8:38 ` Eric S Fraga
  2 siblings, 0 replies; 5+ messages in thread
From: Rasmus @ 2015-02-11 21:01 UTC (permalink / raw)
  To: emacs-orgmode

Jacob Gerlach <jacobgerlach@gmail.com> writes:

> Are there any convenient alternatives?

Maybe something like AfterPreamble, AfterEndPreamble, AtEndPreamble
etc. from etoolbox?  Or AfterPackage from KOMA-Script.

Hope it helps,
Rasmus

-- 
There are known knowns; there are things we know that we know

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Latex code before maketitle
  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
  2015-02-12  8:38 ` Eric S Fraga
  2 siblings, 0 replies; 5+ messages in thread
From: Charles C. Berry @ 2015-02-12  0:24 UTC (permalink / raw)
  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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Latex code before maketitle
  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
@ 2015-02-12  8:38 ` Eric S Fraga
  2015-02-12 16:14   ` Jacob Gerlach
  2 siblings, 1 reply; 5+ messages in thread
From: Eric S Fraga @ 2015-02-12  8:38 UTC (permalink / raw)
  To: Jacob Gerlach; +Cc: Org-mode

On Wednesday, 11 Feb 2015 at 20:42, 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,

I don't know of any æsthetically pleasing solution to this
problem.  I've done this in the past by redefining \maketitle to
introduce my design commands and then invoke the actual \maketitle
command.
-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.1, Org release_8.3beta-816-gae83b3

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Latex code before maketitle
  2015-02-12  8:38 ` Eric S Fraga
@ 2015-02-12 16:14   ` Jacob Gerlach
  0 siblings, 0 replies; 5+ messages in thread
From: Jacob Gerlach @ 2015-02-12 16:14 UTC (permalink / raw)
  To: Org-mode

[-- Attachment #1: Type: text/plain, Size: 1097 bytes --]

On Wed Feb 11 2015 at 4:01:47 PM Rasmus <rasmus@gmx.us> wrote:

> Maybe something like AfterPreamble, AfterEndPreamble, AtEndPreamble etc.
> from etoolbox?


Ah, a Latex solution to an Org problem. I was looking for a final filter
and didn't realize it, but used your approach before I saw Chuck's reply.

Since I was already defining a custom org-latex-class, I was able to add
the necessary code inside the class definition:

(add-to-list 'org-latex-classes
...
[NO-DEFAULT-PACKAGES]
[EXTRA]
\\AfterPreamble{
...
}

This works great.

On Wed Feb 11 2015 at 7:24:43 PM Charles C. Berry <ccberry@ucsd.edu> wrote:

> (info "(org) Advanced configuration") has a heading called 'Filters' that
> may interest you.
>
Indeed, this is what I was missing. I would have used this if I hadn't
already figured it out with AfterPreamble

I started creating a filter to move the TOC (which I need to come after
"Acknowledgments"), but it turned out to be easier just to set toc:nil and
put the TOC and lists of figures/tables where I wanted them as raw Latex
commands

Thanks both for the help.

Regards,
Jake

[-- Attachment #2: Type: text/html, Size: 2423 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-02-12 16:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2015-02-12  8:38 ` Eric S Fraga
2015-02-12 16:14   ` Jacob Gerlach

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).