Fix xslt_process() to ensure that it inserts a NULL terminator after the
[PostgreSQL.git] / doc / src / sgml / docguide.sgml
blobd51f32433b05612de43872976ba3c827348db629
1 <!-- $PostgreSQL$ -->
3 <appendix id="docguide">
4 <title>Documentation</title>
6 <para>
7 <productname>PostgreSQL</productname> has four primary documentation
8 formats:
10 <itemizedlist>
11 <listitem>
12 <para>
13 Plain text, for pre-installation information
14 </para>
15 </listitem>
16 <listitem>
17 <para>
18 <acronym>HTML</acronym>, for on-line browsing and reference
19 </para>
20 </listitem>
21 <listitem>
22 <para>
23 PDF or PostScript, for printing
24 </para>
25 </listitem>
26 <listitem>
27 <para>
28 man pages, for quick reference.
29 </para>
30 </listitem>
31 </itemizedlist>
33 Additionally, a number of plain-text <filename>README</filename> files can
34 be found throughout the <productname>PostgreSQL</productname> source tree,
35 documenting various implementation issues.
36 </para>
38 <para>
39 <acronym>HTML</acronym> documentation and man pages are part of a
40 standard distribution and are installed by default. PDF and
41 PostScript format documentation is available separately for
42 download.
43 </para>
45 <sect1 id="docguide-docbook">
46 <title>DocBook</title>
47 <para>
48 The documentation sources are written in
49 <firstterm>DocBook</firstterm>, which is a markup language
50 superficially similar to <acronym>HTML</acronym>. Both of these
51 languages are applications of the <firstterm>Standard Generalized
52 Markup Language</firstterm>, <acronym>SGML</acronym>, which is
53 essentially a language for describing other languages. In what
54 follows, the terms DocBook and <acronym>SGML</acronym> are both
55 used, but technically they are not interchangeable.
56 </para>
58 <para>
59 <productname>DocBook</productname> allows an author to specify the
60 structure and content of a technical document without worrying
61 about presentation details. A document style defines how that
62 content is rendered into one of several final forms. DocBook is
63 maintained by the <ulink url="http://www.oasis-open.org">
64 OASIS group</ulink>. The <ulink url="http://www.oasis-open.org/docbook">
65 official DocBook site</ulink> has good introductory and reference documentation and
66 a complete O'Reilly book for your online reading pleasure. The
67 <ulink url="http://newbiedoc.sourceforge.net/metadoc/docbook-guide.html">
68 NewbieDoc Docbook Guide</ulink> is very helpful for beginners.
69 The <ulink url="http://www.freebsd.org/docproj/docproj.html">
70 FreeBSD Documentation Project</ulink> also uses DocBook and has some good
71 information, including a number of style guidelines that might be
72 worth considering.
73 </para>
74 </sect1>
77 <sect1 id="docguide-toolsets">
78 <title>Tool Sets</title>
80 <para>
81 The following tools are used to process the documentation. Some
82 might be optional, as noted.
84 <variablelist>
85 <varlistentry>
86 <term><ulink url="http://www.oasis-open.org/docbook/sgml/">DocBook DTD</ulink></term>
87 <listitem>
88 <para>
89 This is the definition of DocBook itself. We currently use
90 version 4.2; you cannot use later or earlier versions. Note
91 that there is also an <acronym>XML</acronym> version of DocBook
92 &mdash; do not use that.
93 </para>
94 </listitem>
95 </varlistentry>
97 <varlistentry>
98 <term><ulink url="http://www.oasis-open.org/cover/ISOEnts.zip">ISO 8879 character entities</ulink></term>
99 <listitem>
100 <para>
101 These are required by DocBook but are distributed separately
102 because they are maintained by ISO.
103 </para>
104 </listitem>
105 </varlistentry>
107 <varlistentry>
108 <term><ulink url="http://openjade.sourceforge.net">OpenJade</ulink></term>
109 <listitem>
110 <para>
111 This is the base package of <acronym>SGML</acronym> processing.
112 It contains an <acronym>SGML</acronym> parser, a
113 <acronym>DSSSL</acronym> processor (that is, a program to
114 convert <acronym>SGML</acronym> to other formats using
115 <acronym>DSSSL</acronym> stylesheets), as well as a number of
116 related tools. <productname>Jade</productname> is now being
117 maintained by the OpenJade group, no longer by James Clark.
118 </para>
119 </listitem>
120 </varlistentry>
122 <varlistentry>
123 <term><ulink url="http://wiki.docbook.org/topic/DocBookDssslStylesheets">DocBook DSSSL Stylesheets</ulink></term>
124 <listitem>
125 <para>
126 These contain the processing instructions for converting the
127 DocBook sources to other formats, such as
128 <acronym>HTML</acronym>.
129 </para>
130 </listitem>
131 </varlistentry>
133 <varlistentry>
134 <term><ulink url="http://search.cpan.org/dist/SGMLSpm/">SGMLSpm</ulink></term>
135 <listitem>
136 <para>
137 This optional package is used to create man pages.
138 </para>
139 </listitem>
140 </varlistentry>
142 <varlistentry>
143 <term><ulink url="http://docbook2x.sourceforge.net">DocBook2X</ulink></term>
144 <listitem>
145 <para>
146 This optional package is also used to create man pages. You
147 want the <literal>docbook2man-sgmlspl</literal> package, not
148 the main <literal>docbook2x</literal> package.
149 </para>
150 </listitem>
151 </varlistentry>
153 <varlistentry>
154 <term><ulink url="http://jadetex.sourceforge.net">JadeTeX</ulink></term>
155 <listitem>
156 <para>
157 If you want to, you can also install
158 <productname>JadeTeX</productname> to use
159 <productname>TeX</productname> as a formatting backend for
160 <productname>Jade</productname>.
161 <application>JadeTeX</application> can create PostScript or
162 <acronym>PDF</acronym> files (the latter with bookmarks).
163 </para>
165 <para>
166 However, the output from <application>JadeTeX</application> is
167 inferior to what you get from the <acronym>RTF</acronym>
168 backend. Particular problem areas are tables and various
169 artifacts of vertical and horizontal spacing. Also, there is
170 no opportunity to manually polish the results.
171 </para>
172 </listitem>
173 </varlistentry>
174 </variablelist>
175 </para>
177 <para>
178 We have documented experience with several installation methods for
179 the various tools that are needed to process the documentation.
180 These will be described below. There might be some other packaged
181 distributions for these tools. Please report package status to the
182 documentation mailing list, and we will include that information
183 here.
184 </para>
186 <sect2>
187 <title><productname>Linux</productname> <acronym>RPM</acronym> Installation</title>
189 <para>
190 Most vendors provide a complete RPM set for DocBook processing in
191 their distribution. Look for an <quote>SGML</quote> option while
192 installing, or the following packages:
193 <filename>sgml-common</filename>, <filename>docbook</filename>,
194 <filename>stylesheets</filename>, <filename>openjade</filename>
195 (or <filename>jade</filename>). Possibly
196 <filename>sgml-tools</filename> will be needed as well. If your
197 distributor does not provide these then you should be able to make
198 use of the packages from some other, reasonably compatible vendor.
199 </para>
200 </sect2>
202 <sect2>
203 <title>FreeBSD Installation</title>
205 <para>
206 The FreeBSD Documentation Project is itself a heavy user of
207 DocBook, so it comes as no surprise that there is a full set of
208 <quote>ports</quote> of the documentation tools available on
209 FreeBSD. The following ports need to be installed to build the
210 documentation on FreeBSD.
211 <itemizedlist>
212 <listitem>
213 <para><filename>textproc/sp</filename></para>
214 </listitem>
215 <listitem>
216 <para><filename>textproc/openjade</filename></para>
217 </listitem>
218 <listitem>
219 <para><filename>textproc/iso8879</filename></para>
220 </listitem>
221 <listitem>
222 <para><filename>textproc/dsssl-docbook-modular</filename></para>
223 </listitem>
224 <listitem>
225 <para><filename>textproc/docbook-420</filename></para>
226 </listitem>
227 </itemizedlist>
228 </para>
230 <para>
231 A number of things from <filename>/usr/ports/print</filename>
232 (<filename>tex</filename>, <filename>jadetex</filename>) might
233 also be of interest.
234 </para>
236 <para>
237 It's possible that the ports do not update the main catalog file
238 in <filename>/usr/local/share/sgml/catalog.ports</filename> or order
239 isn't proper . Be sure to have the following lines in begining of file:
240 <programlisting>
241 CATALOG "openjade/catalog"
242 CATALOG "iso8879/catalog"
243 CATALOG "docbook/dsssl/modular/catalog"
244 CATALOG "docbook/4.2/catalog"
245 </programlisting>
246 If you do not want to edit the file you can also set the
247 environment variable <envar>SGML_CATALOG_FILES</envar> to a
248 colon-separated list of catalog files (such as the one above).
249 </para>
251 <para>
252 More information about the FreeBSD documentation tools can be
253 found in the <ulink url="http://www.freebsd.org/doc/en_US.ISO8859-1/books/fdp-primer/tools.html">
254 FreeBSD Documentation Project's instructions</ulink>.
255 </para>
256 </sect2>
258 <sect2>
259 <title>Debian Packages</title>
261 <para>
262 There is a full set of packages of the documentation tools
263 available for <productname>Debian GNU/Linux</productname>.
264 To install, simply use:
265 <programlisting>
266 apt-get install openjade1.3
267 apt-get install docbook
268 apt-get install docbook-dsssl
269 apt-get install sgmlspl # for the man pages
270 </programlisting>
271 (The plain <literal>openjade</literal> package installs
272 OpenJade 1.4, which seems not to work.)
273 </para>
274 </sect2>
276 <sect2>
277 <title>Manual Installation from Source</title>
279 <para>
280 The manual installation process of the DocBook tools is somewhat
281 complex, so if you have pre-built packages available, use them.
282 We describe here only a standard setup, with reasonably standard
283 installation paths, and no <quote>fancy</quote> features. For
284 details, you should study the documentation of the respective
285 package, and read <acronym>SGML</acronym> introductory material.
286 </para>
288 <sect3>
289 <title>Installing OpenJade</title>
291 <procedure>
292 <step>
293 <para>
294 The installation of OpenJade offers a GNU-style
295 <literal>./configure; make; make install</literal> build
296 process. Details can be found in the OpenJade source
297 distribution. In a nutshell:
298 <synopsis>
299 ./configure --enable-default-catalog=/usr/local/share/sgml/catalog
300 make
301 make install
302 </synopsis>
303 Be sure to remember where you put the <quote>default
304 catalog</quote>; you will need it below. You can also leave
305 it off, but then you will have to set the environment variable
306 <envar>SGML_CATALOG_FILES</envar> to point to the file
307 whenever you use <application>jade</application> later on.
308 (This method is also an option if OpenJade is already
309 installed and you want to install the rest of the tool chain
310 locally.)
311 </para>
312 </step>
314 <step id="doc-openjade-install">
315 <para>
316 Additionally, you should install the files
317 <filename>dsssl.dtd</filename>, <filename>fot.dtd</filename>,
318 <filename>style-sheet.dtd</filename>, and
319 <filename>catalog</filename> from the
320 <filename>dsssl</filename> directory somewhere, perhaps into
321 <filename>/usr/local/share/sgml/dsssl</filename>. It's
322 probably easiest to copy the entire directory:
323 <synopsis>
324 cp -R dsssl /usr/local/share/sgml
325 </synopsis>
326 </para>
327 </step>
329 <step>
330 <para>
331 Finally, create the file
332 <filename>/usr/local/share/sgml/catalog</filename> and add
333 this line to it:
334 <programlisting>
335 CATALOG "dsssl/catalog"
336 </programlisting>
337 (This is a relative path reference to the file installed in
338 <xref linkend="doc-openjade-install">. Be sure to adjust it
339 if you chose your installation layout differently.)
340 </para>
341 </step>
342 </procedure>
343 </sect3>
345 <sect3>
346 <title>Installing the <productname>DocBook</productname> <acronym>DTD</acronym> Kit</title>
348 <procedure>
349 <step>
350 <para>
351 Obtain the <ulink url="http://www.docbook.org/sgml/4.2/docbook-4.2.zip">
352 DocBook V4.2 distribution</ulink>.
353 </para>
354 </step>
356 <step>
357 <para>
358 Create the directory
359 <filename>/usr/local/share/sgml/docbook-4.2</filename> and change
360 to it. (The exact location is irrelevant, but this one is
361 reasonable within the layout we are following here.)
362 <screen>
363 <prompt>$ </prompt><userinput>mkdir /usr/local/share/sgml/docbook-4.2</userinput>
364 <prompt>$ </prompt><userinput>cd /usr/local/share/sgml/docbook-4.2</userinput>
365 </screen>
366 </para>
367 </step>
369 <step>
370 <para>
371 Unpack the archive:
372 <screen>
373 <prompt>$ </prompt><userinput>unzip -a ...../docbook-4.2.zip</userinput>
374 </screen>
375 (The archive will unpack its files into the current directory.)
376 </para>
377 </step>
379 <step>
380 <para>
381 Edit the file
382 <filename>/usr/local/share/sgml/catalog</filename> (or whatever
383 you told jade during installation) and put a line like this
384 into it:
385 <programlisting>
386 CATALOG "docbook-4.2/docbook.cat"
387 </programlisting>
388 </para>
389 </step>
391 <step>
392 <para>
393 Download the <ulink url="http://www.oasis-open.org/cover/ISOEnts.zip">
394 ISO 8879 character entities archive</ulink>, unpack it, and put the
395 files in the same directory you put the DocBook files in:
396 <screen>
397 <prompt>$ </prompt><userinput>cd /usr/local/share/sgml/docbook-4.2</userinput>
398 <prompt>$ </prompt><userinput>unzip ...../ISOEnts.zip</userinput>
399 </screen>
400 </para>
401 </step>
403 <step>
404 <para>
405 Run the following command in the directory with the DocBook and ISO files:
406 <programlisting>
407 perl -pi -e 's/iso-(.*).gml/ISO\1/g' docbook.cat
408 </programlisting>
409 (This fixes a mixup between the names used in the DocBook
410 catalog file and the actual names of the ISO character entity
411 files.)
412 </para>
413 </step>
414 </procedure>
415 </sect3>
417 <sect3>
418 <title>Installing the DocBook <acronym>DSSSL</acronym> Style Sheets</title>
420 <para>
421 To install the style sheets, unzip and untar the distribution and
422 move it to a suitable place, for example
423 <filename>/usr/local/share/sgml</filename>. (The archive will
424 automatically create a subdirectory.)
425 <screen>
426 <prompt>$</prompt> <userinput>gunzip docbook-dsssl-1.<replaceable>xx</>.tar.gz</userinput>
427 <prompt>$</prompt> <userinput>tar -C /usr/local/share/sgml -xf docbook-dsssl-1.<replaceable>xx</>.tar</userinput>
428 </screen>
429 </para>
431 <para>
432 The usual catalog entry in
433 <filename>/usr/local/share/sgml/catalog</filename> can also be
434 made:
435 <programlisting>
436 CATALOG "docbook-dsssl-1.<replaceable>xx</>/catalog"
437 </programlisting>
438 Because stylesheets change rather often, and it's sometimes
439 beneficial to try out alternative versions,
440 <productname>PostgreSQL</productname> doesn't use this catalog
441 entry. See <xref linkend="docguide-toolsets-configure"> for
442 information about how to select the stylesheets instead.
443 </para>
444 </sect3>
446 <sect3>
447 <title>Installing <productname>JadeTeX</productname></title>
449 <para>
450 To install and use <productname>JadeTeX</productname>, you will
451 need a working installation of <productname>TeX</productname> and
452 <productname>LaTeX2e</productname>, including the supported
453 <productname>tools</productname> and
454 <productname>graphics</productname> packages,
455 <productname>Babel</productname>,
456 <productname><acronym>AMS</acronym> fonts</productname> and
457 <productname>AMS-LaTeX</productname>, the
458 <productname><acronym>PSNFSS</acronym></productname> extension
459 and companion kit of <quote>the 35 fonts</quote>, the
460 <productname>dvips</productname> program for generating
461 <productname>PostScript</productname>, the macro packages
462 <productname>fancyhdr</productname>,
463 <productname>hyperref</productname>,
464 <productname>minitoc</productname>,
465 <productname>url</productname> and
466 <productname>ot2enc</productname>. All of these can be found on
467 your friendly neighborhood <ulink url="http://www.ctan.org">
468 <acronym>CTAN</acronym> site</ulink>.
469 The installation of the <application>TeX</application> base
470 system is far beyond the scope of this introduction. Binary
471 packages should be available for any system that can run
472 <application>TeX</application>.
473 </para>
475 <para>
476 Before you can use <application>JadeTeX</application> with the
477 <productname>PostgreSQL</productname> documentation sources, you
478 will need to increase the size of
479 <application>TeX</application>'s internal data structures.
480 Details on this can be found in the <application>JadeTeX</application>
481 installation instructions.
482 </para>
484 <para>
485 Once that is finished you can install <application>JadeTeX</application>:
486 <screen>
487 <prompt>$</prompt> <userinput>gunzip jadetex-<replaceable>xxx</replaceable>.tar.gz</userinput>
488 <prompt>$</prompt> <userinput>tar xf jadetex-<replaceable>xxx</replaceable>.tar</userinput>
489 <prompt>$</prompt> <userinput>cd jadetex</userinput>
490 <prompt>$</prompt> <userinput>make install</userinput>
491 <prompt>$</prompt> <userinput>mktexlsr</userinput>
492 </screen>
493 The last two need to be done as <systemitem>root</systemitem>.
494 </para>
496 </sect3>
498 </sect2>
500 <sect2 id="docguide-toolsets-configure">
501 <title>Detection by <command>configure</command></title>
503 <para>
504 Before you can build the documentation you need to run the
505 <filename>configure</filename> script as you would when building
506 the <productname>PostgreSQL</productname> programs themselves.
507 Check the output near the end of the run, it should look something
508 like this:
509 <screen>
510 <computeroutput>
511 checking for onsgmls... onsgmls
512 checking for openjade... openjade
513 checking for DocBook V4.2... yes
514 checking for DocBook stylesheets... /usr/lib/sgml/stylesheets/nwalsh-modular
515 checking for sgmlspl... sgmlspl
516 </computeroutput>
517 </screen>
518 If neither <filename>onsgmls</filename> nor
519 <filename>nsgmls</filename> were found then you will not see the
520 remaining 4 lines. <filename>nsgmls</filename> is part of the Jade
521 package. You can pass the environment variables
522 <envar>JADE</envar> and <envar>NSGMLS</envar> to configure to point
523 to the programs if they are not found automatically. If
524 <quote>DocBook V4.2</quote> was not found then you did not install
525 the DocBook DTD kit in a place where Jade can find it, or you have
526 not set up the catalog files correctly. See the installation hints
527 above. The DocBook stylesheets are looked for in a number of
528 relatively standard places, but if you have them some other place
529 then you should set the environment variable
530 <envar>DOCBOOKSTYLE</envar> to the location and rerun
531 <filename>configure</filename> afterwards.
532 </para>
534 </sect2>
535 </sect1>
537 <sect1 id="docguide-build">
538 <title>Building The Documentation</title>
540 <para>
541 Once you have everything set up, change to the directory
542 <filename>doc/src/sgml</filename> and run one of the commands
543 described in the following subsections to build the
544 documentation. (Remember to use GNU make.)
545 </para>
547 <sect2>
548 <title>HTML</title>
550 <para>
551 To build the <acronym>HTML</acronym> version of the documentation:
552 <screen>
553 <prompt>doc/src/sgml$ </prompt><userinput>gmake html</userinput>
554 </screen>
555 This is also the default target.
556 </para>
558 <para>
559 To create a proper index, the build might process several identical
560 stages. If you do not care about the index, and just want to
561 proof-read the output, use <literal>draft</>:
562 <screen>
563 <prompt>doc/src/sgml$ </prompt><userinput>gmake draft</userinput>
564 </screen>
565 </para>
567 <para>
568 To allow for easier handling in the final distribution, the files
569 comprising the HTML documentation can be stored in a tar archive that
570 is unpacked at installation time. To create the
571 <acronym>HTML</acronym> documentation package, use the commands:
572 <programlisting>
573 cd doc/src
574 gmake postgres.tar.gz
575 </programlisting>
576 In the distribution, these archives live in the
577 <filename>doc</filename> directory and are installed by default
578 with <command>gmake install</command>.
579 </para>
580 </sect2>
582 <sect2>
583 <title>Manpages</title>
585 <para>
586 We use the <application>docbook2man-sgmlspl</application> utility
587 from the <productname>DocBook2X</productname> project to
588 convert <productname>DocBook</productname>
589 <sgmltag>refentry</sgmltag> pages to *roff output suitable for man
590 pages. The man pages are also distributed as a tar archive,
591 similar to the <acronym>HTML</acronym> version. To create the man
592 pages, use the commands:
593 <programlisting>
594 cd doc/src/sgml
595 gmake man D2MDIR=<replaceable>directory</replaceable>
596 </programlisting>
597 Use the <varname>D2MDIR</varname> variable to specify the name of
598 the directory where the
599 file <filename>docbook2man-spec.pl</filename> from
600 the <application>docbook2man-sgmlspl</application> package resides.
601 There is no default for that. Since that package is not available
602 or outdated in many packaging systems, you might want to just
603 download the source code tarball and unpack it. No building is
604 required. Then the path is something
605 like <literal>D2MDIR=/home/you/somewhere/docbook2man-sgmlspl-1.0/perl</literal>.
606 You may get warnings like this:
607 <screen>
608 Warning: unrecognized SDATA '[scaron]': please add definition to docbook2man-spec.pl
609 Warning: unrecognized SDATA '[ouml ]': please add definition to docbook2man-spec.pl
610 </screen>
611 which can ignore if (and only if) you are using the latest version
612 of <filename>docbook2man-spec.pl</filename>
613 and you are not seeing any other SDATA warnings besides those.
614 </para>
616 <para>
617 To create the man page package for a release, use the following commands:
618 <programlisting>
619 cd doc/src
620 gmake man.tar.gz D2MDIR=<replaceable>directory</replaceable>
621 </programlisting>
622 which will result in a tar file being generated in the
623 <filename>doc/src</filename> directory.
624 </para>
625 </sect2>
627 <sect2>
628 <title>Print Output via <application>JadeTeX</application></title>
630 <para>
631 If you want to use <application>JadeTex</application> to produce a
632 printable rendition of the documentation, you can use one of the
633 following commands:
635 <itemizedlist>
636 <listitem>
637 <para>
638 To generate PostScript via <acronym>DVI</acronym> in A4 format:
639 <screen>
640 <prompt>doc/src/sgml$ </prompt><userinput>gmake postgres-A4.ps</userinput>
641 </screen>
642 In U.S. letter format:
643 <screen>
644 <prompt>doc/src/sgml$ </prompt><userinput>gmake postgres-US.ps</userinput>
645 </screen>
646 </para>
647 </listitem>
649 <listitem>
650 <para>
651 To make a <acronym>PDF</acronym>:
652 <screen>
653 <prompt>doc/src/sgml$ </prompt><userinput>gmake postgres-A4.pdf</userinput>
654 </screen>
656 <screen>
657 <prompt>doc/src/sgml$ </prompt><userinput>gmake postgres-US.pdf</userinput>
658 </screen>
659 (Of course you can also make a <acronym>PDF</acronym> version
660 from the PostScript, but if you generate <acronym>PDF</acronym>
661 directly, it will have hyperlinks and other enhanced features.)
662 </para>
663 </listitem>
664 </itemizedlist>
665 </para>
667 <para>
668 When using JadeTeX to build the PostgreSQL documentation, you will
669 probably need to increase some of TeX's internal parameters. These
670 can be set in the file <filename>texmf.cnf</filename>. The following
671 settings worked at the time of this writing:
672 <programlisting>
673 hash_extra.jadetex = 200000
674 hash_extra.pdfjadetex = 200000
675 pool_size.jadetex = 2000000
676 pool_size.pdfjadetex = 2000000
677 string_vacancies.jadetex = 150000
678 string_vacancies.pdfjadetex = 150000
679 max_strings.jadetex = 300000
680 max_strings.pdfjadetex = 300000
681 save_size.jadetex = 15000
682 save_size.pdfjadetex = 15000
683 </programlisting>
684 </para>
685 </sect2>
687 <sect2>
688 <title>Print Output via <acronym>RTF</acronym></title>
690 <para>
691 You can also create a printable version of the <productname>PostgreSQL</productname>
692 documentation by converting it to <acronym>RTF</acronym> and
693 applying minor formatting corrections using an office suite.
694 Depending on the capabilities of the particular office suite, you
695 can then convert the documentation to PostScript of
696 <acronym>PDF</acronym>. The procedure below illustrates this
697 process using <productname>Applixware</productname>.
698 </para>
700 <note>
701 <para>
702 It appears that current versions of the <productname>PostgreSQL</productname> documentation
703 trigger some bug in or exceed the size limit of OpenJade. If the
704 build process of the <acronym>RTF</acronym> version hangs for a
705 long time and the output file still has size 0, then you might have
706 hit that problem. (But keep in mind that a normal build takes 5
707 to 10 minutes, so don't abort too soon.)
708 </para>
709 </note>
711 <procedure>
712 <title><productname>Applixware</productname> <acronym>RTF</acronym> Cleanup</title>
714 <para>
715 <application>OpenJade</application> omits specifying a default
716 style for body text. In the past, this undiagnosed problem led to
717 a long process of table of contents generation. However, with
718 great help from the <productname>Applixware</productname> folks
719 the symptom was diagnosed and a workaround is available.
720 </para>
722 <step performance="required">
723 <para>
724 Generate the <acronym>RTF</acronym> version by typing:
725 <screen>
726 <prompt>doc/src/sgml$ </prompt><userinput>gmake postgres.rtf</userinput>
727 </screen>
728 </para>
729 </step>
731 <step performance="required">
732 <para>
733 Repair the RTF file to correctly specify all styles, in
734 particular the default style. If the document contains
735 <sgmltag>refentry</sgmltag> sections, one must also replace
736 formatting hints which tie a preceding paragraph to the current
737 paragraph, and instead tie the current paragraph to the
738 following one. A utility, <command>fixrtf</command>, is
739 available in <filename>doc/src/sgml</filename> to accomplish
740 these repairs:
741 <screen>
742 <prompt>doc/src/sgml$ </prompt><userinput>./fixrtf --refentry postgres.rtf</userinput>
743 </screen>
744 </para>
746 <para>
747 The script adds <literal>{\s0 Normal;}</literal> as the zeroth
748 style in the document. According to
749 <productname>Applixware</productname>, the RTF standard would
750 prohibit adding an implicit zeroth style, though Microsoft Word
751 happens to handle this case. For repairing
752 <sgmltag>refentry</sgmltag> sections, the script replaces
753 <literal>\keepn</literal> tags with <literal>\keep</literal>.
754 </para>
755 </step>
757 <step performance="required">
758 <para>
759 Open a new document in <productname>Applixware Words</productname> and
760 then import the <acronym>RTF</acronym> file.
761 </para>
762 </step>
764 <step performance="required">
765 <para>
766 Generate a new table of contents (ToC) using
767 <productname>Applixware</productname>.
768 </para>
770 <substeps>
771 <step>
772 <para>
773 Select the existing ToC lines, from the beginning of the first
774 character on the first line to the last character of the last
775 line.
776 </para>
777 </step>
779 <step>
780 <para>
781 Build a new ToC using
782 <menuchoice><guimenu>Tools</guimenu><guisubmenu>Book
783 Building</guisubmenu><guimenuitem>Create Table of
784 Contents</guimenuitem></menuchoice>. Select the first three
785 levels of headers for inclusion in the ToC. This will replace
786 the existing lines imported in the RTF with a native
787 <productname>Applixware</productname> ToC.
788 </para>
789 </step>
791 <step>
792 <para>
793 Adjust the ToC formatting by using
794 <menuchoice><guimenu>Format</guimenu><guimenuitem>Style</guimenuitem></menuchoice>,
795 selecting each of the three ToC styles, and adjusting the
796 indents for <literal>First</literal> and
797 <literal>Left</literal>. Use the following values:
799 <informaltable>
800 <tgroup cols="3">
801 <thead>
802 <row>
803 <entry>Style</entry>
804 <entry>First Indent (inches)</entry>
805 <entry>Left Indent (inches)</entry>
806 </row>
807 </thead>
809 <tbody>
810 <row>
811 <entry><literal>TOC-Heading 1</literal></entry>
812 <entry><literal>0.4</literal></entry>
813 <entry><literal>0.4</literal></entry>
814 </row>
816 <row>
817 <entry><literal>TOC-Heading 2</literal></entry>
818 <entry><literal>0.8</literal></entry>
819 <entry><literal>0.8</literal></entry>
820 </row>
822 <row>
823 <entry><literal>TOC-Heading 3</literal></entry>
824 <entry><literal>1.2</literal></entry>
825 <entry><literal>1.2</literal></entry>
826 </row>
827 </tbody>
828 </tgroup>
829 </informaltable>
830 </para>
831 </step>
832 </substeps>
833 </step>
835 <step performance="required">
836 <para>
837 Work through the document to:
839 <itemizedlist>
840 <listitem>
841 <para>
842 Adjust page breaks.
843 </para>
844 </listitem>
846 <listitem>
847 <para>
848 Adjust table column widths.
849 </para>
850 </listitem>
851 </itemizedlist>
852 </para>
853 </step>
855 <step performance="required">
856 <para>
857 Replace the right-justified page numbers in the Examples and
858 Figures portions of the ToC with correct values. This only takes
859 a few minutes.
860 </para>
861 </step>
863 <step performance="optional">
864 <para>
865 Delete the index section from the document if it is empty.
866 </para>
867 </step>
869 <step performance="required">
870 <para>
871 Regenerate and adjust the table of contents.
872 </para>
874 <substeps>
875 <step>
876 <para>
877 Select the ToC field.
878 </para>
879 </step>
881 <step>
882 <para>
883 Select <menuchoice><guimenu>Tools</guimenu><guisubmenu>Book
884 Building</guisubmenu><guimenuitem>Create Table of
885 Contents</guimenuitem></menuchoice>.
886 </para>
887 </step>
889 <step>
890 <para>
891 Unbind the ToC by selecting
892 <menuchoice><guimenu>Tools</guimenu><guisubmenu>Field
893 Editing</guisubmenu><guimenuitem>Unprotect</guimenuitem></menuchoice>.
894 </para>
895 </step>
897 <step>
898 <para>
899 Delete the first line in the ToC, which is an entry for the
900 ToC itself.
901 </para>
902 </step>
903 </substeps>
904 </step>
906 <step performance="required">
907 <para>
908 Save the document as native <productname>Applixware
909 Words</productname> format to allow easier last minute editing
910 later.
911 </para>
912 </step>
914 <step performance="required">
915 <para>
916 <quote>Print</quote> the document
917 to a file in PostScript format.
918 </para>
919 </step>
920 </procedure>
921 </sect2>
923 <sect2>
924 <title>Plain Text Files</title>
926 <para>
927 Several files are distributed as plain text, for reading during
928 the installation process. The <filename>INSTALL</filename> file
929 corresponds to <xref linkend="installation">, with some minor
930 changes to account for the different context. To recreate the
931 file, change to the directory <filename>doc/src/sgml</filename>
932 and enter <userinput>gmake INSTALL</userinput>. This will create
933 a file <filename>INSTALL.html</filename> that can be saved as text
934 with <productname>Netscape Navigator</productname> and put into
935 the place of the existing file.
936 <productname>Netscape</productname> seems to offer the best
937 quality for <acronym>HTML</acronym> to text conversions (over
938 <application>lynx</application> and
939 <application>w3m</application>).
940 </para>
942 <para>
943 The file <filename>HISTORY</filename> can be created similarly,
944 using the command <userinput>gmake HISTORY</userinput>. For the
945 file <filename>src/test/regress/README</filename> the command is
946 <userinput>gmake regress_README</userinput>.
947 </para>
948 </sect2>
950 <sect2>
951 <title>Syntax Check</title>
953 <para>
954 Building the documentation can take very long. But there is a
955 method to just check the correct syntax of the documentation
956 files, which only takes a few seconds:
957 <screen>
958 <prompt>doc/src/sgml$ </prompt><userinput>gmake check</userinput>
959 </screen>
960 </para>
961 </sect2>
962 </sect1>
965 <sect1 id="docguide-authoring">
966 <title>Documentation Authoring</title>
968 <para>
969 <acronym>SGML</acronym> and <productname>DocBook</productname> do
970 not suffer from an oversupply of open-source authoring tools. The
971 most common tool set is the
972 <productname>Emacs</productname>/<productname>XEmacs</productname>
973 editor with appropriate editing mode. On some systems
974 these tools are provided in a typical full installation.
975 </para>
977 <sect2>
978 <title>Emacs/PSGML</title>
980 <para>
981 <productname>PSGML</productname> is the most common and most
982 powerful mode for editing <acronym>SGML</acronym> documents.
983 When properly configured, it will allow you to use
984 <application>Emacs</application> to insert tags and check markup
985 consistency. You could use it for <acronym>HTML</acronym> as
986 well. Check the <ulink url="http://www.lysator.liu.se/projects/about_psgml.html">
987 PSGML web site</ulink> for downloads, installation instructions, and
988 detailed documentation.
989 </para>
991 <para>
992 There is one important thing to note with
993 <productname>PSGML</productname>: its author assumed that your
994 main <acronym>SGML</acronym> <acronym>DTD</acronym> directory
995 would be <filename>/usr/local/lib/sgml</filename>. If, as in the
996 examples in this chapter, you use
997 <filename>/usr/local/share/sgml</filename>, you have to
998 compensate for this, either by setting
999 <envar>SGML_CATALOG_FILES</envar> environment variable, or you
1000 can customize your <productname>PSGML</productname> installation
1001 (its manual tells you how).
1002 </para>
1004 <para>
1005 Put the following in your <filename>~/.emacs</filename>
1006 environment file (adjusting the path names to be appropriate for
1007 your system):
1009 <programlisting>
1010 ; ********** for SGML mode (psgml)
1012 (setq sgml-omittag t)
1013 (setq sgml-shorttag t)
1014 (setq sgml-minimize-attributes nil)
1015 (setq sgml-always-quote-attributes t)
1016 (setq sgml-indent-step 1)
1017 (setq sgml-indent-data t)
1018 (setq sgml-parent-document nil)
1019 (setq sgml-default-dtd-file "./reference.ced")
1020 (setq sgml-exposed-tags nil)
1021 (setq sgml-catalog-files '("/usr/local/share/sgml/catalog"))
1022 (setq sgml-ecat-files nil)
1024 (autoload 'sgml-mode "psgml" "Major mode to edit SGML files." t )
1025 </programlisting>
1027 and in the same file add an entry for <acronym>SGML</acronym>
1028 into the (existing) definition for
1029 <varname>auto-mode-alist</varname>:
1030 <programlisting>
1031 (setq
1032 auto-mode-alist
1033 '(("\\.sgml$" . sgml-mode)
1035 </programlisting>
1036 </para>
1038 <para>
1039 The <productname>PostgreSQL</productname> distribution includes a
1040 parsed DTD definitions file <filename>reference.ced</filename>.
1041 You might find that when using <productname>PSGML</productname>, a
1042 comfortable way of working with these separate files of book
1043 parts is to insert a proper <literal>DOCTYPE</literal>
1044 declaration while you're editing them. If you are working on
1045 this source, for instance, it is an appendix chapter, so you
1046 would specify the document as an <quote>appendix</quote> instance
1047 of a DocBook document by making the first line look like this:
1049 <programlisting>
1050 &lt;!DOCTYPE appendix PUBLIC "-//OASIS//DTD DocBook V4.2//EN"&gt;
1051 </programlisting>
1053 This means that anything and everything that reads
1054 <acronym>SGML</acronym> will get it right, and I can verify the
1055 document with <command>nsgmls -s docguide.sgml</command>. (But
1056 you need to take out that line before building the entire
1057 documentation set.)
1058 </para>
1059 </sect2>
1061 <sect2>
1062 <title>Other Emacs modes</title>
1064 <para>
1065 <productname>GNU Emacs</productname> ships with a different
1066 <acronym>SGML</acronym> mode, which is not quite as powerful as
1067 <productname>PSGML</productname>, but it's less confusing and
1068 lighter weight. Also, it offers syntax highlighting (font lock),
1069 which can be very helpful.
1070 </para>
1072 <para>
1073 Norm Walsh offers a
1074 <ulink url="http://nwalsh.com/emacs/docbookide/index.html">major mode</ulink>
1075 specifically for DocBook which also has font-lock and a number of features to
1076 reduce typing.
1077 </para>
1078 </sect2>
1080 </sect1>
1083 <sect1 id="docguide-style">
1084 <title>Style Guide</title>
1086 <sect2>
1087 <title>Reference Pages</title>
1089 <para>
1090 Reference pages should follow a standard layout. This allows
1091 users to find the desired information more quickly, and it also
1092 encourages writers to document all relevant aspects of a command.
1093 Consistency is not only desired among
1094 <productname>PostgreSQL</productname> reference pages, but also
1095 with reference pages provided by the operating system and other
1096 packages. Hence the following guidelines have been developed.
1097 They are for the most part consistent with similar guidelines
1098 established by various operating systems.
1099 </para>
1101 <para>
1102 Reference pages that describe executable commands should contain
1103 the following sections, in this order. Sections that do not apply
1104 can be omitted. Additional top-level sections should only be used
1105 in special circumstances; often that information belongs in the
1106 <quote>Usage</quote> section.
1108 <variablelist>
1109 <varlistentry>
1110 <term>Name</term>
1111 <listitem>
1112 <para>
1113 This section is generated automatically. It contains the
1114 command name and a half-sentence summary of its functionality.
1115 </para>
1116 </listitem>
1117 </varlistentry>
1119 <varlistentry>
1120 <term>Synopsis</term>
1121 <listitem>
1122 <para>
1123 This section contains the syntax diagram of the command. The
1124 synopsis should normally not list each command-line option;
1125 that is done below. Instead, list the major components of the
1126 command line, such as where input and output files go.
1127 </para>
1128 </listitem>
1129 </varlistentry>
1131 <varlistentry>
1132 <term>Description</term>
1133 <listitem>
1134 <para>
1135 Several paragraphs explaining what the command does.
1136 </para>
1137 </listitem>
1138 </varlistentry>
1140 <varlistentry>
1141 <term>Options</term>
1142 <listitem>
1143 <para>
1144 A list describing each command-line option. If there are a
1145 lot of options, subsections can be used.
1146 </para>
1147 </listitem>
1148 </varlistentry>
1150 <varlistentry>
1151 <term>Exit Status</term>
1152 <listitem>
1153 <para>
1154 If the program uses 0 for success and non-zero for failure,
1155 then you do not need to document it. If there is a meaning
1156 behind the different non-zero exit codes, list them here.
1157 </para>
1158 </listitem>
1159 </varlistentry>
1161 <varlistentry>
1162 <term>Usage</term>
1163 <listitem>
1164 <para>
1165 Describe any sublanguage or run-time interface of the program.
1166 If the program is not interactive, this section can usually be
1167 omitted. Otherwise, this section is a catch-all for
1168 describing run-time features. Use subsections if appropriate.
1169 </para>
1170 </listitem>
1171 </varlistentry>
1173 <varlistentry>
1174 <term>Environment</term>
1175 <listitem>
1176 <para>
1177 List all environment variables that the program might use.
1178 Try to be complete; even seemingly trivial variables like
1179 <envar>SHELL</envar> might be of interest to the user.
1180 </para>
1181 </listitem>
1182 </varlistentry>
1184 <varlistentry>
1185 <term>Files</term>
1186 <listitem>
1187 <para>
1188 List any files that the program might access implicitly. That
1189 is, do not list input and output files that were specified on
1190 the command line, but list configuration files, etc.
1191 </para>
1192 </listitem>
1193 </varlistentry>
1195 <varlistentry>
1196 <term>Diagnostics</term>
1197 <listitem>
1198 <para>
1199 Explain any unusual output that the program might create.
1200 Refrain from listing every possible error message. This is a
1201 lot of work and has little use in practice. But if, say, the
1202 error messages have a standard format that the user can parse,
1203 this would be the place to explain it.
1204 </para>
1205 </listitem>
1206 </varlistentry>
1208 <varlistentry>
1209 <term>Notes</term>
1210 <listitem>
1211 <para>
1212 Anything that doesn't fit elsewhere, but in particular bugs,
1213 implementation flaws, security considerations, compatibility
1214 issues.
1215 </para>
1216 </listitem>
1217 </varlistentry>
1219 <varlistentry>
1220 <term>Examples</term>
1221 <listitem>
1222 <para>
1223 Examples
1224 </para>
1225 </listitem>
1226 </varlistentry>
1228 <varlistentry>
1229 <term>History</term>
1230 <listitem>
1231 <para>
1232 If there were some major milestones in the history of the
1233 program, they might be listed here. Usually, this section can
1234 be omitted.
1235 </para>
1236 </listitem>
1237 </varlistentry>
1239 <varlistentry>
1240 <term>See Also</term>
1241 <listitem>
1242 <para>
1243 Cross-references, listed in the following order: other
1244 <productname>PostgreSQL</productname> command reference pages,
1245 <productname>PostgreSQL</productname> SQL command reference
1246 pages, citation of <productname>PostgreSQL</productname>
1247 manuals, other reference pages (e.g., operating system, other
1248 packages), other documentation. Items in the same group are
1249 listed alphabetically.
1250 </para>
1251 </listitem>
1252 </varlistentry>
1254 </variablelist>
1255 </para>
1257 <para>
1258 Reference pages describing SQL commands should contain the
1259 following sections: Name, Synopsis, Description, Parameters,
1260 Outputs, Notes, Examples, Compatibility, History, See
1261 Also. The Parameters section is like the Options section, but
1262 there is more freedom about which clauses of the command can be
1263 listed. The Outputs section is only needed if the command returns
1264 something other than a default command-completion tag. The Compatibility
1265 section should explain to what extent
1266 this command conforms to the SQL standard(s), or to which other
1267 database system it is compatible. The See Also section of SQL
1268 commands should list SQL commands before cross-references to
1269 programs.
1270 </para>
1271 </sect2>
1273 </sect1>
1274 </appendix>