• No results found

The graphicxbox Package

N/A
N/A
Protected

Academic year: 2021

Share "The graphicxbox Package"

Copied!
3
0
0

Bezig met laden.... (Bekijk nu de volledige tekst)

Hele tekst

(1)

The graphicxbox Package

D. P. Story

Email: dpstory@acrotex.net processed January 10, 2014

Contents

1 Introduction 1

2 Example files 1

3 Definitions of the two main commands 2

4 Internal, supporting commands 3

1∗package

1 Introduction

This is a short package that provides two new commands \graphicxbox and

\fgraphicxbox, which are companion commands to \colorbox and \fcolorbox of color.dtx, by D. P. Carlisle. The \graphicxbox inserts a graphical image as a background rather than a background color, while \fgraphcxbox does the same thing, but also draws a colored frame around the box.

This package requires either graphicx or graphicxsp package (the latter calls the first). The graphicxsp allows you to embed graphic images once and use them many times, this is ideal for this current package. Either of these commands should be loaded before this package. If you are using the web package and want to use graphicxsp, you should load graphicxsp before the web package. I will not use the \RequirePackage command to require either of these graphics packages, the reason for this is that graphicxsp contains options the user might want to access and I don’t want to make this package unduly complicated by adding options to this package only to pass them to another.

2 Example files

We provide three sample files with this distribution.

1

(2)

1. grfxbox tst.tex illustrates the basic features available to all users of dvips, dvipsone, pdflatex, and xelatex.

2. grfxbox tst sp.tex same as grfxbox tst.tex, but uses graphicxsp. The drivers dvips or dvipsone are required, and Adobe Distiller required as the PDF creator.

3. grfxbox tst indians.tex uses graphicxsp again, but illustrates trans- parency. Distill the file with Standard transparency.joboptions which accompanie the graphicsp package.

Though we don’t have a \RequirePackage for the required graphics package, we will test for their presence and emit a package error.

2\@ifpackageloaded{graphicxsp}{}

3 {%

4 \@ifpackageloaded{graphicx}{}

5 {%

6 \PackageError{graphicxbox}{%

7 Neither the graphicx nor graphicxsp packages are loaded.}%

8 {Load the graphicx or graphicxsp package before this one.}%

9 }%

10 }

3 Definitions of the two main commands

\graphicxbox This command provides a background graphic for a box, similar to \colorbox.

The syntax is

\graphicxbox[<Graphicx(SP)options>]{<graphic>}{<box content>}

When graphicx is loaded (and not graphicxsp) the syntax, in example form is

\graphicxbox{mycoolgraphic}{\Huge Hello World!}

The first parameter is optional and is passed to the \includegraphics command.

Do not use the scale, width or height parameters of \includegraphics. This package uses width and height to set the dimensions of the graphic to fit the box.

When graphicxsp (distiller required) is loaded, the optional parameter is used to specify the name of the embedded graphic to be used, in this case, the second argument {<graphic>} is not used. For example,

\embedEPS{indianblanket}{IndianBlnkt}

...

...

\graphicxbox[name=indianblanket]{}{\Huge Hello World!}

The indianblanket graphic can be used and reused many time without increasing the file size significantly. The other advantage of using the graphicxsp package is that it supports transparency. See the demo files that accompany this package.

11\newcommand{\graphicxbox}[2][]{\graphicx@b@x\relax{#1}{#2}}

2

(3)

\fgraphicxbox This command does the same as \graphicxbox, but additionally, adds a colored rule framing the box, similar to what \fcolorbox does. The syntax is

\fgraphicxbox[<model>]{<specification>}[<Graphicx(SP)options>]

{<graphic>}{<box content>}

The first two parameters are the same ones used by \fcolorbox, the color specifi- cation. The next three parameters are the same as \graphicxbox. The comments made above for the \graphicxbox hold here as well.

Here is an example for the graphicxsp package:

\graphicxbox{blue}[name=indianblanket]{}{\Huge Hello World!}

As with \colorbox and \fcolorbox, the lengths \fboxsep and \fboxrule.

For example, if we set

\setlength{\fboxsep}{10pt}

\setlength{\fboxrule}{2pt}

\graphicxbox{blue}[name=indianblanket]{}{\Huge Hello World!}

we would make the separation between the content and the frame of the to be 10pt and the rule with to be 2pt.

12\newcommand{\fgraphicxbox}[2][]{\fgraphicx@box{#1}{#2}}

4 Internal, supporting commands

continues the flow from \fgraphicxbox. The parameters of \fgraphicx@@box

\fgraphicx@box are

\fgraphicx@box{model}{color spec}[options for graphicx(sp)]{filename}

13\def\fgraphicx@box#1#2{\@ifnextchar[{\fgraphicx@@box{#1}{#2}}%

14 {\fgraphicx@@box{#1}{#2}[]}}

15\def\fgraphicx@@box#1#2[#3]#4{%

16 \graphicx@b@x{\fboxsep\z@\color#1{#2}\fbox}{#3}{#4}}

\graphicx@b@x is the low-level command that does all the work now that the

\graphicx@b@x

parameters have been set. This code is a modification of \color@b@x from the color.dtx package.

17\long\def\graphicx@b@x#1#2#3#4{\leavevmode

18 \setbox\z@\hbox{\kern\fboxsep{\set@color#4}\kern\fboxsep}%

19 \dimen@\ht\z@\advance\dimen@\fboxsep\ht\z@\dimen@

20 \dimen@\dp\z@\advance\dimen@\fboxsep\dp\z@\dimen@

21 {%\color@block{\wd\z@}{\ht\z@}{\dp\z@}%

22% \dimen@ii\dp\z@\advance\dimen@ii\ht\z@

23 \dimen@\dp\z@\advance\dimen@\ht\z@

24 \edef\gfxb@totalheight{\the\dimen@}%

25 {#1{\lower\dp\z@\rlap{%

26 \includegraphics[#2,width=\wd\z@,height=\gfxb@totalheight]{#3}}%

27 \box\z@}}}%

28}

29/package

3

Referenties

GERELATEERDE DOCUMENTEN

This report was based on a study performed by Pöyry in which ACM was one of the sponsors. Pöyry describes the issue as follows: “The optimal allocation of capacity between timeframes

The type of problem also matters: those with family or relational problems relatively often consulted a lawyer and started a judicial procedure – in contrast with those faced

This Act, declares the state-aided school to be a juristic person, and that the governing body shall be constituted to manage and control the state-aided

The command \subset now displays the symbol ⊆ while a new command \stsubset (for strict sub- sets) can be used for dispaying the symbol ⊂.. Similar behavior occurs with \supset

The names used in the named model are those suggested by Jim Hafner in his colordvi and foiltex packages, and implemented originally in the color.pro header file for the dvips

The hoptionsi are passed to \fetchversestxt of the fetch- bibpes package; hversei is the verse of the passage to be used. The hoptionsi are passed to \fetchversestxt of

This demo file—produced by pdftex—for the graphicxbox package for users that are using the graphicx package, and not the graphicxsp package, the lat- ter requiring the distiller..

This is a demo file for the graphicxbox package for those who are using the graphicxsp package, which requires the distiller.. This package delivers two commands, \graphicxbox