1

my question is an extension of this one, and what i want is Doxygen to output the math formulas and text that are in the same comment line of my python source code. Let's take the following example:

# Create homogeneous probability matrix from the colors matrix
def create_probability_map(colors_map):
    """!\f$(x_1,y_1)\f$"""
    pass

When I run the above code, Doxygen outputs the correct math formula, as expected. However, if I add some text before the math formula:

# Create homogeneous probability matrix from the colors matrix
def create_probability_map(colors_map):
    """Formula is: !\f$(x_1,y_1)\f$"""
    pass

The output is not as expected. Does anyone know how to fix this?

output is not as expected

While trying other several combinations, I found out that Doxygen outputs the correct comment if the text is after the math formula, as follows:

# Create homogeneous probability matrix from the colors matrix
def create_probability_map(colors_map):
    """!\f$(x_1,y_1)\f$ is the formula"""
    pass

P.S: I also found it strange that supposedly Doxygen can't process math formulas on Python, as stated on the documentation (specifically in here). Is the documentation out of date?

albert
  • 8,285
  • 3
  • 19
  • 32

1 Answers1

0

I tried with doxygen 1.8.18 the following code:

## \file

# Create homogeneous probability matrix from the colors matrix
def create_probability_map1(colors_map):
    """!\f$(x_1,y_1)\f$"""
    pass

# Create homogeneous probability matrix from the colors matrix
def create_probability_map2(colors_map):
    """Formula is: !\f$(x_2,y_2)\f$"""
    pass

# Create homogeneous probability matrix from the colors matrix
def create_probability_map3(colors_map):
    """!\f$(x_3,y_3)\f$ is the formula"""
    pass

# Create homogeneous probability matrix from the colors matrix
def create_probability_map4(colors_map):
    """!Formula is: \f$(x_4,y_4)\f$ is the formula"""
    pass

with default doxygen configuration settings, this results in:

enter image description here

This looks all OK to me the doc strings with"""! are seen as doxygen comments and with just """ are seen as verbatim / code (as also shown in the mentioned link in the question).

albert
  • 8,285
  • 3
  • 19
  • 32
  • Perfect, so the trick was actually starting the comment with """! instead on only """. Thanks a lot, that really helped! :) – José Brito Apr 16 '20 at 16:03