emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Aaron Ecay <aaronecay@gmail.com>
To: Nicolas Goaziou <mail@nicolasgoaziou.fr>,
	"Charles C. Berry" <ccberry@ucsd.edu>
Cc: mcg <giepen.m@googlemail.com>,
	Andreas Leha <andreas.leha@med.uni-goettingen.de>,
	emacs-orgmode@gnu.org, Ista Zahn <istazahn@gmail.com>
Subject: Re: New patches WAS Re: [PATCH] inline src block results can be removed
Date: Sun, 18 Jan 2015 14:13:01 -0500	[thread overview]
Message-ID: <87k30jj41u.fsf@gmail.com> (raw)
In-Reply-To: <87wq4lqcbh.fsf@nicolasgoaziou.fr>

Hi Nicolas,

2015ko urtarrilak 17an, Nicolas Goaziou-ek idatzi zuen:
> It would be more flexible, but it would also defeat the whole point of
> the "results" macro, that is to be able to mark /unambiguously/ the
> output of an inline block. Indeed, even if you can get the name of the
> macro from the parameter, you cannot be sure the macro was generated by
> the code block, unlike to a results macro.

Well, you could examine the code block’s :wrap header arg to determine
what kind of macro it generates, rather than hardcoding “results.”
(This would break when :wrap’s value was changed, though).

Probably a better solution is that the results macro could wrap the
custom macro:

{{{results({{{mymacro(foo)}}})}}}

> 
> Also, I don't think we really need this flexibility since any twist to
> the output can be made at the Babel level, or even using
> `org-babel-inline-result-wrap'.

o-b-inline-result-wrap can’t be specified on a per-block basis like
header args can.  And doing it within babel would lead to extra
verbosity.  As an example use case, I sometimes write things like:

src_R{round(100*78/7065,2)}

What I’m really interested in is the value 100*78/7065,¹ but I don’t want
it spilling its many decimal places into the exported document (I don’t
particularly mind them in the org file).  I think the following would be a
better way of writing things like this, since it separates the presentation
(round to two decimal places) from the content (100*78/7065):

src_R[:wrap round2]{100*78/7065}

I would write a round2 macro to arrange the rounding.  (round2 and
round0/truncate would probably cover 90+% of my use of inline R
blocks).  For latex, this would use one of the packages like siunitx
or pgfplots which offer number formatting (including other fancy
options like scientific notation for large numbers).  For other
backends, I’d probably use an eval-type macro to do the rounding in
elisp.

¹ This is just a particularly simple example; often the value is not
just the result of some arithmetic, but rather a coefficient extracted
from a statistical model by a series of function calls etc.

Thanks,

-- 
Aaron Ecay

  reply	other threads:[~2015-01-18 19:13 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-12  0:49 [PATCH] inline src block results can be removed Charles C. Berry
2014-11-12  1:10 ` Andreas Leha
2014-11-12  6:58   ` Charles C. Berry
2014-11-12 19:34 ` Aaron Ecay
2014-11-12 23:47   ` Charles C. Berry
2014-11-13 17:48     ` Nicolas Goaziou
2014-11-13 19:06       ` Andreas Leha
2014-11-14 17:43       ` Charles C. Berry
2014-11-14 20:39         ` Nicolas Goaziou
2014-11-14 23:04           ` Aaron Ecay
2014-11-16  0:10             ` Nicolas Goaziou
2014-11-15 20:22           ` Charles C. Berry
2014-11-16 23:23             ` Nicolas Goaziou
2014-11-24  9:48               ` Daniele Pizzolli
2014-11-24 10:18                 ` Andreas Leha
2015-01-13  0:48               ` New patches WAS " Charles C. Berry
2015-01-16 22:41                 ` Nicolas Goaziou
2015-01-19  3:22                   ` Charles C. Berry
2015-01-19 17:53                     ` Nicolas Goaziou
2015-01-19 19:31                       ` Charles C. Berry
2015-01-20 23:30                         ` Nicolas Goaziou
2015-01-22  3:07                           ` Charles C. Berry
2015-01-22 23:08                             ` Nicolas Goaziou
2015-01-24 22:47                               ` Charles C. Berry
2015-01-25  1:14                                 ` Aaron Ecay
2015-01-25  5:01                                   ` Charles C. Berry
2015-01-29 20:31                               ` Charles C. Berry
2015-01-17  3:22                 ` Aaron Ecay
2015-01-17 22:20                   ` Nicolas Goaziou
2015-01-18 19:13                     ` Aaron Ecay [this message]
2015-01-18 22:34                       ` Nicolas Goaziou
2015-01-18 22:55                         ` Aaron Ecay

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=87k30jj41u.fsf@gmail.com \
    --to=aaronecay@gmail.com \
    --cc=andreas.leha@med.uni-goettingen.de \
    --cc=ccberry@ucsd.edu \
    --cc=emacs-orgmode@gnu.org \
    --cc=giepen.m@googlemail.com \
    --cc=istazahn@gmail.com \
    --cc=mail@nicolasgoaziou.fr \
    /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).