ob-doc-mscgen.org 3.0 KB

Babel support for Mscgen: Message sequence charts

Introduction

Mscgen is a utility for rendering message sequence charts.

The charts are defined in text format as specified on the project homepage.

This Babel module is similar to ob-dot and ob-ditaa in that they just render an image from a text-based definition. Therefore many of the Babel concepts do not apply (things like sessions, variables, vector output).

Requirements

  • Babel requires that Mscgen be installed on your system
  • A path to executable must exist in the variable exec-path

(setq exec-path (append exec-path '("/path/to/mscgen")))

Enabling Babel's Mscgen support

You need to add Mscgen to the org-babel-load-languages variable

Customize thus:

M-x customize-variable RET org-babel-load-languages RET

Or, add the commented line to =.emacs=:

(org-babel-do-load-languages 'org-babel-load-languages '((R . t) (ditaa . t) (dot . t) (emacs-lisp . t) (mscgen . t) ; this is the entry to activate mscgen (latex . t) (perl . t) (python . t) (ruby . t) (screen . nil) (sh . t) (sql . nil) (sqlite . nil)))

Example usage

The following is a trivial example of 2 messages between nodes A and B:

#+begin_src mscgen :file chart.png
msc {
  A,B;
  A -> B [ label = "send message" ];
  A <- B [ label = "receive answer" ];
}
#+end_src

Which produces the following result:

message sequence chart

Header arguments

These header arguments are relevant for Mscgen:
file
the file argument is needed since the output from Mscgen is always to a file
filetype
optional file type, defaults to PNG
    Output file types (as of Mscgen version 2010W30) are:
  • PNG (Portable Network Graphics) - default
  • SVG (Scalable Vector Graphics)
  • EPS (encapsulated PostScript)
  • ismap (server-side image map)

PNG results in a bitmap image, but it is supported in all export formats (i.e. by web browsers and by pdflatex).

Other formats may result in a link to the actual file.

In order to get higher resolution on PNG output, include a width or hscale statement.