Hi Freddie, On Thu, Dec 25, 2008 at 12:30 AM, Freddie Witherden <fred...@witherden.org> wrote: > Hi all, > > I have been toying around with a couple of ideas which might be worth > investigating for the LaTeX printer. First off, different bracket > styles depending on the nesting level. So it might go: > { [ ( ( ) ) ] }; exactly how to do this I am unsure. It depends on how > easy it is to maintain the nesting level. Ideally {} and [] should > only be used for adjacent brackets, for example: > > (x*(y+3)+4)^3 doesn't really require nested brackets, but: > > [a*exp(z*I)] does.
Yes, I like what you propose. > > This is the kind of thing that I might be tempted towards the evils of > regular expressions to achieve. Hopefully, however there is a much > more elegant solution. If the regular expression is maintainable, why not. > > Secondly, constant expanding. If one has a fraction <x>/k where k is a > constant it is often nice to pull the constant out front when > printing, giving 1/k * <x> where <x> is an arbitrary expression. This, > again sacrifices horizontal space for better readability (a larger > font size can be used for <x>). I am yet to look into how hard this > would be to achieve, however. Yes, I also agree with you. > > Finally, an option to use exp() as opposed to {e}^{<x>}. This is most > useful when outputting the solutions to differential equations, which > often raise e to quite a large fraction/expression. Using exp() leads > to better readability (due to the larger font size and greater > spacing). I propose the following: we have a configuration option to > choose between {e}^{x}, exp(x) and auto, where auto uses heuristics to > decide (as soon as you get to needing brackets or fractions exp() is > often nicer). Again +1. > > Be interested to know what you all think -- and if you have any > implementation hints. I am all for it, thanks for thinking about it. Thanks also for your other patch in #1248. > On 24 Dec 2008, at 23:36, Alan Bromborsky wrote: >> When you say configuration option I assume you mean a global switch so >> you can turn the option off and on for different parts of the program. > > I was thinking more along the lines as an optional parameter passed to > latex(expr, expFormat='auto') or something along those lines. That way > there is no need for any kind of global state variable and so no need > to set/restore it. > > Although having to pass multiple configuration options each time is > not the nicest thing in the world, in 99% of cases the defaults will > probably be what most people want. Yes, I am also for latex(expr, exp_format='auto') or something, rather than a global option. Ondrej --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to sympy@googlegroups.com To unsubscribe from this group, send email to sympy+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sympy?hl=en -~----------~----~----~----~------~----~------~--~---