Sei sulla pagina 1di 26

PostScript PDF LATEX

c
, syutkin@ns.kinetics.nsc.ru

21 2001 .


graphics ( David Carlisle) -
, ,
,
, -
. colortbl ( David Carlisle).
,
color, graphicx lscape graphics colortbl
, PostScript PDF fpTEX-0.4. -
, PDF
hyperref.

1 2

2 3
2.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.1.1 . . . . . . . . . . . . . . . . . . . . 6
2.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.4 . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

3 11
3.1 dvips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.2 pdftex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

, .

1
4 12
4.1 . . . . . . . . . . . . . . . . . 13
4.2 . . . . . . . . . . . . . . . . . . 15
4.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4.4 . . . . . . . . . . . . . . . . . . . . . . 17
4.4.1 . . . . . . . . . . . . . . . . . . . 17
4.5 . . . . . . . . . . . . . . . . . . 17
4.6 . . . . . . . . . . . . . . . . . . 18
4.7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

5 20
5.1 . . . . . . . . . . . . . . . . . . . . . . . . 20
5.1.1 . . . . . . . . . . . . . 20
5.1.2 . . . . . . . . . . . 21
5.2 . . . . . . . . . . . . . . . . . . . . . . . 21
5.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

6 23

7 23
7.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
7.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

8 PDF 24

25

1
graphics -
\usepackage ,
TEX ,
, . fpTEX -
dvips pdftex.
Type 1 EPS
(Encapsulated PostScript) PDF (Portable Document Format), . -
dvips1 . dvips ( Tomas Rokicki) -
dvi-, LATEX , ,
1
\ExecuteOptions
graphics.cfg color.cfg.

2
PostScript. ps- -
GhostScript2 -
. , GhostScript ps-
PDF. PDF
pdf LATEX, graphics
pdftex.
, \documentclass.
LATEX,
pdf LATEX,
\ifx\pdfoutput\undefined
\documentclass{article}
\else
\documentclass[pdftex]{article}
\fi

2
color
, .

2.1
, , : model (-
) spec (
). color -
. ,
2.2.

named

named .
. color ,
:


black white
red green
blue cyan
magenta yellow

2
GhostScript PostScript Windows
GSview.

3
\textcolor 2.23 :
\textcolor{blue}{ $x^2$ \dots} x2 . . .

, -
, .
, , -
, .
GhostScript Acrobat Reader -
. .
dvips dvipsnam.def 68 -
. cmyk, .


GreenYellow Yellow
Goldenrod Dandelion
Apricot Peach
Melon YellowOrange
Orange BurntOrange
Bittersweet RedOrange
Mahogany Maroon
BrickRed Red
OrangeRed RubineRed
WildStrawberry Salmon
CarnationPink Magenta
VioletRed Rhodamine
Mulberry RedViolet
Fuchsia Lavender
Thistle Orchid
DarkOrchid Purple
Plum Violet
RoyalPurple BlueViolet
Periwinkle CadetBlue
CornflowerBlue MidnightBlue
NavyBlue RoyalBlue
Blue Cerulean
Cyan ProcessBlue
SkyBlue Turquoise
TealBlue Aquamarine
BlueGreen Emerald
JungleGreen SeaGreen
Green ForestGreen
PineGreen LimeGreen

3
,
LATEX.

4
()

YellowGreen SpringGreen
OliveGreen RawSienna
Sepia Brown
Tan Gray
Black White

color usenames:

\usepackage[usenames]{color}

dvips ,
color, . :
S
\textcolor{Orange}{ $\bigcup$.} .

usenames , dvips
named :
\color[named]{Orange} $\oint$. H
.

dvips pdftex,
color dvipsnames.

rgb

rgb
: (red), (green) (blue). -

0 1, -
. , 1,1,0, 1,1,1.
0,0,0 .
, ,
, . , ,
,
, . -
, .

gray

(gray)
rgb , . -
gray 0 1, , 0.5 0.5,0.5,0.5
rgb. 0, 1. -
gray 2.1.1.

5
cmyk

,
. -
,
.
, . ,
4 .
cmyk.
0 1, -
(cyan), (magenta),
(yellow) (black) . -
.

-.
.
, cmyk -
0,0,0,0 ( ),
0,0,0,1.

2.1.1

