aboutsummaryrefslogtreecommitdiff
path: root/en_US.ISO8859-1/books/fdp-primer/examples/appendix.sgml
blob: c70f5e87ab0c40e74b67297f47e2f4ae0a725c33 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
<?xml version="1.0" encoding="ISO8859-1" standalone="no"?>
<!-- Copyright (c) 2000 Nik Clayton, All rights reserved.

     Redistribution and use in source (SGML DocBook) and 'compiled' forms
     (SGML HTML, PDF, PostScript, RTF and so forth) with or without
     modification, are permitted provided that the following conditions
     are met:

      1. Redistributions of source code (SGML DocBook) must retain the above
         copyright notice, this list of conditions and the following
         disclaimer as the first lines of this file unmodified.

      2. Redistributions in compiled form (transformed to other DTDs,
         converted to PDF, PostScript, RTF and other formats) must reproduce
         the above copyright notice, this list of conditions and the
         following disclaimer in the documentation and/or other materials
         provided with the distribution.

     THIS DOCUMENTATION IS PROVIDED BY NIK CLAYTON "AS IS" AND ANY EXPRESS OR
     IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
     DISCLAIMED. IN NO EVENT SHALL NIK CLAYTON BE LIABLE FOR ANY DIRECT,
     INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
     (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
     SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
     ANY WAY OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF ADVISED OF THE
     POSSIBILITY OF SUCH DAMAGE.

     $FreeBSD$
-->

<appendix id="examples">
  <title>Examples</title>

  <para>This appendix contains example SGML files and command lines
    you can use to convert them from one output format to another.  If
    you have successfully installed the Documentation Project tools
    then you should be able to use these examples directly.</para>

  <para>These examples are not exhaustive&mdash;they do not contain
    all the elements you might want to use, particularly in your
    document's front matter.  For more examples of DocBook markup you
    should examine the SGML source for this and other documents,
    available in the <application>svn</application>
    <literal>doc</literal> repository, or available online starting at
    <ulink url="http://svnweb.FreeBSD.org/doc/"></ulink>.</para>

  <para>To avoid confusion, these examples use the standard DocBook
    4.1 DTD rather than the FreeBSD extension.  They also use the
    stock stylesheets distributed by Norm Walsh, rather than any
    customizations made to those stylesheets by the FreeBSD
    Documentation Project.  This makes them more useful as generic
    DocBook examples.</para>

  <sect1 id="examples-docbook-book">
    <title>DocBook <sgmltag>book</sgmltag></title>

    <example>
      <title>DocBook <sgmltag>book</sgmltag></title>

      <programlisting><![CDATA[<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V4.1//EN">

<book lang='en'>
  <bookinfo>
    <title>An Example Book</title>
    
    <author>
      <firstname>Your first name</firstname>
      <surname>Your surname</surname>
      <affiliation>
        <address><email>foo@example.com</email></address>
      </affiliation>
    </author>

    <copyright>
      <year>2000</year>
      <holder>Copyright string here</holder>
    </copyright>

    <abstract>
      <para>If your book has an abstract then it should go here.</para>
    </abstract>
  </bookinfo>

  <preface>
    <title>Preface</title>

    <para>Your book may have a preface, in which case it should be placed
      here.</para>
  </preface>
      
  <chapter>
    <title>My First Chapter</title>

    <para>This is the first chapter in my book.</para>

    <sect1>
      <title>My First Section</title>

      <para>This is the first section in my book.</para>
    </sect1>
  </chapter>
</book>]]></programlisting>
    </example>
  </sect1>

  <sect1 id="examples-docbook-article">
    <title>DocBook <sgmltag>article</sgmltag></title>

    <example>
      <title>DocBook <sgmltag>article</sgmltag></title>

      <programlisting><![CDATA[<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook V4.1//EN">

<article lang='en'>
  <articleinfo>
    <title>An Example Article</title>

    <author>
      <firstname>Your first name</firstname>
      <surname>Your surname</surname>
      <affiliation>
        <address><email>foo@example.com</email></address>
      </affiliation>
    </author>

    <copyright>
      <year>2000</year>
      <holder>Copyright string here</holder>
    </copyright>

    <abstract>
      <para>If your article has an abstract then it should go here.</para>
    </abstract>
  </articleinfo>

  <sect1>
    <title>My First Section</title>

    <para>This is the first section in my article.</para>

    <sect2>
      <title>My First Sub-Section</title>

      <para>This is the first sub-section in my article.</para>
    </sect2>	
  </sect1>
</article>]]></programlisting>
    </example>
  </sect1>

  <sect1 id="examples-formatted">
    <title>Producing Formatted Output</title>

    <para>This section assumes that you have installed the software
      listed in the <filename
	role="package">textproc/docproj</filename> port, either by
      hand, or by using the port.  Further, it is assumed that your
      software is installed in subdirectories under
      <filename>/usr/local/</filename>, and the directory where
      binaries have been installed is in your <envar>PATH</envar>.
      Adjust the paths as necessary for your system.</para>

    <sect2>
      <title>Using Jade</title>

      <example>
	<title>Converting DocBook to HTML (One Large File)</title>

	<screen>&prompt.user; <userinput>jade -V nochunks \  <co id="examples-co-jade-1-nochunks"/>
    -c /usr/local/share/sgml/docbook/dsssl/modular/catalog \ <co id="examples-co-jade-1-catalog"/>
    -c /usr/local/share/sgml/docbook/catalog \
    -c /usr/local/share/sgml/jade/catalog \
    -d /usr/local/share/sgml/docbook/dsssl/modular/html/docbook.dsl \<co id="examples-co-jade-1-dsssl"/>
    -t sgml <co id="examples-co-jade-1-transform"/> <replaceable>file</replaceable>.sgml &gt; <replaceable>file</replaceable>.html <co id="examples-co-jade-1-filename"/></userinput></screen>

	<calloutlist>
	  <callout arearefs="examples-co-jade-1-nochunks">
	    <para>Specifies the <literal>nochunks</literal> parameter
	      to the stylesheets, forcing all output to be written to
	      the standard output (using Norm Walsh's
	      stylesheets).</para>
	  </callout>

	  <callout arearefs="examples-co-jade-1-catalog">
	    <para>Specifies the catalogs that
	      <application>Jade</application> will need to process.
	      Three catalogs are required.  The first is a catalog
	      that contains information about the DSSSL stylesheets.
	      The second contains information about the DocBook DTD.
	      The third contains information specific to
	      <application>Jade</application>.</para>
	  </callout>

	  <callout arearefs="examples-co-jade-1-dsssl">
	    <para>Specifies the full path to the DSSSL stylesheet that
	      <application>Jade</application> will use when processing
	      the document.</para>
	  </callout>

	  <callout arearefs="examples-co-jade-1-transform">
	    <para>Instructs <application>Jade</application> to perform
	      a <emphasis>transformation</emphasis> from one DTD to
	      another.  In this case, the input is being transformed
	      from the DocBook DTD to the HTML DTD.</para>
	  </callout>

	  <callout arearefs="examples-co-jade-1-filename">
	    <para>Specifies the file that
	      <application>Jade</application> should process, and
	      redirects output to the specified
	      <filename>.html</filename> file.</para>
	  </callout>
	</calloutlist>
      </example>

      <example>
	<title>Converting DocBook to HTML (Several Small
	  Files)</title>

	<screen>&prompt.user; <userinput>jade \
    -c /usr/local/share/sgml/docbook/dsssl/modular/catalog \ <co id="examples-co-jade-2-catalog"/>
    -c /usr/local/share/sgml/docbook/catalog \
    -c /usr/local/share/sgml/jade/catalog \
    -d /usr/local/share/sgml/docbook/dsssl/modular/html/docbook.dsl \<co id="examples-co-jade-2-dsssl"/>
    -t sgml <co id="examples-co-jade-2-transform"/> <replaceable>file</replaceable>.sgml <co id="examples-co-jade-2-filename"/></userinput></screen>

	<calloutlist>
	  <callout arearefs="examples-co-jade-2-catalog">
	    <para>Specifies the catalogs that
	      <application>Jade</application> will need to process.
	      Three catalogs are required.  The first is a catalog
	      that contains information about the DSSSL stylesheets.
	      The second contains information about the DocBook DTD.
	      The third contains information specific to Jade.</para>
	  </callout>

	  <callout arearefs="examples-co-jade-2-dsssl">
	    <para>Specifies the full path to the DSSSL stylesheet that
	      <application>Jade</application> will use when processing
	      the document.</para>
	  </callout>

	  <callout arearefs="examples-co-jade-2-transform">
	    <para>Instructs <application>Jade</application> to perform
	      a <emphasis>transformation</emphasis> from one DTD to
	      another.  In this case, the input is being transformed
	      from the DocBook DTD to the HTML DTD.</para>
	  </callout>

	  <callout arearefs="examples-co-jade-2-filename">
	    <para>Specifies the file that
	      <application>Jade</application> should process.  The
	      stylesheets determine how the individual HTML files will
	      be named, and the name of the <quote>root</quote> file
	      (i.e., the one that contains the start of the
	      document.</para>
	  </callout>
	</calloutlist>

	<para>This example may still only generate one HTML file,
	  depending on the structure of the document you are
	  processing, and the stylesheet's rules for splitting
	  output.</para>
      </example>

      <example id="examples-docbook-postscript">
	<title>Converting DocBook to Postscript</title>

	<para>The source SGML file must be converted to a &tex;
	  file.</para>

	<screen>&prompt.user; <userinput>jade -V tex-backend \ <co id="examples-co-jade-3-tex-backend"/>
    -c /usr/local/share/sgml/docbook/dsssl/modular/catalog \ <co id="examples-co-jade-3-catalog"/>
    -c /usr/local/share/sgml/docbook/catalog \
    -c /usr/local/share/sgml/jade/catalog \
    -d /usr/local/share/sgml/docbook/dsssl/modular/print/docbook.dsl \<co id="examples-co-jade-3-dsssl"/>
    -t tex <co id="examples-co-jade-3-tex"/> <replaceable>file</replaceable>.sgml</userinput></screen>

	<calloutlist>
	  <callout arearefs="examples-co-jade-3-tex-backend">
	    <para>Customizes the stylesheets to use various options
	      specific to producing output for &tex;.</para>
	  </callout>

	  <callout arearefs="examples-co-jade-3-catalog">
	    <para>Specifies the catalogs that
	      <application>Jade</application> will need to process.
	      Three catalogs are required.  The first is a catalog
	      that contains information about the DSSSL stylesheets.
	      The second contains information about the DocBook DTD.
	      The third contains information specific to Jade.</para>
	  </callout>

	  <callout arearefs="examples-co-jade-3-dsssl">
	    <para>Specifies the full path to the DSSSL stylesheet that
	      <application>Jade</application> will use when processing
	      the document.</para>
	  </callout>

	  <callout arearefs="examples-co-jade-3-tex">
	    <para>Instructs <application>Jade</application> to convert
	      the output to &tex;.</para>
	  </callout>
	</calloutlist>

	<para>The generated <filename>.tex</filename> file must now be
	  run through <command>tex</command>, specifying the
	  <literal>&amp;jadetex</literal> macro package.</para>

	<screen>&prompt.user; <userinput>tex "&amp;jadetex" <replaceable>file</replaceable>.tex</userinput></screen>

	<para>You have to run <command>tex</command> <emphasis>at
	    least</emphasis> three times.  The first run processes the
	  document, and determines areas of the document which are
	  referenced from other parts of the document, for use in
	  indexing, and so on.</para>

	<para>Do not be alarmed if you see warning messages such as
	  <errorname>LaTeX Warning: Reference `136' on page 5
	    undefined on input line 728.</errorname> at this
	  point.</para>

	<para>The second run reprocesses the document now that certain
	  pieces of information are known (such as the document's page
	  length).  This allows index entries and other
	  cross-references to be fixed up.</para>

	<para>The third pass performs any final cleanup
	  necessary.</para>

	<para>The output from this stage will be
	  <filename><replaceable>file</replaceable>.dvi</filename>.</para>

	<para>Finally, run <command>dvips</command> to convert the
	  <filename>.dvi</filename> file to Postscript.</para>

	<screen>&prompt.user; <userinput>dvips -o <replaceable>file</replaceable>.ps <replaceable>file.dvi</replaceable></userinput></screen>
      </example>

      <example>
	<title>Converting DocBook to PDF</title>

	<para>The first part of this process is identical to that when
	  converting DocBook to Postscript, using the same
	  <command>jade</command> command line (<xref
	    linkend="examples-docbook-postscript"/>).</para>

	<para>When the <filename>.tex</filename> file has been
	  generated you run <application>pdfTeX</application>.
	  However, use the <literal>&amp;pdfjadetex</literal> macro
	  package instead.</para>

	<screen>&prompt.user; <userinput>pdftex "&amp;pdfjadetex" <replaceable>file</replaceable>.tex</userinput></screen>

	<para>Again, run this command three times.</para>

	<para>This will generate
	  <filename><replaceable>file</replaceable>.pdf</filename>,
	  which does not need to be processed any further.</para>
      </example>
    </sect2>
  </sect1>
</appendix>