İçeriğe atla

LaTeX/Renkler

Vikikitap, özgür kütüphane

Yazılara renk ekleme xcolor paketi tarafından desteklenmektedir (color paketi ile değiştirir). Bu paketi kullanarak, yazıtipi rengini, yazı arkaplanı rengini, ya da sayfa arkaplanı rengini ayarlayabilirsiniz. Öntanımlı renklerden seçmek ya da kendi renklerini RGB, Hex, ya da CMYK ile tanımlamak da ayrıca mümkün. Matematiksel formüller ayrıca renklendirilebilir.

xcolor paketini eklemek

[değiştir]

To make use of these features, the Şablon:LaTeX/Package package must be imported. Şablon:LaTeX/Package starts from the basic facilities of the Şablon:LaTeX/Package package and extends it. Şablon:LaTeX/Usage The package allows you to use the names of 19 base colors (black, white, blue, green, yellow, red etc.); these names are always available. Besides, the package has some options to get more predefined colors, which should be added globally. Şablon:LaTeX/Parameter allows you to access more than 60 colors, and Şablon:LaTeX/Parameter allows access to about 150 colors. If you need more color names, then you may also want to look at the Şablon:LaTeX/Parameter option that offers more than 300 colors.

The Şablon:LaTeX/Parameter option allows colors to be added to tables.

Renkli yazıyı eklemek

[değiştir]

The simplest way to type colored text is by: Şablon:LaTeX/Usage where Şablon:LaTeX/Parameter is a color that was defined before by \definecolor.

Another possible way by

Şablon:LaTeX/Usage that will switch the standard text color to the color you want. It will work until the end of the current TeX group. For example: Şablon:LaTeX/Example

The difference between \textcolor and \color is the same as that between \texttt and \ttfamily, you can use the one you prefer. The \color environment allows the text to run over multiple lines and other text environments whereas the text in \textcolor must all be one paragraph and not contain other environments.

You can change the background color of the whole page by: Şablon:LaTeX/Usage

Yazılara renkli arkaplanlar ayarlamak

[değiştir]

\colorbox{declared-color}{text}

Eğer arkaplan rengi ve yazı rengi değiştiyse:

\colorbox{declared-color1}{\color{declared-color2}text}

Ayrıca \fcolorbox adındaki komut da çerçeveli arkaplan renkleri yapabilir:

\fcolorbox{declared-color-frame}{declared-color-background}{text}

Predefined colors

[değiştir]

The predefined color names are

black, blue, brown, cyan, darkgray, gray, green, lightgray, lime, magenta, olive, orange, pink, purple, red, teal, violet, white, yellow.

There may be other pre-defined colors on your system, but these should be available on all systems.

If you would like a color not pre-defined, you can use one of the 68 dvips colors, or define your own. These options are discussed in the following sections

The 68 standard colors known to dvips

[değiştir]

Invoke the package with the usenames and dvipsnames option. If you are using Şablon:LaTeX/Package or Şablon:LaTeX/Package package you must declare the xcolor package before that, otherwise it will not work.

Şablon:LaTeX/Usage

This above syntax may result in an error if you are using beamer with Şablon:LaTeX/Package. To go around it, include usenames and dvipsnames options when defining the document class.

Şablon:LaTeX/Usage Be wary that the below color names are case-sensitive. For example, \color{olivegreen} raises an "undefined color" error, but \color{OliveGreen} works fine. Table can be sorted by color name, by hue, by saturation, or by lightness.

Name Color Hex Hue Saturation Lightness
Apricot   FBB982 27.3 239.2 190.5
Aquamarine   00B5BE 182.8 255.0 95.0
Bittersweet   C04F17 19.9 200.4 107.5
Black   221E1F 0.3 15.9 32.0
Blue   2D2F92 238.2 134.8 95.5
BlueGreen   00B3B8 181.6 255.0 92.0
BlueViolet   473992 249.4 111.8 101.5
BrickRed   B6321C 8.6 187.0 105.0
Brown   792500 18.3 255.0 60.5
BurntOrange   F7921D 32.2 237.6 138.0
CadetBlue   74729A 243.0 42.1 134.0
CarnationPink   F282B4 333.2 207.0 186.0
Cerulean   00A2E3 197.2 255.0 113.5
CornflowerBlue   41B0E4 199.1 191.5 146.5
Cyan   00AEEF 196.3 255.0 119.5
Dandelion   FDBC42 39.1 249.7 159.5
DarkOrchid   A4538A 319.3 83.6 123.5
Emerald   00A99D 175.7 255.0 84.5
ForestGreen   009B55 152.9 255.0 77.5
Fuchsia   8C368C 300.0 113.0 97.0
Goldenrod   FFDF42 49.8 255.0 160.5
Gray   949698 0.2 4.9 150.0
Green   00A64F 148.6 255.0 83.0
GreenYellow   DFE674 63.7 177.3 173.0
JungleGreen   00A99A 174.7 255.0 84.5
Lavender   F49EC4 333.5 203.1 201.0
LimeGreen   8DC73E 85.4 140.3 130.5
Magenta   EC008C 324.4 255.0 118.0
Mahogany   A9341F 9.1 176.0 100.0
Maroon   AF3235 358.6 141.7 112.5
Melon   F89E7B 16.8 229.3 185.5
MidnightBlue   006795 198.5 255.0 74.5
Mulberry   A93C93 312.1 121.4 114.5
NavyBlue   006EB8 204.1 255.0 92.0
OliveGreen   3C8031 111.6 113.8 88.5
Orange   F58137 23.4 230.7 150.0
OrangeRed   ED135A 340.5 218.9 128.0
Orchid   AF72B0 299.0 71.9 145.0
Peach   F7965A 22.9 231.4 168.5
Periwinkle   7977B8 241.8 80.1 151.5
PineGreen   008B72 169.2 255.0 69.5
Plum   92268F 301.7 149.7 92.0
ProcessBlue   00B0F0 196.0 255.0 120
Purple   99479B 298.6 94.8 113.0
RawSienna   974006 24.0 235.5 78.5
Red   ED1B23 357.7 217.7 132.0
RedOrange   F26035 13.7 224.2 147.5
RedViolet   A1246B 325.9 161.8 98.5
Rhodamine   EF559F 331.2 211.1 162.0
RoyalBlue   0071BC 203.9 255.0 94.0
RoyalPurple   613F99 262.7 106.3 108.0
RubineRed   ED017D 328.5 252.9 119.0
Salmon   F69289 5.0 218.9 191.5
SeaGreen   3FBC9D 165.1 127.0 125.5
Sepia   671800 14.0 255.0 51.5
SkyBlue   46C5DD 189.5 175.8 145.5
SpringGreen   C6DC67 71.3 159.5 161.5
Tan   DA9D76 23.4 146.6 168.0
TealBlue   00AEB3 181.7 255.0 89.5
Thistle   D883B7 323.3 133.0 173.5
Turquoise   00B4CE 187.6 255.0 103.0
Violet   58429B 254.8 102.7 110.5
VioletRed   EF58A0 331.4 210.4 163.5
White   FFFFFF 0.1 0.0 255.0
WildStrawberry   EE2967 341.1 217.5 139.5
Yellow   FFF200 56.9 255.0 127.5
YellowGreen   98CC70 93.9 120.9 158.0
YellowOrange   FAA21A 36.4 244.1 138.0

