[Solved] color personal command – overleaf bug

Thomas Lesgourgues Asks: color personal command – overleaf bug
I’ve been using for a long time a personal command for colors :

Code:
newcommand{red}[1]{{color{red}#1}}

It allows me to use colors by inputing red{some text} it was always working with no issue. but since today I have a very strange behavior using Overleaf. Here is a MWE

Code:
documentclass{article} 
usepackage{xcolor}
newcommand{red}[1]{{color{red}#1}}
begin{document}
red{test}
end{document}

The first time I compile this code, I end up with a runaway error :
enter image description here

Then at the second and subsequent compilations it works fine, meaning it output ‘text’ in red. But if I delete the red{} command, keeping the test the behavior is erratic (I could find a consistent pattern). Sometimes it prints ‘test’ in red followed by ‘test’ in black, sometime just ‘test’ still in red, sometimes in black…

Is there any obvious issue with my command ? Or should I contact Overleaf ? Thanks

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.