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

After some experimentation I came up with the following snippet:

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

(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,

Attachment: test.pdf
Description: Adobe PDF document

On 10 Apr 2018, at 16:39, Christian Lynbech <christ...@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.
                                       - peto...@hal.com (Michael A. Petonic)


Reply via email to