emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Export to LaTeX and Beamer
@ 2013-07-11 21:41 Julien Cubizolles
  2013-07-13 20:25 ` Suvayu Ali
  0 siblings, 1 reply; 8+ messages in thread
From: Julien Cubizolles @ 2013-07-11 21:41 UTC (permalink / raw)
  To: emacs-orgmode

I need to export different parts of an org file with different LaTeX
classes, one of which is a beamer style.

I've come up with the following solution: manually switching the
LATEX_CLASS for each export, and using SELECT_TAGS to choose which
headings to export. For the following file

* First section
** First subsection
*** This is for beamer                            :beamer:
    Some text
*** This is for plain LaTeX                       :latex:      
    Some other text
*** This is for both                              :beamer:latex:      

Changing the preamble from:
 #+LATEX_CLASS: beamer
 #+SELECT_TAGS: beamer
 
 to:
 #+LATEX_CLASS: latex
 #+SELECT_TAGS: latex

does the trick but what if I don't want to export the title of the
heading but just the text ? I can use the noheading BEAMER_ENV for
beamer export but I couldn't find a corresponding option for plain
LaTeX.

How would you go about doing it ?

Julien.

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

* Re: Export to LaTeX and Beamer
  2013-07-11 21:41 Export to LaTeX and Beamer Julien Cubizolles
@ 2013-07-13 20:25 ` Suvayu Ali
  2013-07-15  8:21   ` Julien Cubizolles
  2013-07-15  9:15   ` Julien Cubizolles
  0 siblings, 2 replies; 8+ messages in thread
From: Suvayu Ali @ 2013-07-13 20:25 UTC (permalink / raw)
  To: emacs-orgmode

Hello Julien,

On Thu, Jul 11, 2013 at 11:41:45PM +0200, Julien Cubizolles wrote:
> I need to export different parts of an org file with different LaTeX
> classes, one of which is a beamer style.
> 
> I've come up with the following solution: manually switching the
> LATEX_CLASS for each export, and using SELECT_TAGS to choose which
> headings to export. For the following file

Sounds a bit clumsy; are you aware of subtree export[1]?  However I'm
not sure if you can export the same headline with different backends
with subtree export.

> does the trick but what if I don't want to export the title of the
> heading but just the text ? I can use the noheading BEAMER_ENV for
> beamer export but I couldn't find a corresponding option for plain
> LaTeX.

There is none, but you can use filters to achieve this.  Take a look
here:
<https://github.com/suvayu/.emacs.d/blob/master/org-mode-config.el#L258>
Do note, as the comment says, I have not tested it extensively.

Hope this helps,


Footnotes:

[1] (info "(org) The Export Dispatcher")"

-- 
Suvayu

Open source is the future. It sets us free.

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

* Re: Export to LaTeX and Beamer
  2013-07-13 20:25 ` Suvayu Ali
@ 2013-07-15  8:21   ` Julien Cubizolles
  2013-07-15  8:55     ` Suvayu Ali
  2013-07-15  9:15   ` Julien Cubizolles
  1 sibling, 1 reply; 8+ messages in thread
From: Julien Cubizolles @ 2013-07-15  8:21 UTC (permalink / raw)
  To: Suvayu Ali; +Cc: emacs-orgmode

Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:


> Sounds a bit clumsy; are you aware of subtree export[1]?  However I'm
> not sure if you can export the same headline with different backends
> with subtree export.

Subtree export won't do it: it's the whole org-file I need to
export. It's for a course I'm giving: I need the beamer to display
during class and the notes for myself on the desk.


> There is none, but you can use filters to achieve this.  Take a look
> here:
> <https://github.com/suvayu/.emacs.d/blob/master/org-mode-config.el#L258>
> Do note, as the comment says, I have not tested it extensively.
>
> Hope this helps,

I'll try it and let you know.

Thanks for your help.

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

* Re: Export to LaTeX and Beamer
  2013-07-15  8:21   ` Julien Cubizolles
@ 2013-07-15  8:55     ` Suvayu Ali
  0 siblings, 0 replies; 8+ messages in thread
From: Suvayu Ali @ 2013-07-15  8:55 UTC (permalink / raw)
  To: Julien Cubizolles; +Cc: emacs-orgmode

On Mon, Jul 15, 2013 at 10:21:07AM +0200, Julien Cubizolles wrote:
> Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:
> 
> 
> > Sounds a bit clumsy; are you aware of subtree export[1]?  However I'm
> > not sure if you can export the same headline with different backends
> > with subtree export.
> 
> Subtree export won't do it: it's the whole org-file I need to
> export. It's for a course I'm giving: I need the beamer to display
> during class and the notes for myself on the desk.

That can be done by using beamerarticle as the class and exporting as
beamer.  Say you have H:3 in options, then only level 3 headlines or
headlines with the frame property end up in frames when using the beamer
class.  With beamerarticle, everything ends up in your handout/notes.

Hope this helps,

-- 
Suvayu

Open source is the future. It sets us free.

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

* Re: Export to LaTeX and Beamer
  2013-07-13 20:25 ` Suvayu Ali
  2013-07-15  8:21   ` Julien Cubizolles
@ 2013-07-15  9:15   ` Julien Cubizolles
  2013-07-15  9:40     ` Suvayu Ali
  1 sibling, 1 reply; 8+ messages in thread
From: Julien Cubizolles @ 2013-07-15  9:15 UTC (permalink / raw)
  To: emacs-orgmode

Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:


