emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Suvayu Ali <fatkasuvayu+linux@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: Best practices for literate programming [was: Latex export of tables]
Date: Wed, 17 Apr 2013 08:39:30 +0200	[thread overview]
Message-ID: <20130417063930.GA14455@kuru.dyndns-at-home.com> (raw)
In-Reply-To: <20130416221022.GA7809@panahar>

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

Hi Vikas,

On Wed, Apr 17, 2013 at 03:40:22AM +0530, Vikas Rawal wrote:
> 
> > At one point I realised the problem and made the decision to
> > split things into two kinds of files: static content (document
> > structuring, text, plots, etc), and dynamic content (babel, TikZ blocks
> > that generate tables, plots, figures, etc used by the static content
> > files).  It is still reproducible research, but modular and less hacky
> > (hence more stable).
> 
> This is indeed a very neat approach. Would you kindly elaborate?
> 
> Would it be too much work for you to get some illustrations from your
> work?

Well ... it was couple of years back, the Org version was quite
different, e.g. babel was rapidly evolving.  It might be a fair bit of
work to get it working again.  That said, last year I gave a talk in an
internal workshop, I made the plots with the attached file.  I didn't
spend time to make sure everything is pretty, so the legend and titles
might be a little wonky.  Just evaluating the two main source blocks
should give you two plots in pdf files.

> In your scheme of things, how do you finally combine the static and
> the dynamic content?
> 
> Any chance that you could release the source of something like a
> chapter of your thesis for people to see? Or may be create something
> with dummy content?

The idea is to keep the dynamic content on separate org files which you
export less frequently during the course of your writing, e.g. any
tables that are inputs for source blocks.  Evaluating these blocks, or
exporting these dynamic files (whichever is your preference) generates
the graphic which is then used in the static file.  This is not limited
to plots, you could write org/LaTeX tables to separate files.  You can
then easily include those in your static files.

My main motivation for this was to make the export process simpler.  And
since the complicated interacting bits are all isolated and modularised,
there are fewer things that go wrong and many files are updated only
when required, hence faster too!

Anyway, this is all probably very vague without working examples.  I'll
try to come up with something, but I have been rather busy for the last
year or so and do not see any sign of respite in the near future :-/.
I'll get this fleshed out at some point, just don't know how soon.

Hope this was helpful in some way,

:)

-- 
Suvayu

Open source is the future. It sets us free.

