235
votes
Changing background color of text in Latex
I know this question has been answered very extensively. But not what I wanted or thought was the question based on the title. Therefore if others get in here looking for a possibility for colouring ...
86
votes
How to color math symbols?
An addition to Martin Scharrer's answer.
\textcolor has a side effect in math, that the contents is put in curly braces (see definition of \@textcolor). The color implementation of package color is ...
86
votes
Highlight, textcolor, and boldface simultaneously
\documentclass{article}
\usepackage{xcolor}
\begin{document}
~\\
\colorbox{pink}{highlight}\\
\colorbox{green}{highlight}\\
\colorbox{yellow}{highlight}\\
\bfseries\colorbox{pink}{highlight + boldface}...
70
votes
Accepted
Color RGB in LaTeX
The color package also supports decimal values in the RGB color model that accepts integer values in the interval [0,255]. On the other hand, xcolor offers much more features, so it's better to use it....
62
votes
How to use different colors for different \href commands?
If you're only going to use it once or twice, it may be most simple to just use this directly:
\href{http://google.com}{\color{red}{Google}}
This is the code from the macro of Peter's answer.
52
votes
How to change color for a block of texts?
The following seems simpler:
\documentclass{amsproc}
\usepackage[colorlinks]{hyperref}
\begin{document}
This is {\color{red} highlighted}, and this is not.
\end{document}
35
votes
How to specify a fill color in RGB format in a node in tikzpicture?
Werner has shown the rgb-syntax to mix colors, egreg has shown how to define a color in RGB and then use it.
If you want to specify a color with RGB values [0-255] without defining it before, you can ...
35
votes
What is the name of the color used in CambridgeUS?
From CTAN you can find the source of CambridgeUS beamer theme, where there is:
\usecolortheme{beaver}
In the same site of the source you can find the beamer color theme beaver, where there is:
\...
33
votes
Accepted
How to change reference color to blue
From the questions's MWE:
\usepackage[colorlinks=true,linkcolor=blue]{hyperref}%
Citation links are configured via option citecolor:
citecolor=blue
Or if all kind of links should be blue (since ...
32
votes
Accepted
Use color in verbatim environment
Not exactly the same solution pointed by flav:
\documentclass[]{article}
\usepackage{fancyvrb}
\usepackage{xcolor}
\begin{document}
\begin{Verbatim}[commandchars=\\\{\}]
a (black)
\textcolor{red}{b} ...
29
votes
Is Latex useful for custom formatting?
I'd say wrong approach. What you ask needs low level programming in TeX internals. You'll see that in this answer, as linked in a comment by leandriis.
You can have it as simple as here:
\...
28
votes
Accepted
How do I change the color of itemize bullet? specific and default
A per-\item change of colour is possible using the optional argument of \item[..], and using the same label as itemize - $\bullet$ or \textbullet.
For changing the default settings, you can either ...
27
votes
Accepted
!LaTeX Error: Undefined color 'orange'
I'll make my comment into an answer: Try \usepackage{xcolor} in place of \usepackage{color}. xcolor.sty is a much richer, more feature-packed package.
27
votes
Accepted
Is Latex useful for custom formatting?
Here's a LuaLaTeX-based solution.
This solution takes a preprocessor approach. Lua has several very powerful and flexible pattern-matching functions. The Lua function make_replacements performs two ...
26
votes
How to change color for a block of texts?
All the above answers are excellent for general purpose
If you want to highlight a syntax for a programming language we can use minted package, it provides excellent colored highlighted text.
To use ...
25
votes
Changing the color of itemize item in beamer
The colors for the itemize symbols can be set as any other color in beamer by using \setbeamercolor, the symbolbols themselves by \setbeamertemplate.
The following code was used to get the result ...
25
votes
Accepted
Using \textbf vs. \mathbf in Math mode
Spaces are ignored in the arguments of \mathbf and \mathit, but not in the arguments of \textbf and \textit.
Also, you can't combine \mathbf and \mathit. E.g., \mathbf{\mathit{xyz}} produces xyz ...
24
votes
Accepted
TikZ, coloring edge segments with different colors
Second update
Now that I reread the question, here's a tricolor style; first the total length of the path is measured and then the three colors are applied to each third part of the path:
The code:
...
23
votes
Accepted
How can I color parentheses depending on the nesting level (like emacs' rainbow-delimiters)?
The listings package itself doesn't offer this feature; you need to hack at it a bit.
I won't elaborate much here, as I've left comments in my code, but the basic idea is to use a counter to keep ...
23
votes
Accepted
How are the colors for certain schemes defined in moderncv?
If you use the moderncv class, there is no need to specify a colour scheme. So, by default, the colour scheme is black (or {rgb}{0,0,0}). That's what is contained in moderncv.cls:
% colors
%-------
\...
23
votes
Accepted
TIKZ: only fill 75% of the node-background with color
You can use path picture and path picture bounding box:
\documentclass[tikz,margin=5mm]{standalone}
\usetikzlibrary{calc}
\begin{document}
\tikz
\node[draw]
[path picture={
\fill[gray!30](path ...
22
votes
How to change color of operators (lim, log, etc.)?
Here's a possibility; I wouldn't hack into \mathop, which is a primitive also used in several other situations (in \overset, for instance).
\documentclass{article}
\usepackage{xcolor,amsmath,xpatch,...
22
votes
Accepted
Why does xcolor lighten a color when mixed
The xcolor package defines blue as a RGB color and cyan as a CMY color.
To make a mix, xcolor uses the color model of the first color and, if necessary, converts the second color.
To convert the CMY ...
22
votes
Accepted
Is it possible to change the color of the text according to the background color?
The idea is simple: use some nontrivial blending mode.
You might want to
tune the colors, so that "blue" minus "yellow" is "white"
modify the background, so that the lower right corner looks right.
...
21
votes
How can I fill the grid cell with color in this grid?
Grid is nothing but a bunch of aligned squares. For 2D case,
\documentclass[border={10pt}]{standalone}
\usepackage{tikz,}
\begin{document}
\begin{tikzpicture}
[%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
color × 4147tikz-pgf × 543
tables × 532
beamer × 401
pgfplots × 182
listings × 180
hyperref × 157
backgrounds × 141
math-mode × 103
boxes × 103
formatting × 101
macros × 98
sectioning × 98
graphics × 95
pdftex × 95
fonts × 88
xetex × 84
table-of-contents × 83
tcolorbox × 83
highlighting × 83
colortbl × 82
spacing × 70
pdf × 61
header-footer × 57
environments × 57