emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Re: [babel]Subtree exporting to different LaTeX_CLASS
@ 2009-10-22 22:13 Thomas S. Dye
       [not found] ` <407c66ac0910230548n366dd96bn931a81ea1dabffee@mail.gmail.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas S. Dye @ 2009-10-22 22:13 UTC (permalink / raw)
  To: JBash; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 2919 bytes --]

Hi Jerry,

I do this using org-babel.  I love being able to write my article  
*and* my beamer presentation in the same file.  Using the literate  
programming facility of org-babel, I'm able to write them each in  
pieces, then assemble them at the end for tangling and export.  This  
means I have to write real LaTeX and beamer code, rather than having  
the LaTeX export facility of org-mode do its work, but org-mode makes  
this easy with Ctrl-C ', which opens up the source block in a buffer  
where auctex and reftex are active.

It looks something like this:

#+srcname: latex-preamble
#+begin_src latex :exports none
\documentclass{article}
\author{A. N. Author}
\title{Article Title}
\newcommand{\attr}[1]{\textbf{#1}}

\begin{document}

\maketitle
#+end_src

#+srcname: beamer-preamble
#+begin_src latex :exports none
\documentclass{beamer}
... (lots of stuff here)
\begin{document}

\maketitle

#+end_src

#+srcname: latex-document
#+begin_src latex :tangle adz_print.tex :exports none
   % <<latex-preamble>>
   % <<latex-introduction>
	...
   \end{document}
#+end_src

#+srcname: beamer-document
#+begin_src latex :tangle adz_beamer.tex :exports none
   % <<beamer-preamble>>
   % <<beamer-introduction>>
	...
   \end{document}
#+end_src

Calling org-babel-tangle gives me adz_print.tex for my article and  
adz_beamer.tex for my beamer presentation.

There are probably other ways to achieve this (org-mode, you know)  
that might be simpler.

The text I write outside the source blocks tracks what I hope to  
achieve, decisions I've made, etc. and uses the export facilities of  
org-mode to create a user manual for my employees.  Right now I'm  
targeting html for the user manual, but LaTeX export would also work.

HTH,
Tom



Thomas S. Dye, Ph.D.
T. S. Dye & Colleagues, Archaeologists, Inc.
Phone: (808) 529-0866 Fax: (808) 529-0884
http://www.tsdye.com


On Oct 22, 2009, at 11:20 AM, JBash wrote:

> Hi,
>
> A question about exporting:
>
> Is it possible to export two different subtrees in the same file to  
> a different class?  There are cases where it would be nice to be  
> able to generate a document (say an article) from a single subtree  
> in a file, and have other subtrees that contain short presentations  
> that could be exported quickly to beamer, for example.  Currently,  
> the exporter seems to find the first #+LaTeX_CLASS in the file and  
> use that for the entire file export, as well as exporting any  
> subtree in the file, even if you define a separate LaTeX_CLASS under  
> a specific subtree.  I have looked into using export OPTIONS in  
> subtrees for this, but have not hit on the right combination.  Is  
> this possible?
>
> Thanks,
> Jerry
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[-- Attachment #1.2: Type: text/html, Size: 6774 bytes --]

[-- Attachment #2: Type: text/plain, Size: 204 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: [babel]Subtree exporting to different LaTeX_CLASS
       [not found] ` <407c66ac0910230548n366dd96bn931a81ea1dabffee@mail.gmail.com>
@ 2009-10-23 16:30   ` Thomas S. Dye
  2009-10-23 17:52     ` Thomas S. Dye
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas S. Dye @ 2009-10-23 16:30 UTC (permalink / raw)
  To: JBash; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 6321 bytes --]

Jerry,

Yes, org-babel opens a whole range of possibilities.

The setup I described produces three documents: 1) LaTeX document, 2)  
beamer slide show, and 3) html user manual.  1) and 2) are written  
completely in their own sets of source blocks, in native LaTeX and  
beamer, and are processed by org-babel-tangle to make files that LaTeX  
can typeset.  I don't edit these after they have been tangled.  3) is  
exported using one of the org-mode facilities and contains, where  
appropriate, the source code of various LaTeX and beamer source  
blocks, using the :exports header argument.  For long bits of LaTeX  
code that readers of my user manual would fully understand, I  
set :exports none.  When the LaTeX code does something more  
interesting, I set :exports code, so it appears in the user manual.

The intent of the manual is to show my employees how to solve document  
preparation problems that are common in our work.

Of course, document preparation also includes figures as well as  
text.  org-babel lets me write modular code that queries a MySQL  
server, processes the results of the query in R, and writes a graphic  
to disk.  The LaTex and beamer code in the source blocks can refer to  
these graphic files.  Of course, I write notes about the various parts  
of the figure preparation code as I go.  In this way, the org-mode  
file approximates a reproducible research document.   The modularity  
of the code lets me isolate things like SQL queries.  In the case  
where I have several figures that describe one set of objects and the  
definition of the objects changes as a result of the ongoing analysis,  
I can change the query in one place and expect that the change will  
show up in all of the figures that use that query.

This is the only way I currently move information into the LaTeX and  
beamer source blocks from outside them.  I'm new to this, however, and  
I'm fairly certain my workflow will change as I explore and better  
understand the many possibilities offered by org-babel.  I'll be  
interested to learn the workflow you devise.

HTH,
Tom

Thomas S. Dye, Ph.D.
T. S. Dye & Colleagues, Archaeologists, Inc.
Phone: (808) 529-0866 Fax: (808) 529-0884
http://www.tsdye.com


On Oct 23, 2009, at 2:48 AM, JBash wrote:

