Debian Codegraph @

texmf-dist/doc/latex/graphicxbox/examples/grfxbox_tst.tex

raw
1 \documentclass{article}
2 \usepackage{graphicx}
3 \usepackage[pdftex,tight,designiv]{web}
4 \usepackage{graphicxbox}
5
6 \title{GraphicxBox Test File\texorpdfstring{\\}{: }Using the \textsf{Graphicx} Package}
7 \author{D. P. Story}
8 \subject{Graphic backgrounds to latex boxes}
9 \keywords{LaTeX, PDF, AcroTeX, graphics, backgrounds,}
10 \university{Acro\negthinspace\TeX.Net}
11 \email{[email protected]}
12 \def\webversion{\textcolor{webbrown}{www.acrotex.net}}
13 \revisionLabel{Prepared:}
14 \versionLabel{}
15
16 \newcommand{\cs}[1]{\texttt{\char`\\#1}}
17
18 \parindent0pt\parskip\medskipamount
19 \pagestyle{empty}
20
21 \begin{document}
22
23 \maketitle
24
25 This demo file---produced by \textsf{pdftex}---for the \textsf{graphicxbox} package for users
26 that are using the \textsf{graphicx} package, and not the
27 \textsf{graphicxsp} package, the latter requiring the distiller.\footnote{The package should work for any driver that supports the \textsf{color} package.}
28 This package delivers two commands, these are \cs{graphicxbox} and
29 \cs{fgraphicxbox}. These two are modeled after \cs{colorbox} and
30 \cs{fcolorbox} of the \textsf{color} package. These new commands are
31 similar to their colorful counterparts, but they insert a graphical background
32 in the box rather than a color background.
33
34 The syntax for \cs{graphicxbox} is
35 \begin{verbatim}
36 \graphicxbox[<includegraphics options>]{<graphic>}
37 {<box content>}
38 \end{verbatim}
39 The optional parameter is passed to the \cs{include\-graphics}
40 command, which is used. Do not use the \texttt{scale},
41 \texttt{width} or \texttt{height} options of \cs{include\-graphics},
42 the graphic is scaled to fit the box by \cs{graphicxbox}. The required
43 parameter \verb!{<graphic>}! is also passed to \cs{include\-graphics}.
44
45 Let's see an example.
46
47 \begin{center}
48 \graphicxbox{graphics/indianblanket}{%
49 \begin{minipage}{.67\linewidth-2\fboxsep} %
50 \footnotesize\bfseries\color{red}This is `the Indian Blanket' background
51 graphic. These graphical background can be used for more interesting displays
52 of content, or for an eye-catching presentation. Every time you create a
53 box using \cs{graphicxbox} or \cs{fgraphicxbox}, you import the graphic once again.
54 \end{minipage}}
55 \end{center}
56
57 \cs{fgraphicxbox} does the same as \cs{graphicxbox}, but places a colorful frame around
58 the box, just as \cs{fcolorbox} does. The syntax is
59 \begin{verbatim}
60 \fgraphicxbox[<model>]{<specification>}
61 [<includegraphics options>]{<graphic>}{<box content>}
62 \end{verbatim}
63 The first two (color) parameters are passed to the \cs{color} command, which takes
64 two parameters. The other three parameters are the same ones for \cs{graphicxbox}.
65
66 Here's an example
67
68 \begin{center}
69 \fgraphicxbox{red}{graphics/indianblanket}{%
70 \begin{minipage}{.67\linewidth-2\fboxsep} %
71 \footnotesize\bfseries\color{red}This is `the Indian Blanket' background
72 graphic. These graphical background can be used for more interesting displays
73 of content, or for an eye-catching presentation. Every time you create a
74 box using \cs{graphicxbox} or \cs{fgraphicxbox}, you import the graphic once again.
75 \end{minipage}}
76 \end{center}
77
78 As with \cs{colorbox} and \cs{fcolorbox}, the space around the box is equal to
79 \cs{fboxsep} on all sides, and the width of the rule is \cs{fboxrule}. These can
80 be changed as desired.
81
82 Here's a few more examples of graphical backgrounds.
83
84 \begin{center}
85 \graphicxbox{graphics/Wood-Brown}{%
86 \begin{minipage}[b]{0.5\linewidth-2\fboxsep}
87 \footnotesize\bfseries\color{webgreen}This is a wood-brown background, perhaps `webgreen'
88 is not the best text color for this background, but, then again, I have no feel
89 for color at all. In fact, I really wonder if I know what I'm doing at all. I'm pretty
90 confused and disoriented most all the time.
91 \end{minipage}}
92 \end{center}
93
94
95 \begin{center}
96 \graphicxbox{graphics/news_bgr}{%
97 \begin{minipage}[b]{0.5\linewidth-2\fboxsep}
98 \footnotesize\bfseries Here's a gradient-type background that I downloaded from
99 the Internet. Once can, in theory, download any of your favorite backgrounds
100 and use them as background graphics for a box.
101 \end{minipage}}
102 \end{center}
103
104 What if you have a graphic that has an aspect ratio that cannot be changed
105 because it would distort the graphic? To use such a graphic requires the knowledge
106 of the dimensions of the graphic.
107
108 Let's try a photo for a graphic, now we must take care to preserve
109 the aspect ratio. We simply create the box so that its
110 dimensions have the same aspect ratio as that of the photo. Like so
111 {\small\begin{verbatim}
112 \begin{minipage}[b][112.45bp-2\fboxsep]{149.665bp-2\fboxsep}
113 \footnotesize\bfseries\color{white}%
114 This is the mighty Grand Canyon, as seen from the south rim.
115 Beautiful!
116 \end{minipage}
117 \end{verbatim}
118 }Here, \texttt{149.665bp} and \texttt{112.45bp} are the dimensions of the photo.
119 Wrap this box in \cs{graphicxbox} using the \texttt{grandcanyon} photo and we have\dots
120 \begin{center}
121 \graphicxbox{graphics/grandcanyon}{%
122 \begin{minipage}[b][112.45bp-2\fboxsep]{149.665bp-2\fboxsep}
123 \footnotesize\bfseries\color{white}This is the mighty Grand Canyon, as seen from the
124 south rim. Beautiful!
125 \end{minipage}}
126 \end{center}
127
128 Interesting. Now, let's try framing this picture.
129
130 \begin{center}
131 \setlength{\fboxrule}{4bp}
132 \fgraphicxbox{webblue}{graphics/grandcanyon}{%
133 \begin{minipage}[b][112.45bp-2\fboxsep-2\fboxrule]{149.665bp-2\fboxsep-2\fboxrule}
134 \footnotesize\bfseries\color{white}This is again, the mighty Grand Canyon, as seen from the
135 south rim. Beautiful!
136 \end{minipage}}
137 \end{center}
138 We've also modified the lengths of \cs{fboxsep} and \cs{fboxrule}.
139
140 Cool! That's the \textsf{graphicxbox} package.
141 \end{document}