GNOME Bugzilla – Bug 766023
C++ operator%() confuses pdflatex
Last modified: 2016-05-05 13:12:55 UTC
Created attachment 327339 [details] Doxygen configuration Running doxygen on a toy C++ example produces both html and latex output. When you then run make in the latex directory, pdflatex hits an error condition at the point where the source code defines operator%(). Doxygen configuration is attached. Relevant part of pdflatex output is: Runaway argument? {\texorpdfstring {operator\%(floating lhs, int rhs)}{operator\begin {\ETC. ! Paragraph ended before \@sect was complete. <to be read again> Entire contents of toy.cc follows. #include <iostream> /** * A floating class */ class floating { public: float value; floating(float val) { value = val; }; }; /// A floating operator int operator%(floating lhs, int rhs) { return int(lhs.value) % rhs; } /** * A Toy example */ int main(int argc, char ** argv) { int result = floating(3.5) % 2; std::cout << "result==" << result << std::endl; return 0; }
Created attachment 327340 [details] Toy C++ example
Created attachment 327342 [details] [review] Difference between actual and expected latex file toy_8cc.tex.old is the file generated by Doxygen. toy_8cc.tex is the file I edited. With this one change (putting \ in front of %) pdflatex generates refan.pdf from refman.tex
See also pull request 454 on github *** This bug has been marked as a duplicate of bug 762982 ***