3

I'm working with lists of lists of lists. Each box with information has a specific format like

  information = {{a},{{b}},{{{c},{d}},{e,{f}}},{g}}

and so together they look like

  {{{a},{{b}},{{{c},{d}},{e,{f}}},{g}},{{h},{{i}},{{{j},{k}},{l,{m}}},{n}},...

and this goes over the whole screen.

I want to make the inner and outer brackets in an expression like {{ a }} look different, possibly down to all levels. Is there a way to highlight the bracketing in such a way that I can see the different levels of the list?

Szabolcs
  • 234,956
  • 30
  • 623
  • 1,263
Nikolaj-K
  • 1,485
  • 1
  • 10
  • 14
  • 2
    Mathematica 9 highlights matching brackets when your cursor is at either of them. I would however in such a situation ask the question "why is this structure so complicated" and "Can it be made simpler". If for instance you are making implied assumptions such as "the third argument is a list of lists of number of animals and corresponding weight in a list". Then you can typically make everything much simpler by rethinking how you handle your data. In cases where you are in fact dealing with complex structures consider making a dynamic input gizmo for it. – jVincent Feb 06 '13 at 14:30
  • Related: http://stackoverflow.com/questions/5776158/matching-brackets-in-a-string http://stackoverflow.com/questions/5461688/how-do-i-get-auto-conversion-of-part-double-brackets-on-paste – Szabolcs Feb 06 '13 at 14:31
  • @Szabolcs: I agree on the duplicate. – Ajasja Feb 06 '13 at 14:32
  • @Ajasja The only problem is that the other question doesn't have a general solution yet. The existing answer is only for special cases. – Szabolcs Feb 06 '13 at 14:33
  • @Szabolcs: Interesting reference, although I was not thinking of a function like TraditionalForm, but I want to have the input data displayed differently when I type it in. I'll never evaluate the data as such, I convert the "information" to something differen, see next post. – Nikolaj-K Feb 06 '13 at 14:34
  • 1
    @jVincent: The information is chemical data (the version of the code in that question is not up to date). I e.g. print it in some sort of TeX-Form. Don't know how to reduce the boxes to a more pleasurable form atm. – Nikolaj-K Feb 06 '13 at 14:34
  • 2
    My code highlighter generator could do this with some tweaking. Unfortunately, I did not make the bracket - matchings and highlighting routines customizable enough to incorporate coloring brackets on different levels with different colors, so some changes to the code are needed to implement this. – Leonid Shifrin Feb 06 '13 at 14:45

0 Answers0