How to change the color of part of text in LAtex?

I am going to write a sentence with bold blue color at somewhere in my context. But don't know how to change the color.

1 Answer 1


You can use xcolor package for this. Use textcolor micro for coloring your text.

\usepackage{xcolor} \textcolor{color}{text}

You can use color names like red, blue etc. For more information please refer to color section in Latex Wikibook.

  • 1
    Sometimes, I have observed that color of the text extends beyond the {text}. What I mean that the "Sample textx and other texts followed by {text}" are also colored. Do not know why this happens. One workaround I have figured out is {\color{color}{text}}.
    – Pro
    Commented May 11, 2023 at 9:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .