groff: can I embed images?
I'm generating some troff-style documentation. Is there a way to embed an image (jpg, e开发者_如何学JAVAtc) into a groff file?
Depends on the output format. If you are creating a PostScript file, you can use PSPIC which uses a PS file itself with a single image. For example:
.PSPIC image.ps
Alignment, etc is a bit limited. By default it is aligned to the center but you can put it at the left or the right corner using -L or -R. There are some other options, check the groff_tmac manpage for these (search for pspic).
If you are creating a webpage you might need to use .IMG instead. The syntax is the same.
I use groff to prepare data analysis reports, and often need to tweak my graphs outside of R using Inkscape.
The following may not be to purists' liking but it works for me. Carefully name the images as you generate them, and provision the necessary vertical space for each image, adding appropriate labels.
Create the report's pdf (say tbl report.roff | eqn | groff -Tps -ms | ps2pdfwr - report.pdf
) and use Inkscape (or any other pdf editor such as Pdf Studio) to copy-paste the images in the report's pdf.
精彩评论