[-- Attachment #2: plots.org --]
[-- Type: text/plain, Size: 5338 bytes --]

#+STARTUP: overview
#+PROPERTY: noweb yes
#+PROPERTY: results silent
#+BIND: org-confirm-babel-evaluate nil


* Gnuplot source preamble                                               :src:
  :PROPERTIES:
  :VISIBILITY: folded
  :END:

#+name: gnuplot-preamble
#+begin_src gnuplot
  reset
  set terminal pdfcairo color size 21cm,14.8cm
  set termoption enhanced
  set encoding utf8
  set termoption font "DejaVuSerif,8"
  # set output '|display png:-'
  set grid back
  set style line 1 linewidth 9 pointtype 1  linecolor rgb 'orange'
  set style line 2 pointsize 1 pointtype 5  linecolor rgb 'forest-green'
  set style line 3 pointsize 1 pointtype 7  linecolor rgb 'red'
  set style line 4 pointsize 1 pointtype 9  linecolor rgb 'blue'
  set style line 5 pointsize 1 pointtype 11 linecolor rgb 'dark-gray'
  set style line 6 pointsize 1 pointtype 13 linecolor rgb 'brown'
  set style line 7 linewidth 7 pointtype 19 linecolor rgb 'black'
  set style line 10 linewidth 2 linecolor rgb 'black'
  set style line 11 linewidth 5 linecolor rgb 'red'
  set key outside
  set key box linestyle 10
#+end_src


* BF Upper Limit summary plots
** Gnuplot source 							:src:
#+name: limits-preamble
#+begin_src gnuplot
  set log y
  set format y "10^{%L}"
  set ylabel 'BF Upper Limit'
  set xtics nomirror rotate by 90 offset character 0,-3
#+end_src

*** B⁺ → h⁻l⁺l⁺ / D⁻l⁺l⁺					      :Bplus:
#+begin_src gnuplot :noweb yes :var limits=Bpluslimits
  <<gnuplot-preamble>>
  <<limits-preamble>>
  set xrange [0:8]
  set yrange [1E-14:1E-5]
  set label 'BF Upper Limits:' at graph 1.02,0.55 font ',10'
  set label ' B⁺ → h⁻l⁺l⁺' at graph 1.02,0.5
  set label ' B⁺ → D⁽*⁾⁻l⁺l⁺' at graph 1.02,0.45
  set label 'LHCb limits \@ 95% C.L.' at graph 1.02,0.37 font ',7'
  set label 'Other limits \@ 90% C.L.' at graph 1.02,0.33 font ',7'
  set xtics ("K⁻e⁺e⁺" 1, "K⁻μ⁺μ⁺" 2, "π⁻e⁺e⁺" 3, "π⁻μ⁺μ⁺" 4, "D⁻e⁺e⁺" 5, "D⁻μ⁺μ⁺" 6, "D*⁻μ⁺μ⁺" 7)
  set output "Bpluslimits.pdf"
  plot "$limits" using 1:2 title 'Theory' linestyle 1, \
       "$limits" using 1:3 title 'BaBar' linestyle 2, \
       "$limits" using 1:4 title 'Belle' linestyle 3, \
       "$limits" using 1:5 title 'LHCb' linestyle 4, \
       "$limits" using 1:6 title 'LHCb year-end' linestyle 5, \
       "$limits" using 1:7 title 'LHCb upgrade' linestyle 6
       # 1E-10 with lines linestyle 10 title ''
       # 3.1E-9 with lines linestyle 11
  set output
#+end_src

*** D⁺ → h⁻l⁺l⁺ / Dₛ⁺ → h⁻l⁺l⁺					      :Dplus:
#+begin_src gnuplot :noweb yes :var limits=Dpluslimits
  <<gnuplot-preamble>>
  <<limits-preamble>>
  set xrange [0:7]
  set yrange [1E-10:1E-5]
  set label 'BF Upper Limits:' at graph 0.7,0.55 font ',10'
  set label ' D⁺ → π⁻l⁺l⁺' at graph 0.7,0.5
  set label ' Dₛ⁺ → h⁻l⁺l⁺' at graph 0.7,0.45
  set label 'All limits \@ 90% C.L.' at graph 0.7,0.37 font ',7'
  set xtics nomirror rotate by 90 offset character 0,-5
  set xtics ("D⁺→π⁻e⁺e⁺" 1, "D⁺→π⁻μ⁺μ⁺" 2, "Dₛ⁺→π⁻e⁺e⁺" 3, "Dₛ⁺→π⁻μ⁺μ⁺" 4, "Dₛ⁺→K⁻e⁺e⁺" 5, "Dₛ⁺→K⁻μ⁺μ⁺" 6)
  set output "Dpluslimits.pdf"
  plot "$limits" using 1:2 title 'Theory' linestyle 1, \
       "$limits" using 1:3 title 'BaBar' linestyle 2, \
       "$limits" using 1:4 title 'SuperB' linestyle 7
       # 1E-10 with lines linestyle 10 title ''
       # 3.1E-9 with lines linestyle 11
  set output
#+end_src

** Tables								:tbl:
*** B⁺ → h⁻l⁺l⁺ / D⁻l⁺l⁺					      :Bplus:
#+tblname: Bpluslimits
|   |  Theory |   BaBar |  Belle |       LHCb |     LHCb |    LHCb |                             |
|   |         |         |        | (95% C.L.) | year-end | upgrade |                             |
|---+---------+---------+--------+------------+----------+---------+-----------------------------|
| 1 | 3.6E-14 |  3.0E-8 |        |            |          |         | \(B^+ \to K^-e^+e^+\)       |
| 2 | 3.6E-14 |  6.7E-8 |        |     5.4E-8 |   6.5E-9 |  1.1E-9 | \(B^+ \to K^-\mu^+\mu^+\)   |
| 3 | 6.3E-13 |  2.3E-8 |        |            |          |         | \(B^+ \to \pi^-e^+e^+\)     |
| 4 | 6.3E-13 | 10.7E-8 |        |     5.8E-8 |   7.0E-9 |  1.1E-9 | \(B^+ \to \pi^-\mu^+\mu^+\) |
| 5 | 1.7E-14 |         | 2.6E-6 |            |          |         | \(B^+ \to D^-e^+e^+\)       |
| 6 | 1.7E-14 |         | 1.1E-6 |     6.9E-7 |   2.8E-7 |  4.5E-8 | \(B^+ \to D^-\mu^+\mu^+\)   |
| 7 |         |         |        |     2.4E-6 |   9.6E-7 |  1.6E-7 | \(B^+ \to D*^-\mu^+\mu^+\)  |
#+tblfm: $1=(@#-2)

*** D⁺ → h⁻l⁺l⁺ / Dₛ⁺ → h⁻l⁺l⁺					      :Dplus:
#+tblname: Dpluslimits
|   |  Theory |  BaBar | SuperB |                               |
|---+---------+--------+--------+-------------------------------|
| 1 | 4.5E-10 | 1.9E-6 | 1E-8   | \(D^+ \to \pi^-e^+e^+\)       |
| 2 | 4.5E-10 | 2.0E-6 | 1E-8   | \(D^+ \to \pi^-\mu^+\mu^+\)   |
| 3 |  6.9E-9 | 4.1E-6 |        | \(D^+_s \to \pi^-e^+e^+\)     |
| 4 |  6.9E-9 | 1.4E-5 |        | \(D^+_s \to \pi^-\mu^+\mu^+\) |
| 5 | 2.2E-10 | 5.2E-6 |        | \(D^+_s \to K^-e^+e^+\)       |
| 6 | 2.2E-10 | 1.3E-5 |        | \(D^+_s \to K^-\mu^+\mu^+\)   |
#+tblfm: $1=(@#-1)


* COMMENT local setup

# Local Variables:
# org-export-allow-BIND: t
# End:

  parent reply	other threads:[~2013-04-17  6:39 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-12  8:06 Latex export of tables Vikas Rawal
2013-04-14 23:29 ` Suvayu Ali
2013-04-16 11:56   ` Vikas Rawal
2013-04-16 13:13     ` Thomas Alexander Gerds
2013-04-16 17:39     ` Suvayu Ali
2013-04-16 20:07       ` Thomas S. Dye
2013-04-16 21:39         ` Suvayu Ali
2013-04-16 23:45           ` Thomas S. Dye
2013-04-17 10:21           ` Myles English
2013-04-16 22:10         ` Best practices for literate programming [was: Latex export of tables] Vikas Rawal
2013-04-17  0:06           ` Thomas S. Dye
2013-04-18 16:53             ` Rasmus
2013-04-18 17:59               ` Aaron Ecay
2013-04-18 18:25                 ` Rasmus
2013-04-18 19:48                 ` Achim Gratz
2013-04-18 19:42               ` Thomas S. Dye
2013-04-21 17:25                 ` Rasmus Pank Roulund
2013-04-17  6:39           ` Suvayu Ali [this message]
2013-04-17  9:55             ` Rainer M. Krug
2013-04-17 10:10               ` Suvayu Ali

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=20130417063930.GA14455@kuru.dyndns-at-home.com \
    --to=fatkasuvayu+linux@gmail.com \
    --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).