emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [Latex Export] Influence placement of \maketitle command
@ 2014-05-14 18:26 Alexander Baier
  2014-05-14 19:01 ` Nick Dokos
  0 siblings, 1 reply; 10+ messages in thread
From: Alexander Baier @ 2014-05-14 18:26 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

I am writing a paper using llncs as the document class. I use the
=\institute= command which has to be placed _above_ the =\maketitle=
command to be considered. But exporting my document always yields a
latex file where =\maketitle= appears above =\institute=. I use
simple #+LATEX: directives to insert =\institute=.

Is there a way for me to influence the placement of =\maketitle= and
thus be able to order those commands "the right way"?

TIA for any pointers,
-- 
Alexander Baier

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

* Re: [Latex Export] Influence placement of \maketitle command
  2014-05-14 18:26 [Latex Export] Influence placement of \maketitle command Alexander Baier
@ 2014-05-14 19:01 ` Nick Dokos
  2014-05-14 21:28   ` Alexander Baier
  2014-05-15 19:02   ` Alexander Baier
  0 siblings, 2 replies; 10+ messages in thread
From: Nick Dokos @ 2014-05-14 19:01 UTC (permalink / raw)
  To: emacs-orgmode

Alexander Baier <alexander.baier@mailbox.org> writes:

> Hello,
>
> I am writing a paper using llncs as the document class. I use the
> =\institute= command which has to be placed _above_ the =\maketitle=
> command to be considered. But exporting my document always yields a
> latex file where =\maketitle= appears above =\institute=. I use
> simple #+LATEX: directives to insert =\institute=.
>
> Is there a way for me to influence the placement of =\maketitle= and
> thus be able to order those commands "the right way"?
>
> TIA for any pointers,

If \institute can be placed in the preamble, then using #+LATEX_HEADER
instead of #+LATEX is probably the way to go.

If it has to be in the document body, one way to do it is to redefine
the variable org-latex-title-command in a file-local-variable section
added to the end of your file:

# Local Variables:
# org-latex-title-command: "\\institute{Foo}\\maketitle"
# End:

See

   (info "(emacs) File variables")
   
Nick

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

* Re: [Latex Export] Influence placement of \maketitle command
  2014-05-14 19:01 ` Nick Dokos
@ 2014-05-14 21:28   ` Alexander Baier
  2014-05-15 19:02   ` Alexander Baier
  1 sibling, 0 replies; 10+ messages in thread
From: Alexander Baier @ 2014-05-14 21:28 UTC (permalink / raw)
  To: Nick Dokos; +Cc: emacs-orgmode

On 2014-05-14 21:01 Nick Dokos wrote:
> Alexander Baier <alexander.baier@mailbox.org> writes:
>
>> Hello,
>>
>> I am writing a paper using llncs as the document class. I use the
>> =\institute= command which has to be placed _above_ the =\maketitle=
>> command to be considered. But exporting my document always yields a
>> latex file where =\maketitle= appears above =\institute=. I use
>> simple #+LATEX: directives to insert =\institute=.
>>
>> Is there a way for me to influence the placement of =\maketitle= and
>> thus be able to order those commands "the right way"?
>>
>> TIA for any pointers,
>
> If \institute can be placed in the preamble, then using #+LATEX_HEADER
> instead of #+LATEX is probably the way to go.

Of course! Somehow I totally forgot about the LATEX_HEADER
directive. With this, everything works fine!

> If it has to be in the document body, one way to do it is to redefine
> the variable org-latex-title-command in a file-local-variable section
> added to the end of your file:
>
> # Local Variables:
> # org-latex-title-command: "\\institute{Foo}\\maketitle"
> # End:

Oh, the title-command is a variable, that is nice.

Thank you very much,
-- 
Alexander Baier

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

* Re: [Latex Export] Influence placement of \maketitle command
  2014-05-14 19:01 ` Nick Dokos
  2014-05-14 21:28   ` Alexander Baier
@ 2014-05-15 19:02   ` Alexander Baier
  2014-05-15 19:57     ` Eric S Fraga
  1 sibling, 1 reply; 10+ messages in thread
From: Alexander Baier @ 2014-05-15 19:02 UTC (permalink / raw)
  To: Nick Dokos; +Cc: emacs-orgmode

On 2014-05-14 21:01 Nick Dokos wrote:
> Alexander Baier <alexander.baier@mailbox.org> writes:

[...]

>> Is there a way for me to influence the placement of =\maketitle= and
>> thus be able to order those commands "the right way"?

> If \institute can be placed in the preamble, then using #+LATEX_HEADER
> instead of #+LATEX is probably the way to go.
>
> If it has to be in the document body, one way to do it is to redefine
> the variable org-latex-title-command in a file-local-variable section
> added to the end of your file:
>
> # Local Variables:
> # org-latex-title-command: "\\institute{Foo}\\maketitle"
> # End:
>
> See
>
>    (info "(emacs) File variables")

While we are on the topic of placing "stuff": I also need to insert
citations for which I use bibtex. I use #+LATEX:
\bibliographystyle{plain} and #+LATEX: \bibliography{literatur} under my
last header for the bibliography to be placed at the very end.

I find this to be a somewhat lacking solution as moving my last subtree
would move my bibliography, too.

Is there a way to make it make it appear at the bottom of my document no
matter what?

Regards,
-- 
Alexander Baier

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

* Re: [Latex Export] Influence placement of \maketitle command
  2014-05-15 19:02   ` Alexander Baier
