emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Diego Zamboni <diego@zzamboni.org>
To: Christian Lynbech <christian@defun.dk>
Cc: Diego Zamboni <diego@zzamboni.org>, Org-mode <emacs-orgmode@gnu.org>
Subject: Re: LP weaving: org mode vs noweb
Date: Tue, 10 Apr 2018 21:12:06 +0200	[thread overview]
Message-ID: <005208DC-A5E6-4C8A-8E49-45B039E4D4ED@zzamboni.org> (raw)
In-Reply-To: <m2604zqg6s.fsf@defun.dk>

[-- 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 --]

      reply	other threads:[~2018-04-10 19:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-10 14:39 LP weaving: org mode vs noweb Christian Lynbech
2018-04-10 19:12 ` Diego Zamboni [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=005208DC-A5E6-4C8A-8E49-45B039E4D4ED@zzamboni.org \
    --to=diego@zzamboni.org \
    --cc=christian@defun.dk \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).