-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix latex rendering of variables with underscore in name #7501
Conversation
Hey @ricardoV94, I added a simplistic fix to address the underscores breaking the KaTeX output in VSCode and Jupyter. I tested in VSCode and Jupyter Lab. Are there any other environments I should test it out in? Hmm actually, it is not working now in Jupyter for me. Let me figure out what happened. Oh never mind, I was just not selecting the proper environment. It does work in Jupyter Lab. |
Hey @twiecki, I think some of the tests failed because they expect the LaTeX representation of underscores to be unescaped. Would it be okay, to modify those tests so that they expect underscores for LaTeX to be escaped? |
Yes. |
… fixed testing to expect underscores in LaTeX representation to be escaped
Hey @twiecki, I applied the underscore escaping function to also work at the distribution level within a model. So both calling objects holding distributions or calling the entire model will escape underscore variables for LaTeX representation. I also changed the expected string objects in the testing script to expect that underscores in LaTeX be escaped. |
…st to assert underscores are escaped
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7501 +/- ##
==========================================
+ Coverage 92.16% 92.43% +0.26%
==========================================
Files 103 103
Lines 17200 17109 -91
==========================================
- Hits 15853 15814 -39
+ Misses 1347 1295 -52
|
pymc-devs#7501) * implemented fix for escaping underscores in latex repr and added a unit test * updated unit test staticmethod to include underscore in var name * add underscore escape fix to distribution repr as well as model repr, fixed testing to expect underscores in LaTeX representation to be escaped * added cleaner method using re to escape underscores, added cleaner test to assert underscores are escaped
pymc-devs#7501) * implemented fix for escaping underscores in latex repr and added a unit test * updated unit test staticmethod to include underscore in var name * add underscore escape fix to distribution repr as well as model repr, fixed testing to expect underscores in LaTeX representation to be escaped * added cleaner method using re to escape underscores, added cleaner test to assert underscores are escaped
pymc-devs#7501) * implemented fix for escaping underscores in latex repr and added a unit test * updated unit test staticmethod to include underscore in var name * add underscore escape fix to distribution repr as well as model repr, fixed testing to expect underscores in LaTeX representation to be escaped * added cleaner method using re to escape underscores, added cleaner test to assert underscores are escaped
Description
I added a simple fix to LaTeX Repr that escapes variables that have underscores in them and I created a unit test to test the fix.
Related Issue
_
in variable names is not properly escaped #7495 and Refactor pretty-printing and fix latex underscores #6533Checklist
Type of change
📚 Documentation preview 📚: https://pymc--7501.org.readthedocs.build/en/7501/