@ 2014-05-15 19:57     ` Eric S Fraga
  2014-05-15 20:41       ` Alexander Baier
  0 siblings, 1 reply; 10+ messages in thread
From: Eric S Fraga @ 2014-05-15 19:57 UTC (permalink / raw)
  To: Nick Dokos; +Cc: emacs-orgmode

On Thursday, 15 May 2014 at 21:02, Alexander Baier wrote:

[...]

> While we are on the topic of placing "stuff": I also need to insert
> citations for which I use bibtex. I use #+LATEX:
> \bibliographystyle{plain} and #+LATEX: \bibliography{literatur} under my
> last header for the bibliography to be placed at the very end.
>
> I find this to be a somewhat lacking solution as moving my last subtree
> would move my bibliography, too.
>
> Is there a way to make it make it appear at the bottom of my document no
> matter what?

I put it under its own heading with an :ignoreheading: tag and use the
filter that was posted on this list (today in fact):

#+begin_src org
  ,* references                                             :ignoreheading:
  \bibliographystyle{acm}
  \bibliography{papers.bib}
#+end_src


-- 
: Eric S Fraga (0xFFFCF67D), Emacs 24.4.50.2, Org release_8.2.6-966-g6cdf1b

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

* Re: [Latex Export] Influence placement of \maketitle command
  2014-05-15 19:57     ` Eric S Fraga
@ 2014-05-15 20:41       ` Alexander Baier
  2014-05-16  4:19         ` Nick Dokos
  2014-05-16  7:15         ` Eric S Fraga
  0 siblings, 2 replies; 10+ messages in thread
From: Alexander Baier @ 2014-05-15 20:41 UTC (permalink / raw)
  To: Nick Dokos; +Cc: emacs-orgmode

On 2014-05-15 21:57 Eric S Fraga wrote:
> I put it under its own heading with an :ignoreheading: tag and use the
> filter that was posted on this list (today in fact):

