Mom -- Inserting images into mom documents

Back to Table of Contents | Next: Page headers/footers, pagination

# Inserting images into a document

You can insert images into a document by using the PSPIC macro. PSPIC isn’t actually part of mom; it comes packaged with groff itself. Images must be in PostScript format, either straight .ps or .eps (Encapsulated PostScript). If you have the ImageMagick suite of programmes installed on your system, a simple way to convert most image formats to .eps is with `convert`, at the command line, as in this jpg => eps example:
convert <filename>.jpg <filename>.eps There have been reports of trouble with PostScript level 2 images, so don’t save your images in this format.

### PSPIC

Macro: PSPIC `[ -L | -R | -I <n> ] <file> [ width [ height ] ]`

`man groff-tmac` contains the documentation for PSPIC, but I’ll repeat it here with a few modifications for clarity.

### From groff-tmac

`<file>` is the name of the file containing the image; `width` and `height` give the desired width and height of the image as you wish it to appear within the document. The width and height arguments may have units of measure attached; the default unit of measure is `i`. PSPIC will scale the graphic uniformly in the x and y directions so that it is no more than `width` wide and `height` high. By default, the graphic will be horizontally centered. The `-L` and `-R` options cause the graphic to be left-aligned and right-aligned, respectively. The `-I` option causes the graphic to be indented by `<n>`; the default unit of measure is `m` (ems).

Unless you’re a PostScript whiz and have futzed around with bounding boxes and whatnot, it’s unlikely that your image will occupy an easily predictable and precise amount of space on the page. This is particularly significant when it comes to the amount of vertical space occupied by the image. A certain amount of manual tweaking of the vertical placement of the image will probably be required, via the ALD and RLD macros.

Additionally, images inserted into running text will almost certainly disrupt the baseline placement of running text. In order to get mom back on track after invoking `.PSPIC`, I strongly recommend using the SHIM macro so that the bottom margin of running text falls where it should.

Back to Table of Contents | Top | Next: Page headers/footers, pagination