2

While using groff and pic it is possible to do:

$ cat test.ms
.TL
Test

.NH 1 
Test Header

.PS
circle
arrow
box
.PE
$ cat test.ms | groff -ms -p > test.ps

Which generates a valid test.ps file containing the processed figure in pic.

In larger documents, for mainteinability, it might be desirable to keep the picture pic description in a separate file and invoke such file from the main .ms file.

While trying to get this working I have found that .so can source an external file, but I am finding issues to set up this configuration of embeding external .pic files into the main .ms file as shown here:

$ cat test2.pic
.PS
circle
arrow
box
.PE
$ cat test2.ms
.TL
Test

.NH 1 
Test Header

.so test2.pic
$ cat test2.ms | groff -ms -p > test2.ps
test2.pic:1: macro error: bad arguments to PS (not preprocessed with pic?)
$ 

Which would be the way to achieve this inclusion of .pic code in the main macro .ms files as external files?

4
  • 1
    What does s, the parameter to -m have? Your commands return: troff: fatal error: can't find macro file s Commented May 7, 2021 at 23:58
  • -ms tells groff to use ms macro package. Notice that I am using groff. It might be that troff has a different syntax for using ms macros. I have noticed that troff can not invoke other arguments such as -p (preprocess with pic) Commented May 8, 2021 at 0:30
  • 2
    Note, you can also include pic files by giving the filename to the PS macro, eg .PS <test2.pic where it acts a bit like .so. Commented May 8, 2021 at 12:56
  • I did not know that. Maybe it makes even more sense. Commented May 8, 2021 at 14:37

1 Answer 1

3

You need to add the soelim preprocessor, that will eliminate the .so commands by including the actual files.

In your case this should it (note the added -s flag):

cat test2.ms | groff -ms -p -s > test2.ps

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.