1 %% grfguide.tex Copyright (C) 1994 1995 1996 1998 1999 David Carlisle
2 %% Copyright (C) 2005 2014 2016 2017 David Carlisle, LaTeX3 Project
4 %% This file is part of the Standard LaTeX `Graphics Bundle'.
5 %% It may be distributed under the terms of the LaTeX Project Public
6 %% License, as described in lppl.txt in the base LaTeX distribution.
7 %% Either version 1.3c or, at your option, any later version.
9 %% This file has the LPPL maintenance status "maintained".
11 \begin{filecontents*
}{a.ps
}
13 %%BoundingBox:0 0 72 72
26 \begin{filecontents*
}{a.pdf
}
102 /BaseFont /Times-Roman
105 /FontDescriptor
9 0 R
108 /Encoding /WinAnsiEncoding
114 /FontName /Times-Roman
122 /FontBBox
[0 0 706 674]
123 /Type /FontDescriptor
129 /Producer (GPL Ghostscript
9.06)
130 /ModDate (D:
20140426202438+
01'
00')
131 /CreationDate (D:
20140426202438+
01'
00')
152 /ID
[<
4ca1370d594acd28b9d948a5e8b925c3> <
4ca1370d594acd28b9d948a5e8b925c3>
]
158 \documentclass{ltxguide
}
160 %%% No driver option specified
161 %%% set up the files color.cfg and graphics.cfg for your site.
164 %%% \ExecuteOptions{dvips}
166 \usepackage{color,
graphicx,shortvrb
}
168 %% Just as an example, and to make sure, in case some
169 %% driver option has not declared a default rule for
171 %\DeclareGraphicsRule{.ps}{eps}{.ps}{}
172 %\DeclareGraphicsExtensions{.pdf,.ps}
174 %% .ps files are (to be treated as) EncapsulatedPostScript
175 %% files. The .ps file is to be read for the BoundingBox.
176 %% No `special' commands need to be applied by the driver.
179 \renewcommand\star{{\ttfamily*
}}
184 \settowidth{\gxlen}{\package{graphicx}:
}
185 \newcommand\gs{\makebox[\gxlen][l
]{\package{graphics
}:
}}
186 \newcommand\gx{\makebox[\gxlen][l
]{\package{graphicx}:
}}
191 \title{Packages in the `graphics' bundle
}
192 \author{D. P. Carlisle
\and The
\LaTeX3 Project
}
199 \section{Introduction
}
200 This
document serves as a user-manual for the packages
\package{color},
201 \package{graphics
}, and
\package{graphicx}. Further documentation may be
202 obtained by processing the source (|dtx|) files of the individual
205 \section{Driver support
}\label{drivers
}
206 All these packages rely on features that are not in
\TeX\ itself.
207 These features must be supplied by the `driver' used to print the
208 |dvi| file. Unfortunately not all drivers support the same features, and
209 even the internal method of accessing these extensions varies between
210 drivers. Consequently all these packages take options such as
211 `|
dvips|' to specify which driver is being used.
213 Normally you should
\emph{not
} specify the driver option explicitly
214 in the
document, but allow it to be defaulted automatically.
215 This allows the
document to be portable between different systems.
217 Your
\TeX\ distribution should have included |graphics.cfg| and
218 |
color.cfg| configuration files to specify these defaults.
219 Standard versions of the configuration files are maintained by the
220 \LaTeX\ Project and distributed in the CTAN |graphics-cfg| collection.
222 For special requirements you may edit a copy of these |cfg| files
223 to set up a site default for these options. Suppose that you wish
224 the
\package{color} package to always default to use specials for the
225 PostScript driver, |dvisvgm|. In that case, create a file |
color.cfg|
226 containing the line:\\
227 |
\ExecuteOptions{dvisvgm
}|\\
228 Normally you will want an identical file |graphics.cfg| to set a similar
229 default for the graphics packages.
231 The following driver options are declared in the packages.
232 The matching definition files (
\emph{driver
}|.def|)
233 are now also maintained by the
\LaTeX\ project,
234 but distributed separately, in the CTAN |graphics-def| collection.
235 \begin{quote
}\raggedright
236 |dvipdfmx|, |
dvips|, |dvisvgm|, |luatex|, |pdftex|, |xetex|
240 The following two options are also supported, they do not correspond
241 to separate definition files, but are essentially aliases for the
242 |
dvips| option (and |monochrome| in the case of |xdvi|).
243 \begin{quote
}\raggedright
247 The following set of options are supported by these packages
248 with associated driver files extracted from the |drivers.dtx|
249 documented source in this bundle. These are now, mainly of historic
250 interest but the documented sources do contain some useful code
251 and advice if you need to produce a new definition file for a new
252 driver or
\TeX\ system. |drivers.dtx| also contains documented
253 sources for older driver files that are no longer extracted.
254 \begin{quote
}\raggedright
255 |dvipdf|, |dvipdfm|, |dviwin|, |dvipsone|,
256 |emtex|, |pctexps|, |pctexwin|, |pctexhp|, |pctex32|,
257 |truetex|, |tcidvi|, |vtex|
260 The final driver option is an alias for |dvipsone|.
261 \begin{quote
}\raggedright
266 \section[Colour
]{Colour
\footnote{%
267 The basic
\package{color} package functionality described here
268 will be enough for many uses, however a much extended version
269 is available in the contributed
\package{xcolor
} package, distributed
270 and maintained separately. All the
color commands described here are
271 also available if you specify
\package{xcolor
} in your
document.
}%
273 The colour support is built around the idea of a system of
274 \emph{Colour Models
}. The Colour models supported by a driver vary,
275 but typically include
277 \item[rgb
] Red Green Blue: A comma separated list of three numbers
278 between~
0 and~
1, giving the components of the colour.
279 \item[cmyk
] Cyan Magenta Yellow
[K
]Black: A comma separated list of
280 four numbers between~
0 and~
1, giving the components of the colour
281 according to the additive model used in most printers.
282 \item[gray
] Grey scale: a single number between~
0 and~
1.
283 \item[named
] Colours accessed by name, e.g.\ `JungleGreen'. Not all
284 drivers support this model. The names must either be `known' to the
285 driver or added using commands described in |
color.dtx|. Some drivers
286 support an extended form of the named model in which an `intensity' of
287 the colour may also be specified, so `
\mbox{JungleGreen,
0.5}' would
288 denote that colour at half strength.
290 Note that the
\textbf{named
} model is really just given as an example
291 of a colour model that takes names rather than a numeric specification.
292 Other options may be provided locally that provide different colour
293 models, eg
\textbf{pantone
} (An industry standard set of colours),
294 \textbf{x11
} (Colour names from the X Window System), etc. The
295 standard distribution does not currently have such models, but the
296 \textbf{named
} model could be used as an example of how to define a new
297 colour model. The names used in the
\textbf{named
} model are those
298 suggested by Jim Hafner in his
\textsf{colordvi
} and
\textsf{foiltex
}
299 packages, and implemented originally in the |
color.pro| header file for
300 the
\texttt{dvips} driver.
302 \subsection{Package Options
}
303 Most of the options to the
\package{color} package just specify a
304 driver, e.g., \ |
dvips|, as discussed in section~
\ref{drivers
}.
306 One special option for the
\package{color} package
307 that is of interest is |monochrome.|
308 If this option is selected the colour commands are all
309 disabled so that they do not generate errors, but do not generate colour
310 either. This is useful if previewing with a previewer that can not
313 Three other package options control the use of the
\textbf{named
} model.
314 The |
dvips| driver (by default) pre-defines
68 colour names. The |
dvips|
315 option normally makes these names available in the
\textbf{named
} colour
316 model. If you do not want these names to be declared in this model
317 (Saving
\TeX\ some memory) you may give the |nodvipsnames|
318 option. Conversely, if you are using another driver, you may wish to
319 add these names to the named model for that driver (especially if you
320 are processing a
document originally produced on |
dvips|). In this case
321 you could use the |dvipsnames| option. Lastly the |usenames| option
322 makes all names in the
\textbf{named
} model directly available, as
325 \subsection{Defining Colours
}
327 The colours |black|, |white|, |red|, |green|, |blue|, |cyan|,
328 |magenta|, |yellow| should be predefined, but should you wish to mix
329 your own colours use the |
\definecolor| command.
332 |
\definecolor|
\arg{name
}\arg{model
}\arg{colour specification
}
336 This defines
\m{name
} as a colour which can be used in later colour
337 commands. For example
339 \definecolor{light-blue
}{rgb
}{0.8,
0.85,
1}
340 \definecolor{mygrey
}{gray
}{0.75}
342 \definecolor{light-blue
}{rgb
}{0.8,
0.85,
1}
343 \definecolor{mygrey
}{gray
}{0.75}
345 Now |light-blue| and |mygrey| may be used in addition to the
346 predefined colours above.
348 \subsection{Using Colours
}
350 \subsubsection{Using predefined colours
}
351 The syntax for colour changes is designed to mimic font changes.
358 This is a
\emph{declaration
}, like |
\bfseries| It changes the current
359 colour to
\m{name
} until the end of the current group or
362 An alternative command syntax is to use a
\emph{command
} form that
363 takes the text to be coloured as an
\emph{argument
}. This is similar
364 to the font commands such as |
\textbf|:
367 |
\textcolor|
\arg{name
}\arg{text
}
371 So the above is essentially equivalent to
372 |
{\color|
\arg{name
}\emph{text
}|
}|.
374 \subsubsection{Using colour specifications directly
}
378 |
\color|
\oarg{model
}\arg{specification
}\\
379 |
\textcolor|
\oarg{model
}\arg{specification
}\arg{text
}
382 Normally one would predeclare all the colours used in a package, or in
383 the
document preamble, but sometimes it is convenient to directly use
384 a colour without naming it first. To achieve this |
\color| (and all
385 the other colour commands) take an optional argument specifying the
386 model. If this is used then the mandatory argument takes a
387 \m{colour specification
} instead of a
\m{name
}. For example:\\
388 |
\color[rgb
]{1,
0.2,
0.3}|\\
389 would directly select that colour.
391 This is particularly useful for accessing the
\textbf{named
} model:\\
392 |
\color[named
]{BrickRed
}| selects the |
dvips| colour BrickRed.
394 Rather than repeatedly use |
[named
]| you may use |
\definecolor| to
395 provide convenient aliases:\\
396 |
\definecolor{myred
}{named
}{WildStrawberry
}|
397 \ldots\ |
\color{myred
}|\
\ldots
399 Alternatively if you are happy to use the existing names from the
400 \textbf{named
} model, you may use the |usenames| package option, which
401 effectively calls |
\definecolor| on every colour in the
\textbf{named
}
402 model, thus allowing |
\color{WildStrawberry
}| in addition to
403 |
\color[named
]{WildStrawbery
}|.
405 \subsection{Named Colours
}
406 Using the
\textbf{named
} colour model has certain advantages over
407 using other colour models.
409 Firstly as the |dvi| file contains a request
410 for a colour by
\emph{name
}, the actual mix of primary colours used to
411 obtain the requested colour can be tuned to the characteristics of a
412 particular printer. In the |
dvips| driver the meanings of the colour
413 names are defined in the header file |
color.pro|. Users are encouraged
414 to produce different versions of this file for any printers they use. By
415 this means the same dvi file should produce colours of similar
416 appearance when printed on printers with different colour
419 Secondly, apart from the so called `process colours' that are produced
420 by mixing primary colours during the print process, one may want to use
421 `spot' or `custom' colours. Here a particular colour name does not
422 refer to a mix of primaries, but to a particular ink. The parts of the
423 document using this colour will be printed separately using this named
426 \subsection{Page Colour
}
430 |
\pagecolor|
\arg{name
}\\
431 |
\pagecolor|
\oarg{model
}\arg{specification
}\\
435 The background colour of the whole page can be set using
436 |
\pagecolor|. This takes the same argument forms as |
\color| but sets
437 the background colour for the current and all subsequent pages. It is
438 a global declaration, so you need to use
439 |
\nopagecolor|
\NEWfeature{2014/
04/
23}\ to `get back to normal'.
440 If that is not supported, you may use |
\pagecolor{white
}| although that
441 will make a white background rather than the default transparent background.
443 \subsection{Box Backgrounds
}
444 Two commands similar to |
\fbox| produce boxes with the backgrounds
445 shaded an appropriate colour.
448 |
\colorbox|
\arg{name
}\arg{text
}\\
449 |
\colorbox|
\oarg{model
}\arg{specification
}\arg{text
}\\
450 |
\fcolorbox|
\arg{name1
}\arg{name2
}\arg{text
}\\
451 |
\fcolorbox|
\oarg{model
}%
452 \arg{specification1
}\arg{specification2
}\arg{text
}
456 The former produces a box coloured with
\emph{name
}
457 \colorbox{mygrey
}{like this
}. The latter is similar but puts a frame of
458 colour
\emph{name1
} around the box coloured
\emph{name2
}.
460 These commands use the |
\fbox| parameters |
\fboxrule| and |
\fboxsep|
461 to determine the thickness of the rule, and the size of the shaded area.
463 \subsection{Possible Problems
}
465 \TeX\ was not designed with colour in mind, and producing colours
466 requires a lot of help from the driver program. Thus, depending on the
467 driver, some or all features of the
\package{color} package may not be
470 Some drivers do not maintain a special `colour stack'. These drivers are
471 likely to get confused if you nest colour changes, or use colours in
472 floating environments.
474 Some drivers do not maintain colours over a page break, so that if the
475 page breaks in the middle of a coloured paragraph, the last part of the
476 text will incorrectly be printed in black.
478 There is a different type of problem that will occur for all drivers.
479 Due to certain technical difficulties
\footnote{At least two causes:
480 1) The presence of a
\texttt{\char`\
\special} \m{whatsit
} prevents
481 \texttt{\char`\
\addvspace} `seeing' space on the current vertical list,
482 so causing it to incorrectly add extra vertical space.
2) A
483 \m{whatsit
} as the first item in a
\texttt{\char`\
\vtop} moves the
484 reference point of the box.
}%
485 , it is possible that at points
486 where the colour changes, the
\emph{spacing
} is affected. For this
487 reason the |monochrome| option does not completely disable the colour
488 commands, it redefines them to write to the log file. This will have the
489 same effects on spacing, so you can produce monochrome drafts of your
490 document, at least knowing that the final spacing is being shown.
491 \section{The Graphics packages
}
492 There are two graphics packages:
494 \item[\package{graphics
}] The `standard' graphics package.
495 \item[\package{graphicx}] The `extended' or `enhanced' graphics
498 The two differ only in the format of optional arguments for the
499 commands defined. The command names, and the mandatory arguments are
500 the same for the two packages.
502 \subsection{Package Options
}
503 As discussed in section~
\ref{drivers
}, the graphics packages share the
504 same `driver' options as the
\package{color} package. As for colour
505 you should set up a site-default in a file,
506 |graphics.cfg|, containing the line (for |
dvips|):\\
507 |
\ExecuteOptions{dvips}|
509 The graphics packages have some other options for controlling how many
510 of the features to enable:
512 \item[draft
] suppress all the `special' features. In particular
513 graphics files are not included (but they are still read for size
514 info) just the filename is printed in a box of the correct size.
515 \item[final
] The opposite of |draft|. Useful to over-ride a global
516 |draft| option specified in the |
\documentclass| command.
517 \item[hiderotate
] Do not show rotated text (presumably because the
518 previewer can not rotate).
519 \item[hidescale
] Do not show scaled text (presumably because the
520 previewer can not scale).
521 \item[hiresbb
] Look for size specifications in |
%%HiResBoundingBox|
522 lines rather than standard |
%%BoundingBox| lines.%
523 \NEWfeature{1996/
10/
29}
524 \item[demo
] Instead of inserting an image file |
\includegraphics|
525 draws a
150\,pt by
100\,pt rectangle unless other dimensions are
526 specified manually.
\NEWfeature{2006/
02/
20}
528 \subsection{Rotation
}
531 \gs |
\rotatebox|
\arg{angle
}\arg{text
}\\
532 \gx |
\rotatebox|
\oarg{key val list
}\arg{angle
}\arg{text
}
535 This puts
\emph{text
} in a box, like |
\mbox|, but rotates the box
536 through
\emph{angle
} degrees,
\rotatebox{15}{like this
}.
538 The standard version always rotates around the reference point of the
539 box, but the
\package{keyval
} version takes the following keys:
548 So you may specify both |x| and |y|, which give the coordinate of
549 the centre of rotation relative to the reference point of the box, eg
550 |
[x=
2mm, y=
5mm
]|. Alternatively, for the most common points, one may use
551 |origin| with a
\emph{label
} containing one or two of the following:
552 |lrctbB| (|B| denotes the baseline, as for
\package{PSTricks
}). For
553 example, compare a default rotation of $
180^
\circ$
554 \ldots\rotatebox{180}{Like This
}\ldots\ to the effects gained by using
556 |
[origin = c
]| rotates about the centre of the box,
\ldots
557 \rotatebox[origin=c
]{180}{Like This
}\ldots\\
558 |
[origin = tr
]| rotates about the top right hand corner
\ldots
559 \rotatebox[origin=tr
]{180}{Like This
}\ldots
561 The |units| key allows a change from the default units of degrees
562 anti-clockwise. Give the number of units in one full anti-clockwise
563 rotation. For example:\\
564 |
[units = -
360]| specifies degrees clockwise.\\
565 |
[units=
6.283185]| specifies radians.
569 \subsubsection{Scaling by scale factor
}
572 |
\scalebox|
\arg{h-scale
}\oarg{v-scale
}\arg{text
}
575 Again this is basically like |
\mbox| but scales the
\emph{text
}.
576 If
\emph{v-scale
} is not specified it defaults to
\emph{h-scale
}.
577 If it is specified the text is distorted as the horizontal and
578 vertical stretches are different,
\scalebox{3}[.7]{Like This
}.
582 |
\reflectbox|
\arg{text
}
585 An abbreviation for |
\scalebox{-
1}[1]|
\arg{text
}.
587 \subsubsection{Scaling to a requested size
}
590 |
\resizebox|
\star\arg{h-length
}\arg{v-length
}\arg{text
}
593 Scale
\emph{text
} so that the width is
\emph{h-length
}.
594 If |!| is used as either length argument, the other argument is used
595 to determine a scale factor that is used in both directions.
596 Normally
\emph{v-length
} refers to the height of the box, but in the
597 star form, it refers to the `height + depth'.
598 As normal for
\LaTeXe\ box length arguments, |
\height|,
599 |
\width|, |
\totalheight|, |
\depth| may be used to refer to the
600 original size of the box.
602 |
\resizebox{1in
}{\height}{Some text
}|:
603 \resizebox{1in
}{\height}{Some text
}
605 |
\resizebox{1in
}{!
}{Some text
}|:
606 \resizebox{1in
}{!
}{Some text
}
608 \subsection{Including Graphics Files
}
609 The functions for graphics inclusion try to give the same user syntax
610 for including any kind of graphics file that can be understood by the
611 driver. This relies on the file having an extension that identifies
612 the file type. The `driver options' will define a collection of file
613 extensions that the driver can handle, although this list may be
614 extended using the declarations described below.
616 If the file's extension is unknown to the driver, the system may try a
617 default file type. The PostScript driver files set this default to be
618 |eps| (PostScript), but this behaviour may be customised if other
619 defaults are required.
622 \gs |
\includegraphics|
\star\oarg{llx,lly
}\oarg{urx,ury
}\arg{file
}\\
623 \gx |
\includegraphics|
\star\oarg{key val list
}\arg{file
}
625 Include a graphics file.
627 If
\star\ is present, then the graphic is `clipped' to the size
628 specified. If
\star\ is omitted, then any part of the graphic that is
629 outside the specified `bounding box' will over-print the surrounding
632 If the optional arguments are omitted, then the size of the graphic
633 will be determined by reading an external file as described below.
635 \paragraph{\package{graphics
} version
}
636 If
\oarg{urx,ury
} is present, then it should specify the coordinates
637 of the top right corner of the image, as a pair of
\TeX\ dimensions.
638 If the units are omitted they default to |bp|. So |
[1in,
1in
]| and
639 |
[72,
72]| are equivalent. If only one optional argument appears, the
640 lower left corner of the image is assumed to be at |
[0,
0]|. Otherwise
641 \oarg{llx,lly
} may be used to specify the coordinates of this point.
643 \paragraph{\package{graphicx} version
}
644 Here the star form is just for compatibility with the standard
645 version. It just adds |clip| to the list of keys specified.
646 (Also, for increased compatibility, if
\emph{two
} optional arguments are
647 used, the `standard' version of |
\includegraphics| is always used, even
648 if the
\package{graphicx} package is loaded.)
650 The allowed keys are listed below.
652 \item[bb
] The argument should be four dimensions, separated by spaces.
653 These denote the `Bounding Box' of the printed region within
655 \item[bbllx,bblly,bburx,bbury
] Set the bounding box. Mainly for
656 compatibility with older packages.
657 Specifying |bbllx=a,bblly=b,bburx=c,bbury=d|
658 is equivalent to specifying |bb = a b c d|.
659 \item[natwidth,natheight
] Again an alternative to |bb|.
660 |natheight=h,natwidth=w| is equivalent to |bb =
0 0 h w|.
661 \item[hiresbb
]\NEWfeature{1996/
10/
29}
662 Boolean valued key. If set to |true| (just specifying |hiresbb|
663 is equivalent to |hiresbb=true|) then
\TeX\ will look for
664 |
%%HiResBoundingBox| lines rather than |%%BoundingBox|. It may be set
665 to |false| to overrule a default setting of |true| set by the
666 |hiresbb| package option.
667 \item[pagebox
]\NEWfeature{2017/
06/
01}
668 PDF files do not have BoundingBox but may specify up to four predefined
671 |MediaBox|: the boundaries of the physical medium.
672 |CropBox|: the region to which the contents of the page are to be
673 clipped when displayed.
674 |BleedBox|: the region to which the contents of the
675 page should be clipped in production.
676 |TrimBox|: the intended dimensions of the finished page.
677 |ArtBox|: the extent of the page's meaningful content.
679 The driver will set the image size based on |CropBox| if present,
680 otherwise it will not use one of the others,
681 with a driver-defined order of preference.
682 |MediaBox| is always present.
684 The |pagebox| key may be used to specify which bounding box specification to use,
685 The value should be one of
686 |mediabox|, |cropbox|, |bleedbox|, |trimbox|, |artbox|.
687 \item[viewport
]\NEWfeature{1995/
06/
01}
688 The |viewport| key takes four arguments, just like
689 |bb|. However in this case the values are taken relative to the
690 origin specified by the bounding box in the file. So to `view' the
691 1in square in the bottom left hand corner of the area specified by
692 the bounding box, use the argument |viewport=
0 0 72 72|.
693 \item[trim
]\NEWfeature{1995/
06/
01}
694 Similar to viewport, but here the four lengths specify the
695 amount to remove or add to each side. |trim=
1 2 3 4| `crops' the
696 picture by
1bp at the left,
2bp at the bottom,
3bp on the right and
698 \item[angle
] Rotation angle.
699 \item[origin
]\NEWfeature{1995/
09/
28}
700 Origin for rotation. See the documentation of |
\rotatebox|.
701 \item[width
] Required width. The
702 graphic is scaled to this width.
703 \item[height
] Required height. The
704 graphic is scaled to this height.
705 \item[totalheight
]\NEWfeature{1995/
06/
01}
706 Specify the total height (height $+$ depth) of the figure.
707 This will differ from the `height' if rotation has occurred.
708 In particular if the figure has been rotated by $-
90^
\circ$
709 then it will have zero height but large depth.
710 \item[keepaspectratio
]\NEWfeature{1995/
09/
27}
711 Boolean valued key like `clip'.
712 If set to true then specifying both `width' and `height' (or
713 `totalheight') does not distort the figure but scales such that
714 neither of the specified dimensions is
\emph{exceeded
}.
715 \item[scale
] Scale factor.
716 \item[clip
] Either `true' or `false' (or no value, which is equivalent
717 to `true'). Clip the graphic to the bounding box.
718 \item[draft
] a boolean valued key, like `clip'. Locally switches to
720 \item[type
] Specify the graphics type.
721 \item[ext
] Specify the file extension. This should
\emph{only
} be
722 used in conjunction with |type|.
723 \item[read
] Specify the file extension of the `read file'. This
724 should
\emph{only
} be used in conjunction with |type|.
725 \item[command
] Specify any command to be applied to the file. This
726 should
\emph{only
} be used in conjunction with |type|.
727 \item[quiet
]\NEWfeature{2017/
06/
01}
728 Skip writing information to the log.
729 \item[page
]\NEWfeature{2017/
06/
01}
730 Page of a multi-page PDF file. (by default the first page will be used.)
731 \item[interpolate
]\NEWfeature{2017/
06/
01}
732 Enable/disable interpolation of bitmap images by the viewer.
735 For the keys specifying the original size (i.e,, the bounding box,
736 trim and viewport keys) the units can be omitted, in
737 which case bp (i.e., PostScript points) are assumed.
739 The first seven keys specify the original size of the image. This size
740 needs to be specified in the case that the file can not be read by
741 \TeX, or it contains an incorrect size `BoundingBox' specification.
743 |bbllx|
\ldots\ |
\bbury| are mainly for compatibility for older
745 |bbllx=a, bblly=b, bburx=c, bbury=d|\\
749 |natheight| and |natwidth| are just shorthands for setting the lower
750 left coordinate to
0 0 and the upper right coordinate to the specified
753 The next few keys specify any scaling or rotation to be applied to the
754 image. To get these effects using the standard package, the
755 |
\includegraphics| call must be placed inside the argument of a
756 |
\rotatebox| or |
\scalebox| command.
758 The keys are read left-to-right, so |
[angle=
90, height=
1in
]| means
759 rotate by
90 degrees, and then scale to a height of
1in.
760 |
[height=
1in, angle=
90]| would result in a final
\emph{width
} of
1in.
762 If the
\textsf{calc
} package is also loaded the lengths may use
763 \textsf{calc
} syntax, for instance to specify a width of
2\,cm
764 less than the text width: |
[width=
\textwidth-
2cm
]|.
766 \TeX\ leaves the space specified either in the file, or in
767 the optional arguments. If any part of the image is actually outside
768 this area, it will by default overprint the surrounding text.
769 If the star form is used, or |clip| specified, any part of the image
770 outside this area will not be printed.
772 The last four keys suppress the parsing of the filename. If they are
773 used, the main
\emph{file
} argument should not have the file
774 extension. They correspond to the arguments of |
\DeclareGraphicsRule|
777 To see the effect that the various options have consider the file
778 |a.ps|. This file contains the bounding box specification
780 %%BoundingBox:0 0 72 72
782 That is, the printed region consists of a one-inch square, in
783 the bottom left hand corner of the paper.
785 In all the following examples the input will be of the form
787 left---
\fbox{\includegraphics{a
}}---right
789 With different options supplied to |
\includegraphics|.
791 No optional argument.\\
792 left---
\fbox{\includegraphics{a
}}---right
794 \gs |
\scalebox{0.5}{\includegraphics{a
}}|\\
795 \gx |
\includegraphics[scale=
.5]{a
}|\\
796 left---
\fbox{\includegraphics[scale=
.5]{a
}}---right
798 \gs |
\includegraphics[15,
10][35,
45]{a
}}|\\
799 \gx |
\includegraphics[viewport=
15 10 35 45]{a
}|\\
800 left---
\fbox{\includegraphics[viewport=
15 10 35 45]{a
}}---right
802 \gs |
\includegraphics*
[15,
10][35,
45]{a
}}|\\
803 \gx |
\includegraphics[viewport=
15 10 35 45,clip
]{a
}|\\
804 left---
\fbox{\includegraphics[viewport=
15 10 35 45,clip
]{a
}}---right
806 \gs |
\scalebox{0.5}{\includegraphics{a
}}|
807 and |draft| option.\\
808 \gx |
\includegraphics[scale=
.5, draft
]{a
}|\\
809 left---
\fbox{\includegraphics[scale=
.5, draft
]{a
}}---right
811 \subsection{Other commands in the
\package{graphics
} package
}
814 |
\graphicspath|
\arg{dir-list
}
816 This optional declaration may be used to specify a list of directories
817 in which to search for graphics files. The format is the same as for
818 the
\LaTeXe\ primitive |
\input@path|. A list of directories, each in a
819 |
{}| group (even if there is only one in the list). For example:\\
820 |
\graphicspath{{eps/
}{tiff/
}}|\\
821 would cause the system to look in the subdirectories |eps| and |tiff|
822 of the current directory. (All modern
\TeX{} systems use |/|
823 as the directory separator, even on Windows.)
825 The default setting of this path is
826 |
\input@path| that is: graphics files will be found wherever
\TeX\
830 |
\DeclareGraphicsExtensions|
\arg{ext-list
}
832 \NEWdescription{1994/
12/
01}
833 This specifies the behaviour of the system when no file extension
834 is specified in the argument to |
\includegraphics|.
835 \arg{ext-list
} should be a comma separated list of file extensions.
836 (White space is ignored between the entries.)
837 A file name is produced by appending one extension from the list.
838 If a file is found, the system acts as if that extension had been
839 specified. If not, the next extension in
\emph{ext-list
} is tried.
842 Note that if the extension is not specified in the |
\includegraphics|
843 command, the graphics file must exist at the time
\LaTeX\ is run, as
844 the existence of the file is used to determine which extension from
845 the list to choose. However if a file extension
\emph{is
} specified,
846 e.g.\ |
\includegraphics{a.ps
}| instead of |
\includegraphics{a
}|, then
847 the graphics file need not exist at the time
\LaTeX\ is used. (In
848 particular it may be created on the fly by the
\m{command
}
849 specified in the |
\DeclareGraphicsRule| command described below.)
850 \LaTeX\ does however need to be able to determine the size of the
851 image so this size must be specified in arguments, or the `read file'
852 must exist at the time
\LaTeX\ is used.
855 |
\DeclareGraphicsRule|
\arg{ext
}\arg{type
}\arg{read-file
}\arg{command
}
857 Any number of these declarations can be made. They determine how the
858 system behaves when a file with extension
\emph{ext
} is specified.
859 (The extension may be specified explicitly or, if the argument to
860 |
\includegraphics| does not have an extension, it may be a default
861 extension from the
\emph{ext-list
} specified with
862 |
\DeclareGraphicsExtensions|.)
864 \emph{ext
} the file extension for which this rule applies. As a special
865 case,
\emph{ext
} may be given as |*| to denote the default behaviour for
866 all undeclared extensions (see the example below).
868 \emph{type
} is the `type' of file involved. All files of the same type
869 will be input with the same internal command (which must be defined in
870 a `driver file'). For example files with extensions |ps|, |eps|,
871 |ps.gz| may all be classed as type |eps|.
873 \emph{read-file
} determines the extension of the file that should be
874 read to determine size information. It may be the same as
\emph{ext
}
875 but it may be different, for example |.ps.gz| files are not readable
876 easily by
\TeX, so you may want to put the bounding box information in
877 a separate file with extension |.ps.bb|. If
\emph{read-file
} is empty,
878 |
{}|, then the system will not try to locate an external file for size
879 info, and the size must be specified in the arguments of
880 |
\includegraphics|. If the driver file specifies a procedure for
881 reading size files for
\emph{type
}, that will be used, otherwise the
882 procedure for reading |eps| files will be used. Thus the size of
883 bitmap files may be specified in a file with a PostScript style
884 |
%%BoundingBox| line, if no other specific format is available.
886 As a special case |*| may be used to denote the
887 same extension as the graphic file. This is mainly of use in
888 conjunction with using |*| as the extension, as in that case the
889 particular graphic extension is not known. For example
891 \DeclareGraphicsRule{*
}{eps
}{*
}{}
893 This would declare a default rule, such that all unknown extensions
894 would be treated as EPS files, and the graphic file would be read for
895 a BoundingBox comment.
897 \emph{command
} is usually empty, but if non empty it is used in place
898 of the filename in the |
\special|. Within this argument, |
#1| may be
899 used to denote the filename. Thus using the
dvips driver, one may
901 |
\DeclareGraphicsRule{.ps.gz
}{eps
}{.ps.bb
}{`zcat
#1}|\\
902 the final argument causes
dvips to use the |zcat| command to unzip the
903 file before inserting it into the PostScript output.
905 Note that
\LaTeX\ will find the graphics file by searching along
906 TEXINPUTS (and possibly other places, as specified with
907 |
\graphicspath|) however it may be that the command you specify
908 in this argument can not find such files unless they are in the
909 current directory. On some systems it may be possible to modify
910 the command so that it will find any files that
\LaTeX\ can find.
911 For example on newer web2c
\TeX\ releases on unix, one may modify the
912 above command so that the last argument is:\\
913 |
{`zcat `kpsewhich -n latex tex
#1`
}|\\
914 which incantation causes the |kpsewhich| program to find the
915 file, by searching along
\LaTeX's path, and then pass the full path
916 name to the |zcat| program so that it can uncompress the file.
917 Any such uses are very system dependent, and would best be placed in
918 a |graphics.cfg| file, thus keeping the
document itself portable.
920 \subsection{Global setting of keys
}
922 Most of the
\package{keyval
} keys used in the
\package{graphicx} package
923 may also be set using the command |
\setkeys| provided by the
924 \package{keyval
} package.
%
925 \footnote{\texttt{clip
},
\texttt{scale
} and
\texttt{angle
} may not be set via
926 \texttt{\string\setkeys} prior to calling
927 \texttt{\string\includegraphics}.
}
929 For instance, suppose you wanted all the files to be included in the
930 current
document to be scaled to
75\% of the width of the lines of text,
931 then one could issue the following command:\\
932 |
\setkeys{Gin
}{width=
0.75\textwidth}|\\
933 Here `|Gin|' is the name used for the
\package{keyval
} keys associated
934 with `Graphics inclusion'. All following
935 |
\includegraphics| commands (within the same group or environment) will
936 act as if |
[width=
0.75\textwidth]| had been specified, in addition to
937 any other key settings actually given in the optional argument.
939 Similarly to make all |
\rotatebox| arguments take an argument in
940 radians, one just needs to specify:\\
941 |
\setkeys{Grot
}{units=
6.28318}|
943 \subsection{Compatibility between
\package{graphics
} and
946 For a
document author, there are not really any problems of
947 compatibility between the two packages. You just choose the interface
948 that you personally prefer, and then use the appropriate package.
950 For a package or class writer the situation is slightly
951 different. Suppose that you are writing a letter class that needs to
952 print a company logo as part of the letterhead.
954 As the author of the class you may want to give the users the
955 possibility of using either interface in their letters (should they
956 need to include any further graphics into the letter body).
957 In this case the class should load the
\package{graphics
} package (not
958 \package{graphicx}, as this would commit any users of the class to the
959 \package{keyval
} interface). The logo should be included with
960 |
\includegraphics| either with
\emph{no
} optional argument (if the
961 correct size information is in the file) or
\emph{both
} optional
963 Do not use the
\emph{one
} optional argument form, as the meaning of this
964 argument would change (and generate errors) if the user were to load
965 \package{graphicx} as well as your class.
967 \section{Remaining packages in the graphics bundle
}
970 This is a small package essentially a `wrapper' around the
971 \package{graphicx} package, defining a command |
\psfig| which has the
973 |
\psfig{file=xxx,...
}| rather than |
\includegraphics[...
]{xxx
}|.\\
974 It also has a few more commands to make it slightly more compatible with
975 the old
\LaTeX~
2.09 style of the same name.
977 \subsection{Rotating
}
978 An extension package to
\package{graphicx}, mainly used for providing
979 rotated float environments.
982 The trig package is not intended to be used directly in documents. It
983 calculates sine, cosine and tangent trigonometric functions. These
984 are used to calculate the space taken up by a rotated box. This
985 package is also used by the |fontinst| program which converts
986 PostScript files to a form usable by
\TeX.
988 As well as being used as a
\LaTeX\ package, the macros may be extracted
989 with the
\package{docstrip
} options
\texttt{plain,package
}. In this case
990 the
\LaTeX\ package declarations are omitted from the file, and the
991 macros may be directly used as part of another macro file (they work
992 with any format based on plain
\TeX.)
995 The
\package{keyval
} package is intended to be used by other
996 packages. It provides a generic way of setting `keys' as used by the
997 \package{graphicx} package, and splitting up the comma separated lists
998 of
\m{key
}~=~
\m{value
} pairs.
1000 Like the
\package{trig
} package, these macros may be extracted and used
1001 as part of another macro file, based on plain
\TeX, as well as the
1002 standard use as a
\LaTeX\ package.
1004 By default an undeclared key will generate an error.
1005 If however the option
\texttt{unknownkeysallowed
} is used, then
1006 unknown keys will be silently ignored (leaving a message in the log
1007 file). This option is also accepted by the
\textsf{graphicx} package.
1012 \package{PSTricks
}, by Timothy Van Zandt is an immensely powerful
1013 package that enables a very full featured interface between PostScript
1014 and
\TeX. Unfortunately the colour support in
\package{PSTricks
} is
1015 slightly incompatible with the colour mechanism defined in the
1016 \package{color} package. The
\package{pstcol
} package is a (hopefully
1017 temporary) package that modifies a very small number of internal
1018 PSTricks functions, to remove this incompatibility. If
1019 \package{pstricks
} is loaded via this package, you may use any colours
1020 defined by
\package{color} package commands within
\package{pstricks
}
1021 commands, and vice versa.
1026 The
\package{lscape
} package requires and takes the same options
1027 as the
\package{graphics
} package. It defines a |landscape| environment
1028 within which page bodies are rotated through
90 degrees. The page head
1029 and foot are not affected, they appear in the standard (portrait)