StartLaTeX faqLaTeX for Beginners F.A.Q.LaTeX topicsLaTeX courseSearch

You can write text in different colors using the xcolor package in LaTeX. The command for this is \textcolor{Color}{Text}, and by default, you have access to several colors:


This LaTeX example demonstrates how to color text using the xcolor package. The xcolor package provides various predefined colors that you can apply to your text. To color text, use the \textcolor command followed by the color name enclosed in curly braces. For example, \textcolor{red}{text} will display "text" in red color.

Additionally, you can create colored boxes around text using the \fcolorbox command. It takes two arguments: the border color and the background color. For instance, \fcolorbox{black}{white}{\textcolor{black}{text}} will create a white box with a black border containing the word "text" in black color.

\textcolor{red}{red}, \textcolor{green}{green}, \textcolor{blue}{blue}, \textcolor{cyan}{cyan}, 
\textcolor{magenta}{magenta}, \textcolor{yellow}{yellow}, \textcolor{black}{black}, 
\fcolorbox{black}{white}{\textcolor{black}{white}}, \textcolor{darkgray}{darkgray}, 
\textcolor{gray}{gray}, \textcolor{lightgray}{lightgray}

In this example, we've used the \textcolor command to change the color of text to different predefined colors. This package not only allows you to change the color of text but also to modify the color of the page itself (hence the text color "white") and create colored boxes and borders.

Contact   Privacy Policy   disclosures

accept decline

This website uses cookies and pixel tags to ensure you get the best experience on our website. By using this website, you consent to the use of cookies.learn more about cookies see also our privacy policy