Groff

From wikinotes

Groff is the tool used by the unixes to produce manpages. Groff was built in the 90s as an opensource spinoff of troff.


Usage

groff -man -Tascii < manpage/without/gz/name.1 | less   # preview of manpage

Files

Basically, you can use $PREFIX/man/man1. You can also extend your $MANPATH to add other manpage locations.

/usr/local/man/man1
FreeBSD manpages
/usr/man/man1/*
Archlinux manpages

Man-Numbers

manpages are divided into numbered-sections. Each number has an implied meaning for a particular level of system. The number/meaning varies a little, but generally this is the number-scheme, and it's meaning.

NOTE:

Note that section 5 i file-formats and conventions. This is fairly generally applicable, but if it is used, it should probably be referenced in man 1 , or have it's own separate manpage since many users will only check man 1


    1      # User Commands
    2      # System Calls
    3      # C Library Functions
    4      # Devices and Special Files
    5      # File Formats and Conventions
    6      # Games et. al.
    7      # Miscellanea
    8      # System Administration tools and Daemons

Syntax

Template

.TH WALLPAPERMGR 1 "28 August 2017"  \" (title) (man-num) (date)
\#=================================

.SH NAME                             \" section-header
\#======
wallpapermgr /- manage/apply a shared collection of wallpapers

.SH SYNOPSIS
\#==========

wallmgr
\#      <positional>      <keyword>
   data  [-h|-a|-b]  [-t \fI/path/file\fP ]
   archive


.SH "DESCRIPTION"
\#===============
A short description of what this program actually does.


.SS "OPTIONS"       \" sub-section
\#-----------
.TP                 \" 2+ lines will follow. An item, then multiline description. (desc is indented)
\fB-h               \" arguments are bold
\fRShow Quick-Help  \" description is roman

.TP
\fB-l /fI/path/file/fR   \" arguments are bold, values are italic
Set loglevel

.SH "FILES"
\#=========
.TP
\fB~/.config/wallpapermgr/config.yml
\fRthe main configuration file
.TP
\fB~/.config/wallpapermgr/data.json
\fRcontains order of wallpapers

.SH "SEE ALSO"           \" other manpages you might be interested in
\#============
feh(1), python(1)

Comments

Some Text   \" comment with '\n'
Some Text   \# comment without '\n'

Headers

.TH <title> <man-section-num> "<date>"    # title-header
.SH <title>                               # section-header
.SS <title>                               # sub-section (indented)

Standard Manpage Sections are:

  • NAME
  • SYNOPSIS
  • DESCRIPTION
  • EXAMPLES
  • FILES
  • OPTIONS
  • SEE ALSO
  • AUTHOR

Tags

Tags are two-part items that contain an item, and a description. Items/descriptions are aligned.

.TP
item_1

multiline
description
of 
item

.TP
item_2

multiline
description
of
item


Font

\fB                       # font-bold    
\fI                       # font-italic
\fR                       # font-roman
\fP                       # previous-font

Formatting

.in +3                   # indent following lines by 3x spaces

.vS                      # .vS/.vE  mark a code-block
for f in mylist:
    if f in ('/path/a', '/path/b'):
        print( f )
.vE


References

http://www.linuxjournal.com/article/1158 linux-journal tutorial