grog(1) General Commands Manual grog(1)
grog - “groff guess”—infer a document's groff command
grog [--run] [--warnings] [--ligatures] [groff-option ...] [--] [file ...] grog -h grog --help grog -v grog --version
grog reads the input (file names or standard input) and guesses which groff(1) options are needed to render the input with the groff program. If no operands are given, or if file is “-”, grog reads the standard input stream. The corresponding groff command is normally written to the standard output stream. With the option --run, the generated command is written to the standard error stream and then executed.
-h and --help display a usage message, whereas -v and --version display version information; all exit afterward. --ligatures forces inclusion of the arguments -P-y -PU in the generated groff command. --run writes the inferred command to the standard error stream and then executes it. --warnings issues more warnings to the standard error stream. All other specified short options (words starting with one minus character “-”) are interpreted as groff options or option clusters with or without argument. No space is allowed between such an option and its argument when it is specified to grog; this is not the case for groff itself. Except for -m, these options are passed through; that is, they are included unchanged in the output command without affecting the work of grog.
grog reads all file operands in their entirety, pattern-matching strings that are statistically likely to be characteristic of roff(7) documents. It tries to guess which of the following groff options are required to correctly render the input: -e, -g, -G, -j, -p, -R, -s, -t (preprocessors); and -man, -mdoc, -mdoc-old, -me, -mm, -mom, and -ms (macro packages). The inferred groff command including those options and any file parameters is written to the standard output stream. It is possible to specify arbitrary groff options on the command line. These are included in the inferred command without change, except for the -m options. Choices of groff options include -C to enable compatibility mode and -T to specify an output device other than the default. groff may issue diagnostic messages when an inappropriate -m option, or multiple conflicting ones, are specified. Consequently, it is best to specify no -m options to grog unless it cannot correctly infer any -m arguments at all. grog will only accept -m arguments and exit successfully if it can infer no groff -m argument from the input or if the inferred and specified -m arguments agree. If multiple -m options are inferred by grog, it emits a diagnostic and terminates with an error exit status. The inferred command is written with the wrong options nevertheless. A roff document can also be written without recourse to any macro package. In such cases, grog will infer a groff command without an -m option.
Running grog meintro.me at the command line results in groff -T ps -me meintro.me because grog recognizes that the file meintro.me is written using macros from the me package. The command grog pic.ms outputs groff -T ps -t -e -p -ms pic.ms on the other hand. Besides discerning the ms macro package, grog recognizes that the file pic.ms additionally needs -pte, the combination of -p for pic, -t for tbl, and -e for eqn. If both of the former example files are combined in the command grog meintro.me pic.ms a diagnostic message is sent to the standard error stream because some macro packages cannot be combined. Nevertheless the corresponding output with the wrong options is written to standard output: groff -T ps -t -e -p -ms meintro.me pic.ms and grog terminates with an error exit status. The command grog -ksS -Tdvi grnexmpl.g contains several groff options that are passed through without interference from grog. These are the option cluster -ksS and the typesetter option -T with argument dvi. The output is groff -k -s -S -T dvi grnexmpl.g so no additional option was added by grog. As no -m option was inferred by grog, this file does not use a macro package.
grog was originally written by James Clark. The current Perl implementation was written by Bernd Warken ⟨groff-bernd .email@example.com⟩ with contributions from Ralph Corderoy.
This page is part of the groff (GNU troff) project. Information about the project can be found at ⟨http://www.gnu.org/software/groff/⟩. If you have a bug report for this manual page, see ⟨http://www.gnu.org/software/groff/⟩. This page was obtained from the project's upstream Git repository ⟨https://git.savannah.gnu.org/git/groff.git⟩ on 2021-06-20. (At that time, the date of the most recent commit that was found in the repository was 2021-06-17.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to firstname.lastname@example.org groff 1.23.0.rc1.259-531129-dir1t3yMarch 2021 grog(1)
Pages that refer to this page: gperl(1), gpinyin(1), groff(1), groffer(1), roff(7)