> Tom,
>
> Thanks very much for pointing this out.  I had not taken the time to  
> investigate org-babel up to now.  I didn't know enough about it to  
> know I needed to find out about it...
>
> I've been looking at the information about it on worg, and it seems  
> like it opens a whole range of possibilities.
>
> So, if I may inquire further about the process you are using in your  
> workflow, for clarification.  If I understand...
>
> You are using the source blocks to contain the entire document(s),  
> in separate parts (preamble, intro, chapters, summary, etc.), and  
> using orgmode outlining functions to capture notes, thoughts,  
> actions, etc.  Some of these subtrees then may be exported and  
> placed inside the source blocks of one (or both/more) of the  
> documents, with additional editing (of the source) as needed.  Is  
> that the general idea?
>
> Thanks,
> Jerry
>
>
>
> On Thu, Oct 22, 2009 at 6:13 PM, Thomas S. Dye <tsd@tsdye.com> wrote:
> Hi Jerry,
>
> I do this using org-babel.  I love being able to write my article  
> *and* my beamer presentation in the same file.  Using the literate  
> programming facility of org-babel, I'm able to write them each in  
> pieces, then assemble them at the end for tangling and export.  This  
> means I have to write real LaTeX and beamer code, rather than having  
> the LaTeX export facility of org-mode do its work, but org-mode  
> makes this easy with Ctrl-C ', which opens up the source block in a  
> buffer where auctex and reftex are active.
>
> It looks something like this:
>
> #+srcname: latex-preamble
> #+begin_src latex :exports none
> \documentclass{article}
> \author{A. N. Author}
> \title{Article Title}
> \newcommand{\attr}[1]{\textbf{#1}}
>
> \begin{document}
>
> \maketitle
> #+end_src
>
> #+srcname: beamer-preamble
> #+begin_src latex :exports none
> \documentclass{beamer}
> ... (lots of stuff here)
> \begin{document}
>
> \maketitle
>
> #+end_src
>
> #+srcname: latex-document
> #+begin_src latex :tangle adz_print.tex :exports none
>   % <<latex-preamble>>
>   % <<latex-introduction>
> 	...
>   \end{document}
> #+end_src
>
> #+srcname: beamer-document
> #+begin_src latex :tangle adz_beamer.tex :exports none
>   % <<beamer-preamble>>
>   % <<beamer-introduction>>
> 	...
>   \end{document}
> #+end_src
>
> Calling org-babel-tangle gives me adz_print.tex for my article and  
> adz_beamer.tex for my beamer presentation.
>
> There are probably other ways to achieve this (org-mode, you know)  
> that might be simpler.
>
> The text I write outside the source blocks tracks what I hope to  
> achieve, decisions I've made, etc. and uses the export facilities of  
> org-mode to create a user manual for my employees.  Right now I'm  
> targeting html for the user manual, but LaTeX export would also work.
>
> HTH,
> Tom
>
>
>
> Thomas S. Dye, Ph.D.
> T. S. Dye & Colleagues, Archaeologists, Inc.
> Phone: (808) 529-0866 Fax: (808) 529-0884
> http://www.tsdye.com
>
>
> On Oct 22, 2009, at 11:20 AM, JBash wrote:
>
>> Hi,
>>
>> A question about exporting:
>>
>> Is it possible to export two different subtrees in the same file to  
>> a different class?  There are cases where it would be nice to be  
>> able to generate a document (say an article) from a single subtree  
>> in a file, and have other subtrees that contain short presentations  
>> that could be exported quickly to beamer, for example.  Currently,  
>> the exporter seems to find the first #+LaTeX_CLASS in the file and  
>> use that for the entire file export, as well as exporting any  
>> subtree in the file, even if you define a separate LaTeX_CLASS  
>> under a specific subtree.  I have looked into using export OPTIONS  
>> in subtrees for this, but have not hit on the right combination.   
>> Is this possible?
>>
>> Thanks,
>> Jerry
>> _______________________________________________
>> Emacs-orgmode mailing list
>> Remember: use `Reply All' to send replies to the list.
>> Emacs-orgmode@gnu.org
>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>
>


[-- Attachment #1.2: Type: text/html, Size: 11484 bytes --]

[-- Attachment #2: Type: text/plain, Size: 204 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: [babel]Subtree exporting to different LaTeX_CLASS
  2009-10-23 16:30   ` Thomas S. Dye
@ 2009-10-23 17:52     ` Thomas S. Dye
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas S. Dye @ 2009-10-23 17:52 UTC (permalink / raw)
  To: JBash; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 359 bytes --]

Jerry,

I forgot to mention a setup step.  You'll need this in .emacs to  
register LaTeX as a source language in org-babel.

(org-babel-add-interpreter "latex")
(add-to-list 'org-babel-tangle-langs '("latex" "tex"))

HTH,
Tom

Thomas S. Dye, Ph.D.
T. S. Dye & Colleagues, Archaeologists, Inc.
Phone: (808) 529-0866 Fax: (808) 529-0884
http://www.tsdye.com



[-- Attachment #1.2: Type: text/html, Size: 2800 bytes --]

[-- Attachment #2: Type: text/plain, Size: 204 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

end of thread, other threads:[~2009-10-23 17:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-22 22:13 [babel]Subtree exporting to different LaTeX_CLASS Thomas S. Dye
     [not found] ` <407c66ac0910230548n366dd96bn931a81ea1dabffee@mail.gmail.com>
2009-10-23 16:30   ` Thomas S. Dye
2009-10-23 17:52     ` Thomas S. Dye

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