emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [babel] language support
@ 2009-10-17 17:44 Thomas S. Dye
  2009-10-17 18:41 ` Eric Schulte
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas S. Dye @ 2009-10-17 17:44 UTC (permalink / raw)
  To: emacs-orgmode


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

Aloha all,

Is it possible (or would it be useful) to leverage the literate  
programming facilities of org-babel to write LaTeX code?

I'd like to weave a document that describes how some thesis/idea/story  
can be developed/elaborated/told and then tangle an instance of  
'developed thesis'/'elaborated idea'/'told story' that LaTeX can make  
presentable.  The motivation for this is a desire to have one source  
document that will tangle 1) a slide presentation via beamer, and 2) a  
print document for publication.  The two share a common organization/ 
structure/plot but there are radically different presentation mode  
constraints.

Org-mode is a terrific tool for organizing, structuring, and  
plotting.  Org-babel seems to be a likely candidate for abstracting  
the different presentation modes.

Here is some pseudo-code for illustration:

* Idea 1
#+srcname: beamer-idea-1
#+begin_src latex :exports none
\begin{itemize}
	\item first concept
	\item second concept
\end{itemize}
#+end_src
#+srcname: latex-idea-1
#+begin_src latex :exports none
The first concept was developed by \citet{author1}.  It later became  
the basis for the second concept \citep{author2}. ...
#+end_src

#+srcname: beamer-presentation
#+begin_src latex :tangle beamer-thesis :exports none
# <<beamer-idea-1>>
# <<beamer-idea-2>>
...
#+end_src
#+srcname: latex-presentation
#+begin_src latex :tangle latex-thesis :exports none
# <<latex-idea-1>>
# <<latex-idea-2>>
...
#+end_src
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: 8268 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] language support
  2009-10-17 17:44 [babel] language support Thomas S. Dye
@ 2009-10-17 18:41 ` Eric Schulte
  2009-10-17 19:52   ` Thomas S. Dye
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Schulte @ 2009-10-17 18:41 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: emacs-orgmode

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

Hi Tom,

I certainly believe what you describe should be possible, although it
pains me to imagine embedding pure latex code in an Org-mode document
and losing the ability to use the org latex export helpers :), but I
digress.

Org-babel needs to be told to recognize latex source code blocks and how
they should be tangled, which can be accomplished with the following

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

Once that is done `org-babel-tangle' should do the trick.

for example, after evaluating the above I was able to tangle the
following .org file into the following .tex file.


[-- Attachment #2: babel-latex.org --]
[-- Type: application/octet-stream, Size: 525 bytes --]

#+TITLE: babel-tangling
#+OPTIONS: num:nil ^:nil
#+LaTeX_CLASS: normal

* top level

** and some more

#+srcname: latex-idea-1
#+begin_src latex :tangle none
        \item first concept

        \item second concept
#+end_src

#+srcname: latex-idea-2
#+begin_src latex :tangle none
  The first concept was developed by \citet{author1}.  It later became
  the basis for the second concept \citep{author2}. ...
#+end_src

#+begin_src latex :tangle latex-thesis :exports none
  % <<latex-idea-1>>
  % <<latex-idea-2>>
#+end_src

[-- Attachment #3: latex-thesis.tex --]
[-- Type: application/x-tex, Size: 330 bytes --]

[-- Attachment #4: Type: text/plain, Size: 2046 bytes --]



Hope this suits your needs.  Cheers -- Eric

"Thomas S. Dye" <tsd@tsdye.com> writes:

> Aloha all,
>
> Is it possible (or would it be useful) to leverage the literate programming facilities of org-babel to
> write LaTeX code?  
>
> I'd like to weave a document that describes how some thesis/idea/story can be developed/elaborated/told
> and then tangle an instance of 'developed thesis'/'elaborated idea'/'told story' that LaTeX can make
> presentable.  The motivation for this is a desire to have one source document that will tangle 1) a slide
> presentation via beamer, and 2) a print document for publication.  The two share a common organization/
> structure/plot but there are radically different presentation mode constraints.
>
> Org-mode is a terrific tool for organizing, structuring, and plotting.  Org-babel seems to be a likely
> candidate for abstracting the different presentation modes.
>
> Here is some pseudo-code for illustration:
>
> * Idea 1
>
> #+srcname: beamer-idea-1
>
> #+begin_src latex :exports none
>
> \begin{itemize}
>
>         \item first concept
>
>         \item second concept
>
> \end{itemize}
>
> #+end_src
>
> #+srcname: latex-idea-1
>
> #+begin_src latex :exports none
>
> The first concept was developed by \citet{author1}.  It later became the basis for the second concept \citep{author2}. ...
>
> #+end_src
>
> #+srcname: beamer-presentation
>
> #+begin_src latex :tangle beamer-thesis :exports none
>
> # <<beamer-idea-1>>
>
> # <<beamer-idea-2>>
>
> ... 
>
> #+end_src
>
> #+srcname: latex-presentation
>
> #+begin_src latex :tangle latex-thesis :exports none
>
> # <<latex-idea-1>>
>
> # <<latex-idea-2>>
>
> ... 
>
> #+end_src
>
> Tom
>
> Thomas S. Dye, Ph.D.
>
> T. S. Dye & Colleagues, Archaeologists, Inc.
>
> Phone: (808) 529-0866 Fax: (808) 529-0884
>
> http://www.tsdye.com
>
> _______________________________________________
> 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 #5: 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] language support
  2009-10-17 18:41 ` Eric Schulte
@ 2009-10-17 19:52   ` Thomas S. Dye
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas S. Dye @ 2009-10-17 19:52 UTC (permalink / raw)
  To: emacs-orgmode


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

Hi Eric,

Wonderful!  I look forward to using this new tool.  Thank you.

If it eases your pain :), I don't plan to ignore the org latex export  
helpers.  I'd like to produce a "reproducible research" document (as  
LaTeX/pdf and/or html) that includes descriptions of data collection,  
analysis, results, *and* presentation (as both conference paper and  
publication).  Given my current toolbox, the document might contain  
source code chunks in SQL, R, Python, and LaTeX.  The latex export  
helpers (and html export helpers) will have a role in producing the  
"reproducible research" document, which can have a relatively simple  
structure, but the helpers won't be called on to abstract the full  
complexity of LaTeX (or at least that large portion required to  
achieve some particular publication standard).

