a2p
accept
access
acct
addftinfo
addr2line
adjtime
afmtodit
after
aio_cancel
aio_error
aio_read
aio_return
aio_suspend
aio_waitcomplete
aio_write
alias
aliases
alloc
anvil
append
apply
apropos
ar
array
as
asa
asn1parse
at
atq
atrm
attemptckalloc
attemptckrealloc
authlib
authtest
autopoint
awk
b64decode
b64encode
basename
batch
bc
bdes
bell
bg
bgerror
biff
big5
binary
bind
bindkey
bindtags
bindtextdomain
bio
bitmap
blowfish
bn
bootparams
bootptab
bounce
brandelf
break
breaksw
brk
bsdiff
bsdtar
bsnmpd
bspatch
bthost
btsockstat
buffer
builtin
builtins
bunzip2
button
byacc
bzcat
bzegrep
bzfgrep
bzgrep
bzip2
c2ph
c89
c99
ca
cal
calendar
canvas
cap_mkdb
case
cat
catch
catman
cc
cd
cdcontrol
chdir
checkbutton
checknr
chflags
chfn
chgrp
chio
chkey
chmod
chown
chpass
chroot
chsh
ci
ciphers
ckalloc
ckdist
ckfree
ckrealloc
cksum
cleanup
clear
clipboard
clock
clock_getres
clock_gettime
clock_settime
close
cmp
co
col
colcrt
colldef
colors
colrm
column
comm
command
compile_et
complete
compress
concat
config
connect
console
continue
core
courierlogger
couriertcpd
cp
cpan
cpio
cpp
creat
crl
crontab
crunchgen
crunchide
crypt
crypto
csh
csplit
ctags
ctm
ctm_dequeue
ctm_rmail
ctm_smail
cu
cursor
cursors
cut
cvs
date
dbiprof
dbiproxy
dc
dcgettext
dcngettext
dd
dde
default
defer
deliverquota
des
destroy
devfs
df
dgettext
dgst
dh
dhparam
dialog
diff
diff3
dig
dir
dirent
dirname
dirs
discard
disktab
dngettext
do
domainname
done
dprofpp
dsa
dsaparam
dtmfdecode
du
dup
dup2
eaccess
ec
ecdsa
echo
echotc
ecparam
ed
edit
editrc
ee
egrep
elf
elfdump
elif
else
enc
enc2xs
encoding
end
endif
endsw
engine
enigma
entry
env
envsubst
eof
eqn
err
errno
error
errstr
esac
ethers
euc
eui64
eval
event
evp
ex
exec
execve
exit
expand
export
exports
expr
extattr
extattr_delete_fd
extattr_delete_file
extattr_get_fd
extattr_get_file
extattr_set_fd
extattr_set_file
f77
false
famm
famx
fblocked
fbtab
fc
fchdir
fchflags
fchmod
fchown
fcntl
fconfigure
fcopy
fdescfs
fdformat
fdread
fdwrite
fetch
fg
fgrep
fhopen
fhstat
fhstatfs
fi
file
file2c
fileevent
filename
filetest
find
find2perl
finger
flex
flock
flush
fmt
focus
fold
font
fontedit
for
foreach
fork
format
forward
fpathconf
frame
from
fs
fstab
fstat
fstatfs
fsync
ftp
ftpchroot
ftpusers
ftruncate
futimes
g711conv
gb2312
gb18030
gbk
gcc
gcore
gcov
gdb
gencat
gendsa
genrsa
gensnmptree
getconf
getdents
getdirentries
getdtablesize
getegid
geteuid
getfacl
getfh
getfsstat
getgid
getgroups
getitimer
getlogin
getopt
getopts
getpeername
getpgid
getpgrp
getpid
getppid
getpriority
getresgid
getresuid
getrlimit
getrusage
gets
getsid
getsockname
getsockopt
gettext
gettextize
gettimeofday
gettytab
getuid
glob
global
gmake
goto
gperf
gprof
grab
grep
grid
grn
grodvi
groff
groff_font
groff_out
groff_tmac
grog
grolbp
grolj4
grops
grotty
group
groups
gunzip
gzcat
gzexe
gzip
h2ph
h2xs
hash
hashstat
hd
head
help2man
hesinfo
hexdump
history
host
hostname
hosts
hosts_access
hosts_options
hpftodit
http
hup
i386_get_ioperm
i386_get_ldt
i386_set_ioperm
i386_set_ldt
i386_vm86
iconv
id
ident
idprio
if
ifnames253
ifnames259
image
imapd
incr
indent
indxbib
info
infokey
inode
install
instmodsh
interp
intro
introduction
ioctl
ipcrm
ipcs
ipf
ipftest
ipnat
ippool
ipresend
issetugid
jail
jail_attach
jobid
jobs
join
jot
kbdcontrol
kbdmap
kcon
kdestroy
kdump
kenv
kevent
keycap
keylogin
keylogout
keymap
keysyms
kgdb
kill
killall
killpg
kinit
kldfind
kldfirstmod
kldload
kldnext
kldstat
kldsym
kldunload
klist
kpasswd
kqueue
kse
kse_create
kse_exit
kse_release
kse_switchin
kse_thr_interrupt
kse_wakeup
ktrace
label
labelframe
lam
lappend
last
lastcomm
lastlog
lchflags
lchmod
lchown
ld
ldap
ldapadd
ldapcompare
ldapdelete
ldapmodify
ldapmodrdn
ldappasswd
ldapsearch
ldapwhoami
ldd
leave
less
lesskey
lex
lgetfh
lhash
libnetcfg
library
limit
limits
lindex
link
linprocfs
linsert
lint
lio_listio
list
listbox
listen
lj4_font
lkbib
llength
lmtp
ln
load
loadfont
local
locale
locate
lock
lockf
log
logger
login
logins
logname
logout
look
lookbib
lorder
lower
lp
lpq
lpr
lprm
lptest
lrange
lreplace
ls
lsearch
lseek
lset
lsort
lstat
lsvfs
lutimes
lynx
m4
madvise
magic
mail
maildiracl
maildirkw
maildirmake
mailq
mailx
make
makeinfo
makewhatis
man
manpath
master
mc
mcedit
mcview
md2
md4
md5
mdc2
memory
menu
menubar
menubutton
merge
mesg
message
mincore
minherit
minigzip
mkdep
mkdir
mkfifo
mkimapdcert
mklocale
mknod
mkpop3dcert
mkstr
mktemp
mlock
mlockall
mmap
mmroff
modfind
modfnext
modnext
modstat
moduli
more
motd
mount
mprotect
mptable
msdos
msdosfs
msgattrib
msgcat
msgcmp
msgcomm
msgconv
msgen
msgexec
msgfilter
msgfmt
msggrep
msginit
msgmerge
msgs
msgunfmt
msguniq
mskanji
msql2mysql
msync
mt
munlock
munlockall
munmap
mv
myisamchk
myisamlog
myisampack
mysql
mysqlaccess
mysqladmin
mysqlbinlog
mysqlcheck
mysqld
mysqldump
mysqld_multi
mysqld_safe
mysqlhotcopy
mysqlimport
mysqlshow
mysql_config
mysql_fix_privilege_tables
mysql_zap
namespace
nanosleep
nawk
nc
ncal
ncplist
ncplogin
ncplogout
neqn
netconfig
netgroup
netid
netstat
networks
newaliases
newgrp
nex
nfsstat
nfssvc
ngettext
nice
nl
nm
nmount
nohup
nologin
notify
nroff
nseq
nslookup
ntp_adjtime
ntp_gettime
nvi
nview
objcopy
objdump
objformat
ocsp
od
onintr
open
openssl
opieaccess
opieinfo
opiekey
opiekeys
opiepasswd
option
options
oqmgr
pack
package
packagens
pagesize
palette
pam_auth
panedwindow
parray
passwd
paste
patch
pathchk
pathconf
pawd
pax
pbm
pcre
pcreapi
pcrebuild
pcrecallout
pcrecompat
pcrecpp
pcregrep
pcrematching
pcrepartial
pcrepattern
pcreperform
pcreposix
pcreprecompile
pcresample
pcretest
perl
perl56delta
perl58delta
perl561delta
perl570delta
perl571delta
perl572delta
perl573delta
perl581delta
perl582delta
perl583delta
perl584delta
perl585delta
perl586delta
perl587delta
perl588delta
perl5004delta
perl5005delta
perlaix
perlamiga
perlapi
perlapio
perlapollo
perlartistic
perlbeos
perlbook
perlboot
perlbot
perlbs2000
perlbug
perlcall
perlcc
perlce
perlcheat
perlclib
perlcn
perlcompile
perlcygwin
perldata
perldbmfilter
perldebguts
perldebtut
perldebug
perldelta
perldgux
perldiag
perldoc
perldos
perldsc
perlebcdic
perlembed
perlepoc
perlfaq
perlfaq1
perlfaq2
perlfaq3
perlfaq4
perlfaq5
perlfaq6
perlfaq7
perlfaq8
perlfaq9
perlfilter
perlfork
perlform
perlfreebsd
perlfunc
perlglossary
perlgpl
perlguts
perlhack
perlhist
perlhpux
perlhurd
perlintern
perlintro
perliol
perlipc
perlirix
perlivp
perljp
perlko
perllexwarn
perllinux
perllocale
perllol
perlmachten
perlmacos
perlmacosx
perlmint
perlmod
perlmodinstall
perlmodlib
perlmodstyle
perlmpeix
perlnetware
perlnewmod
perlnumber
perlobj
perlop
perlopenbsd
perlopentut
perlos2
perlos390
perlos400
perlothrtut
perlpacktut
perlplan9
perlpod
perlpodspec
perlport
perlqnx
perlre
perlref
perlreftut
perlrequick
perlreref
perlretut
perlrun
perlsec
perlsolaris
perlstyle
perlsub
perlsyn
perlthrtut
perltie
perltoc
perltodo
perltooc
perltoot
perltrap
perltru64
perltw
perlunicode
perluniintro
perlutil
perluts
perlvar
perlvmesa
perlvms
perlvos
perlwin32
perlxs
perlxstut
perror
pfbtops
pftp
pgrep
phones
photo
pic
pickup
piconv
pid
pipe
pkcs7
pkcs8
pkcs12
pkg_add
pkg_check
pkg_create
pkg_delete
pkg_info
pkg_sign
pkg_version
pkill
pl2pm
place
pod2html
pod2latex
pod2man
pod2text
pod2usage
podchecker
podselect
poll
popd
popup
posix_madvise
postalias
postcat
postconf
postdrop
postfix
postkick
postlock
postlog
postmap
postqueue
postsuper
pr
pread
preadv
printcap
printenv
printf
proc
procfs
profil
protocols
prove
proxymap
ps
psed
psroff
pstruct
ptrace
publickey
pushd
puts
pwd
pwrite
pwritev
qmgr
qmqpd
quota
quotactl
radiobutton
raise
rand
ranlib
rcp
rcs
rcsclean
rcsdiff
rcsfile
rcsfreeze
rcsintro
rcsmerge
read
readelf
readlink
readonly
readv
realpath
reboot
recv
recvfrom
recvmsg
red
ree
refer
regexp
registry
regsub
rehash
remote
rename
repeat
replace
req
reset
resolver
resource
return
rev
revoke
rfcomm_sppd
rfork
rhosts
ripemd
ripemd160
rlog
rlogin
rm
rmd160
rmdir
rpc
rpcgen
rs
rsa
rsautl
rsh
rtld
rtprio
rup
ruptime
rusers
rwall
rwho
s2p
safe
sasl
sasldblistusers2
saslpasswd2
sbrk
scache
scale
scan
sched
sched_getparam
sched_getscheduler
sched_get_priority_max
sched_get_priority_min
sched_rr_get_interval
sched_setparam
sched_setscheduler
sched_yield
scon
scp
script
scrollbar
sdiff
sed
seek
select
selection
semctl
semget
semop
send
sendbug
sendfile
sendmail
sendmsg
sendto
services
sess_id
set
setegid
setenv
seteuid
setfacl
setgid
setgroups
setitimer
setlogin
setpgid
setpgrp
setpriority
setregid
setresgid
setresuid
setreuid
setrlimit
setsid
setsockopt
settc
settimeofday
setty
setuid
setvar
sftp
sh
sha
sha1
sha256
shar
shells
shift
shmat
shmctl
shmdt
shmget
showq
shutdown
sigaction
sigaltstack
sigblock
sigmask
sigpause
sigpending
sigprocmask
sigreturn
sigsetmask
sigstack
sigsuspend
sigvec
sigwait
size
slapadd
slapcat
slapd
slapdn
slapindex
slappasswd
slaptest
sleep
slogin
slurpd
smbutil
smime
smtp
smtpd
socket
socketpair
sockstat
soelim
sort
source
spawn
speed
spinbox
spkac
splain
split
squid
squid_ldap_auth
squid_ldap_group
squid_unix_group
sscop
ssh
sshd_config
ssh_config
stab
startslip
stat
statfs
stop
string
strings
strip
stty
su
subst
sum
suspend
swapoff
swapon
switch
symlink
sync
sysarch
syscall
sysconftool
sysconftoolcheck
systat
s_client
s_server
s_time
tabs
tail
talk
tar
tbl
tclsh
tcltest
tclvars
tcopy
tcpdump
tcpslice
tcsh
tee
tell
telltc
telnet
term
termcap
terminfo
test
texindex
texinfo
text
textdomain
tfmtodit
tftp
then
threads
time
tip
tk
tkerror
tkvars
tkwait
tlsmgr
tmac
top
toplevel
touch
tput
tr
trace
trafshow
trap
troff
true
truncate
truss
tset
tsort
tty
ttys
type
tzfile
ui
ul
ulimit
umask
unalias
uname
uncomplete
uncompress
undelete
unexpand
unhash
unifdef
unifdefall
uniq
units
unknown
unlimit
unlink
unmount
unset
unsetenv
until
unvis
update
uplevel
uptime
upvar
usbhidaction
usbhidctl
users
utf8
utimes
utmp
utrace
uudecode
uuencode
uuidgen
vacation
variable
verify
version
vfork
vgrind
vgrindefs
vi
vidcontrol
vidfont
view
virtual
vis
vt220keys
vwait
w
wait
wait3
wait4
waitpid
wall
wc
wget
what
whatis
where
whereis
which
while
who
whoami
whois
window
winfo
wish
wm
write
writev
wtmp
x509
xargs
xgettext
xmlwf
xstr
xsubpp
yacc
yes
ypcat
ypchfn
ypchpass
ypchsh
ypmatch
yppasswd
ypwhich
yyfix
zcat
zcmp
zdiff
zegrep
zfgrep
zforce
zgrep
zmore
znew
_exit
__syscall
 
