Hello everyone, I have recently discovered the “Coloring according to nesting level” feature of TeXmacs. Once enabled in the tag preferences of the math parentheses (“around” environment), individual levels parentheses in math expression are colored corresponding to their nesting level as shown in the image bellow:
This feature is not mentioned in the Jolly writer book nor in the TeXmacs manual.
I am looking for a way to change the colors of the individual nesting levels. For this I searched the TeXmacs source code. The actual preference is called math-brackets
and is defined in the file TeXmacs/packages/customize/math/math-brackets.ts
by a oneliner <assign|math-nesting-mode|colored>
. Further search led me to file src/Typeset/Concat/concat_math.cpp
where the code realizing the coloring is located. The important part of code is :
static string
bracket_color (int nl) {
switch (nl % 3) {
case 0 : return "#662266";
case 1 : return "#226666";
default: return "#663322";
}
}
void
concater_rep::typeset_around (tree t, path ip, bool colored) {
tree old_nl=
env->local_begin (MATH_NESTING_LEVEL, as_string (env->nesting_level + 1));
if (colored) {
tree old_col= env->local_begin (COLOR, bracket_color (env->nesting_level));
typeset_around (t, ip, false);
env->local_end (COLOR, old_col);
}
...
This unfortunately means that the colors are hard coded into the C++ code. I would like to ask, if there is a way around how to change the colors without having to recompile everything.
Thanks in advance for advice.
Once this question is closed I would like to compile the information of this feature it into something short and easily readable and add it into the Undocumented scripts wiki thread.