At this point, I don't fully comprehend the possible paths to this  
end, especially in comparison to the capabilities of others on this  
list, and comments or suggestions are most welcome.

All the best,
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 17, 2009, at 8:41 AM, Eric Schulte wrote:

> Hi Tom,
>
> I certainly believe what you describe should be possible, although it
> pains me to imagine embedding pure latex code in an Org-mode document
> and losing the ability to use the org latex export helpers :), but I
> digress.
>
> Org-babel needs to be told to recognize latex source code blocks and  
> how
> they should be tangled, which can be accomplished with the following
>
> (org-babel-add-interpreter "latex")
> (add-to-list 'org-babel-tangle-langs '("latex" "tex"))
>
> Once that is done `org-babel-tangle' should do the trick.
>
> for example, after evaluating the above I was able to tangle the
> following .org file into the following .tex file.
>
> <babel-latex.org><latex-thesis.tex>
>
> Hope this suits your needs.  Cheers -- Eric
>
> "Thomas S. Dye" <tsd@tsdye.com> writes:
>
>> Aloha all,
>>
>> Is it possible (or would it be useful) to leverage the literate  
>> programming facilities of org-babel to
>> write LaTeX code?
>>
>> I'd like to weave a document that describes how some thesis/idea/ 
>> story can be developed/elaborated/told
>> and then tangle an instance of 'developed thesis'/'elaborated  
>> idea'/'told story' that LaTeX can make
>> presentable.  The motivation for this is a desire to have one  
>> source document that will tangle 1) a slide
>> presentation via beamer, and 2) a print document for publication.   
>> The two share a common organization/
>> structure/plot but there are radically different presentation mode  
>> constraints.
>>
>> Org-mode is a terrific tool for organizing, structuring, and  
>> plotting.  Org-babel seems to be a likely
>> candidate for abstracting the different presentation modes.
>>
>> Here is some pseudo-code for illustration:
>>
>> * Idea 1
>>
>> #+srcname: beamer-idea-1
>>
>> #+begin_src latex :exports none
>>
>> \begin{itemize}
>>
>>        \item first concept
>>
>>        \item second concept
>>
>> \end{itemize}
>>
>> #+end_src
>>
>> #+srcname: latex-idea-1
>>
>> #+begin_src latex :exports none
>>
>> The first concept was developed by \citet{author1}.  It later  
>> became the basis for the second concept \citep{author2}. ...
>>
>> #+end_src
>>
>> #+srcname: beamer-presentation
>>
>> #+begin_src latex :tangle beamer-thesis :exports none
>>
>> # <<beamer-idea-1>>
>>
>> # <<beamer-idea-2>>
>>
>> ...
>>
>> #+end_src
>>
>> #+srcname: latex-presentation
>>
>> #+begin_src latex :tangle latex-thesis :exports none
>>
>> # <<latex-idea-1>>
>>
>> # <<latex-idea-2>>
>>
>> ...
>>
>> #+end_src
>>
>> Tom
>>
>> Thomas S. Dye, Ph.D.
>>
>> T. S. Dye & Colleagues, Archaeologists, Inc.
>>
>> Phone: (808) 529-0866 Fax: (808) 529-0884
>>
>> http://www.tsdye.com
>>
>> _______________________________________________
>> 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: 10516 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-17 19:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-17 17:44 [babel] language support Thomas S. Dye
2009-10-17 18:41 ` Eric Schulte
2009-10-17 19: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).