home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 13 / CDA13.ISO / DOC / HOWTO / MINI / MAN_PAGE < prev    next >
Encoding:
Text File  |  1996-04-20  |  31.6 KB  |  801 lines

  1.  
  2.                        THE LINUX MAN-PAGE-HOWTO
  3.  
  4.         Copyright 1995,96 by Jens Schweikhardt <schweikh@noc.dfn.de>
  5.             See further information on copying conditions below.
  6.  
  7.                          Last update: April 1996
  8.                    Corrections and suggestions welcome!
  9.  
  10.    This HOWTO explains what you should bear in mind when you are going
  11.    to write on-line documentation -- a so called man page -- that you
  12.    want to make accessible via the man(1) command.
  13.  
  14.    Throughout this HOWTO, a manual entry is simply referred to as a
  15.    man page, regardless of actual length and without sexist intention.
  16.  
  17.    Table of contents:
  18.    ------------------
  19.  
  20.    0)  A few thoughts on documentation
  21.    1)  How are man pages accessed?
  22.    2)  How should a formatted man page look like?
  23.    3)  How do I document several programs/functions in a single man page?
  24.    4)  Which macro package should I use?
  25.    5)  What preprocessors may I use?
  26.    6)  Should I distribute source and/or already formatted documentation?
  27.    7)  What are the font conventions?
  28.    8)  How do I polish my man page?
  29.    9)  How do I get a plain text man page without all that ^H^_ stuff?
  30.   10)  How do I get a high quality PostScript man page?
  31.   11)  How do I get apropos and whatis to work?
  32.  
  33.    A)  Copying conditions
  34.  
  35.  
  36.  
  37.  0)   A few thoughts on documentation
  38.  ====================================
  39.  
  40.  Why do we write documentation? Silly question. Because we want others to
  41.  be able to use our program, library function or whatever we have written
  42.  and made available. But writing documentation is not all there is to it:
  43.  
  44.  + documentation must be accessible.
  45.    If it's hidden in some non-standard place where the documentation
  46.    related tools won't find it -- how can it serve its purpose?
  47.  
  48.  + documentation must be reliable and accurate.
  49.    There's nothing more annoying than having program behaviour and
  50.    documentation disagree. Users will curse you, send you hate mail and
  51.    throw your work into the bit bucket, with the firm intent to never
  52.    install anything written by that jerk again.
  53.  
  54.  The historical and well known way documentation is accessed on UNIX
  55.  is via the man(1) command. This HOWTO describes what you have to do to
  56.  write a man page that will be correctly processed by the documentation
  57.  related tools. The most important of these tools are man(1), xman(1x),
  58.  apropos(1), makewhatis(8) and catman(8).
  59.  
  60.  Reliability and accuracy of the information are, of course, up to you.
  61.  But even in this respect you will find some ideas below that help you
  62.  avoid some common glitches.
  63.  
  64.  1)   How are man pages accessed?
  65.  ================================
  66.  
  67.  You need to know the precise mechanism how man pages are accessed
  68.  in order to give your man page the right name and install it in the
  69.  right place.  Any man page belongs to a specific section, which is
  70.  denoted by a single character. The most common sections under Linux
  71.  and their human readable names are
  72.  
  73.  Section   The human readable name
  74.  
  75.     1      User commands that may be started by everyone.
  76.     2      System calls, that is, functions provided by the kernel.
  77.     3      Subroutines, that is, library functions.
  78.     4      Devices, that is, special files in the /dev directory.
  79.     5      File format descriptions, e.g. /etc/passwd.
  80.     6      Games, self-explanatory.
  81.     7      Miscellaneous, e.g. macro packages, conventions.
  82.     8      System administration tools that only root can execute.
  83.     9      Another (Linux specific) place for kernel routine documentation.
  84.     n      New documentation, that may be moved to a more appropriate section.
  85.     o      Old documentation, that may be kept for a grace period.
  86.     l      Local documentation referring to this particular system.
  87.  
  88.  The name of the source file for a man page (the input to the formatting
  89.  system) is the name of the command, function or file name, followed by
  90.  a dot, followed by the section. If you write the documentation on the
  91.  format of the `passwd' file you have to name the source file `passwd.5'.
  92.  Here we also have an example of a file name that is the same as a
  93.  command name. There might be even a library subroutine named passwd.
  94.  Sectioning is the usual way to resolve these ambiguities: The command
  95.  description is found in the file `passwd.1' and the hypothetical
  96.  library subroutine in `passwd.3'.
  97.  
  98.    Sometimes additional characters are appended and the file name looks
  99.    for example like `xterm.1x' or `wish.1tk'. The intent is to indicate
  100.    that this is documentation for an X Window program or a Tk application,
  101.    respectively. Some manual browsers can make use of this additional
  102.    information. For example xman will use `xterm(x)' and `wish(tk)' in
  103.    the list of available documentation.
  104.  
  105.    Please don't use the n, o and l sections; according to the File System
  106.    Standard these sections are deprecated. Stick to the numeric sections.
  107.  
  108.  Beware of name clashes with existing programs, functions or file names.
  109.  It is certainly a bad idea to write yet another editor and call it
  110.  ed, sed (for smart ed) or red (for Rocky's ed). By making sure your
  111.  program's name is unique you avoid that someone executes your program
  112.  and reads someone else's man page or vice versa. Checking out the lsm
  113.  database on a program name is a place to start doing so.
  114.  
  115.  Now we know the name to give our file. The next decision is which
  116.  directory it will finally get installed (say, when the user runs
  117.  `make install' for your package.)  On Linux, all man pages are
  118.  below directories mentioned in the environment variable MANPATH. The
  119.  doc related tools use it quite similar like the shell uses PATH to
  120.  locate executables. In fact, MANPATH has the same format as PATH.
  121.  Both hold a colon separated list of directories (with the exception
  122.  that MANPATH does not allow empty fields and relative pathnames but
  123.  has absolute names only.) If MANPATH is not set or not exported, a
  124.  default will be used that contains at least the /usr/man directory.
  125.  To speed up the search and to keep directories small, the directories
  126.  specified by MANPATH (the so called base directories) contain a bunch
  127.  of subdirectories named `man<s>' where <s> stands for the one character
  128.  section introduced in the table above. Not all of the sections may
  129.  be represented by a subdirectory because there simply is no reason to
  130.  keep an empty `mano' subdirectory. However, there may be directories
  131.  named `cat<s>', `dvi<s>' and `ps<s>' which hold documentation that is
  132.  ready to display or print. More on this later.  The only other file
  133.  in any base directory should be a file named `whatis'. The purpose
  134.  and creation of this file will also be described under paragraph 11).
  135.  The safest way to have a man page for section <s> installed in
  136.  the right place is to put it in the directory /usr/man/man<s>. A good
  137.  Makefile, however, will allow the user to chose a base directory, by
  138.  means of a make variable, MANDIR, say. Most of the GNU packages can be
  139.  configured with the --prefix=/what/ever option. The manuals will then
  140.  be installed under the base directory /what/ever/man. I suggest you
  141.  also provide a way to do something similar.
  142.  
  143.    With the advent of the Linux File System Standard (FS-Stnd), things
  144.    became more complicated. The FS-Stnd 1.2 states that "Provisions must
  145.    be made in the structure of /usr/man to support manual pages which
  146.    are written in different (or multiple) languages." This is achieved
  147.    by introducing another directory level that distinguishes between
  148.    different languages. Quoting again from FS-Stnd 1.2:
  149.  
  150.    "This naming of language subdirectories of /usr/man is based on
  151.    Appendix E of the POSIX 1003.1 standard which describes the locale
  152.    identification string -- the most well accepted method to describe
  153.    a cultural environment. The <locale> string is:
  154.  
  155.        <language>[_<territory>][.<character-set>][,<version>]"
  156.  
  157.    (See the FS-Stnd for a few common <locale> strings.)
  158.    According to these guidelines, we have our man pages in
  159.    /usr/man/<locale>/man[1-9lno]. The formatted versions should then be
  160.    in /usr/man/<locale>/cat[1-9lno] of course, otherwise we could only
  161.    provide them for a single locale.
  162.  
  163.    HOWEVER, I can not recommend switching to that structure at this time.
  164.    The FS-Stnd 1.2 also allows that "Systems which use a unique language
  165.    and code set for all manual pages may omit the <locale> substring and
  166.    store all manual pages in <mandir>. For example, systems which only
  167.    have English manual pages coded with ASCII, may store manual pages
  168.    (the man[1-9] directories) directly in /usr/man. (That is the traditional
  169.    circumstance and arrangement in fact.)"
  170.  
  171.    I would not switch until all tools (like xman, tkman, info and many
  172.    others that read man pages) can cope with the new structure.
  173.  
  174.  
  175.  2)   How should a formatted man page look like?
  176.  ===============================================
  177.  
  178.  Let me present you an example. Below I will explain it in detail.
  179.  Due to the nature of this document, it can't show the different typefaces
  180.  (bold and italics). Please refer to the paragraph "What are the font
  181.  conventions?" for further explanations.
  182.  
  183.  Here comes the man page for the (hypothetical) foo program. 
  184.  
  185.  
  186.  
  187. FOO(1)                     User Manuals                    FOO(1)
  188.  
  189.  
  190. NAME
  191.        foo - frobnicate the bar library
  192.  
  193. SYNOPSIS
  194.        foo [-bar] [-c config-file ] file ...
  195.  
  196. DESCRIPTION
  197.        foo  frobnicates the bar library by tweaking internal sym-
  198.        bol tables. By default it  parses  all  baz  segments  and
  199.        rearranges  them in reverse order by time for the xyzzy(1)
  200.        linker to find them. The symdef entry is  then  compressed
  201.        using  the WBG (Whiz-Bang-Gizmo) algorithm.  All files are
  202.        processed in the order specified.
  203.  
  204. OPTIONS
  205.        -b     Do not write `busy' to stdout while processing.
  206.  
  207.        -c config-file
  208.               Use the alternate system wide  config-file  instead
  209.               of /etc/foo.conf.  This overrides any FOOCONF envi-
  210.               ronment variable.
  211.  
  212.        -a     In addition to the baz  segments,  also  parse  the
  213.               blurfl headers.
  214.  
  215.        -r     Recursive  mode.  Operates  as fast as lightning at
  216.               the expense of a megabyte of virtual memory.
  217.  
  218. FILES
  219.        /etc/foo.conf
  220.               The system wide configuration file. See foo(5)  for
  221.               further details.
  222.        ~/.foorc
  223.               Per user configuration file. See foo(5) for further
  224.               details.
  225.  
  226. ENVIRONMENT
  227.        FOOCONF
  228.               If non-null the full pathname for an alternate sys-
  229.               tem wide foo.conf.  Overridden by the -c option.
  230.  
  231. DIAGNOSTICS
  232.        The following diagnostics may be issued on stderr:
  233.  
  234.        Bad magic number.
  235.               The  input file does not look like an archive file.
  236.        Old style baz segments.
  237.               foo can only handle new style baz  segments.  COBOL
  238.               object libraries are not supported in this version.
  239.  
  240. BUGS
  241.        The command name should have been chosen more carefully to
  242.        reflect its purpose.
  243.  
  244. AUTHOR
  245.        Jens Schweikhardt <jens@kssun3.rus.uni-stuttgart.de>
  246.  
  247. SEE ALSO
  248.        bar(1), foo(5), xyzzy(1)
  249.  
  250.  
  251. Linux                       MARCH 1995                          1
  252.  
  253.  
  254.  
  255.  Here's the explanation as I promised.
  256.  
  257.  
  258.       The NAME section
  259.  
  260.  ...is the only required section. Man pages without a name section are
  261.  as useful as refrigerators at the north pole. This section also has
  262.  a standardized format consisting of a comma separated list of program
  263.  or function names followed by a dash followed by a short (usually one
  264.  line) description what functionality the program (function, file) is
  265.  supposed to provide. By means of makewhatis(8) the name sections make
  266.  it into the whatis database files. Makewhatis is the reason why the name
  267.  section must exist and why it must adhere to the format I described. In
  268.  the groff source it must look like
  269.  
  270.      .SH NAME
  271.      foo \- frobnicate the bar library
  272.  
  273.  The \- is of importance here. The backslash is needed to make the dash
  274.  distinct from a hyphenation dash that may appear in either the command
  275.  name or the one line description.
  276.  
  277.  
  278.       The SYNOPSIS section
  279.  
  280.  ...is intended to give a short overview on available program options.
  281.  For functions this sections lists corresponding include files and the
  282.  prototype so the programmer knows the type and number of arguments as
  283.  well as the return type.
  284.  
  285.  
  286.       The DESCRIPTION section
  287.  
  288.  ...gives an eloquent explanation why your sequence of 0s and 1s is worth
  289.  anything at all. Here's where you write down all your knowledge. This is
  290.  the Hall Of Fame. Win other programmer's and user's admiration by making
  291.  this section the source of reliable and detailed information. Explain
  292.  what the arguments are for, the file format, what algorithms do the
  293.  dirty jobs.
  294.  
  295.  
  296.       The OPTIONS section
  297.  
  298.  ...gives a description for any option how it affects program behaviour.
  299.  You knew that, didn't you?
  300.  
  301.  
  302.       The FILES section
  303.  
  304.  ...lists files the program or function uses. For example, configuration
  305.  files, startup files, files the program directly operates on. It is
  306.  a good idea to give the full pathname of these files and to make the
  307.  install process modify the directory part to match user preferences: the
  308.  groff manuals have a default prefix of /usr/local, so they reference
  309.  /usr/local/lib/groff/* by default. However, if you install using
  310.  'make prefix=/opt/gnu' the references in the man page change to
  311.  /opt/gnu/lib/groff/*
  312.  
  313.  
  314.       The ENVIRONMENT section
  315.  
  316.  ...lists all environment variables that affect your program or
  317.  function and tells how, of course. Most commonly the variables will
  318.  hold pathnames, filenames or default options.
  319.  
  320.  
  321.       The DIAGNOSTICS section
  322.  
  323.  ...should give an overview of the most common error messages from your
  324.  program and how to cope with them. There's no need to explain system
  325.  error error messages (from perror(3)) or fatal signals (from psignal(3))
  326.  as they can appear during execution of any program.
  327.  
  328.  
  329.       The BUGS section
  330.  
  331.  ...should ideally be non-existent. If you're brave, you can describe
  332.  here limitations, known inconveniences, features that others may regard
  333.  as misfeatures. If you're not so brave, rename it the TO DO section ;-)
  334.  
  335.  
  336.       The AUTHOR section
  337.  
  338.  ...is nice to have in case there are gross errors in the documentation
  339.  or program behaviour (Bzzt!) and you want to mail a bug report.
  340.  
  341.  
  342.       The SEE ALSO section
  343.  
  344.  ...is a list of related man pages in alphabetical order.
  345.  Conventionally, it is the last section.
  346.  
  347.  
  348.  You are free to invent other sections if they really don't fit in one
  349.  of those described so far.
  350.  
  351.   So how exactly did you generate that man page?
  352.   I expected that question, here's the source, Luke:
  353.  
  354.  
  355. .\" Process this file with
  356. .\" groff -man -Tascii foo.1
  357. .\"
  358. .TH FOO 1 "MARCH 1995" Linux "User Manuals"
  359. .SH NAME
  360. foo \- frobnicate the bar library
  361. .SH SYNOPSIS
  362. .B foo [-bar] [-c
  363. .I config-file
  364. .B ]
  365. .I file
  366. .B ...
  367. .SH DESCRIPTION
  368. .B foo
  369. frobnicates the bar library by tweaking internal
  370. symbol tables. By default it parses all baz segments
  371. and rearranges them in reverse order by time for the
  372. .BR xyzzy (1)
  373. linker to find them. The symdef entry is then compressed
  374. using the WBG (Whiz-Bang-Gizmo) algorithm.
  375. All files are processed in the order specified.
  376. .SH OPTIONS
  377. .IP -b
  378. Do not write `busy' to stdout while processing.
  379. .IP "-c config-file"
  380. Use the alternate system wide
  381. .I config-file
  382. instead of
  383. .IR /etc/foo.conf .
  384. This overrides any
  385. .B FOOCONF
  386. environment variable.
  387. .IP -a
  388. In addition to the baz segments, also parse the
  389. blurfl headers.
  390. .IP -r
  391. Recursive mode. Operates as fast as lightning
  392. at the expense of a megabyte of virtual memory.
  393. .SH FILES
  394. .I /etc/foo.conf
  395. .RS
  396. The system wide configuration file. See
  397. .BR foo (5)
  398. for further details.
  399. .RE
  400. .I ~/.foorc
  401. .RS
  402. Per user configuration file. See
  403. .BR foo (5)
  404. for further details.
  405. .SH ENVIRONMENT
  406. .IP FOOCONF
  407. If non-null the full pathname for an alternate system wide
  408. .IR foo.conf .
  409. Overridden by the
  410. .B -c
  411. option.
  412. .SH DIAGNOSTICS
  413. The following diagnostics may be issued on stderr:
  414.  
  415. Bad magic number.
  416. .RS
  417. The input file does not look like an archive file.
  418. .RE
  419. Old style baz segments.
  420. .RS
  421. .B foo
  422. can only handle new style baz segments. COBOL
  423. object libraries are not supported in this version.
  424. .SH BUGS
  425. The command name should have been chosen more carefully
  426. to reflect its purpose.
  427. .SH AUTHOR
  428. Jens Schweikhardt <jens@kssun3.rus.uni-stuttgart.de>
  429. .SH "SEE ALSO"
  430. .BR bar (1),
  431. .BR foo (5),
  432. .BR xyzzy (1)
  433.  
  434.  
  435.  
  436.  
  437.  
  438.   3) How do I document several programs/functions in a single man page?
  439.      ==================================================================
  440.  
  441.   Many programs (grep, egrep) and functions (printf, fprintf, ...) are
  442.   documented in a single man page. However, these man pages would be
  443.   quite useless if they were only accessible under one name. We can not
  444.   expect a user to remember that the egrep man page is actually the grep
  445.   man page. It is therefore necessary to have the man page available
  446.   under different names. You have several possibilities to achieve this:
  447.  
  448.   1) have identical copies for each name.
  449.   2) connect all man pages using hard links.
  450.   3) symbolic links pointing to the actual man page.
  451.   4) use groff's `source' mechanism provided by the `.so' macro.
  452.  
  453.   The first way is obviously a waste of disk space. The second is not
  454.   recommended because intelligent versions of the catman program can save
  455.   a lot of work by looking at the the file type or contents.  Hard links
  456.   will prevent catman from being clever. (catman's purpose is to format
  457.   all man pages so that they can be displayed more quickly.) The third
  458.   alternative has a slight drawback: if flexibility is a concern, you
  459.   have to be aware that there are file systems that do not support
  460.   symbolic links. The upshot of this is that the Best Thing (TM) is
  461.   using groff's source mechanism.
  462.  
  463.   Here's how to do it:
  464.   If you want to have your man page available under the names `foo' and
  465.   `bar' in section 1, then put the man page in foo.1 and have bar.1 look
  466.   like this:
  467.  
  468.          .so man1/foo.1
  469.  
  470.   It is important to specify the `man1/' directory part as well as the
  471.   file name `foo.1' because when groff is run by the browser it will
  472.   have the manual base directory as its current working directory (cwd)
  473.   and groff interprets .so arguments relative to the cwd.
  474.  
  475.   4)   Which macro package should I use?
  476.   ======================================
  477.  
  478.   There are a number of macro packages especially designed for use in
  479.   writing man pages. Usually they are in the groff macro directory
  480.   /usr/lib/groff/tmac.  The file names are tmac.<something>, where
  481.   <something> is the argument to groff's -m option. Groff will use
  482.   tmac.<something> when it is given the `-m <something>' option. Often
  483.   the blank between `-m' and `<something>' is omitted so we may say
  484.   `groff -man' when we are formatting man pages using the tmac.an
  485.   macro package. That's the reason for the strange name `tmac.an'.
  486.   Besides tmac.an there is another popular macro package, tmac.doc,
  487.   which originated at the University of California at Berkeley. Many
  488.   BSD man pages use it and it seems that UCB has made it its standard
  489.   for documentation.  The tmac.doc macros are much more flexible but
  490.   alas, there are manual browsers that will not use them but always call
  491.   groff -man. For example, all xman programs I have seen will screw up
  492.   on man pages requiring tmac.doc.  So do yourself a favor: use tmac.an
  493.   -- use of any other macro package is considered harmful. Tmac.andoc is
  494.   a pseudo macro package that takes a look at the source and then loads
  495.   either tmac.an or tmac.doc. Actually any man page browser should use
  496.   it but until now not all of them do, so it is best we cling to ye olde
  497.   tmac.an. Anything I tell you from now on and concerning macros only
  498.   holds true for tmac.an.
  499.  
  500.     If you want to use the tmac.doc macros anyway, here is a pointer to
  501.     detailed information on how to use them:
  502.  
  503.                    http://www.bsdi.com/bsdi-man
  504.  
  505.     There is a searchable index form on the page. Enter mdoc and it will
  506.     find you mdoc(7) and mdoc.samples(7), a tutorial sampler for
  507.     writing BSD man pages.
  508.  
  509.   5)   What preprocessors may I use?
  510.   ==================================
  511.  
  512.   Groff comes with at least three preprocessors, tbl, eqn, and pic (on
  513.   some systems they are named gtbl, geqn and gpic.) Their purpose is to
  514.   translate preprocessor macros and their data to regular troff input.
  515.   Tbl is a table preprocessor, eqn is an equations/maths preprocessor
  516.   and pic is a picture preprocessor. Please refer to the man pages for
  517.   more information on what functionality they provide.
  518.  
  519.   To put it in a nutshell: don't write man pages requiring ANY preprocessor.
  520.  
  521.   Eqn will generally produce terrible output for typewriter-like devices,
  522.   unfortunately the type of device 99% of all man pages are viewed on.
  523.   For example, XAllocColor.3x uses a few formulas with exponentiation.
  524.   Due to the nature of typewriter-like devices the exponent will be on
  525.   the same line as the base. N to the power of two appears as `N2'.
  526.  
  527.   Tbl should be avoided because all xman programs I have seen fail
  528.   on them.  Xman 3.1.6 uses the following command to format man pages,
  529.   e.g. signal(7):
  530.  
  531.     gtbl /usr/man/man7/signal.7 | geqn | gtbl | groff -Tascii -man \
  532.     > /tmp/xmana01760 2> /dev/null
  533.  
  534.   which screws up for sources using gtbl, because gtbl output is
  535.   fed again into gtbl. The effect is a man page without your table.
  536.   I don't know if it's a bug or a feature that gtbl chokes on its own
  537.   output or if xman could be a little smarter not using gtbl twice...
  538.   Anyway, if you want a table, format it yourself and put it between
  539.   .nf .fi lines so that it will be left unformatted. You won't have bold
  540.   and italics this way but this beats having your table swallowed any day.
  541.  
  542.   I have yet to see a man page requiring pic preprocessing. But I would
  543.   not like it. As you can see above, xman will not use it and groff will
  544.   certainly do the funky wadakiki on the input.
  545.  
  546.  
  547.  
  548.   6)   Should I distribute source and/or already formatted documentation?
  549.   =======================================================================
  550.  
  551.   Let me give the pros (+) and cons (-) of a few selected possibilities:
  552.   1) Source only:
  553.      + smaller distribution package.
  554.      - inaccessible on systems without groff.
  555.   2) Uncompressed formatted only: 
  556.      + accessible even on systems without groff.
  557.      - the user can't generate a dvi or postscript file.
  558.      - waste of disk space on systems that also handle compressed pages.
  559.   3) Compressed formatted only:
  560.      + accessible even on systems without groff.
  561.      - the user can't generate a dvi or postscript file.
  562.      - which compression format would you use? .Z? .z? .gz? All of them?
  563.   4) Source and uncompressed formatted:
  564.      + accessible even on systems without groff.
  565.      - larger distribution package
  566.      - some systems may expect compressed formatted man pages.
  567.      - redundant information on systems equipped with groff.
  568.  
  569.   IMHO it is best to distribute source only. The argument that it's
  570.   inaccessible on systems without groff does not matter. The 500+ man
  571.   pages of the Linux Documentation Project are source only. The man
  572.   pages of XFree86 are source only. The man pages from the FSF are source
  573.   only. In fact, I have rarely seen software distributed with formatted
  574.   man pages. If any sysadmin is really concerned about having man pages
  575.   accessible then he also has groff installed.
  576.  
  577.  
  578.  
  579.   7)   What are the font conventions?
  580.   ===================================
  581.  
  582.   First of all: don't use direct font operators like \fB \fP etc. Use
  583.   macros which take arguments. This way you avoid a common glitch:
  584.   forgetting the font change at the end of the word and having the bold
  585.   or italic extend up to the next font change. Believe me, it happens
  586.   more often than you think.
  587.  
  588.   The tmac.an macros provide the following type faces:
  589.  
  590.        .B      Bold
  591.        .BI     Bold alternating with italics
  592.        .BR     Bold alternating with Roman
  593.        .I      Italics
  594.        .IB     Italics alternating with bold
  595.        .IR     Italics alternating with Roman
  596.        .RB     Roman alternating with bold
  597.        .RI     Roman alternating with italics
  598.        .SM     Small (scaled 9/10 of the regular size)
  599.        .SB     Small bold (NOT small alternating with bold)
  600.  
  601.   X alternating with Y means that the odd arguments are typeset in X
  602.   while the even arguments are typeset in Y. For example
  603.   .BI "Arg 1 is Bold, " "Arg 2 is Italics, " "and Bold, " "and Italics."
  604.   The double quotes are needed to include white space into an argument.
  605.  
  606.   So much for what's available. Here's how you should make use of the
  607.   different typefaces: (portions shamelessly stolen from man(7))
  608.  
  609.   Although there are many arbitrary conventions for man pages in the
  610.   UNIX world, the existence of several hundred Linux-specific man pages
  611.   defines our standards:
  612.  
  613.   For functions, the arguments are always specified using italics, even
  614.   in the SYNOPSIS section, where the rest of the function is specified
  615.   in bold:
  616.  
  617.       .BI "myfunction(int " argc ", char **" argv );
  618.  
  619.   Filenames are always in italics, except in the SYNOPSIS section, where
  620.   included files are in bold. So you should use
  621.  
  622.       .I /usr/include/stdio.h and
  623.       .B #include <stdio.h>
  624.  
  625.   Special macros, which are usually in upper case, are in bold:
  626.  
  627.       .B MAXINT
  628.  
  629.   When enumerating a list of error codes, the codes are in bold. This
  630.   list usually uses the .TP (paragraph with hanging tag) macro as follows:
  631.  
  632.       .TP
  633.       .B EBADF
  634.       .I fd
  635.       is not a valid file descriptor.
  636.       .TP
  637.       .B EINVAL
  638.       .I fd
  639.       is unsuitable for reading
  640.  
  641.   Any reference to another man page (or to the subject of the current
  642.   man page) is in bold. If the manual section number is given, it is
  643.   given in roman, without any spaces:
  644.  
  645.       .BR man (7)
  646.  
  647.   Acronyms look best when typeset in small type face. So I recommend
  648.       .SM UNIX     .SM ASCII     .SM TAB      .SM NFS      .SM LALR(1)
  649.  
  650.   8)   Polishing your man page
  651.   ============================
  652.  
  653.   Following are some guidelines that increase reliability, readability
  654.   and 'formatability' of your documentation.
  655.  
  656.   + Test examples if they work (use cut and paste to give your shell the
  657.     exact wording from the man page) read output of your command into
  658.     your man page, don't type what you THINK your program will print.
  659.  
  660.   + Proof read, ispell, have someone else read it, especially if you are
  661.     not a native English speaker. The HOWTO you are reading by now has
  662.     not yet passed the latter test. Do you want to volunteer?
  663.  
  664.   + Test your man page: Does groff complain when you format your man page?
  665.     It's nice to have the groff command line in a comment.  Does the
  666.     man(1) command complain when you call `man yourprog'?  Does the way
  667.     how man(1) uses the formatting system produce the expected result?
  668.     Will xman(1x) and tkman(1tk) cope with your manual?  XFree86 3.1
  669.     has xman 3.1.6 - X11R6, it will try to uncompress using
  670.  
  671.         gzip -c -d < %s > %s
  672.         zcat < %s > %s
  673.  
  674.   + Will makewhatis(8) be able to extract the one-line description
  675.     from the NAME section?
  676.  
  677.  
  678.  
  679.   9)  How do I get a plain text man page without all that ^H^_ stuff?
  680.       ===============================================================
  681.  
  682.   Have a look at col(1), col can filter out backspace sequences. Just in
  683.   case you can't wait that long: 
  684.  
  685.   funnyprompt% groff -t -e -mandoc -Tascii manpage.1 | col -bx > manpage.txt
  686.  
  687.   The -t and -e switches tell groff to preprocess using tbl and eqn.
  688.   This is overkill for man pages that don't require preprocessing but it
  689.   doesn't harm apart from a few CPU cycles wasted. On the other hand,
  690.   not using -t when it is actually required does harm: the table is
  691.   terribly formatted.  You can even find out (well, "guess" is a better
  692.   word) what command is needed to format a certain groff document (not
  693.   just man pages) by issuing
  694.  
  695.   funnyprompt% grog /usr/man/man7/signal.7
  696.   groff -t -man /usr/man/man7/signal.7
  697.  
  698.   "Grog" stands for "GROff Guess", and it does what it says--guess, if
  699.   it were perfect we wouldn't need options any more. I've seen it guess
  700.   wrong on macro packages, but never on preprocessors.
  701.  
  702.   Here is a little perl script I wrote that can delete the page headers
  703.   and footers, therefore saving you a few pages when printing long and
  704.   elaborate man pages. Save it in a file named strip-header & chmod 755.
  705.  
  706.     #!/usr/bin/perl -n
  707.     #  make it slurp the whole file at once:
  708.     undef $/; 
  709.     #  delete page breaks:
  710.     s/\n{4}\S.{50,}\n{6}\S.{50,}\n{3}/\n/g;            
  711.     #  delete first header & last footer:
  712.     s/\n\S.{50,}\n//g;
  713.     #  collapse two or more blank lines into a single one:
  714.     s/\n{3,}/\n\n/g;
  715.     #  see what's left...
  716.     print;
  717.  
  718.  You have to use it as the first filter after the 'man' command as it relies
  719.  on the number of newlines being output by groff. For example:
  720.  
  721.     funnyprompt% man bash | strip-headers | col -bx > bash.txt
  722.  
  723.  
  724.  
  725.  10)  How do I get a high quality PostScript man page?
  726.       ===================================================
  727.  
  728.   funnyprompt% groff -t -e -mandoc -Tps manpage.1 > manpage.ps
  729.  
  730.   Print that using your favorite PostScript printer/interpreter.
  731.   See question 9) for explanation of options.
  732.  
  733.  
  734.  
  735.  11)  How do I get `apropos' and `whatis' to work?
  736.       ============================================
  737.  
  738.   Suppose you wonder what compilers are installed on your system and how
  739.   these can be invoked. To answer this (frequently asked) question you say
  740.  
  741.   funnyprompt% apropos compiler
  742.   f77 (1) - Fortran 77 compiler
  743.   gcc (1) - GNU C and C++ compiler
  744.   pc (1) - Pascal compiler
  745.   
  746.   Apropos and whatis are used to give a quick response which man page
  747.   has information on a certain topic. Both programs search a number
  748.   of files named `whatis' that may be found in each of the manual base
  749.   directories.  Like I said before, the whatis data base files contain
  750.   a one line entry for any man page in the respective directory tree. In
  751.   fact, that line is exactly the NAME section (to be precise: joined on
  752.   one line and with hyphenation removed, also note that the section is
  753.   mentioned within parentheses). The whatis data base files are created
  754.   with the makewhatis(8) program. There are several versions around,
  755.   so please refer to the man page what options are available. In order
  756.   for makewhatis to be able to extract the NAME sections correctly it
  757.   is important that you, the manual writer, adhere to the NAME section
  758.   format described under paragraph 2).  The difference between apropos
  759.   and whatis is where in the line and what they are looking for. Apropos
  760.   (which is equivalent to man -k) searches the argument string anywhere on
  761.   the line whereas whatis (equivalent to man -f) tries to match a complete
  762.   command name only on the part before the dash. Consequently, `whatis
  763.   cc' will report if there is a cc manual and remain quiet for gcc.
  764.  
  765.  
  766.                  Corrections and suggestions welcome!
  767.  
  768.  
  769.  
  770.  
  771.  
  772.  A)  Copying conditions
  773.      ==================
  774.  
  775.  Copyright 1995,96 by Jens Schweikhardt
  776.  <schweikh@noc.dfn.de>
  777.  Voice: ++49 7151 909516
  778.  
  779. Unless otherwise stated, Linux HOWTO documents are copyrighted by
  780. their respective authors. Linux HOWTO documents may be reproduced and
  781. distributed in whole or in part, in any medium physical or electronic,
  782. as long as this copyright notice is retained on all copies. Commercial
  783. redistribution is allowed and encouraged; however, the author would like
  784. to be notified of any such distributions.
  785.  
  786. All translations, derivative works, or aggregate works incorporating
  787. any Linux HOWTO documents must be covered under this copyright notice.
  788. That is, you may not produce a derivative work from a HOWTO and impose
  789. additional restrictions on its distribution. Exceptions to these rules
  790. may be granted under certain conditions; please contact the Linux HOWTO
  791. coordinator at the address given below.
  792.  
  793. In short, we wish to promote dissemination of this information through
  794. as many channels as possible. However, we do wish to retain copyright
  795. on the HOWTO documents, and would like to be notified of any plans to
  796. redistribute the HOWTOs.
  797.  
  798. If you have questions, please contact Greg Hankins, the Linux HOWTO
  799. coordinator, at gregh@sunsite.unc.edu via email.
  800.  
  801.