> There is none, but you can use filters to achieve this.  Take a look
> here:
> <https://github.com/suvayu/.emacs.d/blob/master/org-mode-config.el#L258>
> Do note, as the comment says, I have not tested it extensively.

I tried it (evaled the following)

(defun jc-ignore-headline (contents backend info)
  "Ignore headlines with tag `ignoreheading'."
  (if (eq backend 'latex) (message contents)
    contents))

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

and then added the ignoreheading tag (there was already another tag)
to a headline but the headline is still exported. Is there another
variable to configure to ensure that the filter function is indeed run ?

Julien.

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

* Re: Export to LaTeX and Beamer
  2013-07-15  9:15   ` Julien Cubizolles
@ 2013-07-15  9:40     ` Suvayu Ali
  2013-07-15  9:49       ` Suvayu Ali
  0 siblings, 1 reply; 8+ messages in thread
From: Suvayu Ali @ 2013-07-15  9:40 UTC (permalink / raw)
  To: Julien Cubizolles; +Cc: Org-mode Discussion

On Mon, Jul 15, 2013 at 11:15:16AM +0200, Julien Cubizolles wrote:
> The following message is a courtesy copy of an article
> that has been posted to gmane.emacs.orgmode as well.
> 
> Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:
> 
> 
> > There is none, but you can use filters to achieve this.  Take a look
> > here:
> > <https://github.com/suvayu/.emacs.d/blob/master/org-mode-config.el#L258>
> > Do note, as the comment says, I have not tested it extensively.
> 
> I tried it (evaled the following)
> 
> (defun jc-ignore-headline (contents backend info)
>   "Ignore headlines with tag `ignoreheading'."
>   (if (eq backend 'latex) (message contents)
>     contents))
> 
> (add-to-list 'org-export-filter-headline-functions 'jc-ignore-headline)
> 
> and then added the ignoreheading tag (there was already another tag)
> to a headline but the headline is still exported. Is there another
> variable to configure to ensure that the filter function is indeed run ?

Now that I look at the code carefully, I realise the function is dummy.
I never got the time to implement it, hence the FIXME!  I just wrote the
filter so that I do not forget how.  What you need to do is instead of
returning contents, look for the tag, if present return the contents
without the headline, the unaltered contents otherwise.  Should be
simple to do.  If I can find the time, I'll take a crack at it today.

Cheers,

-- 
Suvayu

Open source is the future. It sets us free.

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

* Re: Export to LaTeX and Beamer
  2013-07-15  9:40     ` Suvayu Ali
@ 2013-07-15  9:49       ` Suvayu Ali
       [not found]         ` <87k3koc3sf.fsf@free.fr>
  0 siblings, 1 reply; 8+ messages in thread
From: Suvayu Ali @ 2013-07-15  9:49 UTC (permalink / raw)
  To: Julien Cubizolles; +Cc: Org-mode Discussion

On Mon, Jul 15, 2013 at 11:40:34AM +0200, Suvayu Ali wrote:
> On Mon, Jul 15, 2013 at 11:15:16AM +0200, Julien Cubizolles wrote:
> > (defun jc-ignore-headline (contents backend info)
> >   "Ignore headlines with tag `ignoreheading'."
> >   (if (eq backend 'latex) (message contents)
> >     contents))

Here is an older version of the function:

 (defun my-org-export-remove-tagged-headlines (tag)
   (save-excursion
     (goto-char (point-min))
     (while (re-search-forward (concat ":" tag ":") nil t)
       (delete-region (point-at-bol) (point-at-eol)))))

Here I'm parsing the buffer in a pre-process hook.  In a filter, you
have to parse a string instead.  But the logic should be the same.

Hope this helps,

-- 
Suvayu

Open source is the future. It sets us free.

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

* Re: Export to LaTeX and Beamer
       [not found]         ` <87k3koc3sf.fsf@free.fr>
@ 2013-07-17 21:00           ` Suvayu Ali
  0 siblings, 0 replies; 8+ messages in thread
From: Suvayu Ali @ 2013-07-17 21:00 UTC (permalink / raw)
  To: Julien Cubizolles; +Cc: Emacs Org mode

On Wed, Jul 17, 2013 at 10:47:12PM +0200, Julien Cubizolles wrote:
> Hi Ali (am I right in assuming that's your first name ?)
> 
> Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:
> 
> > Here is an older version of the function:
> >
> >  (defun my-org-export-remove-tagged-headlines (tag)
> >    (save-excursion
> >      (goto-char (point-min))
> >      (while (re-search-forward (concat ":" tag ":") nil t)
> >        (delete-region (point-at-bol) (point-at-eol)))))
> >
> > Here I'm parsing the buffer in a pre-process hook.  In a filter, you
> > have to parse a string instead.  But the logic should be the same.
> 
> I'll try and adapt to make it work. I'll let you know how it goes.

Actually Rasmus shared his filter earlier today on the Emacs list.  Try
this:

(defun my-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 headline)))
    (replace-match "" nil nil headline)))

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

Cheers,

-- 
Suvayu

Open source is the future. It sets us free.

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

end of thread, other threads:[~2013-07-17 21:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-11 21:41 Export to LaTeX and Beamer Julien Cubizolles
2013-07-13 20:25 ` Suvayu Ali
2013-07-15  8:21   ` Julien Cubizolles
2013-07-15  8:55     ` Suvayu Ali
2013-07-15  9:15   ` Julien Cubizolles
2013-07-15  9:40     ` Suvayu Ali
2013-07-15  9:49       ` Suvayu Ali
     [not found]         ` <87k3koc3sf.fsf@free.fr>
2013-07-17 21:00           ` Suvayu Ali

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