\definecolor{name}{model}{spec}

name . model ,
spec . name , -
,
named. :
\definecolor{faded}{gray}{0.7} . . .
\textcolor{faded}{\dots}

4
, ,
.

6
2.2
text

\textcolor[model]{spec}{text}

{\color[model]{spec}text}

model , spec .
:
\textcolor{red}{,} ,
\textcolor[cmyk]{0,1,1,0}{ ,} ,
\textcolor[rgb]{1,0,0}{ !} !

color ,
monochrome. ,
.

2.3

\colorbox[model]{spec}{lr-text}

, \mbox, lr-text ,
model spec. model , spec
.

\fcolorbox[model]{fr-spec}{spec}{lr-text}

fr-spec. :

\fcolorbox{red}{yellow}{\dots} . . .

, , -
color. 2.1.

\fcolorbox
\fboxrule \fboxsep.

7
2.4

\pagecolor[model]{spec}

model , spec .
.
, \pagecolor{white}.

2.5
colortbl ( David Carlisle) color array
. , color
model spec (. 2.1).

\columncolor[model]{spec}[left-overhang][right-overhang]

>{...} ( array)
tabular array. ,
model spec. left-overhang
right-overhang , ,
. ,
.
\tabcolsep tabular \arraycolsep array.
,
.4\tabcolsep:
\begin{tabular}{%
|>{\color{white}\columncolor{black}}l|
>{\columncolor{yellow}[.6\tabcolsep]}c|
>{\columncolor[gray]{.8}}r|}
& & \\ & &
\end{tabular}

\rowcolor[model]{spec}[left-overhang][right-overhang]

.
:
\begin{tabular}{|l|c|}
\rowcolor[gray]{.9} & \\
\rowcolor[gray]{.6} &
\end{tabular}

8
.
\multicolumn.
, :
\newcolumntype{H}{>{\columncolor{magenta}}c}
\begin{tabular}{%
|>{\columncolor{yellow}}l|
>{\color{white}\columncolor{black}}l|}
\multicolumn{2}{|H|}{} \\
& \\ &
\end{tabular}

colortbl longtable dcolumn.

, -
. -
. \tabrowsep.
plain TEX, \tabrowsep :

\def\tabrowsep{\noalign{\vskip 2pt}}

\noalign, (
2 pt) ( ).
\tabrowsep:
\newcolumntype{H}{%
>{\columncolor[gray]{.9}}p{1.7cm}}
\begin{tabular}[t]{*2H}

\rowcolor[gray]{.6} & \\\tabrowsep
& \\\tabrowsep &
\end{tabular}

\arrayrulecolor[model]{spec}

, -
. , >{...}
- .
\arrayrulecolor
. , , -
, , .

\doublerulesepcolor[model]{spec}

(||) -
(\hline\hline) .

9
-
. :
\setlength\arrayrulewidth{2pt}\arrayrulecolor{blue}
\setlength\doublerulesep{2pt}\doublerulesepcolor{yellow}

\begin{tabular}{||l||c||}
\hline\hline
& \\ & \\
\hline\hline
\end{tabular}

, -
, :
\newlength{\ArrayrulewidthDefault}
\setlength{\ArrayrulewidthDefault}{\arrayrulewidth}
...
\setlength{\arrayrulewidth}{\ArrayrulewidthDefault}
\hhline hhline, ,
, , :
\begin{tabular}{||l|c||}
\hhline{|t:=:t:=:t|}
& \\ & \\
\hhline{|b:=:b:=:b|}
\end{tabular}

