emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Using noweb with org-mode source
@ 2011-01-05 17:59 Phil Branigan
  2011-01-05 19:58 ` suvayu ali
  2011-01-05 20:17 ` Christian Moe
  0 siblings, 2 replies; 6+ messages in thread
From: Phil Branigan @ 2011-01-05 17:59 UTC (permalink / raw)
  To: emacs-orgmode


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

In making up lecture and teaching materials, I would find it useful to be
able to use noweb references to replicate blocks of org-mode text directly,
rather than source code from latex or another language.  But org-mode isn't
one of the babel-supported languages.  Can anyone suggest a tricky way to
achieve this result?

What I have in mind is something like the following:

* One section, exported to a particular document

#+srcname: primates
#+begin_src org-mode
  - chimps :: strong, smart and savage
  - bonobos :: less savage, sexy, smart
  - orangutans :: kinda asocial, with big arms
  - gorillas :: really strong, but shy
#+end_src

Lots of text here.

* Another section, exported to a different document

Let's review what we know about the primate group.

<<primates>>


-- 
Phil Branigan

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

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

_______________________________________________
Emacs-orgmode mailing list
Please 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] 6+ messages in thread

* Re: Using noweb with org-mode source
  2011-01-05 17:59 Using noweb with org-mode source Phil Branigan
@ 2011-01-05 19:58 ` suvayu ali
  2011-01-05 20:17 ` Christian Moe
  1 sibling, 0 replies; 6+ messages in thread
From: suvayu ali @ 2011-01-05 19:58 UTC (permalink / raw)
  To: Phil Branigan; +Cc: emacs-orgmode

Hi Phil,

On Wed, Jan 5, 2011 at 9:59 AM, Phil Branigan <branigan@mun.ca> wrote:
> In making up lecture and teaching materials, I would find it useful to be
> able to use noweb references to replicate blocks of org-mode text directly,
> rather than source code from latex or another language.  But org-mode isn't
> one of the babel-supported languages.  Can anyone suggest a tricky way to
> achieve this result?

Does this help? http://orgmode.org/manual/Include-files.html#Include-files

-- 
Suvayu

Open source is the future. It sets us free.

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

* Re: Using noweb with org-mode source
  2011-01-05 17:59 Using noweb with org-mode source Phil Branigan
  2011-01-05 19:58 ` suvayu ali
@ 2011-01-05 20:17 ` Christian Moe
  2011-01-06  0:08   ` Phil Branigan
  2011-01-06  6:24   ` Eric Schulte
  1 sibling, 2 replies; 6+ messages in thread
From: Christian Moe @ 2011-01-05 20:17 UTC (permalink / raw)
  To: Phil Branigan; +Cc: emacs-orgmode

Hi,

This should get you part of the way: Use `org' as the language name, 
not `org-mode'. Enclose the noweb reference in another src block with 
noweb explicitly turned on. Reworked example follows.

I can't seem to get rid of the code block around it, though, however I 
play with the header arguments.

Yours,
Christian


* One section, exported to a particular document

#+srcname: primates
#+begin_src org
   ,- chimps :: strong, smart and savage
   ,- bonobos :: less savage, sexy, smart
   ,- orangutans :: kinda asocial, with big arms
   ,- gorillas :: really strong, but shy
#+end_src

Lots of text here.

* Another section, exported to a different document

Let's review what we know about the primate group.

#+begin_src org :noweb yes
<<primates>>
#+end_src

On 1/5/11 6:59 PM, Phil Branigan wrote:
> In making up lecture and teaching materials, I would find it useful to
> be able to use noweb references to replicate blocks of org-mode text
> directly, rather than source code from latex or another language.  But
> org-mode isn't one of the babel-supported languages.  Can anyone
> suggest a tricky way to achieve this result?
>
> What I have in mind is something like the following:
>
> * One section, exported to a particular document
>
> #+srcname: primates
> #+begin_src org-mode
>    - chimps :: strong, smart and savage
>    - bonobos :: less savage, sexy, smart
>    - orangutans :: kinda asocial, with big arms
>    - gorillas :: really strong, but shy
> #+end_src
>
> Lots of text here.
>
> * Another section, exported to a different document
>
> Let's review what we know about the primate group.
>
> <<primates>>
>
>
> --
> Phil Branigan
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please 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] 6+ messages in thread

