How to Change Text Color in LaTeX
The fix
Load \usepackage{xcolor} and use \textcolor{red}{your text} to colour a span, or {\color{blue} a block}. Define custom colours with \definecolor{myblue}{HTML}{2A5CAA} and use them the same way. xcolor also colours table rows, boxes, and (with hyperref) links.
Example
\usepackage{xcolor}
\textcolor{red}{Important}.
\definecolor{brand}{HTML}{2A5CAA}
{\color{brand} A custom-coloured sentence.}Frequently asked questions
How do I use a custom hex colour?
Define it once with \definecolor{name}{HTML}{RRGGBB} (no # sign), then use \textcolor{name}{...}. Load xcolor first.
How do I colour a whole paragraph?
Use a group: {\color{blue} your paragraph}. \textcolor is best for short inline spans; \color applies until the group ends.
Try the fix in LetX
Open the editor, paste your code, and compile in 1 second to see the error clear — free, in your browser.
Open LetX Free