decumar v0.1

by Hadley Wickham

A sweave alternative



Decumar is a tool for interleaving latex and R. It uses specially formatted comment blocks, so your file is always valid latex.

Decumar is similar to sweave, but comes from a slightly different heritage. As well as deriving inspiration from literate programming, it also draws ideas from code generation. Why should you use decumar instead of sweave?

  • you only need one file
  • it's always valid latex
  • caching is built in
  • you don't need to manually print ggplot2 and lattice plots
  • more types of output (figures, listing, ...)

Basic format

Decumar blocks look like this:

%   OPTION1: value 1
%   OPTION2: value 2
% a <- 10
% a + b


Decumar expects the following in your preamble:



Decumar currently supports the following block types:

  • DEFAULTS: set up default parameters

  • CODE: execute code, but don't display it

  • LISTING: display code, but don't execute it
  • CODELISTING: execute and display code
  • INTERWEAVE: interweave each line of code with its results

  • GRAPHIC: insert a bare graphic

  • FIGURE: insert multiple graphics in a floating figure
  • FIGLISTING: insert a figure and the display the code used to create it

Functions in decumar

Name Description
block_listing Show code, but don't evaluate it...
block_codelisting Evaluate code and display listing separately...
block_figlisting Show figure along with the code that produced it...
block_interweave Interweave code and output, as if you had executed at the command line...
blocks blocks
block_graphic Embed a plot.
block_defaults Set document defaults.
block_code Evaluate code, but don't show it...
block_raw Display text output as is (no escaping of special characters)...
block_figure Embed a plot in a floating figure block...
decumar Overwrite input with processed output...
texweave Weave evaluate output into tex.
escape_tex Escape latex special characters...
output_code Extract code from a decumar file.
save_plot save_plot
open_dev Create graphics device from filename...
image_tex image_tex
process_file Process decumar file and return result as string...
No Results!


Type Package
Date 2008-08-19
License GPL
LazyData true
Collate 'block.r' 'blocks.r' 'cache.r' 'defaults.r' 'output.r' 'parser.r' 'plot.r' 'tex-utils.r' 'tex-weave.r' 'utils.r' 'jss.r'

Include our badge in your README