Listing 1.“Hello World” Program
  
\# hello.gr
\#
\# a groff macro demonstration:
\#
\# groff -Tps hello.gr > hello.ps
\#
\#################################
\#
\# assume we have the following aliases:
.als    ALIAS   als
.ALIAS  STRING  ds
.ALIAS  NUMBER  nr
.ALIAS  MACRO   de
.ALIAS  PTSIZE  ps
\#
\# define variables:
\# note:  the lack of closing quote below
\# is groff syntax, and not a typo!
.STRING  $HELLO    "Hello, world!
.NUMBER  #BIGSIZE  18p
\#
\# define a support macro that simply places
\# all arguments to stream in process:
.MACRO   OUTPUT   __END__
\\$*
.__END__
\#
\# define a user interface macro that gives
\# a big hello, then resumes pointsize:
.MACRO   <hello>  __END__
.    PTSIZE  \\n[#BIGSIZE]u
.    OUTPUT  \\*[$HELLO]
.    PTSIZE
.__END__
\#
\# usage of  friendly greeting here:
.<hello>
\#
  
  
  
  
  
  
  
  
  
    Copyright © 1994 - 2014 Linux Journal.  All rights reserved.