Hi all,

I'm in the middle of adding nice LaTeX printing for a units library I'm 
working on that uses sympy to handle the algebraic unit manipulation.

I currently have lots of units that look like (for example) "g/cm**3".  I'd 
like to obtain LaTeX representations for these unit expressions using the 
sympy latex pretty printer, but I can't seem to find a way to format the 
resulting LaTeX like I'd like to.

Currently, I have something like:

>>>latex(sympify("g/cm**3"))
\frac{g}{cm^{3}}.

However, I'd like to somehow force the latex printing function to use "/" 
instead of "\frac{}{}".  It seems that this capability is *almost* there 
via the fold_short_frac keyword argument to the latex() function, described 
here: 
http://docs.sympy.org/latest/modules/printing.html?highlight=latex#module-sympy.printing.latex

Unfortunately, that keyword argument doesn't allow splitting of the 
"\frac{}{}" if the denominator has a power.  Is it possible to 
short-circuit this behavior somehow?  I'm happy to use lower-level 
capabilities in sympy if something is available but not exposed via the 
latex() pretty-printing API.

Thanks for your help with this,

Nathan Goldbaum

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to