0024809: Exception is raised during perform of "bfillds" command on attached shape
[occt.git] / dox / dev_guides / documentation / documentation.md
CommitLineData
e5bd0d98 1 Documentation System {#dev_guides__documentation}
2======================
3
4@tableofcontents
72b7576f 5
6@section OCCT_DM_SECTION_1 Introduction
7
3d68eaf5 8This document provides practical guidelines for generation and editing of OCCT user documentation.
72b7576f 9
10@section OCCT_DM_SECTION_2 Prerequisites
11
3d68eaf5 12You need to have the following software installed to generate the documentation.
e8181411 13
3d68eaf5 14**Tcl/Tk**
e5bd0d98 15Version 8.5 or 8.6: http://www.tcl.tk/software/tcltk/download.html
72b7576f 16
3d68eaf5 17**Doxygen**
e5bd0d98 18Version 1.8.4 or above: http://www.stack.nl/~dimitri/doxygen/download.html
72b7576f 19
3d68eaf5 20**MiKTeX** or other package providing **pdflatex** command (only needed for generation of PDF documents): http://miktex.org/download
72b7576f 21
3d68eaf5 22**Inkscape** (only needed for generation of PDF documents containing SVG images): http://www.inkscape.org/download
e5bd0d98 23
3d68eaf5 24When generating PDF documentation, **pdflatex** and **inkscape** executables should be accessible by PATH variable.
25You can use *custom.bat* file to add necessary paths to the *PATH* variable.
e5bd0d98 26
3d68eaf5 27Note that in the process of PDF generation MiKTeX may need some packages not installed by default.
28We recommend setting option "Install missing packages on-the-fly" to "Ask me first" (default) during MiKTeX installation:
dba69de2 29
3d68eaf5 30@figure{/dev_guides/documentation/images/documentation_miktex.png}
e8181411 31
3d68eaf5 32On the first run of **pdflatex** it will open a dialog window prompting for installation of missing packages.
33Follow the instructions to proceed (define proxy settings if needed, select a mirror site to download from, etc.).
34
35**MathJax** is used for rendering math formulas in browser (HTML and CHM outputs): http://www.mathjax.org.
36
37By default MathJAX scripts and fonts are taken from http://cdn.mathjax.org/mathjax/latest and no installation of MathJAX is necessary if Internet is accessible.
38If you need to use OCCT documentation while off-line, you can install a local copy of MatJAX, see http://www.mathjax.org/download/.
39See \ref OCCT_DM_SECTION_A_9 for more details on inserting mathematical expressions.
e8181411 40
72b7576f 41@section OCCT_DM_SECTION_2_1 Documentation Generation
42
3d68eaf5 43Run *gendoc.bat* from OCCT directory to generate all documents defined in *FILES.txt*:
72b7576f 44
3d68eaf5 45*gendoc.bat* can be started with the following options:
72b7576f 46
3d68eaf5 47 * <i>-html</i> : Generates HTML files (cannot be used with -pdf);
48 * <i>-pdf</i> : Generates PDF files (cannot be used with -html);
49 * <i>-m=\<modules_list\></i> : Specifies the list of documents to generate. If it is not specified, all files mentioned in *FILES.txt* are processed;
50 * <i>-l=\<document_name\></i> : Specifies the output document title;
51 * <i>-mathjax=\<path\></i> : Specifies the path to a non-default location of MathJAX;
52 * <i>-h</i> : Prints a help message;
53 * <i>-v</i> : Toggles the Verbose mode (info on all script actions is shown).
72b7576f 54
3d68eaf5 55If you run the command without arguments (like in the example above) it will generate HTML documentation for all documents defined in *FILES.txt*.
72b7576f 56
3d68eaf5 57**Note**
72b7576f 58
3d68eaf5 59* In case of a PDF output the utility generates a separate PDF file for each document;
60* In case of an HTML output the utility generates a common Table of contents containing references to all documents.
72b7576f 61
3d68eaf5 62To generate the output for a specific document specify the path to the corresponding MarkDown file (paths relative to *dox* sub-folder can be given), for instance:
72b7576f 63
3d68eaf5 64~~~~
65 % gendoc.bat -html -m=dev_guides/documentation/documentation.md
66~~~~
72b7576f 67
3d68eaf5 68Multiple files can be separated with commas:
69~~~~
e8181411 70 % gendoc.bat -html -m=MD_FILE_1,MD_FILE_2
3d68eaf5 71~~~~
72b7576f 72
3d68eaf5 73Use quotes to specify an article name with <i>-l</i> option, which helps to prevent incorrect interpretation of white spaces:
72b7576f 74
3d68eaf5 75~~~~
e8181411 76 % gendoc.bat -pdf -m=MD_FILE_1 -l="Label of MD_FILE_1 document"
3d68eaf5 77~~~~
72b7576f 78
79@section OCCT_DM_SECTION_3 Documentation Conventions
80
3d68eaf5 81This section contains information about file format conventions, directories structure, etc.
72b7576f 82
83@subsection OCCT_DM_SECTION_3_1 File Format
84
79d580f2 85The format used for documentation is MarkDown with Doxygen extensions.
3d68eaf5 86The MarkDown files have a <i>*.md</i> extension and are based on rules described in \ref OCCT_DM_SECTION_A section.
72b7576f 87
88@subsection OCCT_DM_SECTION_3_2 Directory Structure
89
3d68eaf5 90@figure{/dev_guides/documentation/images/documentation_folders.png}
72b7576f 91
3d68eaf5 92Each document has its own folder if there are any images used in it. These images are stored in *images* subfolder.
93
94If you want to use the same image for several documents, you can place it in *dox/resources* folder.
95
96**Note**: To avoid incorrect image display, use a relative path to the image (starting from *dox* folder). For instance:
72b7576f 97
72b7576f 98
72b7576f 99@verbatim
3d68eaf5 100@figure{/dev_guides/documentation/images/documentation_test_image.svg}
72b7576f 101@endverbatim
102
72b7576f 103
3d68eaf5 104The documentation is generated in subfolder *doc* :
105* *html* - a directory for generated HTML pages;
106* *pdf* - a directory for generated PDF files.
107
108@section OCCT_DM_SECTION_4 Adding a New Document
109
110Place a new document in the folder taking into account its logical position in the documentation hierarchy. For instance, the document *svn.md* about the use of SVN to work with OCCT source code can be placed into <i>/dox/dev_guides/</i>.
72b7576f 111
3d68eaf5 112If there are images in the document, it should be placed in its own folder containing a subfolder for images. For instance:
113* <i> /dox/dev_guides/svn/ </i> - for *svn.md* file;
114* <i> /dox/dev_guides/svn/images/ </i> - for images.
72b7576f 115
3d68eaf5 116Add a relative path to *svn.md* in file <i>dox/FILES.txt</i>. For instance
72b7576f 117
72b7576f 118@verbatim
3d68eaf5 119dev_guides/svn/svn.md
72b7576f 120@endverbatim
121
3d68eaf5 122**Note** that the order of paths to documents in *FILES.txt* is reproduced in the Table of Contents in the HTML output. Please, place them logically.
72b7576f 123
3d68eaf5 124**Note** that you should specify a file tag, not the document name. See <a href="#OCCT_DM_SECTION_A_1">Header section</a> for details.
72b7576f 125
126@section OCCT_DOC_SECTION_5 Additional Resources
127
128More information about OCCT can be found at http://www.opencascade.org
129
130The information on formula syntax can be found at:
131http://en.wikipedia.org/wiki/Help:Displaying_a_formula
132
133More information on MarkDown and Doxygen syntax can be found at:
134http://www.stack.nl/~dimitri/doxygen/manual
e5bd0d98 135
136@section OCCT_DM_SECTION_A Appendix 1: Document Syntax
137
3d68eaf5 138A document file in *.md format must start with a proper header defining a caption and a unique tag.
139
140@verbatim
141Documentation System {#dev_guides__documentation}
142=====================
143@endverbatim
e5bd0d98 144
3d68eaf5 145The document structure is formed by sections that must be defined consistently.
e5bd0d98 146
3d68eaf5 147The document can contain plain text, lists, tables, code snippets, images, math, etc.
148Any specific text elements can be introduced by Markdown language tags or by usual HTML tags.
e5bd0d98 149
3d68eaf5 150The table of contents, page numbers (in PDF), and figure numbers (in PDF) are generated automatically.
e5bd0d98 151
3d68eaf5 152@subsection OCCT_DM_SECTION_A_1 Headers and hierarchic document structure
e5bd0d98 153
3d68eaf5 154Headers of different levels can be specified with the following tags:
155* <i>\@section</i> - for the first-level headers;
156* <i>\@subsection</i> - for the second level headers;
157* <i>\@subsubsection</i> - for the third level headers.
158
159For example:
e5bd0d98 160
161@verbatim
3d68eaf5 162 @section occt_ocaf_1 Basic Concepts
163 @subsection occt_ocaf_1_1 Applications and Documents
164 @subsubsection occt_ocaf_1_1_1 The document and the data framework
e5bd0d98 165@endverbatim
166
3d68eaf5 167Please, note that section names can be used for references within the document and in other documents, so it is necessary to use the common prefix indicative of the document name for all section names in the given document.
168For example, *occt_ocaf* for sections in Open CASCADE Application Framework manual.
e5bd0d98 169
3d68eaf5 170The remaining part of section names in most documents consists only of numbers, for example *1_1*. Actually, the hierarchical structure of the output table of contents is not based on these numbers and is generated automatically.
e5bd0d98 171
3d68eaf5 172The numbers are only indicative of a section location in the body of the document. However, duplicate section names in a document inevitably cause errors during generation.
e5bd0d98 173
3d68eaf5 174If you insert a section in the middle of a big document, do not renumber the document to the end (which is inefficient and error prone), but choose an arbitrary number or letter, not yet used in the document section naming, and base the naming in this section on it.
e5bd0d98 175
3d68eaf5 176The section hierarchy is limited to three levels and further levels cannot be presented in the Table of Contents.
e5bd0d98 177
3d68eaf5 178However, the fourth and fifth level headers can be tagged with <i>####</i> and <i>#####</i> correspondingly.
e5bd0d98 179
3d68eaf5 180It is also possible to use tags <i>##</i> and <i>###</i> for second and third level headers if you do not wish to show them in the table of contents or make references to them.
e5bd0d98 181
182@subsection OCCT_DM_SECTION_A_2 Plain Text
183
3d68eaf5 184A plain text is organized in paragraphs, separated by empty lines in MarkDown source.
185The length of lines is not restricted; it is recommended to put each sentence on a separate line -- this is optimal for easier comparison of different versions of the same document.
186
187To insert special symbols, like \< , \> or \\, prepend them with \\ character: \\\<, \\\>, \\\\, etc.
188To emphasize a word or a group of words, wrap the text with one pair of asterisks (*) or underscores (_) to make it *italic* and two pairs of these symbols to make it **Bold**.
189
190**Note** that if your emphasized text starts or ends with a special symbol, the asterisks may not work. Use explicit HTML tags \<i\>\</i\> and \<b\>\</b\> instead.
191
e5bd0d98 192
193@subsection OCCT_DM_SECTION_A_3 Lists
194
195To create a bulleted list, start each line with a hyphen or an asterisk,
196followed by a space. List items can be nested. This code:
197
198@verbatim
79d580f2 199* Bullet 1
200* Bullet 2
201 - Bullet 2a
202 - Bullet 2b
203* Bullet 3
e5bd0d98 204@endverbatim
205
79d580f2 206produces this list:
e5bd0d98 207
79d580f2 208* Bullet 1
209* Bullet 2
210 * Bullet 2a
211 * Bullet 2b
212* Bullet 3
e5bd0d98 213
79d580f2 214To create a numbered list, start each line with number and a period,
215then a space. Numbered lists can also be nested. Thus this code
e5bd0d98 216
217@verbatim
79d580f2 2181. List item 1
219 1. Sub-item 1
220 2. Sub-item 2
2212. List item 2
3d68eaf5 2224. List item 3
e5bd0d98 223@endverbatim
224
79d580f2 225produces this list:
e5bd0d98 226
79d580f2 2271. List item 1
228 1. Sub-item 1
229 2. Sub-item 2
2302. List item 2
2313. List item 3
e5bd0d98 232
3d68eaf5 233**Note** that numbers of list items in the output are generated so they do not necessarily follow the numbering of source items.
234
235In some cases automatic generation adversely restarts the numbering, i.e. you get list items 1. 1. 1. instead of 1. 2. 3. in the output.
236The use of explicit HTML tags \<ol\>\</ol\> and \<li\>\</li\> can help in this case.
237
79d580f2 238Each list item can contain several paragraphs of text; these paragraphs must
239have the same indentation as text after bullet or number in the numbered list
240item (otherwise numbering will be broken).
241
242Code blocks can be inserted as paragraphs with additional indentation
243(4 spaces more). Note that fenced code blocks do not work within numbered lists
244and their use may cause numeration to be reset.
245
246
3d68eaf5 247Example of a complex nested list:
79d580f2 248
2491. List item 1
250
251 Additional paragraph
252
253 code fragment
254
255 One more paragraph
256
257 1. Sub-item 1
258
259 code fragment for sub-item 1
260
261 2. Sub-item 2
262
263 Paragraph for sub-item 2
264
265 Yet one more paragraph for list item 1
266
2672. List item 2
268
e5bd0d98 269
270@subsection OCCT_DM_SECTION_A_4 Tables
271
272A table consists of a header line, a separator line, and at least one row line.
273Table columns are separated by the pipe (|) character. The following example:
274
275@verbatim
276First Header | Second Header
277------------- | -------------
278Content Cell | Content Cell
279Content Cell | Content Cell
280@endverbatim
281
282 will produce the following table:
283
284First Header | Second Header
285------------ | -------------
286Content Cell | Content Cell
287Content Cell | Content Cell
288
289Column alignment can be controlled via one or two colons at the header separator line:
290
291@verbatim
292| Right | Center | Left |
293| ----: | :----: | :---- |
294| 10 | 10 | 10 |
295| 1000 | 1000 | 1000 |
296@endverbatim
297
298which will looks as follows:
299
300| Right | Center | Left |
301| ----: | :----: | :---- |
302| 10 | 10 | 10 |
303| 1000 | 1000 | 1000 |
304
3d68eaf5 305Note that each table row should be contained in one line of text; complex tables can be created using HTML tags.
79d580f2 306
e5bd0d98 307@subsection OCCT_DM_SECTION_A_5 Code Blocks
308
3d68eaf5 309Paragraphs indented with 4 or more spaces are considered as code fragments and rendered using Courier font.
310Example:
311
312 This line is indented by 4 spaces and rendered as a code block.
313
e5bd0d98 314A fenced code block does not require indentation, and is defined by a pair of "fence lines".
315Such line consists of 3 or more tilde (~) characters on a line.
3d68eaf5 316The end of the block should have the same number of tildes.
317Thus it is strongly advised to use only three or four tildes.
e5bd0d98 318
319By default the output is the same as for a normal code block.
320To highlight the code, the developer has to indicate the typical file extension,
321which corresponds to the programming language, after the opening fence.
322For highlighting according to the C++ language, for instance, write the following code (the curly braces and dot are optional):
323
324@verbatim
3d68eaf5 325~~~{.cpp}
bb27b807 326int func(int a,int b) { return a*b; }
3d68eaf5 327~~~
e5bd0d98 328@endverbatim
329
330which will produce:
3d68eaf5 331~~~{.cpp}
bb27b807 332int func(int a,int b) { return a*b; }
3d68eaf5 333~~~
e5bd0d98 334
3d68eaf5 335Smaller code blocks can be inserted by wrapping with tags <i>\@code</i> and <i>\@endcode</i>.
bb27b807 336
3d68eaf5 337Verbatim content (same as code but without syntax highlighting) can be inserted by wrapping with tags <i>\@verbatim</i> and <i>\@endverbatim</i>.
e5bd0d98 338
339@subsection OCCT_DM_SECTION_A_6 References
340
3d68eaf5 341To insert a reference to a website, it is sufficient to write an URL.
342For example: http://en.wikipedia.org
e5bd0d98 343
3d68eaf5 344To insert a reference to a document or its subsection, use command <i>\@ref</i> followed by the document or section tag name.
345For instance, @code @ref OCCT_DM_SECTION_A @endcode will be rendered as @ref OCCT_DM_SECTION_A.
e5bd0d98 346
3d68eaf5 347Note that links between documents will not work in PDF output if each document is generated independently.
348Hence it is recommended to add a name of the referenced section after the tag name in the <i>\@ref</i> command (in quotes): this will guarantee that the reference is recognizable for the reader even if the cross-link is not instantiated.
349For instance: @code @ref occt_modat_1 "Geometry Utilities" @endcode will be rendered as @ref occt_modat_1 "Geometry Utilities".
e5bd0d98 350
351@subsection OCCT_DM_SECTION_A_7 Images
352
3d68eaf5 353For inserting images into the document use the command <i>\@figure</i>, as follows:
bb27b807 354
bb27b807 355@verbatim
3d68eaf5 356 @figure{/relative/path/to/image/image_file_name.png,"Image caption"}
bb27b807 357@endverbatim
358
3d68eaf5 359The first argument is a path to the image file, relative to the *dox* folder.
360The supported formats for images are PNG, JPG, and SVG.
361The file extension must be lowercase and correspond to the file format.
362The image file name should have no dots except for the one before extension (names with more than one dot confuse **pdflatex**).
363
364The second argument is optional, it defines the caption for the image to be inserted.
365The caption argument, if given, should be quoted, even if it is a single word.
366Captions are included below the image; in PDF output the images with caption are numbered automatically.
367
368Example:
bb27b807 369
e5bd0d98 370@verbatim
3d68eaf5 371 @figure{/dev_guides/documentation/images/documentation_test_image.svg,"Test SVG image"}
e5bd0d98 372@endverbatim
373
3d68eaf5 374is rendered as:
375
376@figure{/dev_guides/documentation/images/documentation_test_image.svg,"Test SVG image"}
377
378We recommend using **Inkscape** for creation and edition of vector graphics.
379The graphics created in MS Word Draw and some other vector editors can be copy-pasted to Inkscape and saved as SVG images.
380
381Note that the image that will be included in documentation is the whole page of the Inkscape document; use option "Resize page to content" in menu **File -> Document properties** of Inkscape to fit page dimensions to the picture (adding margins as necessary).
382
383Note that the *figure* command is an alias to the standard Doxygen command *image* repeated twice: once for HTML and then for Latex output (used for PDF generation). Thus if HTML and PDF outputs should include different images or captions, command "image" can be used:
384
e5bd0d98 385@verbatim
3d68eaf5 386 @image html /relative/path/to/image/occ_logo.png
387 @image latex /relative/path/to/image/occ_logo.png "OCC logo"
e5bd0d98 388@endverbatim
389
3d68eaf5 390@image html /resources/occ_logo.png
391@image latex /resources/occ_logo.png "OCC logo"
e5bd0d98 392
393@subsection OCCT_DM_SECTION_A_8 Table Of Contents
394
3d68eaf5 395Use \@tableofcontents tag to get the table of contents at the beginning of the document.
396
397Actually, it is not strictly necessary now because TreeView option for HTML is used.
e5bd0d98 398The TOC in the PDF document will be generated automatically.
399
400@subsection OCCT_DM_SECTION_A_9 Formulas
401
e8181411 402Formulas within MarkDown documents can be defined using LaTeX syntax.
e5bd0d98 403
404Equations can be written by several ways:
405
4061.Unnumbered displayed formulas that are centered on a separate line.
407These formulas should be put between \@f\[ and \@f\] tags. An example:
408
409@verbatim
dd21889e 410@f[
e5bd0d98 411 |I_2|=\left| \int_{0}^T \psi(t)
412 \left\{
413 u(a,t)-
414 \int_{\gamma(t)}^a
415 \frac{d\theta}{k(\theta,t)}
416 \int_{a}^\theta c(\xi)u_t(\xi,t)\,d\xi
417 \right\} dt
418 \right|
dd21889e 419@f]
e5bd0d98 420@endverbatim
421
422gives the following result:
423
424 @f$
425 |I_2|=\left| \int_{0}^T \psi(t)
426 \left\{
427 u(a,t)-
428 \int_{\gamma(t)}^a
429 \frac{d\theta}{k(\theta,t)}
430 \int_{a}^\theta c(\xi)u_t(\xi,t)\,d\xi
431 \right\} dt
432 \right|
433 @f$
434
3d68eaf5 4352.Formulas can also be put between @verbatim \begin{align} @endverbatim and @verbatim \end{align} @endverbatim tags.
e5bd0d98 436
3d68eaf5 437 For example:
438
e5bd0d98 439@verbatim
440 \begin{align}
441 \dot{x} & = \sigma(y-x) \\
442 \dot{y} & = \rho x - y - xz \\
443 \dot{z} & = -\beta z + xy
444 \end{align}
445@endverbatim
446
447 gives the following result:
448@latexonly
449 \begin{align}
450 \dot{x} & = \sigma(y-x) \\
451 \dot{y} & = \rho x - y - xz \\
452 \dot{z} & = -\beta z + xy
453 \end{align}
454@endlatexonly
455
456@htmlonly
457 \begin{align}
458 \dot{x} & = \sigma(y-x) \\
459 \dot{y} & = \rho x - y - xz \\
460 \dot{z} & = -\beta z + xy
461 \end{align}
462@endhtmlonly
463
4643.Inline formulas can be specified using this syntax:
465
466@verbatim
467 @f$ \sqrt{3x-1}+(1+x)^2 @f$
468@endverbatim
469
470 that leads to the following result: @f$ \sqrt{3x-1}+(1+x)^2 @f$
471