FreeBSD/Linux/UNIX General Commands Manual
Hypertext Man Pages
tmac
 
GROFF_TMAC(5)							 GROFF_TMAC(5)



NAME
       groff_tmac - macro files in the roff typesetting system

DESCRIPTION
       The  roff(7) type-setting system provides a set of macro packages suit-
       able for special kinds of documents.  Each  macro  package  stores  its
       macros  and  definitions in a file called the package's tmac file.  The
       name is deduced from `TroffMACros'.

       The tmac files are normal roff source documents, except that they  usu-
       ally  contain  only  definitions  and setup commands, but no text.  All
       tmac files are kept in a single or a small number of  directories,  the
       tmac directories.

GROFF MACRO PACKAGES
       groff  provides	all classical macro packages, some more full packages,
       and some secondary packages for special purposes.  Note that it is  not
       possible  to use multiple primary macro packages at the same time; say-
       ing e.g.

	      sh# groff -m man -m ms foo

       or

	      sh# groff -m man foo -m ms bar

       will fail.

   Man Pages
       man    This is the  classical  macro  package  for  UNIX  manual  pages
	      (man   pages);   it   is	quite  handy  and  easy  to  use;  see
	      groff_man(7).

       doc
       mdoc   An alternative macro package for man pages mainly  used  in  BSD
	      systems;	it provides many new features, but it is not the stan-
	      dard for man pages; see groff_mdoc(7).

   Full Packages
       The packages in this section provide a complete set of macros for writ-
       ing  documents  of  any	kind,  up to whole books.  They are similar in
       functionality; it is a matter of taste which one to use.

       me     The classical me macro package; see groff_me(7).

       mm     The semi-classical mm macro package; see groff_mm(7).

       mom    The new mom macro package, only available in groff.  As this  is
	      not  based  on other packages, it can be freely designed.  So it
	      is expected to become quite a nice, modern macro	package.   See
	      groff_mom(7).

       ms     The classical ms macro package; see groff_ms(7).

   Special Packages
       The macro packages in this section are not intended for stand-alone us-
       age, but can be used to add special functionality to  any  other  macro
       package or to plain groff.

       papersize
	      This  macro  file  is  already loaded at start-up by troff so it
	      isn't necessary to call it explicitly.  It provides an interface
	      to  set  the  paper  size  on  the  command line with the option
	      -dpaper=size.  Possible values for size are the same as the pre-
	      defined  papersize  values in the DESC file (only lowercase; see
	      groff_font(5) for more) except a7-d7.  An appended l (ell) char-
	      acter  denotes  landscape  orientation.  Examples: a4, c3l, let-
	      terl.

	      Most output drivers need additional command line switches -p and
	      -l  to  override the default paper length and orientation as set
	      in the driver specific DESC file.  For example, use the  follow-
	      ing for PS output on A4 paper in landscape orientation:

	      sh# groff -Tps -dpaper=a4l -P-pa4 -P-l -ms foo.ms > foo.ps

       pic    This  file provides proper definitions for the macros PS and PE,
	      needed for the pic(1) preprocessor.  They will center each  pic-
	      ture.   Use it only if your macro package doesn't provide proper
	      definitions for those two macros (actually, most of them already
	      have).

       pspic  A  single  macro	is  provided in this file, PSPIC, to include a
	      PostScript graphic in a document.  It makes only sense for  out-
	      put  devices  which support inclusion of PS images: -Tps, -Tdvi,
	      and -Thtml; the file is then loaded automatically.  Syntax:

		     .PSPIC [-L|-R|-I n] file [width [height]]

	      file is the name of the file containing the illustration;  width
	      and  height  give  the  desired width and height of the graphic.
	      The width and height arguments may have scaling  indicators  at-
	      tached;  the  default  scaling  indicator is i.  This macro will
	      scale the graphic uniformly in the x and y directions so that it
	      is  no  more  than  width wide and height high.  By default, the
	      graphic will be horizontally centered.  The -L  and  -R  options
	      cause  the graphic to be left-aligned and right-aligned, respec-
	      tively.  The -I option causes the graphic to be  indented  by  n
	      (default scaling indicator is m).

       trace  Use  this for tracing macro calls.  It is only useful for debug-
	      ging.  See groff_trace(7).

       tty-char
	      Overrides the definition of standard troff characters  and  some
	      groff characters for tty devices.  The optical appearance is in-
	      tentionally inferior compared to that of normal  tty  formatting
	      to allow processing with critical equipment.

       www    Additions  of elements known from the html format, as being used
	      in the internet (World Wide Web) pages; this includes URL  links
	      and mail addresses; see groff_www(7).

NAMING
       In  classical  roff  systems, there was a funny naming scheme for macro
       packages, due to a simplistic design in option parsing.	Macro packages
       were  always  included by option -m; when this option was directly fol-
       lowed by its argument without an intervening space, this looked like  a
       long  option  preceded by a single minus -- a sensation in the computer
       stone age.  To make this optically working for macro package names, all
       classical  macro  packages  choose  a name that started with the letter
       `m', which was omitted in the naming of the macro file.

       For example, the macro package for the man pages was called man,  while
       its macro file tmac.an.	So it could be activated by the argument an to
       option -m, or -man for short.

       For similar reasons, macro packages that did not start with an `m'  had
       a  leading  `m' added in the documentation and in talking; for example,
       the package corresponding to tmac.doc was called mdoc in the documenta-
       tion,  although	a more suitable name would be doc.  For, when omitting
       the space between the option and its argument, the command line	option
       for activating this package reads -mdoc.

       To  cope  with  all  situations,  actual versions of groff(1) are smart
       about both naming schemes by providing two macro files for the inflict-
       ed  macro  packages;  one with a leading `m', the other one without it.
       So in groff, the man macro package may be specified as on of  the  fol-
       lowing four methods:

	      sh# groff -m man
	      sh# groff -man
	      sh# groff -mman
	      sh# groff -m an

       Recent packages that do not start with `m' do not use an additional `m'
       in the documentation.  For example, the www macro package may be speci-
       fied only as one of the two methods:

	      sh# groff -m www
	      sh# groff -mwww

       Obviously, variants like -mmwww would not make much sense.

       A second strange feature of classical troff was to name macro files ac-
       cording to tmac.name.  In modern operating systems, the type of a  file
       is  specified  as postfix, the file name extension.  Again, groff copes
       with this situation by searching both anything.tmac  and  tmac.anything
       if only anything is specified.

       The  easiest  way  to  find out which macro packages are available on a
       system is to check the man page groff(1), or the contents of  the  tmac
       directories.

       In  groff,  most  macro	packages  are  described  in  man pages called
       groff_name(7), with a leading `m' for the classical packages.

INCLUSION
       There are several ways to use a macro package in a document.  The clas-
       sical  way  is  to  specify the troff/groff option -m name at run-time;
       this makes the contents of the macro package name available.  In groff,
       the  file  name.tmac  is  searched  within the tmac path; if not found,
       tmac.name will be searched for instead.

       Alternatively, it is also possible to include a macro  file  by	adding
       the  request  .so  filename into the document; the argument must be the
       full file name of an existing file, possibly with the  directory  where
       it  is  kept.   In groff, this was improved by the similar request .mso
       package, which added searching in the tmac path, just  like  option  -m
       does.

       Note  that in order to resolve the .so and .mso requests, the roff pre-
       processor soelim(1) must be called if the files	to  be	included  need
       preprocessing.	This  can be done either directly by a pipeline on the
       command line or by using the troff/groff option -s.  man  calls	soelim
       automatically.

       For     example,    suppose    a    macro    file    is	  stored    as
       /usr/share/tmac/macros.tmac  and  is  used  in  some  document	called
       docu.roff.

       At run-time, the formatter call for this is

	      sh# groff -m macrofile document.roff

       To include the macro file directly in the document either

	      .mso macrofile.tmac

       is used or

	      .so /usr/share/tmac/macros.tmac

       In both cases, the formatter is called with

	      sh# groff -s docu.roff

       If  you	want to write your own groff macro file, call it whatever.tmac
       and put it in some directory of the tmac path, see section FILES.  Then
       documents can include it with the .mso request or the option -m.

WRITING MACROS
       A  roff(7)  document is a text file that is enriched by predefined for-
       matting constructs, such as requests, escape sequences, strings, numer-
       ic  registers, and macros from a macro package.	These elements are de-
       scribed in roff(7).

       To give a document a personal style, it is most useful  to  extend  the
       existing elements by defining some macros for repeating tasks; the best
       place for this is near the beginning of the document or in  a  separate
       file.

       Macros  without arguments are just like strings.  But the full power of
       macros reveals when arguments are passed with a macro call.  Within the
       macro  definition,  the arguments are available as the escape sequences
       $1, ..., $9, $[...], $*, and $@, the name under	which  the  macro  was
       called  is  in  $0,  and  the number of arguments is in register 0; see
       groff(7).

   Copy-in Mode
       The phase when groff reads a macro is called copy-in mode in roff-talk.
       This  is comparable to the C preprocessing phase during the development
       of a program written in the C language.

       In this phase, groff interprets all backslashes; that  means  that  all
       escape  sequences  in  the  macro  body are interpreted and replaced by
       their value.  For constant expression, this is wanted, but strings  and
       registers that might change between calls of the macro must be protect-
       ed from being evaluated.  This is most  easily  done  by  doubling  the
       backslash  that	introduces the escape sequence.  This doubling is most
       important for the positional parameters.  For example, to print	infor-
       mation  on the arguments that were passed to the macro to the terminal,
       define a macro named `.print_args', say.

	      .ds midpart was called with
	      .de print_args
	      .  tm \f[I]\\$0\f[] \\*[midpart] \\n[.$] arguments:
	      .  tm \\$*
	      ..

       When calling this macro by

	      .print_args arg1 arg2

       the following text is printed to the terminal:

	      print_args was called with the following 2 arguments:
	      arg1 arg2

       Let's analyze each backslash in the macro definition.  As the position-
       al parameters and the number of arguments will change with each call of
       the macro their leading backslash must be  doubled,  which  results  in
       \\$*  and  \\[.$].  The same applies to the macro name because it could
       be called with an alias name, so \\$0.

       On the other hand, midpart is a constant string, it will not change, so
       no  doubling  for  \*[midpart].	The \f escape sequences are predefined
       groff elements for setting the font within the text.  Of  course,  this
       behavior will not change, so no doubling with \f[I] and \f[].

   Draft Mode
       Writing groff macros is easy when the escaping mechanism is temporarily
       disabled.  In groff, this is done by enclosing the macro  definition(s)
       into  a pair of .eo and .ec requests.  Then the body in the macro defi-
       nition is just like a normal part of the document -- text  enhanced  by
       calls  of  requests, macros, strings, registers, etc.  For example, the
       code above can be written in a simpler way by

	      .eo
	      .ds midpart was called with
	      .de print_args
	      .  tm \f[I]\$0\f[] \*[midpart] \n[.$] arguments:
	      .  tm \$*
	      ..
	      .ec

       Unfortunately, draft mode cannot be used universally.  Although	it  is
       good  enough  for defining normal macros, draft mode will fail with ad-
       vanced applications, such as  indirectly  defined  strings,  registers,
       etc.  An optimal way is to define and test all macros in draft mode and
       then do the backslash doubling as a final step; do not forget to remove
       the .eo request.

   Tips for Macro Definitions
       o Start	every line with a dot, for example, by using the groff request
	 .nop for text lines, or write your own macro that handles  also  text
	 lines with a leading dot.

	 .de Text
	 .  if (\\n[.$] == 0) \
	 .    return
	 . nop \)\\$*[rs]
	 ..

       o Write a comment macro that works both for copy-in and draft mode; for
	 as escaping is off in draft mode, trouble  might  occur  when	normal
	 comments are used.  For example, the following macro just ignores its
	 arguments, so it acts like a comment line:

	 .de c
	 ..
	 .c This is like a comment line.

       o In long macro definitions, make ample use of comment lines  or  empty
	 lines for a better structuring.

       o To  increase  readability,  use  groff's indentation facility for re-
	 quests and macro calls (arbitrary whitespace after the leading  dot).

   Diversions
       Diversions  can	be  used  to  realize  quite advanced programming con-
       structs.  They are comparable to pointers to large data	structures  in
       the C programming language, but their usage is quite different.

       In their simplest form, diversions are multi-line strings, but they get
       their power when diversions are used dynamically  within  macros.   The
       information  stored  in a diversion can be retrieved by calling the di-
       version just like a macro.

       Most of the problems arising with diversions can be avoided if you  are
       conscious  about  the  fact  that  diversions always deal with complete
       lines.  If diversions are used  when  the  line	buffer	has  not  been
       flashed,  strange  results  are produced; not knowing this, many people
       get desperate about diversions.	To ensure that a diversion works, line
       breaks  should be added at the right places.  To be on the secure side,
       enclose everything that has to do with diversions into a pair  of  line
       breaks;	for example, by amply using .br requests.  This rule should be
       applied to diversion definition, both inside and outside,  and  to  all
       calls of diversions.  This is a bit of overkill, but it works nicely.

       [If  you really need diversions which should ignore the current partial
       line, use environments to save the current partial line and/or use  the
       .box request.]

       The  most  powerful  feature  using  diversions is to start a diversion
       within a macro definition and end it within another macro.  Then every-
       thing  between each call of this macro pair is stored within the diver-
       sion and can be manipulated from within the macros.

