Open s133314 opened 2 years ago
I suppose that tabulate should stick to producing only Unicode output. So it needs something to recognize and convert inline formulas $E = mc^2$ to Unicode text. Something like https://github.com/phfaist/pylatexenc
As a workaround I would suggest to pre-process your headers and or data with it or a similar converter. Or type your formulas direclty in Unicode.
Let me know what works for you.
I may add an option to tabulate which allows to specify a custom formatter function for all or some values. In your case you would be able to supply a function which takes a string "foo $\eta$" and returns "foo η".
I did indeed for some things write my formula's directly in unicode but that was quite gruesome. But I guess with the converter you linked to (pylatexenc) that would ease my life. I'm not working with tabulate at the moment but I'll try it out when I use it again. If that library converts my latex to unicode that is good enough for me and I would not need the custom formatter function (could still be a nice to have for the tabulate module off course). Thanks!
I'm enjoying tabulate a lot, but I mostly use it just for printing a table in a jupyter notebook via the default plain format:
I often have headers with symbols/small math formula's. I would very much like it if a
when printing the table. I'm thinking similar to matplotlib where you can easily include latex math in labels and titles for example. Is this available and if not could it be made?
\eta
for example would automatically be rendered as