groff: can I embed images?

杀马特。学长 韩版系。学妹 提交于 2019-12-23 10:23:35

问题


I'm generating some troff-style documentation. Is there a way to embed an image (jpg, etc) into a groff file?


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/2701843/groff-can-i-embed-images

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!