# Greek (and special) symbols in LaTex

(Qoptics) #1

I am working on a project where I use Greek and special symbols in expressions (e.g. beta and hbar). In the latex output it would be nice to have these symbols render with their actual symbol rather than the spelled-out name. I can’t find a reliable way to do this with the LaTex string after exporting because all of the variables are put together without spaces (e.g. both “beta" and “beta” render as “beta” in the latex output, so I can’t tell whether the latex should be “b \eta” or “\beta”). Is there a way to force the latex output routine to put braces around each symbol so that the LaTex output is unambiguous? (e.g. for the input "beta”, the LaTex output would be “{b}{eta}”)

Infix.Parse throws error on underscore?
(Christoph Rüegg) #2

Braces would be an option and would not impact the rendering (and actually resolve a related issue on potential LaTeX parsing).

But I think we should render such symbols automatically using the Greek glyph out of the box, and while we’re at it render suffix numbers nicely as well, e.g. beta1 could render as {\beta_1}. We already render a few expressions like pi and infinity with proper symbols. This also applies to the Infix rendering with proper unicode glyphs.

(Christoph Rüegg) #3

On second thought, maybe the automatic suffix handling should be implemented differently, to ensure it is possible to cause consistent rendering of e.g. {\beta_1} and {\beta_k}.

(Qoptics) #4

I like the addition of braces to disambiguate the LaTex output. Having the glyph replacement be part of the LaTex output routine seems good, but should probably be implimented in a way that allows the package user to customize the replacement rules (edit, add, remove).

It seems like automatically typesetting numeric suffixes would be safe and beneficial (e.g… beta12 -> {\beta_{12}}), but alphabetic subscripts wouldn’t be uniquely defined well enough to handle automatically (e.g. should xi render as {\xi} or {x_{i}}). I haven’t tested, but it seems like you should be allowed to use underscores in symbol names on the input end, so that something like x_i*sin(omega) would render as something like {x_{i}} \sin( {\omega} ).

(Qoptics) #5

I noticed on GitHub that you’d added the braces to the LaTex output routine. Thanks for your help on that. Do you by chance have an estimated time for your next official release?

(Christoph Rüegg) #6

Finally found some time to do a release: v0.12

(Qoptics) #7

Works great. Thanks!