copperspice / doxypress

Documentation generator using annotated sources for multiple computer languages
https://www.copperspice.com/
GNU General Public License v2.0
150 stars 14 forks source link

Incorrect LaTex output in code snippets #41

Closed igor-chalenko closed 4 years ago

igor-chalenko commented 4 years ago

Hi,

Here's the way to reproduce the issue (see attachment for a self-contained example): 1) Use a snippet in comments:

/**
 * @snippet example/custom_operator.cc full
 */

2) In the referenced custom_operator.cc, write something like this:

auto operator^(E1 &&x, E2 &&y) -> Compound<XOR, E1, E2> {
    ....
}

Notice there's NO space between operator and ^.

When LaTex docs are generated, open refman.tex in some validating tool (I use TexStudio), or just run make pdf in latex directory. PDF generation should fail, and the reason for it is this line:

\DoxyCodeLine{\textcolor{keyword}{auto} operator^(E1 \&\&x, E2 \&\&y) -> Compound<XOR, E1, E2>

For comparison, this is what Doxygen generates (tested with 1.8.19):

\DoxyCodeLine{\textcolor{keyword}{auto} operator\string^(E1 \&\&x, E2 \&\&y) -\/> \mbox{\hyperlink{classctaeb_1_1Compound}{Compound<XOR, E1, E2>}} \{}

Now, if I ADD a space between operator and ^, Doxypress generates correct LaTex:

\DoxyCodeLine{\textcolor{keyword}{auto} operator\string^(E1 \&\&x, E2 \&\&y) -\/> \mbox{\hyperlink{classctaeb_1_1Compound}{Compound<XOR, E1, E2>}} \{}

So, apparently the problem boils down to the ^ being unrecognized. Enabling or disabling clang parsing makes no difference, it seems.

My environment: Ubuntu 18.04 + doxypress 1.4.0

Thanks, Igor.

latex-snippet-bug-reproduce.zip

agserm commented 4 years ago

Thanks so much for the report. We'll be looking at this next week.

bgeller commented 4 years ago

We have pushed a correction to correctly escape the ^ in Latex. Thanks for reporting this issue.

igor-chalenko commented 4 years ago

Excellent news! Thanks.