groff_trace(7) -- Linux man page
groff_trace - groff macro package trace.tmac
groff -m trace
Elements in brackets denote optional arguments, and the ellipsis means
that there can be any number of arguments of this kind.
macro package of
can be a valuable tool for debugging documents written in the roff
A call stack trace is protocolled on standard error, that means, a
diagnostic message is emitted on entering and exiting of a macro call.
This greatly eases to track down an error in some macro.
This tracing process is activated by specifying the groff or troff
command line option
This works also with the
A finer control can be obtained by including the macro file within the
document by the groff macro call
Only macros that are defined after this line are traced.
If some other macro package should be traced as well it must be specified
on the command line.
The macro file
is unusual because it does not contain any macros to be called by a
Instead, the existing macro definition and appending facilities are
modified such that they display diagnostic messages.
In the following examples, a roff fragment is fed into groff via
As we are only interested in the diagnostic messages (standard error)
on the terminal, the normal formatted output (standard output) is
redirected into the nirvana device
The resulting diagnostic messages are displayed directly below the
Command line option
ell_cmd echo '.
ell_cmd+ .de test_macro
ell_cmd+ .test_macro some dummy arguments
ell_cmd+ ' | groff -m trace >/dev/null
*** de trace enter: test_macro
*** trace exit: test_macro
*** de trace enter: test_macro "some" "dummy" "arguments"
*** trace exit: test_macro "some" "dummy" "arguments"