use macro in doxygen that relies on etoolbox package

60 Views Asked by At

I have a macro defined as

\usepackage{etoolbox} %to use \ifstrempty

\newcommand{\ISet}[1][]
{
    \ifstrempty{#1}
        {\mathfrak{i}}
        {\mathfrak{i}_{#1}}
}

which relies on the etoolbox package.

Is there a way to use this macro in doxygen?

EDIT (provided a MWE):

# configuration file
FORMULA_MACROFILE      = ./macros.tex
EXTRACT_ALL            = YES
EXTRA_PACKAGES = etoolbox amsfonts
INPUT                  = ./mwe.cc

macros.tex

\newcommand{\pr}[1][]{
\ifstrempty{#1}%
{%
p%
}{%
p_{#1}%
}%
}

mwe.cc

/**
*  \f$  \pr[1] , \pr  \f$
*/
int main()
{
return 0;
}

Gives wrong output, see the picture

enter image description here

1

There are 1 best solutions below

21
albert On BEST ANSWER

With the proposed doxygen patch https://github.com/doxygen/doxygen/pull/10189 in the current doxygen master version (using an absolute path at the moment would probably also work) the settings:

QUIET = YES
EXTRA_PACKAGES = etoolbox amsfonts
FORMULA_MACROFILE = mymacro.sty

and

the FORMULA_MACROFILE

\newcommand{\ISet}[1][]
{
    \ifstrempty{#1}
        {\mathfrak{i}}
        {\mathfrak{i}_{#1}}
}

it all looks like to work.

Edit Given the example from the question I get for HTML:

enter image description here

and for Latex:

enter image description here

This looks all OK to me.

  • Where should I look for the problem?