Debian Codegraph @

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

raw
1 \documentclass{article}
2 \usepackage{graphicxsp}
3 \usepackage[tight,designiv,usetemplates,nodirectory]{web}
4 \usepackage{graphicxbox}
5
6 \title{GraphicxBox Test File\texorpdfstring{\\}{: }Using the \textsf{GraphicxSP} 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
20 \embedEPS[hiresbb]{grandcanyon}{graphics/grandcanyon}
21 \embedEPS{indianblanket}{graphics/indianblanket}
22 \embedEPS{Wood-Brown}{graphics/Wood-Brown}
23 \embedEPS{news_bgr}{graphics/news_bgr}
24
25 \begin{document}
26
27 \maketitle
28
29 This is a demo file for the \textsf{graphicxbox} package for those who
30 are using the \textsf{graphicxsp} package, which requires the distiller.
31 This package delivers two commands, \cs{graphicxbox} and
32 \cs{fgraphicxbox}. These two are modeled after \cs{colorbox} and
33 \cs{fcolorbox} of the \textsf{color} package. These new commands are
34 similar to their colorful counterparts, but they insert a graphical background
35 in the box rather than a color background.
36
37 The syntax for \cs{graphicxbox} is
38 \begin{verbatim}
39 \graphicxbox[<includegraphics options>,name=<name>]
40 {<graphic>}{<box content>}
41 \end{verbatim}
42 The optional parameter is passed to the \cs{include\-graphics}
43 command,\footnote{Including addition key-value pairs defined in the
44 \textsf{GraphicxSP} package.} which is used. Do not use the \texttt{scale},
45 \texttt{width} or \texttt{height} options of \cs{include\-graphics},
46 the graphic is scaled to fit the box by \cs{graphicxbox}. The
47 required parameter \verb!{<graphic>}! is not used and can be left empty.
48
49 Let's see an example.
50
51 \begin{center}
52 \graphicxbox[name=indianblanket]{}{%
53 \begin{minipage}{.67\linewidth-2\fboxsep} %
54 \footnotesize\bfseries\color{red}This is `the Indian Blanket' background
55 graphic. These graphical background can be used for more interesting displays
56 of content, or for an eye-catching presentation. Every time you create a
57 box using \cs{graphicxbox} or \cs{fgraphicxbox}, you import the graphic once again.
58 \end{minipage}}
59 \end{center}
60
61 \cs{fgraphicxbox} does the same as \cs{graphicxbox}, but places a colorful frame around
62 the box, just as \cs{fcolorbox} does. The syntax is
63 {\small\begin{verbatim}
64 \fgraphicxbox[<model>]{<specification>}
65 [<includegraphics options>,name=<name>]{<graphic>}{<box content>}
66 \end{verbatim}
67 }The first two (color) parameters are passed to the \cs{color} command, which takes
68 two parameters. The other three parameters are the same ones for \cs{graphicxbox}.
69
70 Here's an example
71
72 \begin{center}
73 \fgraphicxbox{red}[name=indianblanket]{}{%
74 \begin{minipage}{.67\linewidth-2\fboxsep} %
75 \footnotesize\bfseries\color{red}This is `the Indian Blanket' background
76 graphic. These graphical background can be used for more interesting displays
77 of content, or for an eye-catching presentation. Every time you create a
78 box using \cs{graphicxbox} or \cs{fgraphicxbox}, you import the graphic once again.
79 \end{minipage}}
80 \end{center}
81
82 As with \cs{colorbox} and \cs{fcolorbox}, the space around the box is equal to
83 \cs{fboxsep} on all sides, and the width of the rule is \cs{fboxrule}. These can
84 be changed as desired.
85
86 Here's a few more examples of graphical backgrounds.
87
88 \begin{center}
89 \graphicxbox[name=Wood-Brown]{}{%
90 \begin{minipage}[b]{0.5\linewidth-2\fboxsep}
91 \footnotesize\bfseries\color{webgreen}This is a wood-brown background, perhaps `webgreen'
92 is not the best text color for this background, but, then again, I have no feel
93 for color at all. In fact, I really wonder if I know what I'm doing at all. I'm pretty
94 confused and disoriented most all the time.
95 \end{minipage}}
96 \end{center}
97
98
99 \begin{center}
100 \graphicxbox[name=news_bgr]{news_bgr}{%
101 \begin{minipage}[b]{0.5\linewidth-2\fboxsep}
102 \footnotesize\bfseries Here's a gradient-type background that I downloaded from
103 the Internet. Once can, in theory, download any of your favorite backgrounds
104 and use them as background graphics for a box.
105 \end{minipage}}
106 \end{center}
107
108 What if you have a graphic that has an aspect ratio that cannot be changed
109 because it would distort the graphic? To use such a graphic requires the knowledge
110 of the dimensions of the graphic.
111
112 Let's try a photo for a graphic, now we must take care to preserve
113 the aspect ratio. We simply create the box so that its
114 dimensions have the same aspect ratio as that of the photo. Like so
115 {\small\begin{verbatim}
116 \begin{minipage}[b][\heightOf{grandcanyon}bp-2\fboxsep]
117 {\widthOf{grandcanyon}bp-2\fboxsep}
118 \footnotesize\bfseries\color{white}This is the mighty
119 Grand Canyon, as seen from the south rim. Beautiful!
120 \end{minipage}
121 \end{verbatim}
122 }Here, \texttt{\widthOf{grandcanyon}bp} and
123 \texttt{\heightOf{grandcanyon}bp} are the dimensions of the photo.
124 Now, wrap this box in \cs{graphicxbox} using the \texttt{grandcanyon}
125 photo
126 \begin{center}
127 \graphicxbox[name=grandcanyon]{}{%
128 \begin{minipage}[b][\heightOf{grandcanyon}bp-2\fboxsep]{\widthOf{grandcanyon}bp-2\fboxsep}
129 \footnotesize\bfseries\color{white}This is the mighty Grand Canyon, as seen from the
130 south rim. Beautiful!
131 \end{minipage}}
132 \end{center}
133
134 Interesting. Now, let's try framing this picture.
135
136 \begin{center}
137 \setlength{\fboxrule}{4bp}
138 \fgraphicxbox{webblue}[name=grandcanyon]{}{%
139 \begin{minipage}[b][\heightOf{grandcanyon}bp-2\fboxsep-2\fboxrule]{\widthOf{grandcanyon}bp-2\fboxsep-2\fboxrule}
140 \footnotesize\bfseries\color{white}This is again, the mighty Grand Canyon, as seen from the
141 south rim. Beautiful!
142 \end{minipage}}
143 \end{center}
144 Cool! That's the \textsf{graphicxbox} package.
145
146 \textbf{\textcolor{red}{Notes:}} This file has a size of 83KB,\footnote{83KB before additional text and fonts were introduced
147 into this version of the document.} and \texttt{grfxbox\_tst.pdf},
148 as produced by \textsf{pdftex}, has file size 111KB. GraphicxSP embeds the file once, and reuses
149 the graphic. We got a slight savings on file space.
150
151 See the demo file \texttt{grfxbox\_tst\_indians.pdf} for an example of the use
152 of transparency and tiling.
153
154 \end{document}