Rustdoc messes up math formulas, but only in one module

Hello all, I am a bit stumped here. I have a project here that contains a lot of math in the documentation. I am using katex via the --html-in-header flag and it all used to work out fine. I added a new module statistics in the branch and built the documentation locally via

RUSTDOCFLAGS="--html-in-header katex-header.html" cargo doc --no-deps --open

And it works for every module but the new statistics module. In that module the formulas are displayed as code $f(x,y$)$, with dollar signs around it rather than rendered in katex. This is also what the generated hmtl shows. I am really stumped. Why does this not work for the newly added module but it works for all the old modules on the same level of the module tree??

(Disclosure: I posted this to Rust reddit, but I did not get an answer unfortunately)

I cloned your repo, switched to the feature/uncertainties-of-fit-parameters branch, and ran the command you provided. When I turn on developer tools in my browser and navigate to target/doc/varpro/statistics/struct.FitStatistics.html (the documentation for statistics::FitStatistics) I see this error in the console:

Uncaught ParseError: KaTeX parse error: Can't use function '$' in math 
mode at position 10: \vec{r_w}$̲ = W * (\vec{y}…

So my guess would be invalid KaTeX somewhere? I don't know KaTeX though.


Thank you so much, that would have driven me insane. I should learn how to use the dev tools in my browser :sweat_smile:

Also thanks for a certain book that got me into this whole ecosystem :smiley:


No problem! I'm a recovering web developer :sweat_smile: And thank you for your kind words!! :heart:


This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.