The use of color in LaTeX

Today I want to introduce you to another article dedicated to the graphic capabilities of the LaTeX publishing system. This time we will focus on color. Most often these opportunities are ignored by LaTeX, as the proportion of color publishing is pleased small. Besides excessive use of color can only hurt — motley multicolor document difficult to read and it looks unattractive. But clever use of colour can greatly facilitate perception of content: highlighting headings, subheadings, quotations, important parts of the text, and even table cells helps you to quickly grasp the essence, not getting a grasp in the details.
So who became interested, click the link:

the

Color in LaTeX


Color in a LaTeX system allow you to operate the two bags from the collection graphics: color and colortbl. The first allows you to set the text color and background, as a separate unit and the entire document, and the second is to paint the table. Connect both of the package in the preamble of the document:
\usepackage[usenames]{color}
\usepackage{colortbl}

All teams switch colors have the option where you specify the color model and required arguments that specify a color.
the Model named is a color model by default. The color is given by one of eight constants:
the
    the
  • black
  • the
  • red
  • the
  • blue
  • the
  • magenta
  • the
  • white
  • the
  • green
  • the
  • cyan
  • the
  • yellow

Reminds possibity palette DOS. Here is a small example:
\textcolor{blue}{Blue \hbox{$x^2$}}
Blue x2

the color of the named driver dvips. Driver dvips contains the definition of the names of 68 colors:
the
    the
  • Yellow
  • the
  • Yellow
  • the
  • Goldenrod
  • the
  • Dandelion
  • the
  • Apricot
  • the
  • Peach
  • the
  • Melon
  • the
  • YellowOrange
  • the
  • Orange
  • the
  • BurntOrange
  • the
  • Bittersweet
  • the
  • RedOrange
  • the
  • Mahogany
  • the
  • Maroon
  • the
  • BrickRed
  • the
  • Red
  • the
  • Sapphire
  • the
  • RubineRed
  • the
  • WildStrawberry
  • the
  • Salmon
  • the
  • CarnationPink
  • the
  • Magenta
  • the
  • VioletRed
  • the
  • Rhodamine
  • the
  • Mulberry
  • the
  • RedViolet
  • the
  • Fuchsia
  • the
  • Lavender
  • the
  • Thistle
  • the
  • Orchid
  • the
  • DarkOrchid
  • the
  • Purple
  • the
  • Plum
  • the
  • Violet
  • the
  • RoyalPurple
  • the
  • BlueViolet
  • the
  • Periwinkle
  • the
  • CadetBlue
  • the
  • mixed color
  • the
  • MidnightBlue
  • the
  • NavyBlue
  • the
  • RoyalBlue
  • the
  • Blue
  • the
  • Cerulean
  • the
  • Cyan
  • the
  • ProcessBlue
  • the
  • SkyBlue
  • the
  • Turquoise
  • the
  • TealBlue
  • the
  • Aquamarine
  • the
  • BlueGreen
  • the
  • Emerald
  • the
  • JungleGreen
  • the
  • SeaGreen
  • the
  • Green
  • the
  • ForestGreen
  • the
  • PineGreen
  • the
  • LimeGreen
  • the
  • YellowGreen
  • the
  • SpringGreen
  • the
  • OliveGreen
  • the
  • RawSienna
  • the
  • Sepia
  • the
  • Brown
  • the
  • Tan
  • the
  • Gray
  • the
  • Black
  • the
  • White

Here, as you can see, your options are wider. An example is a little different from the previous one:
\textcolor{Orange}{Orange $\bigcup$.}
An orange ∪

the rgb. model rgb any color obtained by mixing light rays of three primary colors: red (red), green (green), and blue (blue). In General, the model is not used in the printing industry, as it is based on the color rays of light (as in the CRT, our LCD monitor or on film). Print is traditionally used model of cmyk, which will be discussed below.
Color specification in a model rgb is specified the three enumerated through a comma numbers in the range from 0 to 1, which correspond to the intensity of the basic components of the color. For example, yellow is set as 1, 1, 0, white as 1, 1, 1, 0, 0, 0 gives black.
the Model gray. Gray color is obtained by mixing equal proportions of the base colors of the model rgb with intensity less than one. Color specification in a model gray is specified by a single number between 0 and 1, e.g. 0.5 instead of 0.5, 0.5, 0.5 in the model rgb. Black color corresponds to 0 and white — 1.

