Fix for UBSan build
[platform/upstream/doxygen.git] / doc / formulas.doc
1 /******************************************************************************
2  *
3  * 
4  *
5  * Copyright (C) 1997-2012 by Dimitri van Heesch.
6  *
7  * Permission to use, copy, modify, and distribute this software and its
8  * documentation under the terms of the GNU General Public License is hereby 
9  * granted. No representations are made about the suitability of this software 
10  * for any purpose. It is provided "as is" without express or implied warranty.
11  * See the GNU General Public License for more details.
12  *
13  * Documents produced by Doxygen are derivative works derived from the
14  * input used in their production; they are not affected by this license.
15  *
16  */
17 /*! \page formulas Including formulas 
18
19 Doxygen allows you to put \f$\mbox{\LaTeX}\f$ formulas in the
20 output (this works only for the HTML and \f$\mbox{\LaTeX}\f$ output, 
21 not for the RTF nor for the man page output). To be able to include 
22 formulas (as images) in the HTML documentation, you will also need to 
23 have the following tools installed
24 <ul>
25 <li>\c latex: the \f$\mbox{\LaTeX}\f$ compiler, needed to parse the formulas. 
26     To test I have used the teTeX 1.0 distribution.
27 <li>\c dvips: a tool to convert DVI files to PostScript files 
28     I have used version 5.92b from Radical Eye software for testing.
29 <li>\c gs: the GhostScript interpreter for converting PostScript files 
30     to bitmaps. I have used Aladdin GhostScript 8.0 for testing.
31 </ul>
32 For the HTML output there is also an alternative solution using
33 <a href="http://www.mathjax.org">MathJax</a> which does not
34 require the above tools. If you enable \ref cfg_use_mathjax "USE_MATHJAX" in
35 the config then the latex formulas will be copied to the HTML "as is" and a
36 client side javascript will parse them and turn them into (interactive) images.
37
38 There are three ways to include formulas in the documentation.
39 <ol>
40 <li>Using in-text formulas that appear in the running text. 
41     These formulas should be put between a pair of \\f\$ 
42     commands, so
43 \verbatim
44   The distance between \f$(x_1,y_1)\f$ and \f$(x_2,y_2)\f$ is 
45   \f$\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}\f$.
46 \endverbatim results in:
47
48   The distance between \f$(x_1,y_1)\f$ and \f$(x_2,y_2)\f$ is 
49   \f$\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}\f$.
50 <br>
51 <li>Unnumbered displayed formulas that are centered on a separate line.
52     These formulas should be put between \\f[ and \\f] commands.
53     An example:
54 \verbatim
55   \f[
56     |I_2|=\left| \int_{0}^T \psi(t) 
57              \left\{ 
58                 u(a,t)-
59                 \int_{\gamma(t)}^a 
60                 \frac{d\theta}{k(\theta,t)}
61                 \int_{a}^\theta c(\xi)u_t(\xi,t)\,d\xi
62              \right\} dt
63           \right|
64   \f]
65 \endverbatim
66   results in:
67   \f[
68     |I_2|=\left| \int_{0}^T \psi(t) 
69              \left\{ 
70                 u(a,t)-
71                 \int_{\gamma(t)}^a 
72                 \frac{d\theta}{k(\theta,t)}
73                 \int_{a}^\theta c(\xi)u_t(\xi,t)\,d\xi
74              \right\} dt
75           \right|
76   \f]
77 <li>Formulas or other latex elements that are not in a math 
78     environment can be specified using \\f{environment}, where
79     \c environment is the name of the \f$\mbox{\LaTeX}\f$ environment, 
80     the corresponding end command is \\f}. Here is an example for an 
81     equation array
82 \verbatim
83    \f{eqnarray*}{
84         g &=& \frac{Gm_2}{r^2} \\ 
85           &=& \frac{(6.673 \times 10^{-11}\,\mbox{m}^3\,\mbox{kg}^{-1}\,
86               \mbox{s}^{-2})(5.9736 \times 10^{24}\,\mbox{kg})}{(6371.01\,\mbox{km})^2} \\ 
87           &=& 9.82066032\,\mbox{m/s}^2
88    \f}
89 \endverbatim
90   which results in:
91    \f{eqnarray*}
92         g &=& \frac{Gm_2}{r^2} \\ 
93           &=& \frac{(6.673 \times 10^{-11}\,\mbox{m}^3\,\mbox{kg}^{-1}\,
94               \mbox{s}^{-2})(5.9736 \times 10^{24}\,\mbox{kg})}{(6371.01\,\mbox{km})^2} \\ 
95           &=& 9.82066032\,\mbox{m/s}^2
96    \f}
97 </ol>
98 For the first two commands one should make sure formulas contain 
99 valid commands in \f$\mbox{\LaTeX}\f$'s math-mode. For the third command
100 the section should contain valid command for the specific environment.
101
102 \warning Currently, doxygen is not very fault tolerant in recovering 
103 from typos in formulas. It may be necessary to remove the
104 file <code>formula.repository</code> that is written to the html directory to 
105 get rid of an incorrect formula.
106
107 \htmlonly
108 Go to the <a href="diagrams.html">next</a> section or return to the
109  <a href="index.html">index</a>.
110 \endhtmlonly
111
112 */