MRI pulse sequence macros for TeX or LaTeX
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 3 commits ahead, 1 commit behind cbhushan:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

MetaPost MRI pulse sequence macros

These MetaPost macros draw simple but publication-quality MRI pulse sequence diagrams for TeX documents, by describing RF and gradients events as a series of logical objects along lines.

This a fork of the pulses macros by Mark White, which was originally published in 2004.

Impoved gradient shapes have been added as per Proper Gradients for Metapost Pulse Sequences.


Macros are in Several example sequences are in

Many TeX installations come with MetaPost so you might well have it already. Running mpost will create a series of numbered postscript fragments, one for each figure, suitable for inclusion with TeX or LaTeX.

Getting fonts right in MetaPost can be complex. Depending on your installation and how you want to use the output, you may need to comment or change the prologues and defaultfont lines at the top of and/or the infont "Symbol" lines in

If you're an MRI scientist (which I guess you are, if you've made it this far down the page) you may notice that figure 2 has a physics error: the readout gradient starts during the excitation pulse. Fortunately somebody spotted that in the draft these came from.

There is a write-up on the installation and basic use on my blog


Basic FLASH sequence using the original gradients: alt tag Spin Echo sequence with the improved gradients: alt tag


Written by Mark White, mark [at], in 2004.

There didn't seem to be many straightforward tools for this in 2004, so I published the files online here with some examples and comments. In 2016 I released the same code under a clear 2-clause BSD licence here.

The 2016 release (1.0) is identical apart from a few lines in the header comments referring to the licence. Thir version (1.1) has improved gradient shapes.

Licence and contact

Both files - the macros and the example sequence diagrams (which were taken from a draft of my PhD thesis) - are released under the 2-clause BSD licence. See COPYING.txt in the distribution for details.

If you do anything useful with this code, or if you have any comments or patches, I'd love to hear from you - email mark [at]