* Re: Using noweb with org-mode source
  2011-01-05 20:17 ` Christian Moe
@ 2011-01-06  0:08   ` Phil Branigan
  2011-01-06  6:24   ` Eric Schulte
  1 sibling, 0 replies; 6+ messages in thread
From: Phil Branigan @ 2011-01-06  0:08 UTC (permalink / raw)
  To: emacs-orgmode


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

Thanks, Suvaya and Christian,  Unfortunately, neither of these two
suggestions really does what I had hoped.  Using INCLUDE files will
certainly allow me to reuse my text and export to different documents, but
at the cost of cluttering up my directories with a bunch of files which have
no other purpose.  And the syntax proposed by Christian produces verbatim
copies of the org-mode source, instead of allowing me to export the same
text at different points in the document.

I can achieve what I want already to some extent by using org-tables and the
like to generate latex code in a src block.  But this obviously doesn't
offer a general export solution to other formats, and it's a clunky way of
working.  It may be that the noweb syntax can't accomodate the kind of
src-export-reuse that I'm looking for.

- Phil Branigan

On Wed, Jan 5, 2011 at 4:47 PM, Christian Moe <mail@christianmoe.com> wrote:

> Hi,
>
> This should get you part of the way: Use `org' as the language name, not
> `org-mode'. Enclose the noweb reference in another src block with noweb
> explicitly turned on. Reworked example follows.
>
> I can't seem to get rid of the code block around it, though, however I play
> with the header arguments.
>
> Yours,
> Christian
>
>
>
> * One section, exported to a particular document
>
> #+srcname: primates
> #+begin_src org
>  ,- chimps :: strong, smart and savage
>
>  ,- bonobos :: less savage, sexy, smart
>  ,- orangutans :: kinda asocial, with big arms
>  ,- gorillas :: really strong, but shy
> #+end_src
>
> Lots of text here.
>
> * Another section, exported to a different document
>
> Let's review what we know about the primate group.
>
> #+begin_src org :noweb yes
> <<primates>>
> #+end_src
>
>
> On 1/5/11 6:59 PM, Phil Branigan wrote:
>
>> In making up lecture and teaching materials, I would find it useful to
>> be able to use noweb references to replicate blocks of org-mode text
>> directly, rather than source code from latex or another language.  But
>> org-mode isn't one of the babel-supported languages.  Can anyone
>> suggest a tricky way to achieve this result?
>>
>> What I have in mind is something like the following:
>>
>> * One section, exported to a particular document
>>
>> #+srcname: primates
>> #+begin_src org-mode
>>   - chimps :: strong, smart and savage
>>   - bonobos :: less savage, sexy, smart
>>   - orangutans :: kinda asocial, with big arms
>>   - gorillas :: really strong, but shy
>> #+end_src
>>
>> Lots of text here.
>>
>> * Another section, exported to a different document
>>
>> Let's review what we know about the primate group.
>>
>> <<primates>>
>>
>>
>> --
>> Phil Branigan
>>
>>
>>
>> _______________________________________________
>> Emacs-orgmode mailing list
>> Please use `Reply All' to send replies to the list.
>> Emacs-orgmode@gnu.org
>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>>
>
>


-- 
Phil Branigan
--------------------
Associate Professor
Department of Linguistics
Memorial University of Newfoundland
St. John's, NL,  A1B 3X9
Tel. (709) 737-8134
Fax (709) 737-4000

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

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

_______________________________________________
Emacs-orgmode mailing list
Please 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] 6+ messages in thread

