diff options
Diffstat (limited to 'macros/latex/contrib/graphicxbox/examples/grfxbox_tst_sp.tex')
-rw-r--r-- | macros/latex/contrib/graphicxbox/examples/grfxbox_tst_sp.tex | 154 |
1 files changed, 154 insertions, 0 deletions
diff --git a/macros/latex/contrib/graphicxbox/examples/grfxbox_tst_sp.tex b/macros/latex/contrib/graphicxbox/examples/grfxbox_tst_sp.tex new file mode 100644 index 0000000000..d319013b3a --- /dev/null +++ b/macros/latex/contrib/graphicxbox/examples/grfxbox_tst_sp.tex @@ -0,0 +1,154 @@ +\documentclass{article} +\usepackage{graphicxsp} +\usepackage[tight,designiv,usetemplates,nodirectory]{web} +\usepackage{graphicxbox} + +\title{GraphicxBox Test File\texorpdfstring{\\}{: }Using the \textsf{GraphicxSP} Package} +\author{D. P. Story} +\subject{Graphic backgrounds to latex boxes} +\keywords{LaTeX, PDF, AcroTeX, graphics, backgrounds,} +\university{Acro\negthinspace\TeX.Net} +\email{dpstory@acrotex.net} +\def\webversion{\textcolor{webbrown}{www.acrotex.net}} +\revisionLabel{Prepared:} +\versionLabel{} + +\newcommand{\cs}[1]{\texttt{\char`\\#1}} + +\parindent0pt\parskip\medskipamount + +\embedEPS[hiresbb]{grandcanyon}{graphics/grandcanyon} +\embedEPS{indianblanket}{graphics/indianblanket} +\embedEPS{Wood-Brown}{graphics/Wood-Brown} +\embedEPS{news_bgr}{graphics/news_bgr} + +\begin{document} + +\maketitle + +This is a demo file for the \textsf{graphicxbox} package for those who +are using the \textsf{graphicxsp} package, which requires the distiller. +This package delivers two commands, \cs{graphicxbox} and +\cs{fgraphicxbox}. These two are modeled after \cs{colorbox} and +\cs{fcolorbox} of the \textsf{color} package. These new commands are +similar to their colorful counterparts, but they insert a graphical background +in the box rather than a color background. + +The syntax for \cs{graphicxbox} is +\begin{verbatim} + \graphicxbox[<includegraphics options>,name=<name>] + {<graphic>}{<box content>} +\end{verbatim} +The optional parameter is passed to the \cs{include\-graphics} +command,\footnote{Including addition key-value pairs defined in the +\textsf{GraphicxSP} package.} which is used. Do not use the \texttt{scale}, +\texttt{width} or \texttt{height} options of \cs{include\-graphics}, +the graphic is scaled to fit the box by \cs{graphicxbox}. The +required parameter \verb!{<graphic>}! is not used and can be left empty. + +Let's see an example. + +\begin{center} +\graphicxbox[name=indianblanket]{}{% + \begin{minipage}{.67\linewidth-2\fboxsep} % + \footnotesize\bfseries\color{red}This is `the Indian Blanket' background + graphic. These graphical background can be used for more interesting displays + of content, or for an eye-catching presentation. Every time you create a + box using \cs{graphicxbox} or \cs{fgraphicxbox}, you import the graphic once again. + \end{minipage}} +\end{center} + +\cs{fgraphicxbox} does the same as \cs{graphicxbox}, but places a colorful frame around +the box, just as \cs{fcolorbox} does. The syntax is +{\small\begin{verbatim} +\fgraphicxbox[<model>]{<specification>} + [<includegraphics options>,name=<name>]{<graphic>}{<box content>} +\end{verbatim} +}The first two (color) parameters are passed to the \cs{color} command, which takes +two parameters. The other three parameters are the same ones for \cs{graphicxbox}. + +Here's an example + +\begin{center} +\fgraphicxbox{red}[name=indianblanket]{}{% + \begin{minipage}{.67\linewidth-2\fboxsep} % + \footnotesize\bfseries\color{red}This is `the Indian Blanket' background + graphic. These graphical background can be used for more interesting displays + of content, or for an eye-catching presentation. Every time you create a + box using \cs{graphicxbox} or \cs{fgraphicxbox}, you import the graphic once again. + \end{minipage}} +\end{center} + +As with \cs{colorbox} and \cs{fcolorbox}, the space around the box is equal to +\cs{fboxsep} on all sides, and the width of the rule is \cs{fboxrule}. These can +be changed as desired. + +Here's a few more examples of graphical backgrounds. + +\begin{center} +\graphicxbox[name=Wood-Brown]{}{% + \begin{minipage}[b]{0.5\linewidth-2\fboxsep} + \footnotesize\bfseries\color{webgreen}This is a wood-brown background, perhaps `webgreen' + is not the best text color for this background, but, then again, I have no feel + for color at all. In fact, I really wonder if I know what I'm doing at all. I'm pretty + confused and disoriented most all the time. + \end{minipage}} +\end{center} + + +\begin{center} +\graphicxbox[name=news_bgr]{news_bgr}{% + \begin{minipage}[b]{0.5\linewidth-2\fboxsep} + \footnotesize\bfseries Here's a gradient-type background that I downloaded from + the Internet. Once can, in theory, download any of your favorite backgrounds + and use them as background graphics for a box. + \end{minipage}} +\end{center} + +What if you have a graphic that has an aspect ratio that cannot be changed +because it would distort the graphic? To use such a graphic requires the knowledge +of the dimensions of the graphic. + +Let's try a photo for a graphic, now we must take care to preserve +the aspect ratio. We simply create the box so that its +dimensions have the same aspect ratio as that of the photo. Like so +{\small\begin{verbatim} + \begin{minipage}[b][\heightOf{grandcanyon}bp-2\fboxsep] + {\widthOf{grandcanyon}bp-2\fboxsep} + \footnotesize\bfseries\color{white}This is the mighty + Grand Canyon, as seen from the south rim. Beautiful! + \end{minipage} +\end{verbatim} +}Here, \texttt{\widthOf{grandcanyon}bp} and +\texttt{\heightOf{grandcanyon}bp} are the dimensions of the photo. +Now, wrap this box in \cs{graphicxbox} using the \texttt{grandcanyon} +photo +\begin{center} +\graphicxbox[name=grandcanyon]{}{% + \begin{minipage}[b][\heightOf{grandcanyon}bp-2\fboxsep]{\widthOf{grandcanyon}bp-2\fboxsep} + \footnotesize\bfseries\color{white}This is the mighty Grand Canyon, as seen from the + south rim. Beautiful! + \end{minipage}} +\end{center} + +Interesting. Now, let's try framing this picture. + +\begin{center} +\setlength{\fboxrule}{4bp} +\fgraphicxbox{webblue}[name=grandcanyon]{}{% + \begin{minipage}[b][\heightOf{grandcanyon}bp-2\fboxsep-2\fboxrule]{\widthOf{grandcanyon}bp-2\fboxsep-2\fboxrule} + \footnotesize\bfseries\color{white}This is again, the mighty Grand Canyon, as seen from the + south rim. Beautiful! + \end{minipage}} +\end{center} +Cool! That's the \textsf{graphicxbox} package. + +\textbf{\textcolor{red}{Notes:}} This file has a size of 83KB,\footnote{83KB before additional text and fonts were introduced +into this version of the document.} and \texttt{grfxbox\_tst.pdf}, +as produced by \textsf{pdftex}, has file size 111KB. GraphicxSP embeds the file once, and reuses +the graphic. We got a slight savings on file space. + +See the demo file \texttt{grfxbox\_tst\_indians.pdf} for an example of the use +of transparency and tiling. + +\end{document} |