\arrayrulecolor \doublerulesepcolor
>{...} - = \hhline. :
\newcommand\rgbline[1]{\hhline{>{\arrayrulecolor{red}}|#1:=%
>{\arrayrulecolor{green}}=>{\arrayrulecolor{blue}}=:#1|}}

\arrayrulecolor{red}
\begin{tabular}{||*3c||}\rgbline{t} red green blue
red & green & \multicolumn{1}{c||}{blue}\\
\rgbline{b}\end{tabular}

- \cline,
\hhline -.

10
3

3.1 dvips
dvips
EPS5 . eps- PostScript. ,
. eps-
:

%%BoundingBox: llx lly urx ury

llx, lly, urx ury x- y- 6


,
. .
a.eps, -
:

%%BoundingBox: 99 99 155 155

, ( ) -
99 bp , ,
56 bp 56 bp 1.98 1.98 .
, -
eps-.
eps-.
, fpTEX
, GhostScript.
jpeg2ps.exe JPEG eps-.
EPS. jpeg2ps -
eps- ,
JPEG-. PostScript,
, GhostScript, .
jpg- eps-
:

jpeg2ps -r 0 -o outputfile.eps inputfile.jpg

-o jpeg2ps
. -r 0 Bounding Box,
. , 600 px 300 px, Bounding
Box 600 bp 300 bp.
(0,0). -r -r dpi, dpi .
5
- PCX,
, , .
6
72 (bp) 1 2.54

11
, 600 px 300 px -r 600,
Bounding Box 72 bp 36 bp 1 (600/600) 0.5
(300/600).
tiff2ps.ps pstools GhostScript -
TIFF eps-. TIFF
( LZW). eps-, -
tif-, . tiff2ps.ps
. -
-h, eps-
tif-, .
:
gswin32c -- tiff2ps.ps inputfile.tif outputfile.eps -i -h -b0

3.2 pdftex
pdf LATEX EPS.
PDF7 . EPS PDF -
, , GSview.
pdf- CropBox ( BoundingBox EPS).
pdf TEX MediaBox, -
, . -
Bounding Box eps-,
eps- , (0,0) -
BoundingBox. epstopdf.exe.
eps-
pdf-:
epstopdf inputfile.eps outputfile.pdf

, a.pdf, a.eps epstopdf,


MediaBox [0 0 56 56].
pdftex, dvips, -
PNG, TIFF ,
, JPEG.

4
graphicx

\includegraphics[keyval-list]{file}

file. -
keyval-list .
7
, MetaPost. -
, pdf TEX.

12
key=value, .
\includegraphics ,
eps-
dvips pdf- pfdtex. TEX -
, BoundingBox MediaBox,
. 8 :

\includegraphics{a} A
, , ,
. . -
, LATEX,
pfdLATEX: LATEX a.eps, pfdLATEX a.pdf.
4.4.
BoundingBox eps- 1 bp.
, .
( )

%%HiResBoundingBox: llx lly urx ury

llx, lly, urx ury (


, BoundingBox) -
, 1 bp. , TEX ,
\includegraphics

hiresbb

4.1
\includegraphics, -
,
.

width=length

length ( TEX )
8
( ),
, .

13
, . :

\includegraphics[width=1.5cm]{a} A

height=length | totalheight=length

length ( TEX )
( ) , . :

\includegraphics[width=1in,height=10mm]{a} A

keepaspectratio

, -
, , ,
, . :

\includegraphics[width=1in,height=1cm,% A
keepaspectratio]{a}

, , , -
height. width :
.

scale=scale

scale . :

\includegraphics[scale=0.5]{a} A
, ,
, 5.1.1 5.1.2.
:

\resizebox{1in}{10mm}{\includegraphics{a}} A
14
-
dvips pdftex

bb=llx lly urx ury

bb=0 0 W H -
PCX (. . 11). W
H , LATEX . pdf LATEX
bb .

4.2

viewport=llx lly urx ury


trim=dl db dr du

. -
. llx, lly, urx ury x- y-
( TEX )
, dl, db, dr du -
( TEX ) , ,
, .
. :

\includegraphics[viewport=-5 -5 40 40]{a}
A

clip=boolean

, ,
boolean true ( ). :

\includegraphics[trim=-5 -5 16 16,clip]{a}
A

15
4.3

angle=angle

angle .
. :

\includegraphics[scale=0.6,angle=30]{a} A

origin=pos

12 , -
:

g
-
lt t rt : l ( -
), c ( ) r (
).
:
l c r b ( ), B (
), c ( ) t ( -
lB B rB ). -

pos: lb, lB, l, lt, b, B, c, t, rb, rB, r,
lb b rb rt. , -
c. , origin=lB -
- ,
pos. origin=c .
, , -
, 5.3:

\rotatebox{30}{\scalebox{0.6}%
{\includegraphics{a}}}
A

, -
, \width . (. 22).
!

16
4.4
\includegraphics -
, , ,
. dvips

eps, ps, eps.gz, ps.gz, eps.Z

pdftex

png, pdf, jpg, mps, tif

\includegraphics ,
( )
. ,
.
graphicx

\DeclareGraphicsExtensions{ext-list}


, .
ext-list , -
.
.
\includegraphics -
, LATEX,
pfdLATEX.

4.4.1

dvips -
eps. eps-
.

4.5
LATEX ,
.

\graphicspath{dir-list}

. dir-list -
. ,

17
\graphicspath{{images/}{d:/images/eps/}{d:/images/pdf/}}

LATEX images -
( ) d:/images/eps
d:/images/pdf.
eps- ,
filecontents*
LATEX.

4.6

, , dvips
pfdtex.
dvips eps-,
gzip. eps.gz.
dvips.def:

\@namedef{Gin@rule@.eps.gz}#1{{eps}{.eps.bb}{gunzip -c #1}}

#1 name. , ,
eps.gz eps,
name.eps.bb, -
name.eps.gz gunzip. name.eps.bb
TEX .

%%BoundingBox: llx lly urx ury

eps- ( 11). ,
TEX .

\DeclareGraphicsRule{ext}{type}{read-file}{command}

: (i) ext type, (eps


dvips); (ii) read-file,
; (iii) command,
.
\DeclareGraphicsRule , -
eps.gz dvips.def. -
, \DeclareGraphicsRule:

\DeclareGraphicsRule{.eps.gz}{eps}{.eps.bb}{gunzip -c #1}

18
, ext read-file
.
\DeclareGraphicsRule
s.jpg.
11 , dvips
JPEG EPS. , s.jpg
s.eps, s.jpg.bb eps-
BoundingBox. s.eps .

\DeclareGraphicsRule{.jpg}{eps}{.jpg.bb}{jpeg2ps -r 0 -h #1}

dvips , jpg-:
jpeg2ps, jpg- EPS
( , -o ),
. TEX BoundingBox.
s.jpg.bb. ,

\includegraphics[width=3cm]{s.jpg}

LATEX, pdf LATEX:

\includegraphics[width=3cm]{s.jpg}

\DeclareGraphicsRule

ext=ext
type=type
read=read-file
command=command

\includegraphics. ,
\DeclareGraphicsRule.
s.jpg

\includegraphics[width=3cm,%
type=eps,read=.bb,command=jpeg2ps -r 0 -h #1]{s.jpg}

\includegraphics[width=3cm,%
type=eps,ext=.jpg,read=.jpg.bb,command=jpeg2ps -r 0 -h #1]{s}

19
4.7

draft

,
. :

images/a.pdf
\includegraphics[width=1.5cm,draft]{a}

draft
, \documentclass.

final

\includegraphics
.

5
\includegraphics -
. graphicx
, , -
.

5.1
5.1.1

\resizebox{width}{height}{lr-text}

, \mbox, lr-text -
( ) ,
width height:

\resizebox{4cm}{8mm}{abc} abc

20
, width
height !:

\resizebox{3cm}{!}{abc} abc

\resizebox*{width}{totalheight}{lr-text}

\resizebox, , -
( ) totalheight.
\resizebox -
\height, \width, \totalheight \depth.

5.1.2

\scalebox{h-scale}[v-scale]{lr-text}

, \mbox, lr-text
h-scale v-scale . v-scale ,
.
:

\scalebox{1.5}[3]{abc} \scalebox{1.5}%
[-3]{abc}
abc abc
5.2

\reflectbox{lr-text}

\scalebox{-1}[1]{lr-text}, 5.1.2.

21
5.3

\rotatebox[keyval-list]{angle}{lr-text}

, \mbox, lr-text angle


. -
9 :

i
{\huge ghi \rotatebox{30}{ghi}} ghi gh
keyval-list \rotatebox
, , -
.
key=value.

origin=pos

12 , -
4.3.

x=dimen1
y=dimen2

, [keyval-list] [x=4mm,y=3mm], -
, 4
3 .

units=number

number . ,
, units=360.
units=1, 90
0.25. :
W

\rotatebox[origin=c,units=1]{0.25}{\huge W} W
9
,
.

22
6
lscape

\begin{landscape} ... \end{landscape}

. -
.

. .

7
graphicx ,
.

7.1
hiderotate , .

hidescale , c
.

hiresbb , %%HiResBoundingBox
%%BoundingBox (. hiresbb . 13).

draft | final () .
.

7.2
graphicx keyval,

\setkeys{operation}{keyval-list}

keyval-list -
\rotatebox ( operation Grot)
\includegraphics ( operation Gin). ,

\setkeys{Gin}{width=\textwidth}

\setkeys,
.

23
8 PDF
hyperref pdf-
(bookmarks), Acrobat
Reader. , -
LATEX.
unicode :

\usepackage[colorlinks,unicode]{hyperref}

.
colorlinks, .
manual.pdf ( Sebastian Rahtz),
.
hyperref LATEX -
.
. , -
( hyperindex
; , false).
, -
, ( bookmarks
). ,
\addcontentsline. -
. , LATEX ,
\addcontentsline.
, , ,
. .
, \addcontentsline -

.
\pdfbookmark \hypertarget -
. , paper.pdf (
Heiko Oberdiek), .
hyperref -
, URL. manual.pdf (
Sebastian Rahtz), .

\href{URL}{link text}

:
\href{mailto:syutkin@ns.kinetics.nsc.ru}%
{ }

24

, 7
\DeclareGraphicsExtensions, , 7
17 \includegraphics, 12
\DeclareGraphicsRule, 18 angle, 16
\arrayrulecolor, 9 bb, 15
\color, 7 clip, 15
\doublerulesepcolor, 9 command, 19
\graphicspath, 17 draft, 20
\pagecolor, 8 ext, 19
\setkeys, 23 final, 20
height, 14
, 12 hiresbb, 13
keepaspectratio, 14
origin, 16
, 23 read, 19
\includegraphics scale, 14
angle, 16 totalheight, 14
bb, 15 trim, 15
clip, 15 type, 19
command, 19 viewport, 15
draft, 20 width, 13
ext, 19 \reflectbox, 21
final, 20 \resizebox*, 21
height, 14 \resizebox, 20
hiresbb, 13 , 21
keepaspectratio, 14 , 21
origin, 16 \rotatebox, 22
read, 19 origin, 22
scale, 14 units, 22
totalheight, 14 x, 22
trim, 15 y, 22
type, 19 \rowcolor, 8
viewport, 15 \scalebox, 21
width, 13 , 21
\rotatebox \textcolor, 7
origin, 22
units, 22
x, 22 landscape, 23
y, 22
\documentclass, 3
\colorbox, 7 color
\columncolor, 8 dvipsnames, 5
\definecolor, 6 dvips, 2
\fcolorbox, 7 monochrome, 7

25
pdftex, 3 hiderotate, 23
usenames, 5 hidescale, 23
graphicx hiresbb, 23
draft, 23 pdftex, 3
dvips, 2 hyperref, 24
final, 23 keyval, 23
hiderotate, 23 \setkeys, 23
hidescale, 23 lscape, 2, 23
hiresbb, 23 landscape, 23
pdftex, 3 dvips, 2
lscape pdftex, 3
dvips, 2
pdftex, 3
EPS, 11
BoundingBox, 11, 13
colortbl, 8 HiResBoundingBox, 13
\arrayrulecolor, 9 JPEG, 12
\columncolor, 8 PDF, 12
\doublerulesepcolor, 9 MediaBox, 12, 13
\rowcolor, 8 PNG, 12
color, 2, 3 TIFF, 12
\colorbox, 7 , 12
\color, 7 EPS PDF, 12
\definecolor, 6 JPEG EPS, 11,
\fcolorbox, 7 19
\pagecolor, 8 TIFF EPS, 12
\textcolor, 7 , 18
, 3
dvipsnames, 5
dvips, 2 cmyk, 6, 7
monochrome, 7 gray, 5, 6
pdftex, 3 named, 3, 5, 7
usenames, 5 pdftex, 5
graphicx, 2, 12, 20 dvips, 4, 5
\DeclareGraphicsExtensions, color, 3
17 rgb, 5, 7
\DeclareGraphicsRule, 18
\graphicspath, 17
\includegraphics, 12
\reflectbox, 21
\resizebox*, 21
\resizebox, 20
\rotatebox, 22
\scalebox, 21
draft, 23
dvips, 2
final, 23

26

Potrebbero piacerti anche