* Re: Using noweb with org-mode source
  2011-01-05 20:17 ` Christian Moe
  2011-01-06  0:08   ` Phil Branigan
@ 2011-01-06  6:24   ` Eric Schulte
  2011-01-06  7:59     ` Christian Moe
  1 sibling, 1 reply; 6+ messages in thread
From: Eric Schulte @ 2011-01-06  6:24 UTC (permalink / raw)
  To: mail; +Cc: emacs-orgmode, Phil Branigan

Hi Christian,

The following should remove the enclosing begin_src org blocks, and
results in the org-mode exporting normally, rather than verbatim.
Notice the :results header arguments on the last code block, such header
arguments can be set on a file-wide basis to reduce code clutter.

Best -- Eric

* One section, exported to a particular document

#+srcname: primates
#+begin_src org
   ,- chimps :: strong, smart and savage
   ,- bonobos :: less savage, sexy, smart
   ,- orangutans :: kinda asocial, with big arms
   ,- gorillas :: really strong, but shy
#+end_src

Lots of text here.

* Another section, exported to a different document

Let's review what we know about the primate group.

#+begin_src org :noweb yes :results replace raw
<<primates>>
#+end_src


Christian Moe <mail@christianmoe.com> writes:

> Hi,
>
> This should get you part of the way: Use `org' as the language name, 
> not `org-mode'. Enclose the noweb reference in another src block with 
> noweb explicitly turned on. Reworked example follows.
>
> I can't seem to get rid of the code block around it, though, however I 
> play with the header arguments.
>
> Yours,
> Christian
>
>
> * One section, exported to a particular document
>
> #+srcname: primates
> #+begin_src org
>    ,- chimps :: strong, smart and savage
>    ,- bonobos :: less savage, sexy, smart
>    ,- orangutans :: kinda asocial, with big arms
>    ,- gorillas :: really strong, but shy
> #+end_src
>
> Lots of text here.
>
> * Another section, exported to a different document
>
> Let's review what we know about the primate group.
>
> #+begin_src org :noweb yes
> <<primates>>
> #+end_src
>
> On 1/5/11 6:59 PM, Phil Branigan wrote:
>> In making up lecture and teaching materials, I would find it useful to
>> be able to use noweb references to replicate blocks of org-mode text
>> directly, rather than source code from latex or another language.  But
>> org-mode isn't one of the babel-supported languages.  Can anyone
>> suggest a tricky way to achieve this result?
>>
>> What I have in mind is something like the following:
>>
>> * One section, exported to a particular document
>>
>> #+srcname: primates
>> #+begin_src org-mode
>>    - chimps :: strong, smart and savage
>>    - bonobos :: less savage, sexy, smart
>>    - orangutans :: kinda asocial, with big arms
>>    - gorillas :: really strong, but shy
>> #+end_src
>>
>> Lots of text here.
>>
>> * Another section, exported to a different document
>>
>> Let's review what we know about the primate group.
>>
>> <<primates>>
>>
>>
>> --
>> Phil Branigan
>>
>>
>>
>> _______________________________________________
>> Emacs-orgmode mailing list
>> Please use `Reply All' to send replies to the list.
>> Emacs-orgmode@gnu.org
>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please 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] 6+ messages in thread

* Re: Using noweb with org-mode source
  2011-01-06  6:24   ` Eric Schulte
