Jupyter notebooks allows LaTeX rendering inside markdown. This way you can write complex math equations within a notebook. While LaTeX is the de facto standard for scientific documents, it hasn't a very friendly and intuitive syntax. handcalcs is an Open Source library for converting Python calculations into rendered LaTeX: just write the symbolic formula, followed by numeric substitutions and that's it. After install it (it is available through PyPI), in the simplest case you just need to import the render class and use the %%render magic command to render the content of a cell:
Here another example of equation render and numeric substitution:It is also possible to render just the symbolic equation:or any way generate the corresponding LaTeX code:By default handcalcs renders code vertically, but it is possible to use the %%render params magic to save space by rendering in a single line or show just the result of a calculation:
handcalcs allows to adjust precision, use Greek symbols, use custom functions, render inline comments, include conditional statements, use units (along with the forallpeople or pint packages), export to HTML or PDF (the latter via LaTeX).After starting evaluation of this library, I can confirm that from a user experience standpoint it is definitely better that writing directly in LaTeX syntax within a notebook. All the features listed in the documentation work as expected. Only downside is that, at the moment this post is written, there is not yet full support for all the functions and symbols available in LaTeX (but I am quite sure this library will become more comprehensive in the future). Also, unfortunately the Python code render doesn't work in Colab: the %%render magic renders a cell into LaTeK content:
Thank you for sharing. Your blog provides huge support and information for everyone.
ReplyDeleteMini Projects | Major Projects | Enginering Projects | Diploma | BTech | MTech | Courses | Internships
Thanks for sharing this.It is a nice post.best project center in chennai|Project center in chennai
ReplyDelete