2
votes

What is the best way to include math symbols/equations in Doxygen Markdown? I've gotten it to work by enabling MathJax in my Doxygen config doing something like this in my .md markdown file:

\\[
A_{C \\rightarrow P}=\\begin{bmatrix}
f * S_x / d_{px} & 0.0        & C_x & 0.0 \\\\ \
0.0              & f / d_{py} & C_y & 0.0 \\\\ \
0.0              & 0.0        & f   & 0.0 \\\\ \
0.0              & 0.0        & 1.0 & 0.0 \\\\
\\end{bmatrix}
\\]

But as you can see, I've entered the land of escaping hell. The original LaTeX used with a MathJax-enabled page looked like this:

\[
A_{C \rightarrow P}=\begin{bmatrix}
f * S_x / d_{px} & 0.0        & C_x & 0.0 \\
0.0              & f / d_{py} & C_y & 0.0 \\
0.0              & 0.0        & f   & 0.0 \\
0.0              & 0.0        & 1.0 & 0.0 \\
\end{bmatrix}
\]

Is there a better way?

1
Did you have a look at the doxygen commands \f{ etc, they can be used in doxygen's implementation for Markdown as well (see manual chapter about formulas).albert

1 Answers

3
votes

As @albert pointed it out, you just need to use doxygen's formatting commands, in your case \f[ and \f]:

\f[
A_{C \rightarrow P}=\begin{bmatrix}
f * S_x / d_{px} & 0.0        & C_x & 0.0 \\
0.0              & f / d_{py} & C_y & 0.0 \\
0.0              & 0.0        & f   & 0.0 \\
0.0              & 0.0        & 1.0 & 0.0 \\
\end{bmatrix}
\f]

It might not be relevant to your case, but it took me a while to realize that the default URL for MathJax provided by doxygen is invalid. One should change it, or include it in another way.