@ 2011-01-06  7:59     ` Christian Moe
  0 siblings, 0 replies; 6+ messages in thread
From: Christian Moe @ 2011-01-06  7:59 UTC (permalink / raw)
  To: Eric Schulte; +Cc: emacs-orgmode, Phil Branigan

Hi, Eric,

Thanks, it's working now. I had tried ":results raw" before, and 
perhaps "replace" too. I had dropped them again, because it still 
didn't work. Why not was forehead-slappingly obvious after a good 
night's sleep...

Hi, Phil,

In addition to what Eric writes below (":results replace raw"), you 
also need to *activate Org as a Babel language.* In your .emacs, you 
need something like

(org-babel-do-load-languages
  'org-babel-load-languages
  '((org . t)))

-- with any other languages you need in the same list.

Now it should do exactly what you want.

Yours,
Christian


On 1/6/11 7:24 AM, Eric Schulte wrote:
> Hi Christian,
>
> The following should remove the enclosing begin_src org blocks, and
> results in the org-mode exporting normally, rather than verbatim.
> Notice the :results header arguments on the last code block, such header
> arguments can be set on a file-wide basis to reduce code clutter.
>
> Best -- Eric
>
> * One section, exported to a particular document
>
> #+srcname: primates
> #+begin_src org
>     ,- chimps :: strong, smart and savage
>     ,- bonobos :: less savage, sexy, smart
>     ,- orangutans :: kinda asocial, with big arms
>     ,- gorillas :: really strong, but shy
> #+end_src
>
> Lots of text here.
>
> * Another section, exported to a different document
>
> Let's review what we know about the primate group.
>
> #+begin_src org :noweb yes :results replace raw
> <<primates>>
> #+end_src
>
>
> Christian Moe<mail@christianmoe.com>  writes:
>
>> Hi,
>>
>> This should get you part of the way: Use `org' as the language name,
>> not `org-mode'. Enclose the noweb reference in another src block with
>> noweb explicitly turned on. Reworked example follows.
>>
>> I can't seem to get rid of the code block around it, though, however I
>> play with the header arguments.
>>
>> Yours,
>> Christian
>>
>>
>> * One section, exported to a particular document
>>
>> #+srcname: primates
>> #+begin_src org
>>     ,- chimps :: strong, smart and savage
>>     ,- bonobos :: less savage, sexy, smart
>>     ,- orangutans :: kinda asocial, with big arms
>>     ,- gorillas :: really strong, but shy
>> #+end_src
>>
>> Lots of text here.
>>
>> * Another section, exported to a different document
>>
>> Let's review what we know about the primate group.
>>
>> #+begin_src org :noweb yes
>> <<primates>>
>> #+end_src
>>
>> On 1/5/11 6:59 PM, Phil Branigan wrote:
>>> In making up lecture and teaching materials, I would find it useful to
>>> be able to use noweb references to replicate blocks of org-mode text
>>> directly, rather than source code from latex or another language.  But
>>> org-mode isn't one of the babel-supported languages.  Can anyone
>>> suggest a tricky way to achieve this result?
>>>
>>> What I have in mind is something like the following:
>>>
>>> * One section, exported to a particular document
>>>
>>> #+srcname: primates
>>> #+begin_src org-mode
>>>     - chimps :: strong, smart and savage
>>>     - bonobos :: less savage, sexy, smart
>>>     - orangutans :: kinda asocial, with big arms
>>>     - gorillas :: really strong, but shy
>>> #+end_src
>>>
>>> Lots of text here.
>>>
>>> * Another section, exported to a different document
>>>
>>> Let's review what we know about the primate group.
>>>
>>> <<primates>>
>>>
>>>
>>> --
>>> Phil Branigan
>>>
>>>
>>>
>>> _______________________________________________
>>> Emacs-orgmode mailing list
>>> Please use `Reply All' to send replies to the list.
>>> Emacs-orgmode@gnu.org
>>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>>
>>
>> _______________________________________________
>> Emacs-orgmode mailing list
>> Please 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] 6+ messages in thread

end of thread, other threads:[~2011-01-06  7:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-05 17:59 Using noweb with org-mode source Phil Branigan
2011-01-05 19:58 ` suvayu ali
2011-01-05 20:17 ` Christian Moe
2011-01-06  0:08   ` Phil Branigan
2011-01-06  6:24   ` Eric Schulte
2011-01-06  7:59     ` Christian Moe

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