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
|
<!doctype linuxdoc system>
<!-- Here's an SGML example file. Format it and print out the source,
and use it as a model for your own SGML files. As you can see
this is a comment.
-->
<article>
<!-- Title information -->
<title>Quick Example for Linuxdoc DTD SGML source</title>
<author>
<name>Matt Welsh <tt/<mdw@cs.cornell.edu/>
Original version as &dquot;Quick SGML Example&dquot;,
<newline>
</name>
<and>
<name>Taketoshi Sano <tt/<sano@debian.org/>
Updated and renamed to current name<newline></name>
</author>
<date>2002/03/18</date>
<abstract>
This document is a brief example using the Linuxdoc DTD SGML.
</abstract>
<!-- Table of contents -->
<toc>
<!-- Begin the document -->
<sect>
<heading>Introduction</heading>
<p>
This is an SGML example file using the Linuxdoc DTD SGML.
You can format it using the command
<tscreen>
<verb>
% linuxdoc -B txt example.sgml
</verb>
</tscreen>
this will produce a plain ASCII file. You can also produce
files in various formats including LaTeX, HTML and GNU info
with the commands in linuxdoc-tools.
</p>
<p>
The command name is ``<tt>linuxdoc</tt>''.
It is ``<tt>-B</tt>'' option to choose the proper backend driver.
Old command names are now obsoleted.
<verb>
Old (obsoleted) New (prefered)
------------------- ------------------
sgml2txt linuxdoc -B txt
sgml2html linuxdoc -B html
sgml2latex linuxdoc -B latex
sgml2info linuxdoc -B info
sgml2lyx linuxdoc -B lyx
sgml2rtf linuxdoc -B rtf
</verb>
You can use ``<tt>linuxdoc -B latex</tt>'' to produce
the tex, dvi, ps and pdf output.
</p>
<p>
You can also use ``<tt>linuxdoc -B check</tt>'' command
to check the syntax of your document sources.
</p>
<p>
The linuxdoc-tool provides the general command &dquot;linuxdoc&dquot;,
and you can use it with &dquot;--backend=<it>format</it>&dquot; option
in order to access the facility of all the command above. Check the
online manual of linuxdoc command.
</p>
</sect>
<sect>The source
<p>
Looking at the source for this file will be instructive to show you
how to use many of the Linuxdoc-SGML constructs. You should also read
the <em/Linuxdoc-SGML User's Guide/, in the file <tt/guide.sgml/.
The source looks and feels like LaTeX, as you can see. Paragraphs are
separated by blank lines, macros are enclosed in angle brackets. It's
quite simple.
(Warning!) This is just a simplificated explanation as a quick reference.
In fact, the correct way to separate paragraphs are not just to put the
blank lines between them. But since the Linuxdoc DTD was created as an
introduction to the SGML world, it allows us to use the easy way.
If you wish to know the correct but not-so-easy way, then read the source
of the previous section. (Hint: using <p> with &etago;p>).
<sect>Some examples
<p>
Here are examples of things that you'll be using in the source. First,
let's decend into a subsection:
<sect1>This is a subsection
<p>
As the header says. Note that you need to use the <tt/p/ command to
start the body of the section, after the <tt/sect1/ command.
Here's a subsubsection:
<sect2>This is a subsubsection
<p>
Right. 5 levels of sections are available. Use the commands
<tt/sect/, <tt/sect1/, <tt/sect2/, <tt/sect3/, and <tt/sect4/ to get them.
This document uses the <tt>article</> document style, which is
appropriate for HOWTOs and other docs; the <tt>report</> style (which
includes the <tt/chapt/ sectioning command) should be used for the LDP docs.
<sect1>Example text
<p>
All right, so you're typing along, and you want to show some example code,
or example I/O with a program, whatever. Use the <tt/code/ or <tt/verb/
``environments'' for this, wrapped in a <tt/tscreen/ environment, as so:
<tscreen><verb>
This is an example verb environment.
</verb></tscreen>
As well as:
<tscreen><code>
This is an example code environment.
</code></tscreen>
The <tt/tscreen/ environment just sets the font to small type and
indents it nicely. It's not required for using <tt/verb/ or <tt/code/,
but I suggest that you do.
The <em/Linuxdoc-SGML User's Guide/ explains what special characters you
can and can't use in the <tt/verb/ and <tt/code/ environments.
<sect1>
<heading>Cross references<label id="test-ref"></heading>
<p>
What about cross-references? This section has been marked with the
<tt>label</> command; using <tt>ref</> will provide a cross reference,
as in ``See Section <ref id="test-ref">'' for more. </p>
<p>
Right now cross-references don't work in the <tt/groff/ translation for
plain ASCII. They do work when generating LaTeX or HTML output.</p>
<sect1>Using fonts
<p>
You want fonts, we got fonts. Of course these won't show up in the
plain ASCII text, but they all map into the various output formats:
<bf/boldface/, <em/emphasis/, <sf/sans serif/, <sl/slanted/,
<tt/typewriter/, and <it/italics/.
<sect1>Lists
<p>
Lists are easy as well. Just use the <tt/itemize/ element with the
<tt/item/ commands, seen here:
<itemize>
<item> This is a list.
<item> Nothing exciting about that.
<itemize>
<item> Multiple levels are supported as well.
<item> Again, that's no surprise.
</itemize>
<enum>
<item> Enumerated lists using <tt>enum</> also work.
<item> Description environments using <tt>descrip</> along
with <tt>tag</> are also available, as seen here.
</enum>
<descrip>
<tag/First item./ Here's one item.
<tag/Second item./ Here's another.
<tag/Third item./ Can we go for three?
</descrip>
<item> A final item to top it all off.
</itemize>
<sect1>Tables and Figures
<p>
The Linuxdoc DTD itself has the element definition for tables and figures
which exists in the original QWERTZ DTD. They are not used widely because
the Linuxdoc DTD is created for multiple outputs with the same contents.
Tables can be used only in text, html, and latex formats. And figures can
be used only in html and latex formats.
</p>
<p>
The usage of these tags without very strong reasons is not recommended.
If you wish to enhance your documents, then it may be the time you should
move up to the DocBook DTD. But if you think you have enough reasons to
use graphics with Linuxdoc DTD for your documents, then it is your choice.
</p>
<p>
One more point. Please remember that text only documents can be listened
by a blind person, while the heavy graphical documents can't.
</p>
<sect2>
<heading>Table</heading>
<p>
Here is an example of table. Check this in various output formats.
Please take care in using this. There are several limitation.
Each row can not be folded into multiple lines, and too long row
will be corrupted in the output. The output in info, lyx, and rtf
may not be correct at all. Anyway, you are warned. Be carefull.
<table loc="tbp">
<tabular ca="lll">
DTD |comments |tools @
Linuxdoc|What this document aimed at|linuxdoc-tools@
DocBook|Now the de facto standard|openjade, sgmltools-lite@
QWERTZ|The origin of Linuxdoc|sgml2latex-format
</tabular>
<caption>Comparison on Some DTD</caption>
</table>
</p>
</sect2>
<sect2>
<heading>Figure</heading>
<p>
In html and latex output, the graphics can be included with
the <it>figure</it> element. It is not encouraged to use this feature
since the LinuxDoc DTD is created for fairiy simple and light way of
producing the multiple output formats with the same content.
Using graphics only in some outputs will spoil the value of a simple
plain text output in many cases. And heavy usage of huge graphics
files was just a pain when the network (and the machine) was too slow.
But when you only need the versions in html and latex format, and if
you don't need to concern the network speed, then you can use this.
</p>
<p>
Here is an example to use the figure in html or tex (tex, dvi, and ps).
This example uses the (unofficial) logo of Linux kernel 2.0, which was
created by Larry Ewing with the GIMP. Check his site:
<url url="http://www.isc.tamu.edu/˜lewing/linux/">
I use &dquot;convert&dquot; command from ImageMagic and ghostscript
to get the png and eps files from the original GIF.
</p>
<p>
You should put all the graphic files into the same directory as the
SGML source file. For html and pdf, use <it>img</it> element with png
or jpeg graphic file. For other latex (tex, dvi, and ps), use <it>eps</it>
element with ps or eps graphic file.
<figure>
<eps file="logo.eps">
<img src="logo.png">
<caption>The Penguin Logo of the Linux</caption>
</figure>
</p>
</sect2>
</sect1>
<sect1>Summary
<p>
This is just about everything that you need to get started with
writing SGML docs using the <tt/linuxdoc-sgml/ DTD. Please let me know
if you think something should be changed or added to this document.
<sect>
<heading>SGML world</heading>
<p>
SGML is an ISO standard (ISO 8879:1986) for information processing.
You can read some introduction of SGML related to HTML from
<url url="www.w3.org/TR/REC-html40/intro/sgmltut.html" name="[On SGML and HTML]">.
SGML provides the scheme to express the logical structure of a document
(such as chapter, section, subsection, and so on.) and it call a piece of
document as an <it>element</it>. When we write a document in SGML, we need
the specification of structure of the document. This specification is called
<it>DTD</it> (abbreviated from &dquot;Document Type Definition&dquot;), and
this DTD defines the relation of various elements in the specific type of
documents.
</p>
<p>
This document uses the word <it>Linuxdoc DTD</it> without explanation so far.
Here is the meaning of &dquot;DTD&dquot;. We can't write any document in
SGML without an appropriate DTD.
</p>
<p>
You should also note that Linuxdoc DTD is created as a simple and easy
introduction for SGML world. Matt Welsh (the original author of the Linuxdoc
DTD and the tool for it) wrote in his guide:
<quote>
If you'd like to write general documentation in SGML, I suggest using
the original QWERTZ DTD instead of the hacked-up linuxdoc DTD, which I've
modified for use particularly by the Linux HOWTOs and other such documentation.
</quote>
</p>
<p>
Now the DocBook DTD, which is maintained by OASIS, has been around
for a while, and is very popular for technical documentation.
Moreover, it uses DSSSL, which is an ISO standard for doing rendering.
In the future this might move to and XML DTD and using XSL instead of
DSSSL, but that doesn't matter to the author. See the following URLs
for more info:
<itemize>
<item><url url="http://nwalsh.com/docbook/">
<item><url url="http://www.oasis-open.org/docbook/">
<item><url url="http://www.docbook.org/">
<item><url url="http://www.mulberrytech.com/dsssl/">
<item><url url="http://www.oasis-open.org/cover/dsssl.html">
</itemize>
</p>
<p>
You should use the DocBook DTD if you are serious to be a writer
in the technical documentation world. The Linuxdoc DTD is intended
as an easy introduction, and is considered now as the work-around
to help many useful documents until they can be converted into the
DocBook based.
</p>
</sect>
</article>
|