Defining new colors

[değiştir]

If the predefined colors are not adequate, you may wish to define your own.

Place

[değiştir]

Define the colors in the preamble of your document. (Reason: do so in the preamble, so that you can already refer to them in the preamble, which is useful, for instance, in an argument of another package that supports colors as arguments, such as the listings package.)

Method

[değiştir]

You need to include the Şablon:LaTeX/Package package in your preamble to define new colors. In the abstract, the colors are defined following this scheme:

Şablon:LaTeX/Usage

where:

  • name is the name of the color; you can call it as you like
  • model is the way you describe the color, and is one of gray, rgb, RGB, HTML, and cmyk.
  • color-spec is the description of the color

Color Models

[değiştir]

Among the models you can use to describe the color are the following (several more are described in the xcolor manual):

Color Models
Model Description Color Specification Example
gray Shades of gray
(0-1)
Just one number between 0 (black) and 1 (white), so 0.95 will be very light gray, 0.30 will be dark gray. \definecolor{light-gray}{gray}{0.95}
rgb Red, Green, Blue
(0-1)
Three numbers given in the form red,green,blue; the quantity of each color is represented with a number between 0 and 1. \definecolor{orange}{rgb}{1,0.5,0}
RGB Red, Green, Blue
(0-255)
Three numbers given in the form red,green,blue; the quantity of each color is represented with a number between 0 and 255. \definecolor{orange}{RGB}{255,127,0}
HTML Red, Green, Blue
(00-FF)
Six hexadecimal numbers given in the form RRGGBB; similar to what is used in HTML. \definecolor{orange}{HTML}{FF7F00}
cmyk Cyan, Magenta, Yellow, Black
(0-1)
Four numbers given in the form cyan,magenta,yellow,black; the quantity of each color is represented with a number between 0 and 1. \definecolor{orange}{cmyk}{0,0.5,1,0}

Examples

[değiştir]

To define a new color, follow the following example, which defines orange for you, by setting the red to the maximum, the green to one half (0.5), and the blue to the minimum:

Şablon:LaTeX/Usage

The following code should give a similar results to the last code chunk.

Şablon:LaTeX/Usage

If you loaded the Şablon:LaTeX/Package package, you can define colors upon previously defined ones.

The first specifies 20 percent blue and 80 percent white; the second is a mixture of 20 percent blue and 80 percent black; and the last one is a mixture of (20*0.3) percent blue, ((100-20)*0.3) percent black and (100-30) percent green.

Şablon:LaTeX/Usage

Şablon:LaTeX/Package also features a handy command to define colors from color mixes:

Şablon:LaTeX/Usage

Using color specifications directly

[değiştir]

Normally one would predeclare all the colors as above, but sometimes it is convenient to directly use a color without naming it first. To achieve this, \color and \textcolor have an alternative syntax specifying the model in square brackets, and the color specification in curly braces. For example:

Şablon:LaTeX/Usage

Creating / Capturing colors

[değiştir]

You may want to use colors that appear on another document, web pages, pictures, etc. Alternatively, you may want to play around with rgb values to create your own custom colors.

Image processing suites like the free GIMP suite for Linux/Windows/Mac offer color picker facilities to capture any color on your screen or synthesize colors directly from their respective rgb / hsv / hexadecimal values.

Smaller, free utilities also exist:

Spot colors

[değiştir]

Spot colors are customary in printing. They usually refer to pre-mixed inks based on a swatchbook (like Pantone, TruMatch or Toyo). The package Şablon:LaTeX/Package extends xcolor to provide real spot colors (CMYK and CIELAB). They are defined with, say:

Şablon:LaTeX/Usage

Kaynakça

[değiştir]


Previous: HiperBağlantılar İçerik İleri: Paketler