DoxyPress  1.7.0
Formulas

DoxyPress allows you to put LaTeX formulas in the output (this works only for the HTML and LaTeX output, not for the RTF nor for the man page output). To be able to include formulas (as images) in the HTML documentation, you will also need to have the following tools installed

  • latex: LaTeX compiler, needed to parse the formulas.
  • dvips: A tool to convert DVI files to PostScript files.
  • gs: GhostScript interpreter for converting PostScript files to bitmaps.

For the HTML output there is also an alternative solution using MathJax which does not require the above tools. If you enable use-mathjax in the project file then the latex formulas will be copied to the HTML "as is" and a client side JavaScript will parse them and turn them into (interactive) images.

There are three ways to include formulas in the documentation. For the first two commands make sure the formulas contain valid commands in LaTeX's math-mode. The third option section requires commands valid for the specific environment.

(1) Using in line formulas

The formulas can be inserted between a pair of \f$ commands as shown below.

The distance between \f$(x_1,y_1)\f$ and \f$(x_2,y_2)\f$ is \f$\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}\f$

The result will be as follows:

The distance between \((x_1,y_1)\) and \((x_2,y_2)\) is \(\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}\)


(2) UnNumbered displayed formulas which are centered on a separate line

The formulas can be inserted between \f[ and \f] commands.

\f[
 |I_2|=\left| \int_{0}^T \psi(t)
          \left\{
             u(a,t)-
             \int_{\gamma(t)}^a
             \frac{d\theta}{k(\theta,t)}
             \int_{a}^\theta c(\xi)u_t(\xi,t)\,d\xi
          \right\} dt
       \right|
\f]

The result will be as follows:

\[ |I_2|=\left| \int_{0}^T \psi(t) \left\{ u(a,t)- \int_{\gamma(t)}^a \frac{d\theta}{k(\theta,t)} \int_{a}^\theta c(\xi)u_t(\xi,t)\,d\xi \right\} dt \right| \]


(3) Formulas or other latex elements that are not in a math environment

Formulas can be specified using \f{environment}, where environment is the name of the LaTeX environment, the corresponding end command is \f}. The following is an example for an equation array.

\f{eqnarray*}{
     g &=& \frac{Gm_2}{r^2} \\
       &=& \frac{(6.673 \times 10^{-11}\,\mbox{m}^3\,\mbox{kg}^{-1}\,
           \mbox{s}^{-2})(5.9736 \times 10^{24}\,\mbox{kg})}{(6371.01\,\mbox{km})^2} \\
       &=& 9.82066032\,\mbox{m/s}^2
\f}

The result will be as follows:

\begin{eqnarray*} g &=& \frac{Gm_2}{r^2} \\ &=& \frac{(6.673 \times 10^{-11}\,\mbox{m}^3\,\mbox{kg}^{-1}\, \mbox{s}^{-2})(5.9736 \times 10^{24}\,\mbox{kg})}{(6371.01\,\mbox{km})^2} \\ &=& 9.82066032\,\mbox{m/s}^2 \end{eqnarray*}


If you make an error in a formula it may be necessary to remove the file formula.repository which is located in the HTML output directory.