1 #+OPTIONS: H:3 num:nil toc:1 \n:nil @:t ::t |:t ^:{} -:t f:t *:t TeX:t LaTeX:nil skip:nil d:(HIDE) tags:not-in-toc
2 #+STARTUP: align fold nodlcheck hidestars oddeven lognotestate hideblocks
3 #+SEQ_TODO: TODO(t) INPROGRESS(i) WAITING(w@) | DONE(d) CANCELED(c@)
4 #+TAGS: Write(w) Update(u) Fix(f) Check(c)
6 #+AUTHOR: Thomas S. Dye
7 #+EMAIL: tsd at tsdye dot com
9 #+STYLE: <style type="text/css">#outline-container-introduction{ clear:both; }</style>
10 #+STYLE: <style type="text/css">#table-of-contents{ max-width:100%; }</style>
12 #+LINK_HOME: http://orgmode.org/worg/
15 This page collects examples of using Babel in a variety of
16 contexts. Contributions of further examples from Babel users are
19 * [[file:examples/data-collection-analysis.org][Data Collection and Analysis]]
20 (raw file available at [[http://repo.or.cz/w/Worg.git/blob_plain/HEAD:/org-contrib/babel/examples/data-collection-analysis.org][data-collection-analysis.org]])
22 This example uses Babel to automate a repeated data-collection
23 and analysis task. A Ruby code block is used to scrape data from
24 the output of a computational experiment. This data is then written
25 to an Org-mode table. A block of R code reads from this table and
26 calculates lines of fit. Finally a block of gnuplot code is used to
27 graph the results of both the raw data and the R analysis. By
28 performing all of these steps within an Org-mode document working
29 notes, discussion, and TODOs can be naturally interspersed with the
30 code, and the results can easily be published to HTML or PDF for
33 * [[http://www.stats.ox.ac.uk/~davison/software/org-babel/drift.org.html][Teaching evolution using R]]
34 This example is a tutorial on simulating evolution in R. It contains
35 examples of diagrams generated with =ditaa=, LaTeX, and graphics
38 A good way to see how org-babel functions to create the tutorial is to
39 view the [[http://www.stats.ox.ac.uk/~davison/software/org-babel/drift.org.html][htmlized org buffer]]. This also provides an example of how
40 images and latex-generated mathematical notation can be viewed inline
41 in emacs. The HTML export version is [[file:examples/drift.org][here]] [!BROKEN LINK - [[http://orgmode.org/worg/sources/FIXME/drift.org][drift.org]]
42 does not export correctly. --Bzg 2010-09-19 Sun]
44 * [[file:examples/org-check.org][Checking Your Org-Mode Configuration]]
45 (raw file available at [[http://repo.or.cz/w/Worg.git/blob_plain/HEAD:/org-contrib/babel/examples/org-check.org][org-check.org]])
47 This example runs some diagnostic checks to see if your system and
48 Org-mode are configured to accomplish various tasks. It is
49 currently a stub placed here in the hope that the Org-mode community
50 will augment and enhance it. It was created in response to a thread
51 on the mailing list on how to ease the learning curve for new
54 * [[file:examples/latex-form.org][A LaTeX Form]]
55 (raw file available at [[http://repo.or.cz/w/Worg.git/blob_plain/HEAD:/org-contrib/babel/examples/latex-form.org][latex-form.org]])
57 This example uses Babel as a user interface for a LaTeX form
58 that might be used by the members of an organization. It uses the
59 literate programming facility of Babel to isolate the user from
60 the sometimes arcane LaTeX constructs needed to create a
61 highly-structured form. Babel can tangle multiple documents in
62 a single Org-mode file, and this ability is used to create a
63 distribution version of the form separate from one designed for the
66 * [[file:examples/short-report.org][A Standardized Short Report]]
67 (raw file available at [[http://repo.or.cz/w/Worg.git/blob_plain/HEAD:/org-contrib/babel/examples/short-report.org][short-report.org]])
69 This example is similar to the previous one, but here the users are
70 expected to write substantial content. This type of workflow might
71 be used by a small organization whose employees regularly produce
72 standard documents and where the writing tasks for any one document
73 are divided among the authors.
75 The HTML export facility of Org-mode is used to produce a guide to
76 writing the standardized short report. This HTML file can be used
77 to train new authors. The Org-mode content also supplies
78 substantial direction to experienced authors as they write.
79 Org-mode keywords and tags are used to keep track of writing
80 assignments and progress. Babel's literate programming facility
81 makes it possible to present writing tasks to the authors in an order
82 different from which they appear in the report.
84 * [[file:examples/ascii.org][A Example Using Ascii Package]]
85 (raw file available at [[http://repo.or.cz/w/Worg.git/blob_plain/HEAD:/org-contrib/babel/examples/ascii.org][ascii.org]])
87 This example shows how to use Babel with =R= and =ascii= package.
89 * [[http://repo.or.cz/w/Worg.git/blob_plain/HEAD:/org-contrib/babel/examples/foo.org.html][/An Babel Demo/ -- A Comparison to Sweave]]
93 [[http://www.stat.umn.edu/~charlie/][Charlie Geyer]] created an excellent short demonstration of Sweave
94 entitled /An Sweave Demo/ available at [[http://www.stat.umn.edu/~charlie/Sweave/][his Sweave page]]. There is now
95 an Babel version of this demonstration entitled /An Babel
96 Demo/ which matches Charlie's document word for word (as much as
97 possible) and figure for figure with all the examples implemented
98 using Babel instead of Sweave.
100 Compare the two side-by-side.
102 |--------+-----------------------------------------+---------|
103 | Sweave | [[http://www.stat.umn.edu/~charlie/Sweave/foo.Rnw][foo.Rnw]] | [[http://www.stat.umn.edu/~charlie/Sweave/foo.pdf][foo.pdf]] |
104 | Babel | [[http://repo.or.cz/w/Worg.git/blob_plain/HEAD:/org-contrib/babel/examples/foo.org][foo.org]] ([[http://repo.or.cz/w/Worg.git/blob_plain/HEAD:/org-contrib/babel/examples/foo.org.html][foo.org.html]] as seen in Emacs) | [[http://repo.or.cz/w/Worg.git/blob_plain/HEAD:/org-contrib/babel/examples/foo.pdf][foo.pdf]] |
106 * [[file:examples/finances.org][Tracking finances]]
108 :Author: Jason Dunsmore
109 :CUSTOM_ID: tracking-finances
112 An Emacs lisp function in a Babel source block aggregates entries in
113 an Org-mode table, which can be useful in tracking finances.
115 * Using Ledger to track finances
117 Instead of writing functions to track finances entered in Org-mode
118 tables, Babel makes it possible to use Org-mode and Ledger to track
119 finances. A [[file:languages/ob-doc-ledger.org][short tutorial]] illustrates how to insert ledger entries
120 in an Org-mode file and how to generate financial reports from those
121 entries using Babel to call Ledger.
122 * [[https://github.com/tsdye/hawaii-colonization][A Reproducible Research Paper Written in Org-Mode]]
124 This git repository contains Org-mode source and data files for the
125 paper "A Model-based Age Estimate for the Polynesian Colonization of
126 Hawai`i," which is currently in press at the journal [[http://sydney.edu.au/arts/publications/oceania/arch_oceaniacrnt.htm][Archaeology in
129 The repo includes a README file with system requirements and
130 instructions to make a pdf version of the paper. Also included is a
131 Makefile that automates the process of compiling the paper to pdf.
133 The pdf file represents the initial submittal to the journal.
134 [[http://sydney.edu.au/arts/publications/oceania/arch_oceaniacrnt.htm][Archaeology in Oceania]] requires a Word file at the end of the review
135 process. This was created from the Org-mode LaTeX export with the
136 late Eitan Gurari's [[http://www.tug.org/applications/tex4ht/mn.html][tex4ht]] software, followed by numerous tweaks with
137 Word (graciously executed by a colleague who knows how to use that
140 * [[file:examples/article-class.org][A Literate Article Class for Org-mode LaTeX Export]]
142 This project is no longer supported. It eventually became the [[http://orgmode.org/worg/org-tutorials/org-latex-export.html][LaTeX
143 export tutorial.]] It is included here as a historical curiosity.
145 This example is a literate program that tangles an article class for
146 Org-mode LaTeX export. The class supports numerous options that
147 control the look and feel of the resulting pdf file. It provides
150 - Default packages :: Options to keep individual LaTeX packages from
151 loading make it somewhat easier to modify which LaTeX packages
152 are loaded during the processing of LaTeX code exported by
154 - Semantic markup :: A facility for semantic markup is implemented,
155 which makes it possible to markup according to arbitrary LaTeX
156 styles, such as the ones distributed by journals and book publishers.
157 - Fonts :: The package also implements several choices of fonts and
158 takes steps to ensure that the fonts don't clash with the
159 symbol font files that Org-mode depends upon to typeset
161 - Listing themes :: The class provides pre-defined themes for
162 formatting source code listings, which can be
163 used as is, or used as a basis for minor modifications.
164 - Compact lists :: A facility to typeset lists with less vertical
166 - Double spacing :: An option is provided to set lines double spaced.
167 - Table of contents :: The table of contents depth can be set
168 independently of section numbering depth.
169 - Section numbering :: Section numbering depth can specified
170 independently of the table of contents depth.
173 * [[file:examples/Rpackage.org][R Package Development Headers]]
174 This document contains
175 - tools useful for writing R extensions called /packages/
176 - source code to create a simple R package
178 [[http://repo.or.cz/w/Worg.git/blob_plain/HEAD:/org-contrib/babel/examples/Rpackage.org][Download]] the =.org= version of this document and place it in either
179 an R package source directory or in a clean directory to get started.
181 * [[file:examples/fontify-src-code-blocks.org][Pretty fontification of code blocks]]
183 The article about [[file:examples/fontify-src-code-blocks.org][pretty fontification of code blocks]] shows the user how to
184 customize a couple of Emacs faces in order to enhance his Babel experience,
185 and get much nicer visual separation between code and text.
187 * Tutorial on Emacs+ESS and Org+R by Stephen Eglen
189 See [[http://article.gmane.org/gmane.emacs.orgmode/45777][this message]] from Stephen Eglen:
191 : I gave a 3 hour tutorial on Emacs Speaks Statistics on Monday; this
192 : included mostly Emacs and ESS, but also introduced org-mode for R users.
193 : If anyone is interested, the slides and material are available at:
195 http://www.damtp.cam.ac.uk/user/sje30/ess11