3
$\begingroup$

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?

$\endgroup$
  • 2
    $\begingroup$ 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. $\endgroup$ – jVincent Feb 6 '13 at 14:30
  • $\begingroup$ Related: stackoverflow.com/questions/5776158/… stackoverflow.com/questions/5461688/… $\endgroup$ – Szabolcs Feb 6 '13 at 14:31
  • $\begingroup$ @Szabolcs: I agree on the duplicate. $\endgroup$ – Ajasja Feb 6 '13 at 14:32
  • 1
    $\begingroup$ @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. $\endgroup$ – Nikolaj-K Feb 6 '13 at 14:34
  • 2
    $\begingroup$ 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. $\endgroup$ – Leonid Shifrin Feb 6 '13 at 14:45