the cmyk. If on a sheet of paper, apply red paint and then illuminate it with white light, then only red component of light reflected from the paper. Apply now on paper red paint thickly-set points, and then fill in all the spaces between the red dots with green paint. Now from the sheet of paper will reflect both red and green light. From a distance to distinguish between separate points is impossible, so the eye receives a mixture of red and green colors and the paper looks yellow. [If the colors need to spread dots, and solid fill, the paint will mix and get dirty reddish color.]
This is based on a color model cmyk. In this model, the specification of colors is specified by the four listed comma-separated numbers between 0 and 1, which correspond to "number of" blue (cyan), Magenta (magenta), yellow (yellow) and black (black) paint on a white sheet of paper. The white color corresponds to specification 0, 0, 0, 0 (on white paper, no paint), and black— 0, 0, 0, 1.

Colored text


To change the color of text in the document you can either command
\textcolor[model]{spec}{text}
or Declaration
{\color[model]{spec}text}
Here model — the color model, spec — the color specification.
Example:
\textcolor{red}{Red,} \textcolor[cmyk]{0,1,1,0}{again red,}
\textcolor[rgb]{1,0,0}{red again!}

Red, again red and again red!

Colored boxes


The command
\colorbox[model]{spec}{lr text}
places, like the \mbox, the text lr-text in a box with a background color specified by the argument model and spec. Here model — the color model, spec — the color specification. The command
\fcolorbox[model]{fr-spec}{spec}{lr text}
additionally encircles the box frame color fr-spec. Example:
\fcolorbox{red}{yellow}{Text\dots}
Text...

Color page background


To change the color of the page Declaration
\pagecolor[model]{spec}
Here model — the color model, spec — the color specification. The scope of the Declaration is not limited to any brackets. To restore the white color of the pages, it is necessary to invoke the command \pagecolor{white}.

Color tables


Package colortbl using color and array, allows you to colorize the table. Colors are as in the package color.
The command
\columncolor[model]{spec}[left-overhang][right-overhang]
specifies the color of the table column with the color specified by the first two arguments. Option left-overhang and right-overhang specify the distance between the left and right edges of the painted region and the text. If you specify only one argument, it sets both the distance.
The command
\rowcolor[model]{spec}[left-overhang][right-overhang]
color a table row. Its place in the beginning of the line.
The following examples will help to understand.
\begin{tabular}{%
|>{\color{white}\columncolor{black}}l|
>{\columncolor{yellow}[.6\tabcolsep]}c|
>{\columncolor[gray]{.8}}r|}
one &two &three \\ four & five & six
\end{tabular}



\begin{tabular}{|l|c|}
\rowcolor[gray]{.9} one &two \\
\rowcolor[gray]{.6} three & four
\end{tabular}


\newcolumntype{H} {>{\columncolor{magenta}}c}
\begin{tabular}{%
|>{\columncolor{yellow}}l|
>{\color{white}\columncolor{black}}l|}
\multicolumn{2}{|H|}{one} \\
two &three \\ four &five
\end{tabular}



\def\tabrowsep{\noalign{\vskip 2pt}}
\newcolumntype{H}{%
>{\columncolor[gray]{.9}}p{1.7 cm}}
\begin{tabular}[t]{*2}
\rowcolor[gray]{.6}one &two\\\tabrowsep three &four \\\tabrowsep
five & six
\end{tabular}



\setlength\arrayrulewidth{2pt}\arrayrulecolor{blue}
\setlength\doublerulesep{2pt}\doublerulesepcolor{yellow}
\begin{tabular}{||l||c||}
\hline\hline
one &two \\ three &four \\
\hline\hline
\end{tabular}



\begin{tabular}{||l|c||}
\hhline{|t:=:t:=:t|}
one &two \\ three &four \\
\hhline{|b:=:b:=:b|}
\end{tabular}



\newcommand\rgbline[1]{\hhline{>{\arrayrulecolor{red}}|#1:=%
>{\arrayrulecolor{green}}=>{\arrayrulecolor{blue}}=:#1|}}
\arrayrulecolor{red}
\begin{tabular}{||*3c||}\rgbline{t}
red & green & \multicolumn{1}{c||}{blue}\\
\rgbline{b}\end{tabular}



Well, that's all. For writing the article used the book of Vladimir Syutkin "Color in LaTeX2e". I hope someone will be useful this article. Here is the original article. Thank you.
Article based on information from habrahabr.ru

Комментарии

Популярные сообщения из этого блога

Python-digest #8. News, interesting projects, articles and interviews [20 Dec 2013 — 27 Dec 2013]

Performance comparison of hierarchical models, Django and PostgreSQL

google life search