1groff_www(7) Miscellaneous Information Manual groff_www(7)
2
3
4
6 groff_www - GNU roff macros for authoring web pages
7
9 groff -m www [option ...] [file ...]
10
12 This manual page describes the GNU www macro package, which is part of
13 the groff(7) document formatting system. This macro file is automati‐
14 cally loaded by the default troffrc file when the formatter (usually
15 groff(1)) is called with either of the options -Thtml or -Txhtml. To
16 see hyperlinks in action, format this man page using one of those op‐
17 tions.
18
19 This document is a basic guide; the HTML output driver (grohtml) re‐
20 mains in an alpha state. It has been included with the distribution to
21 encourage testing.
22
23 Here is a summary of the functions found in this macro set.
24
25 .JOBNAME split output into multiple files
26 .HX automatic heading level cut off
27 .BCL specify colours on a web page
28 .BGIMG specify background image
29 .URL create a URL using two parameters
30 .FTP create an FTP reference
31 .MTO create an HTML email address
32 .TAG generate an HTML name
33 .IMG include an image file
34 .PIMG include PNG image
35 .MPIMG place PNG on the margin and wrap text around it
36 .HnS begin heading
37 .HnE end heading
38 .LK emit automatically collected links.
39 .HR produce a horizontal rule
40 .NHR suppress automatic generation of rules.
41 .HTL only generate HTML title
42 .HEAD add data to <head> block
43 .ULS unorder list begin
44 .ULE unorder list end
45 .OLS ordered list begin
46 .OLE ordered list end
47 .DLS definition list begin
48 .DLE definition list end
49 .LI insert a list item
50 .DC generate a drop capital
51 .HTML pass an HTML raw request to the device driver
52 .CDS code example begin
53 .CDE code example end
54 .ALN place links on left of main text.
55 .LNS start a new two-column table with links in the left.
56 .LNE end the two-column table.
57 .LINKSTYLE initialize default URL attributes.
58
60 .JOBNAME filename
61 Split output into multiple HTML files. A file is split whenever
62 a .SH or .NH 1 is encountered. Its argument is the file stem
63 name for future output files. This option is equivalent to
64 grohtml's -j option.
65
66 .HX n Specify the cut off depth when generating links from section
67 headings. For example, a parameter of 2 would cause grohtml to
68 generate a list of links for .NH 1 and .NH 2 but not for .NH 3.
69 Whereas
70
71 .HX 0
72
73 tells grohtml that no heading links should be created at all.
74 Another method for turning automatic headings off is by issuing
75 the command-line switch -P-l to groff.
76
77 .BCL foreground background active not-visited visited
78 This macro takes five parameters: foreground, background, active
79 hypertext link, hypertext link not yet visited, and visited hy‐
80 pertext link colour.
81
82 .BGIMG imagefile
83 the only parameter to this macro is the background image file.
84
85 .URL url [description] [after]
86 generates a URL using either one, two, or three arguments. The
87 first parameter is the actual URL, the second is the name of the
88 link, and the third is optional stuff to be printed immediately
89 afterwards. If description and after are absent then the URL
90 becomes the anchor text. Hyphenation is disabled while printing
91 the actual URL; explicit breakpoints should be inserted with the
92 \: escape sequence. Here is how to encode foo ⟨http://foo
93 .org/⟩:
94
95 .URL http://\:foo\:.org/ foo :
96
97 If this is processed by a device other than -Thtml or -Txhtml it
98 appears as:
99
100 foo ⟨http://foo.org⟩:
101
102 The URL macro can be of any type; for example, we can reference
103 Eric Raymond's pic guide ⟨pic.html⟩ by:
104
105 .URL pic\:.html "Eric Raymond's pic guide"
106
107 .MTO address [description] [after]
108 Generate an email HTML reference. The first argument is manda‐
109 tory as the email address. The optional second argument is the
110 text you see in your browser. If an empty argument is given,
111 address is used instead. An optional third argument is stuff
112 printed immediately afterwards. Hyphenation is disabled while
113 printing the actual email address. For example, Joe User ⟨joe@
114 user.org⟩ can be achieved by the following macro:
115
116 .MTO joe@user.org "Joe User"
117
118 All URLs currently are treated as consuming no textual space in
119 groff. This could be considered as a bug since it causes some
120 problems. To circumvent this, www.tmac inserts a zero-width
121 character which expands to a harmless space (only if run with
122 -Thtml or -Txhtml).
123
124 .FTP url [description] [after]
125 indicates that data can be obtained via FTP. The first argument
126 is the URL and the second is the browser text. A third argu‐
127 ment, similar to the macros above, is intended for stuff printed
128 immediately afterwards. The second and the third parameter are
129 optional. Hyphenation is disabled while printing the actual
130 URL. As an example, here is the location of the GNU FTP server
131 ⟨ftp://ftp.gnu.org/⟩. The macro example above can be specified
132 as:
133
134 .FTP ftp://\:ftp\:.gnu\:.org/ "GNU FTP server" .
135
136 .TAG name
137 Generates an HTML name tag from its argument. This can then be
138 referenced using the URL ⟨#URL⟩ macro. As you can see, you must
139 precede the tag name with # since it is a local reference. This
140 link was achieved via placing a TAG in the URL description
141 above; the source looks like this:
142
143 .TP
144 .B URL
145 generates
146 .TAG URL
147 a URL using either two or three arguments.
148 ...
149
150 .IMG [-R|-L|-C] filename [width] [height]
151 Include a picture into the document. The first argument is the
152 horizontal location: right, left, or center (-R, -L, or -C).
153 Alignment is centered by default (-C). The second argument is
154 the filename. The optional third and fourth arguments are the
155 width and height. If the width is absent it defaults to 1 inch.
156 If the height is absent it defaults to the width. This maps
157 onto an HTML img tag. If you are including a PNG image then it
158 is advisable to use the PIMG macro.
159
160 .PIMG [-R|-L|-C] filename [width [height]]
161 Include an image in PNG format. This macro takes exactly the
162 same parameters as the IMG macro; it has the advantage of work‐
163 ing with PostScript and HTML devices also since it can automati‐
164 cally convert the image into the EPS format, using the following
165 programs of the netpbm package: pngtopnm, pnmcrop, and pnmtops.
166 If the document isn't processed with -Thtml or -Txhtml it is
167 necessary to use the -U option of groff.
168
169 .MPIMG [-R|-L] [-G gap] filename [width [height]]
170 Place a PNG image on the margin and wrap text around it. The
171 first parameters are optional. The alignment: left or right (-L
172 or -R) specifies the margin where the picture is placed at. The
173 default alignment is left (-L). Optionally, -G gap can be used
174 to arrange a gap between the picture and the text that wraps
175 around it. The default gap width is zero.
176 The first non-optional argument is the filename. The optional
177 following arguments are the width and height. If the width is
178 absent it defaults to 1 inch. If the height is absent it de‐
179 faults to the width. Example:
180
181 .MPIMG -L -G 2c foo.png 3c 1.5c
182
183 The height and width may also be given as percentages. The
184 PostScript device calculates the width from the .l register and
185 the height from the .p register. For example:
186
187 .MPIMG -L -G 2c foo.png 15%
188
189 .HnS n Begin heading. The numeric heading level n is specified by the
190 first parameter. Use this macro if your headings contain URL,
191 FTP or MTO macros. Example:
192
193 .HnS 1
194 .HR
195 GNU Troff
196 .URL https://\:www\:.gnu\:.org/\:software/\:groff/
197 \[em]a
198 .URL http://www\:.gnu\:.org/ GNU
199 project.
200 .HR
201 .HnE
202
203 In this case you might wish to disable automatic links to head‐
204 ings. This can be done via -P-l from the command line.
205
206 .HnE End heading.
207
208 .LK Force grohtml to place the automatically generated links at this
209 position.
210
211 .HR Generate a full-width horizontal rule for -Thtml and -Txhtml.
212 No effect for all other devices.
213
214 .NHR Suppress generation of the top and bottom rules which grohtml
215 emits by default.
216
217 .HTL Generate an HTML title only. This differs from the TL macro of
218 the ms macro package which generates both an HTML title and an
219 <H1> heading. Use it to provide an HTML title as search engine
220 fodder but a graphic title in the document. The macro termi‐
221 nates when a space or break is seen (.sp, .br).
222
223 .HEAD Add arbitrary HTML data to the <head> block. Ignored if not
224 processed with -Thtml or -Txhtml. Example:
225
226 .HEAD "<link \
227 rel=""icon"" \
228 type=""image/png"" \
229 href=""http://foo.org//bar.png""/>"
230
231 .HTML All text after this macro is treated as raw HTML. If the docu‐
232 ment is processed without -Thtml or -Txhtml then the macro is
233 ignored. Internally, this macro is used as a building block for
234 other higher-level macros.
235
236 For example, the BGIMG macro is defined as
237
238 .de BGIMG
239 . HTML <body background=\\$1>
240 ..
241
242 .DC l text [color]
243 Produce a drop capital. The first parameter is the letter to be
244 dropped and enlarged, the second parameter text is the adjoining
245 text whose height the first letter should not exceed. The op‐
246 tional third parameter is the color of the dropped letter. It
247 defaults to black.
248
249 .CDS Start displaying a code section in constant width font.
250
251 .CDE End code display
252
253 .ALN [color] [percentage]
254 Place section heading links automatically to the left of the
255 main text. The color argument is optional and if present indi‐
256 cates which HTML background color is to be used under the links.
257 The optional percentage indicates the amount of width to devote
258 to displaying the links. The default values are #eeeeee and 30
259 for color and percentage width, respectively. This macro should
260 only be called once at the beginning of the document. After
261 calling this macro each section heading emits an HTML table con‐
262 sisting of the links in the left and the section text on the
263 right.
264
265 .LNS Start a new two-column table with links in the left column.
266 This can be called if the document has text before the first .SH
267 and if .ALN is used. Typically this is called just before the
268 first paragraph and after the main title as it indicates that
269 text after this point should be positioned to the right of the
270 left-hand navigational links.
271
272 .LNE End a two-column table. This should be called at the end of the
273 document if .ALN was used.
274
275 .LINKSTYLE color [ fontstyle [ openglyph closeglyph ] ]
276 Initialize default URL attributes to be used if this macro set
277 is not used with the HTML device. The macro set initializes it‐
278 self with the following call
279
280 .LINKSTYLE blue CR \[la] \[ra]
281
282 but these values will be superseded by a user call to LINKSTYLE.
283
285 By default grohtml generates links to all section headings and places
286 these at the top of the HTML document. (See LINKS ⟨#LK⟩ for details of
287 how to switch this off or alter the position).
288
290 tbl(1) tables are rendered as PNG images. Paul DuBois's approach with
291 tblcvt(1), part of the troffcvt distribution ⟨http://www.snake.net/
292 software/troffcvt/⟩, should be explored.
293
295 /usr/share/groff/1.23.0/tmac/www.tmac
296
298 The www macro package was written by Gaius Mulley ⟨gaius@glam.ac.uk⟩,
299 with additions by Werner Lemberg ⟨wl@gnu.org⟩ and Bernd Warken
300 ⟨groff-bernd.warken-72@web.de⟩.
301
303 groff(1), troff(1), grohtml(1), netpbm(1)
304
305
306
307groff 1.23.0 2 November 2023 groff_www(7)