Support via Liberapay

Mscgen: Message Sequence Charts

Babel support for Mscgen: Message sequence charts


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).


  • 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:

 '((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 [ label = "send message" ];
  A <- B [ label = "receive answer" ];

Which produces the following result:

message sequence chart

Header arguments

These header arguments are relevant for Mscgen:

the file argument is needed since the output from Mscgen is always to a file
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.

Documentation from the orgmode.org/worg/ website (either in its HTML format or in its Org format) is licensed under the GNU Free Documentation License version 1.3 or later. The code examples and css stylesheets are licensed under the GNU General Public License v3 or later.