From mboxrd@z Thu Jan 1 00:00:00 1970 From: Suvayu Ali Subject: Re: Best practices for literate programming [was: Latex export of tables] Date: Wed, 17 Apr 2013 08:39:30 +0200 Message-ID: <20130417063930.GA14455@kuru.dyndns-at-home.com> References: <20130412080600.GA18235@panahar> <20130414232953.GC11696@kuru.dyndns-at-home.com> <20130416115619.GA12405@panahar> <20130416173948.GC7402@kuru.dyndns-at-home.com> <20130416221022.GA7809@panahar> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="WIyZ46R2i8wDzkSu" Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([208.118.235.92]:47827) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1USM1p-0003zK-FB for emacs-orgmode@gnu.org; Wed, 17 Apr 2013 02:39:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1USM1n-0008Ju-Mc for emacs-orgmode@gnu.org; Wed, 17 Apr 2013 02:39:37 -0400 Received: from mail-ea0-x234.google.com ([2a00:1450:4013:c01::234]:57151) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1USM1n-0008Jd-D9 for emacs-orgmode@gnu.org; Wed, 17 Apr 2013 02:39:35 -0400 Received: by mail-ea0-f180.google.com with SMTP id d10so542874eaj.11 for ; Tue, 16 Apr 2013 23:39:34 -0700 (PDT) Content-Disposition: inline In-Reply-To: <20130416221022.GA7809@panahar> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --WIyZ46R2i8wDzkSu Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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. --WIyZ46R2i8wDzkSu Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename="plots.org" Content-Transfer-Encoding: 8bit #+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 <> <> 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 <> <> 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: --WIyZ46R2i8wDzkSu--