Hot answers tagged

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 ...
JTIM's user avatar
  • 2,689
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 ...
Heiko Oberdiek's user avatar
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}...
SDrolet's user avatar
  • 4,768
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....
egreg's user avatar
  • 1.1m
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.
CephBirk's user avatar
  • 1,155
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}
Glasby's user avatar
  • 681
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 ...
jakun's user avatar
  • 5,909
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: \...
CarLaTeX's user avatar
  • 60.5k
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 ...
Heiko Oberdiek's user avatar
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} ...
Ignasi's user avatar
  • 134k
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: \...
Keks Dose's user avatar
  • 30.3k
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 ...
Werner's user avatar
  • 589k
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.
sgmoye's user avatar
  • 8,152
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 ...
Mico's user avatar
  • 479k
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 ...
Mohammad Hizzani's user avatar
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 ...
Alwin's user avatar
  • 445
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 ...
Mico's user avatar
  • 479k
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: ...
Gonzalo Medina's user avatar
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 ...
jub0bs's user avatar
  • 58k
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 %------- \...
Werner's user avatar
  • 589k
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 ...
esdd's user avatar
  • 84.2k
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,...
egreg's user avatar
  • 1.1m
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 ...
Paul Gaborit's user avatar
  • 69.7k
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. ...
Symbol 1's user avatar
  • 36.4k
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} [%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ...
CroCo's user avatar
  • 5,822

Only top scored, non community-wiki answers of a minimum length are eligible