| 1 |
<?xml version="1.0"?> |
|---|
| 2 |
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" |
|---|
| 3 |
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" |
|---|
| 4 |
> |
|---|
| 5 |
<chapter id="chap-project-documentation"> |
|---|
| 6 |
<title>Using <application>Gaphor</application> diagrams in project documentation</title> |
|---|
| 7 |
|
|---|
| 8 |
<para> |
|---|
| 9 |
Diagrams created with <application>Gaphor</application> can be easily used in your project |
|---|
| 10 |
documentation. It can be done in two ways |
|---|
| 11 |
<itemizedlist> |
|---|
| 12 |
<listitem><simpara>exporting diagram from <application>Gaphor</application></simpara></listitem> |
|---|
| 13 |
<listitem><simpara> |
|---|
| 14 |
converting diagrams included in <application>Gaphor</application> file into |
|---|
| 15 |
PDF or SVG files using <command>gaphorconvert</command> commandline utility |
|---|
| 16 |
</simpara></listitem> |
|---|
| 17 |
</itemizedlist> |
|---|
| 18 |
This chapter describes how to create high quality documents |
|---|
| 19 |
using second approach. |
|---|
| 20 |
</para> |
|---|
| 21 |
|
|---|
| 22 |
<section id="sect-project-documentation-gaphor-convert"> |
|---|
| 23 |
<title>Converting <application>Gaphor</application> files</title> |
|---|
| 24 |
<para> |
|---|
| 25 |
<application>Gaphor</application> installation includes |
|---|
| 26 |
<command>gaphorconvert</command> utility. This utility takes list of |
|---|
| 27 |
<application>Gaphor</application> files and converts them into PDF or |
|---|
| 28 |
SVG files. |
|---|
| 29 |
</para> |
|---|
| 30 |
<para> |
|---|
| 31 |
<application>Gaphor</application> file contains several diagrams. Every |
|---|
| 32 |
diagram is included in some package |
|---|
| 33 |
(see <xref linkend="sect-tree-view"/>). |
|---|
| 34 |
Using <command>gaphorconvert</command> utility |
|---|
| 35 |
you will get diagram files in desired format (PDF by default), which reflect |
|---|
| 36 |
structure of your <application>Gaphor</application> file. |
|---|
| 37 |
</para> |
|---|
| 38 |
<figure id="fig-packages-and-diagrams-example" float="1"> |
|---|
| 39 |
<title>Packages with diagrams</title> |
|---|
| 40 |
<graphic fileref="packageswithdiagrams.png"/> |
|---|
| 41 |
</figure> |
|---|
| 42 |
<para> |
|---|
| 43 |
For example you can have |
|---|
| 44 |
structure like on <xref linkend="fig-packages-and-diagrams-example"/>. |
|---|
| 45 |
Processing <application>Gaphor</application> file with |
|---|
| 46 |
<command>gaphorconvert</command> utility |
|---|
| 47 |
<informalexample> |
|---|
| 48 |
<programlisting> |
|---|
| 49 |
gaphorconvert -u <ulink url="project-documentation-example.gaphor">project-documentation-example.gaphor</ulink> |
|---|
| 50 |
</programlisting> |
|---|
| 51 |
</informalexample> |
|---|
| 52 |
will give you list of files |
|---|
| 53 |
<informalexample> |
|---|
| 54 |
<screen> |
|---|
| 55 |
Documentation_Example/DocBook/Classes.pdf |
|---|
| 56 |
Documentation_Example/Overview.pdf |
|---|
| 57 |
</screen> |
|---|
| 58 |
</informalexample> |
|---|
| 59 |
You can also put files to some subdirectory (creating SVG files, now) |
|---|
| 60 |
with command |
|---|
| 61 |
<informalexample> |
|---|
| 62 |
<programlisting> |
|---|
| 63 |
gaphorconvert -u -d diagrams -f svg <ulink url="project-documentation-example.gaphor">project-documentation-example.gaphor</ulink> |
|---|
| 64 |
</programlisting> |
|---|
| 65 |
</informalexample> |
|---|
| 66 |
which will give you |
|---|
| 67 |
<informalexample> |
|---|
| 68 |
<screen> |
|---|
| 69 |
diagrams/Documentation_Example/DocBook/Classes.svg |
|---|
| 70 |
diagrams/Documentation_Example/Overview.svg |
|---|
| 71 |
</screen> |
|---|
| 72 |
</informalexample> |
|---|
| 73 |
</para> |
|---|
| 74 |
<para> |
|---|
| 75 |
See <command>gaphorconvert</command> help screen for more options |
|---|
| 76 |
<informalexample> |
|---|
| 77 |
<programlisting> |
|---|
| 78 |
gaphorconvert -h |
|---|
| 79 |
</programlisting> |
|---|
| 80 |
</informalexample> |
|---|
| 81 |
</para> |
|---|
| 82 |
</section> |
|---|
| 83 |
|
|---|
| 84 |
<section id="sect-project-documentation-tex"> |
|---|
| 85 |
<title>TeX/LaTeX using pdfTeX</title> |
|---|
| 86 |
|
|---|
| 87 |
<para> |
|---|
| 88 |
Most Unix operating systems come with decent |
|---|
| 89 |
<ulink url = "http://www.tug.org/">TeX</ulink> distribution installation. |
|---|
| 90 |
<ulink url = "http://www.tug.org/">TeX</ulink> distribution like |
|---|
| 91 |
<ulink url = "http://www.tetex.org/">teTeX</ulink> includes |
|---|
| 92 |
<ulink url = "http://www.pdftex.org/">pdfTeX</ulink> support, which |
|---|
| 93 |
allows to create high quality PDF files. |
|---|
| 94 |
</para> |
|---|
| 95 |
<para> |
|---|
| 96 |
<application>pdfTeX</application> support means that you can include |
|---|
| 97 |
PDF files in your documents using <literal>graphicx</literal> package and |
|---|
| 98 |
<command>\includegraphics</command> command. |
|---|
| 99 |
</para> |
|---|
| 100 |
<para> |
|---|
| 101 |
Taking as an example <application>Gaphor</application> file from |
|---|
| 102 |
<xref linkend="sect-project-documentation-gaphor-convert"/> you can |
|---|
| 103 |
process gaphor file with command |
|---|
| 104 |
<informalexample> |
|---|
| 105 |
<programlisting> |
|---|
| 106 |
gaphorconvert -u -d pdfdiagrams <ulink url="project-documentation-example.gaphor">project-documentation-example.gaphor</ulink> |
|---|
| 107 |
</programlisting> |
|---|
| 108 |
</informalexample> |
|---|
| 109 |
and include one of diagrams in <application>LaTeX</application> |
|---|
| 110 |
document, see <xref linkend="ex-latex-include-diagram"/>. |
|---|
| 111 |
Finally, create PDF file |
|---|
| 112 |
<informalexample> |
|---|
| 113 |
<programlisting> |
|---|
| 114 |
pdflatex <ulink url="texexample.tex">texexample.tex</ulink> |
|---|
| 115 |
</programlisting> |
|---|
| 116 |
</informalexample> |
|---|
| 117 |
|
|---|
| 118 |
<example id="ex-latex-include-diagram"> |
|---|
| 119 |
<title>Including Gaphor diagram in LaTeX document</title> |
|---|
| 120 |
<programlisting> |
|---|
| 121 |
\begin{figure} |
|---|
| 122 |
\includegraphics[width=.8\textwidth]{pdfdiagrams/Documentation_Example/DocBook/Classes} |
|---|
| 123 |
\caption{DocBook documentation example}\label{fig:docbook} |
|---|
| 124 |
\end{figure} |
|---|
| 125 |
</programlisting> |
|---|
| 126 |
</example> |
|---|
| 127 |
</para> |
|---|
| 128 |
|
|---|
| 129 |
|
|---|
| 130 |
|
|---|
| 131 |
|
|---|
| 132 |
|
|---|
| 133 |
|
|---|
| 134 |
|
|---|
| 135 |
|
|---|
| 136 |
|
|---|
| 137 |
|
|---|
| 138 |
|
|---|
| 139 |
|
|---|
| 140 |
<para> |
|---|
| 141 |
For more information about including graphic files in |
|---|
| 142 |
<application>LaTeX</application> documents see |
|---|
| 143 |
"Using Imported Graphics in LaTeX 2e" by Keith Reckdahl, |
|---|
| 144 |
which is usually provided with <application>TeX</application> |
|---|
| 145 |
distribution installed on your operating system (look for |
|---|
| 146 |
<filename>epslatex.ps</filename> file). |
|---|
| 147 |
</para> |
|---|
| 148 |
<section id="sect-project-documentation-latex-advanced"> |
|---|
| 149 |
<title>Advanced <application>LaTeX</application> usage</title> |
|---|
| 150 |
<para> |
|---|
| 151 |
While creating <application>LaTeX</application> documents it can |
|---|
| 152 |
be desirable to distinguish between UML diagrams and common figures. |
|---|
| 153 |
Using <literal>float</literal> |
|---|
| 154 |
<application>LaTeX</application> package you can create new |
|---|
| 155 |
<application>LaTeX</application> environment specific for UML diagrams, see |
|---|
| 156 |
<xref linkend="ex-latex-use-float"/>. |
|---|
| 157 |
</para> |
|---|
| 158 |
<example id="ex-latex-use-float"> |
|---|
| 159 |
<title>Diagram LaTeX environment</title> |
|---|
| 160 |
<programlisting> |
|---|
| 161 |
\newfloat{diagram}{ht}{drg} |
|---|
| 162 |
\floatname{diagram}{Diagram} |
|---|
| 163 |
|
|---|
| 164 |
... |
|---|
| 165 |
|
|---|
| 166 |
\begin{diagram} |
|---|
| 167 |
\includegraphics[width=.8\textwidth]{pdfdiagrams/Documentation_Example/DocBook/Classes} |
|---|
| 168 |
\caption{DocBook documentation example}\label{diag:docbook} |
|---|
| 169 |
\end{diagram} |
|---|
| 170 |
|
|---|
| 171 |
... |
|---|
| 172 |
|
|---|
| 173 |
% generate list of diagrams |
|---|
| 174 |
\listof{diagram}{List of Diagrams} |
|---|
| 175 |
</programlisting> |
|---|
| 176 |
</example> |
|---|
| 177 |
<para> |
|---|
| 178 |
Example file can be downloaded using following link |
|---|
| 179 |
<ulink url="texfloatexample.tex">texfloatexample.tex</ulink>. |
|---|
| 180 |
</para> |
|---|
| 181 |
<para> |
|---|
| 182 |
See also |
|---|
| 183 |
<literal>float</literal> <application>LaTeX</application> |
|---|
| 184 |
package documentation "An Improved Environment |
|---|
| 185 |
for Floats" by Anselm Lingnau. |
|---|
| 186 |
</para> |
|---|
| 187 |
</section> |
|---|
| 188 |
</section> |
|---|
| 189 |
|
|---|
| 190 |
<section id="sect-project-documentation-docbook"> |
|---|
| 191 |
<title>DocBook</title> |
|---|
| 192 |
<para> |
|---|
| 193 |
(to be done using svg files, first let's change gaphor manual to use |
|---|
| 194 |
them) |
|---|
| 195 |
</para> |
|---|
| 196 |
</section> |
|---|
| 197 |
</chapter> |
|---|
| 198 |
|
|---|
| 199 |
|
|---|