I can't find the filter you are referring to. I guess it is in the
org-ref thread?  I did not follow that thread as org-ref seems to be
a somewhat full-fledged solution including a lot of things I do not
need.  I looked through the thread but wasn't lucky to find said
filter.  Could you kindly post a link? (if that's not to much to ask)

Thanks,
-- 
Alexander Baier

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

* Re: [Latex Export] Influence placement of \maketitle command
  2014-05-15 20:41       ` Alexander Baier
@ 2014-05-16  4:19         ` Nick Dokos
  2014-05-16  8:36           ` Alexander Baier
  2014-05-16  7:15         ` Eric S Fraga
  1 sibling, 1 reply; 10+ messages in thread
From: Nick Dokos @ 2014-05-16  4:19 UTC (permalink / raw)
  To: emacs-orgmode

Alexander Baier <alexander.baier@mailbox.org> writes:

> On 2014-05-15 21:57 Eric S Fraga wrote:
>> I put it under its own heading with an :ignoreheading: tag and use the
>> filter that was posted on this list (today in fact):
>
> I can't find the filter you are referring to. I guess it is in the
> org-ref thread?  I did not follow that thread as org-ref seems to be
> a somewhat full-fledged solution including a lot of things I do not
> need.  I looked through the thread but wasn't lucky to find said
> filter.  Could you kindly post a link? (if that's not to much to ask)
>

I don't have a link, but I have the following in an example file (which
afaik still works fine):

--8<---------------cut here---------------start------------->8---
#+LATEX_CLASS: article

#+include: "ch1.org" 
#+include: "ch2.org" :minlevel 1 
#+include: "ch3.org" :minlevel 1 
#+include: "ch4.org" :minlevel 1 
#+include: "ch5.org" :minlevel 1 
#+include: "bib.org"

* Code                                                                                                        :noexport:

Suvayu's filter to get rid of :ignoreheading: tagged headlines - used in bib.org
#+BEGIN_SRC emacs-lisp :results silent
(defun sa-ignore-headline (contents backend info)
  "Ignore headlines with tag `ignoreheading'."
  (when (and (org-export-derived-backend-p backend 'latex 'html 'ascii)
          (string-match "\\`.*ignoreheading.*\n"
                (downcase contents)))
    (replace-match "" nil nil contents)))

(add-to-list 'org-export-filter-headline-functions 'sa-ignore-headline)

#+END_SRC
--8<---------------cut here---------------end--------------->8---

Using #+include also largely resolves your original concern I think
and is invaluable for larger files.

HTH,
-- 
Nick

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

* Re: [Latex Export] Influence placement of \maketitle command
  2014-05-15 20:41       ` Alexander Baier
  2014-05-16  4:19         ` Nick Dokos
@ 2014-05-16  7:15         ` Eric S Fraga
  2014-05-16  9:15           ` Alexander Baier
  1 sibling, 1 reply; 10+ messages in thread
From: Eric S Fraga @ 2014-05-16  7:15 UTC (permalink / raw)
  To: Nick Dokos; +Cc: emacs-orgmode

On Thursday, 15 May 2014 at 22:41, Alexander Baier wrote:
> On 2014-05-15 21:57 Eric S Fraga wrote:
>> I put it under its own heading with an :ignoreheading: tag and use the
>> filter that was posted on this list (today in fact):
>
> I can't find the filter you are referring to. I guess it is in the
> org-ref thread?  I did not follow that thread as org-ref seems to be
> a somewhat full-fledged solution including a lot of things I do not
> need.  I looked through the thread but wasn't lucky to find said
> filter.  Could you kindly post a link? (if that's not to much to ask)
>
> Thanks,

It was not in that thread and the email was tangentially about ignored
headlines.  I think it had to with beamer columns and generating
articles.  I'm offline currently so cannot check.

In any case, this is what I use:

  (defun esf/remove-lines-with-ignore-heading-tag (backend)
    (message "Deleting lines with ignore heading tag")
    (while (search-forward-regexp "^\\*+.*[ \t]+[a-ZA-Z0-9:]*:ignoreheading:[a-ZA-Z0-9:]*$" (point-max) t)
      (cond
       ((eq backend 'latex) (replace-match "#+latex: % \\&" ))
       ((eq backend 'html) (replace-match "#+html: <!-- \\& -->" ))
       (t (replace-match "")))))
  (add-hook 'org-export-before-processing-hook 'esf/remove-lines-with-ignore-heading-tag)

HTH,
eric

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 24.3.1, Org release_8.2.6-937-g60502a

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

* Re: [Latex Export] Influence placement of \maketitle command
  2014-05-16  4:19         ` Nick Dokos
@ 2014-05-16  8:36           ` Alexander Baier
  0 siblings, 0 replies; 10+ messages in thread
From: Alexander Baier @ 2014-05-16  8:36 UTC (permalink / raw)
  To: Nick Dokos; +Cc: emacs-orgmode

On 2014-05-16 06:19 Nick Dokos wrote:
> Alexander Baier <alexander.baier@mailbox.org> writes:
>
>> On 2014-05-15 21:57 Eric S Fraga wrote:
>>> I put it under its own heading with an :ignoreheading: tag and use the
>>> filter that was posted on this list (today in fact):
>>
>> I can't find the filter you are referring to. I guess it is in the
>> org-ref thread?  I did not follow that thread as org-ref seems to be
>> a somewhat full-fledged solution including a lot of things I do not
>> need.  I looked through the thread but wasn't lucky to find said
>> filter.  Could you kindly post a link? (if that's not to much to ask)
>>
>
> I don't have a link, but I have the following in an example file (which
> afaik still works fine):

This works like charm, thanks!

> Suvayu's filter to get rid of :ignoreheading: tagged headlines - used
> in bib.org
> #+BEGIN_SRC emacs-lisp :results silent
> (defun sa-ignore-headline (contents backend info)
>   "Ignore headlines with tag `ignoreheading'."
>   (when (and (org-export-derived-backend-p backend 'latex 'html 'ascii)
>           (string-match "\\`.*ignoreheading.*\n"
>                 (downcase contents)))
>     (replace-match "" nil nil contents)))
>
> (add-to-list 'org-export-filter-headline-functions 'sa-ignore-headline)
> #+END_SRC

And thanks to Suvayu for providing this filter in the first place!

> Using #+include also largely resolves your original concern I think

This is also a good idea. But for now my document is small enough to
maintain it in a single org file.

Regards,
-- 
Alexander Baier

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

* Re: [Latex Export] Influence placement of \maketitle command
  2014-05-16  7:15         ` Eric S Fraga
@ 2014-05-16  9:15           ` Alexander Baier
  0 siblings, 0 replies; 10+ messages in thread
From: Alexander Baier @ 2014-05-16  9:15 UTC (permalink / raw)
  To: Nick Dokos; +Cc: emacs-orgmode

On 2014-05-16 09:15 Eric S Fraga wrote:
> On Thursday, 15 May 2014 at 22:41, Alexander Baier wrote:
>> On 2014-05-15 21:57 Eric S Fraga wrote:
>>> I put it under its own heading with an :ignoreheading: tag and use the
>>> filter that was posted on this list (today in fact):
>>
>> I can't find the filter you are referring to. I guess it is in the
>> org-ref thread?  I did not follow that thread as org-ref seems to be
>> a somewhat full-fledged solution including a lot of things I do not
>> need.  I looked through the thread but wasn't lucky to find said
>> filter.  Could you kindly post a link? (if that's not to much to ask)
>>
>> Thanks,
>
> It was not in that thread and the email was tangentially about ignored
> headlines.  I think it had to with beamer columns and generating
> articles.  I'm offline currently so cannot check.

Ah, well, neither did I follow that one.

> In any case, this is what I use:
>
>   (defun esf/remove-lines-with-ignore-heading-tag (backend)
>     (message "Deleting lines with ignore heading tag")
>     (while (search-forward-regexp "^\\*+.*[ \t]+[a-ZA-Z0-9:]*:ignoreheading:[a-ZA-Z0-9:]*$" (point-max) t)
>       (cond
>        ((eq backend 'latex) (replace-match "#+latex: % \\&" ))
>        ((eq backend 'html) (replace-match "#+html: <!-- \\& -->" ))
>        (t (replace-match "")))))
>   (add-hook 'org-export-before-processing-hook 'esf/remove-lines-with-ignore-heading-tag)
>
> HTH,
> eric

Thank you for digging this up!  I, however, already applied Suvayu's
solution suggested by Nick that uses a headline filter.  I see that
your filter inserts the original headline in comments into the source
document, which might be very helpful, in case you are using this for
more than just two latex commands.

Regards,
-- 
Alexander Baier

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

end of thread, other threads:[~2014-05-16  9:17 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-14 18:26 [Latex Export] Influence placement of \maketitle command Alexander Baier
2014-05-14 19:01 ` Nick Dokos
2014-05-14 21:28   ` Alexander Baier
2014-05-15 19:02   ` Alexander Baier
2014-05-15 19:57     ` Eric S Fraga
2014-05-15 20:41       ` Alexander Baier
2014-05-16  4:19         ` Nick Dokos
2014-05-16  8:36           ` Alexander Baier
2014-05-16  7:15         ` Eric S Fraga
2014-05-16  9:15           ` Alexander Baier

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