FILES
       All macro names must be named name.tmac to fully use  the  tmac	mecha-
       nism.   tmac.name  as  with classical packages is possible as well, but
       deprecated.

       The macro files are kept in the tmac  directories;  a  colon  separated
       list of these constitutes the tmac path.

       The search sequence for macro files is (in that order):

       o the directories specified with troff/groff's -M command line option

       o the directories given in the $GROFF_TMAC_PATH environment variable

       o the  current  directory  (only if in unsafe mode, which is enabled by
	 the -U command line switch)

       o the home directory

       o a platform-specific directory, being /usr/share/tmac in this  instal-
	 lation

       o a     site-specific	 (platform-independent)    directory,	 being
	 /usr/share/tmac in this installation

       o the main tmac directory, being /usr/share/tmac in this installation

ENVIRONMENT
       $GROFF_TMAC_PATH
	      A colon separated list of additional tmac directories  in  which
	      to  search  for macro files.  See the previous section for a de-
	      tailed description.

AUTHOR
       Copyright (C) 2000, 2001, 2002, 2003, 2004  Free  Software  Foundation,
       Inc.

       This document is distributed under the terms of the FDL (GNU Free Docu-
       mentation License) version 1.1 or later.  You should  have  received  a
       copy of the FDL on your system, it is also available on-line at the GNU
       copyleft site .

       This document is part of groff, the  GNU  roff  distribution.   It  was
       written	by  Bernd Warken ; it is maintained by Werner
       Lemberg .

SEE ALSO
       A complete reference for all parts of the groff system is found in  the
       groff info(1) file.

       groff(1)
	      an overview of the groff system.

       groff_man(7),
       groff_mdoc(7),
       groff_me(7),
       groff_mm(7),
       groff_mom(7),
       groff_ms(7),
       groff_trace(7),
       groff_www(7).
	      the groff tmac macro packages.

       groff(7)
	      the groff language.

       The Filesystem Hierarchy Standard is available at the FHS web site
       .



Groff Version 1.19.2	       15 November 2005 		 GROFF_TMAC(5)
=208633
+87
(59)