Say I have an expressions like $(\sin(x-3(z^{(x-2)^2}))+1)^2$ with many nested expressions. To better visualize this in the output (and to help finding missing delimiters when proof-reading) I'd like to have nested expressions and their delimiter show up in a different color than its surrounding. Is there a package for that purpose?
Tell me more
×
TeX - LaTeX Stack Exchange is a question and answer site for
users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.
|
|
||||
| show 2 more comments |
|
I am not aware of any packages that do this. A relatively easy way is to redefine
The amount of colors specified this way is limited, I couldn't think of something more elegant right now. Perhaps somebody has a suggestion how colors can be picked in a better way. The result:
And your example:
Note the exponents have the colour of the parentheses group they are in, this might not be what you actually want. It would require a bit of additional code to fix this. I think it looks horrible, but that is mainly due to the poor choice of colours on my end. |
|||||||||||||||
|



breqnpackage (which is aware of nesting since it makes that affect the badness of line-breaks), or into thenathpackage (which IIRC changes every(to\left(: then hook to add a test on the\currentgrouplevelto each left and right delimiter), or a more down-to-earth approach by setting the\mathcodeof(etc. to be"8000, and defining an active(to produce the right color and increment a nesting counter. – Bruno Le Floch Oct 13 '11 at 12:03