# LaTeX: textcolor-environment handling suddenly changed

Robert T. shared this problem 4 years ago
Solved

Until yesterday I could use the textcolor-command to switch back into math-environment within a text-environment:

\text{This is my formula\mbox{:} \textcolor{black}{x^2+y^2=z^2}, which is just an example.}

The formula x^2+y^2=z^2 was formatted in math-style until yesterday. Suddenly the textcolor-environment is no longer interpreted as math-environment, it behaves like the surrounding text-environment.

The result is that all the LaTeX-texts in my applets are pretty destroyed now... Of course I can change that with some effort, but I wonder which handling is correct:

a) textcolor does NOT change the parent-environment (new version)

b) textcolor should switch into math-environment (behaviour until yesterday)

1

There have been changes in LaTeX lately that might have triggered your issue.

I'm looping your post to the Developers, thank you

1

Thank you for your reply! While repairing my texts I found another change in LaTeX: it concerns the space between a colon (:) and text. Usually an additional space was inserted between a letter and a colon, but now this space is no longer inserted (actually this would make things easier, because I always had to reduce this space by using \mbox{:} ).

1

1

I tried to change most of my applets today, so most of the LaTex-texts are alomst repaired - I had to change several spaces, braces, text-environments, etc.

I uploaded an applet with LaTeX-text only where I tried to explain the new behaviour:

https://www.geogebra.org/m/c3yenfru

1

I found two of my applets which are still suffering the loss of spaces which in math-environment would be inserted automatically - I could repair this by using the javascript command replace and regexp syntax.

Here all the vectors are formatted in textstyle, since last night.

Here you have click through the explanation until the texts with the vector equations are shown. Once there were spaces before and after the + and - signs :( Now the vector equations look very compressed.

1

Thanks for the nice investigations :)

I think \textcolor{} going into math mode was a bug.

We'll try and fix the spacing problem with A \cap B \text{ A \cap B} soon!

1

Please try the new version (v501)

1

Thank you for reanimating the lost spaces!

In case someone is interested: In the meantime I found out that switching to math-mode within text-environment can be done by enclosing the math-formula with $and$:

\text{This is a formula: $c^2=a^2+b^2$, copyright by Pythagoras.}