| gsoelim(1) | User Commands | gsoelim(1) |
gsoelim - recursively interpolate source requests in roff or other text files
gsoelim |
[-Crt] [-I dir] [input-file ...] |
gsoelim |
--help |
gsoelim |
-v |
gsoelim |
--version |
GNU soelim is a preprocessor for the groff(7) document formatting system. gsoelim eliminates source requests in roff(7) and other text files; that is, it replaces lines of the form “.so included-file” within each text input-file with the contents of included-file recursively, flattening a tree of documents. By default, it writes roff lf requests as well to record the name and line number of each input-file and included-file, so that any diagnostics produced by later processing can be accurately traced to the original input. Options allow this information to be suppressed (-r) or supplied in TeX comments instead (-t). In the absence of input-file arguments, gsoelim reads the standard input stream. The program writes to the standard output stream.
gsoelim reads the included-file argument as GNU troff does. It ignores spaces immediately after “so”; to embed a sequence of one or more leading spaces in the argument, prefix the sequence with a neutral double quote ("). Non-leading spaces are interpreted literally. A backslash followed by a space (“\ ”) also encodes a space, for compatibility with earlier versions of GNU soelim. If the included file name requires a backslash, use \\ or \e to embed it. Any other escape sequence in included-file, including “\[rs]”, prevents gsoelim from replacing the source request. AT&T and descendant versions of soelim have no means of embedding spaces in file names; they replace the first space encountered with a newline and stop interpreting the request.
The dot must be at the beginning of a line and must be followed by “so” without intervening spaces or tabs for gsoelim to handle it. This convention allows source requests to be “protected” from processing by gsoelim, for instance as part of macro definitions or “if” requests.
There must also be at least one space between “so” and its included-file argument. The -C option overrides this requirement.
The foregoing is the limit of gsoelim's understanding of the roff language; it does not, for example, replace the input line
.if 1 .so otherfile
soelim was designed to handle situations where the target of a roff source request requires a preprocessor such as geqn(1), gpic(1), grefer(1), or gtbl(1). The usual processing sequence of groff(1) is as follows. In the diagrams below, the traditional names for soelim and troff are used; on this system, the GNU versions are installed as gsoelim and gtroff.
input sourced
file file
⎪ ⎪
↓ ↓
preprocessor ⎯→ troff ⎯→ postprocessor
⎪
↓
output
file
That is, files sourced with “so” are normally
read only by the formatter, gtroff(1). gsoelim is
not required for gtroff to source files.
If a file to be sourced should also be preprocessed, it must already be read before the input passes through the preprocessor. gsoelim, normally invoked via groff's -s option, handles this.
input
file
⎪
↓
soelim ⎯→ preprocessor ⎯→ troff ⎯→ postprocessor
↑ ⎪
⎪ ↓
sourced output
file file
--help displays a usage message, while -v and --version show version information; all exit afterward.
If both -r and -t are given, the last one specified controls.
gsoelim exits with status 0 on successful operation, status 2 if the program cannot interpret its command-line arguments, and status 1 if it encounters an error during operation.
groff(1)
| 2026-03-14 | groff 1.24.1 |