Coloring our documents
We could enhance our text further with colors. We haven't dealt with it yet, because most people use LaTeX to write serious books and articles or business letters where too much color may harm the appearance. But why not try something fancy? For instance, diagrams and tables in presentations are often colorful.
We just need to load the xcolor
package:
\usepackage{xcolor}
From now on, we have to use a command to set the text color:
\color{name}
This command is a declaration that switches to the color that is named. Just try \color{blue}
.
The corresponding command form to color a piece of text is as follows:
\textcolor{name}{text}
\textcolor
adds grouping implicitly; it works like this:
{\color{name} text}
For coloring text snippets, \textcolor
is the better choice, while \color
would be a good choice for longer pieces of text enclosed by an environment or braces.
The xcolor
package offers a lot of ready-mixed colors; you...