emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* LP weaving: org mode vs noweb
@ 2018-04-10 14:39 Christian Lynbech
  2018-04-10 19:12 ` Diego Zamboni
  0 siblings, 1 reply; 2+ messages in thread
From: Christian Lynbech @ 2018-04-10 14:39 UTC (permalink / raw)
  To: Org-mode

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

I am wondering if anybody has looked into making org mode weaving (eg.
pdf export) of literate style prorgrams to look more like the output
from the noweb literate programming tool?

I have attached two small examples of each style (org-code.pdf shows
what you get from org export, nw-code.pdf how the same snippet could
look with noweb).

Obviously there are many ways to tweak the output in each case, my
main interest is getting the label on each chunk. In the org mode
export, the `configuration' chunk may have a name but it is not printed
alongside the chunk itself as noweb does it. I have seen examples where
this information is added explicitly in the org file but I find that a
rather cumbersome way of getting something that noweb provides for free.

Is there an easy way to get something like this in org mode?

------------------------+-----------------------------------------------------
Christian Lynbech       | christian #\@ defun #\. dk
------------------------+-----------------------------------------------------
Hit the philistines three times over the head with the Elisp reference manual.
                                        - petonic@hal.com (Michael A. Petonic)



[-- Attachment #2: org-code.pdf --]
[-- Type: application/pdf, Size: 68987 bytes --]

[-- Attachment #3: nw-code.pdf --]
[-- Type: application/pdf, Size: 65485 bytes --]

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

* Re: LP weaving: org mode vs noweb
  2018-04-10 14:39 LP weaving: org mode vs noweb Christian Lynbech
@ 2018-04-10 19:12 ` Diego Zamboni
  0 siblings, 0 replies; 2+ messages in thread
From: Diego Zamboni @ 2018-04-10 19:12 UTC (permalink / raw)
  To: Christian Lynbech; +Cc: Diego Zamboni, Org-mode

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

Hi Christian,

I found here that the output template for code segments can be customized: https://stackoverflow.com/questions/40033843/show-the-name-of-a-code-block-in-org-mode-when-export <https://stackoverflow.com/questions/40033843/show-the-name-of-a-code-block-in-org-mode-when-export>

After some experimentation I came up with the following snippet:

(setq org-babel-exp-code-template
      (concat "\n\\langle /%name/ \\rangle\\equiv\n"
              org-babel-exp-code-template))

(BTW the entity names can be found by running M-x org-entities-help)

Which results in the attached output from a simple code sample. It’s not perfect yet (e.g. the indentation of the labels is wrong, and there’s an extras space between the brackets and label), but I’m sure these can be fixed with some more tweaking.

Hope this helps,
—Diego



> On 10 Apr 2018, at 16:39, Christian Lynbech <christian@defun.dk> wrote:
> 
> I am wondering if anybody has looked into making org mode weaving (eg.
> pdf export) of literate style prorgrams to look more like the output
> from the noweb literate programming tool?
> 
> I have attached two small examples of each style (org-code.pdf shows
> what you get from org export, nw-code.pdf how the same snippet could
> look with noweb).
> 
> Obviously there are many ways to tweak the output in each case, my
> main interest is getting the label on each chunk. In the org mode
> export, the `configuration' chunk may have a name but it is not printed
> alongside the chunk itself as noweb does it. I have seen examples where
> this information is added explicitly in the org file but I find that a
> rather cumbersome way of getting something that noweb provides for free.
> 
> Is there an easy way to get something like this in org mode?
> 
> ------------------------+-----------------------------------------------------
> Christian Lynbech       | christian #\@ defun #\. dk
> ------------------------+-----------------------------------------------------
> Hit the philistines three times over the head with the Elisp reference manual.
>                                        - petonic@hal.com (Michael A. Petonic)
> 
> 
> <org-code.pdf><nw-code.pdf>


[-- Attachment #2.1: Type: text/html, Size: 1555 bytes --]

[-- Attachment #2.2: test.pdf --]
[-- Type: application/pdf, Size: 76293 bytes --]

[-- Attachment #2.3: Type: text/html, Size: 2474 bytes --]

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

end of thread, other threads:[~2018-04-10 19:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-10 14:39 LP weaving: org mode vs noweb Christian Lynbech
2018-04-10 19:12 ` Diego Zamboni

Code repositories for project(s) associated with this 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).