4
votes

I am including amsmath in my doxygen and I wrote:

\f{equation}{
  x=2 
\f}

but the result in the doxygen is

\begin{equation} x=2 \end{equation}

rather than the equation

x=2

Does anyone know what going wrong?

3
I used default doxygen setup and have the formula in a C file and works without problems. Which version of doxygen are you using? Which rendering are you using for formulas (LaTeX or MathJax). Are you getting any error messages.albert
I am using doxygen version 1.8.8 using LaTeX and I am not getting any errors ...ad_ad
Best is to supply a small complete example either here or as a bug report or on the mailing list so it is possible to reproduce. seen the \begin{equation} x=2 \end{equation} it looks a bit like you are using MathJax and don't get it loaded.albert

3 Answers

4
votes

You are doing it correctly, I do that and it works. The page briefly shows \begin{equation} x=2 \end{equation} and then the correct equation appears.

Double check that you have USE_MATHJAX = YES in your config file. The default is NO

See: USE_MATHJAX in the Doxygen reference.

If not set to YES the page displaying the equation might not include the mathjax scripts (I haven't checked):

<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    extensions: ["tex2jax.js"],
    jax: ["input/TeX","output/HTML-CSS"],
});
</script><script src="http://cdn.mathjax.org/mathjax/latest/MathJax.js"></script>
0
votes

Instead use

\f$ x=2 \f$

which would output an inline math formula.

Reference: Doxygen Including formulas

0
votes

I decided to put add some new information to this question as it is 2019 and there is a more easy way to enable MathJax.

When using the Doxygen GUI frontend, You can enable MathJax in the "expert" tab under HTML. By default this will include a CDN. To point to your own downloaded version of MathJax you can set MATHJAX_RELPATH.

enter image description here