diff options
author | Karl Berry <karl@freefriends.org> | 2011-02-11 19:46:38 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-02-11 19:46:38 +0000 |
commit | 510b2e2546fd8769ac33125f9a14cf0c2d898fee (patch) | |
tree | d5d9a8a39c12d18b6799be83c7103d9ee8f43b55 /Master/texmf-dist/source/latex | |
parent | a9610f976501f433502791b14cf775eea4f5f4e8 (diff) |
new latex package gradientframe (10feb11)
git-svn-id: svn://tug.org/texlive/trunk@21372 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex')
-rw-r--r-- | Master/texmf-dist/source/latex/gradientframe/gradientframe.dtx | 358 |
1 files changed, 358 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/gradientframe/gradientframe.dtx b/Master/texmf-dist/source/latex/gradientframe/gradientframe.dtx new file mode 100644 index 00000000000..f11c2751173 --- /dev/null +++ b/Master/texmf-dist/source/latex/gradientframe/gradientframe.dtx @@ -0,0 +1,358 @@ +% \iffalse The license starting three lines down applies to this file. +%<*batchfile> +{\obeylines\obeyspaces \gdef\thepreamble{ + +LaTeX package gradientframe for simple gradient frames around objects. + +Copyright (C) Christian Raue, 2011 +Send feedback to christian°raue@gmail°com (after being exposed to gravity). + +This file may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either +version 1.3c of this license or (at your option) any later +version. The latest version of this license is in: + + http://www.latex-project.org/lppl.txt + +and version 1.3c or later is part of all distributions of +LaTeX version 2005/12/01 or later. + +This work has the LPPL maintenance status 'maintained'. + +The Current Maintainer of this work is Christian Raue. + +This work consists of gradientframe.dtx and the derived file +gradientframe.sty. + +}} + +\begingroup +\input{docstrip} +\keepsilent +\usedir{tex/latex/\jobname} +\expandafter\preamble\thepreamble\endpreamble +\askforoverwritefalse +\generate{\file{\jobname.sty}{\from{\jobname.dtx}{package}}} +\endgroup + +\documentclass{ltxdoc} +\usepackage[american]{babel} +\usepackage[T1]{fontenc} +\usepackage{lmodern} +\usepackage{charter} +\usepackage[margin=1.5in]{geometry} +\usepackage{color} +\usepackage{graphicx} +\usepackage[% + pdftitle={the \jobname{} package},% + pdfauthor={Christian Raue},% + pdfsubject={LaTeX package documentation},% + pdfkeywords={\jobname{} LaTeX gradient frame border around object table figure},% + pdfproducer={LaTeX},% + pdfcreator={LaTeX},% + pdfborder={0 0 0},% + pdfpagemode={UseOutlines},% + pdfstartview={FitH},% + pdfview={FitH},% + pdfdisplaydoctitle=true,% + ]{hyperref} +\usepackage{tabularx} +\usepackage{listings} +\definecolor{lightgray}{gray}{.95} +\lstset{ + frame=trbl,% + framerule=0pt,% + basicstyle=\footnotesize\ttfamily,% + breaklines=true,% + tabsize=4,% + numbers=left,% + numberstyle=\tiny,% + backgroundcolor=\color{lightgray},% +} +\usepackage{emp} +\ifx\pdftexversion\undefined + \usepackage[dvips]{graphicx} +\else + \usepackage{graphicx} + \DeclareGraphicsRule{*}{mps}{*}{} +\fi +\usepackage{\jobname} + +\DoNotIndex{\def} + +%\CodelineIndex +%\EnableCrossrefs +\RecordChanges +\OnlyDescription +\setcounter{IndexColumns}{2} +\GetFileInfo{\jobname.sty} + +\newcommand{\supdot}{% + \scalebox{1.2}{$\dot{~}$}% +} +\newcommand{\package}[1]{% + \texttt{#1}% +} +\newcommand{\resultarrow}{% + \begin{center} + \scalebox{2}{% + \begin{picture}(9,10) + \put(5,10){\vector(0,-4){10}} + \end{picture}% + } + \end{center}% +} +\newcommand{\face}{% + \fboxsep=5px + \scalebox{2}{\fbox{% + \Huge + $\ddot\smile$% + }}% +} + +\title{the \package{\jobname} package\thanks{This document corresponds to \package{\jobname}~\fileversion, dated \filedate.}\\[1em]} +\author{Christian Raue\\[1em]\texttt{christian\supdot{}raue@gmail\supdot{}com}\\(after being exposed to gravity)\\[2em]} +\date{\filedate} + +\begin{document} +\maketitle + + +\phantomsection +\addcontentsline{toc}{section}{\abstractname} +\begin{abstract} +\noindent +The \package{\jobname} package provides a command, |\gradientframe|, for simple discreet grayscale gradient frames +around objects, such as images or tables, to set them apart from the surrounding text. +\end{abstract} + + +\phantomsection +\addcontentsline{toc}{section}{\contentsname} +\tableofcontents +\clearpage + + +\section{Introduction} +The \package{gradientframe} package is loaded in the usual way, i.e. by putting the line +\begin{quote} + |\usepackage{gradientframe}| +\end{quote} +in the document's preamble. The \package{gradientframe} package depends on the \package{color} package which is loaded +by the \package{gradientframe} package if not already done so far in the document's preamble. + + +\section{Usage} +\DescribeMacro\gradientframe +To frame an object, such as figure, table, etc., use |\gradientframe{|\meta{object}|}|. +By using |\gradientframe[|\meta{width}|]{|\meta{object}|}|, a space between the frame and the object (in all four +directions) can be added. + + +\section{Examples} +\subsection{Frame surrounding a figure} +\begin{lstlisting} + \begin{center} + \gradientframe{\includegraphics{image.jpg}} + \end{center} +\end{lstlisting} +\resultarrow +\begin{center} + \gradientframe{\face} +\end{center} + + +\subsection{Frame surrounding a figure with additional space} +\begin{lstlisting} + \begin{center} + \gradientframe[5mm]{\includegraphics{image.jpg}} + \end{center} +\end{lstlisting} +\resultarrow +\begin{center} + \gradientframe[5mm]{\face} +\end{center} + + +\subsection{Frame surrounding a table} +\begin{lstlisting} + \begin{center} + \gradientframe{% + \begin{tabular}{r|l} + \textbf{column A} & \textbf{column B} \\\hline + cell 1A & cell 1B \\\hline + cell 2A & cell 2B \\\hline + cell 3A & cell 3B \\ + \end{tabular}% + } + \end{center} +\end{lstlisting} +\resultarrow +\begin{center} + \gradientframe{% + \begin{tabular}{r|l} + \textbf{column A} & \textbf{column B} \\\hline + cell 1A & cell 1B \\\hline + cell 2A & cell 2B \\\hline + cell 3A & cell 3B \\ + \end{tabular}% + } +\end{center} +Be careful not to produce unintentional space when breaking lines. Add comments at line endings if needed to prevent +this, as shown in lines 2 and 8. Otherwise the result will look like this: +\begin{center} + \gradientframe{ + \begin{tabular}{r|l} + \textbf{column A} & \textbf{column B} \\\hline + cell 1A & cell 1B \\\hline + cell 2A & cell 2B \\\hline + cell 3A & cell 3B \\ + \end{tabular} + } +\end{center} + + +\clearpage +\subsection{Frame surrounding a MetaPost figure} +If you want to draw a frame around a MetaPost (or in the case of this example, MetaUML) generated figure, use the +|\empuse| command. +\begin{lstlisting} + \begin{center} + \begin{empfile} + \begin{empcmds} + input metauml; + \end{empcmds} + \begin{empdef}[unique_name](0,0) + save start, end; + Begin.start; + End.end; + leftToRight(15)(start, end); + drawObjects(start, end); + clink(transition)(start, end); + \end{empdef} + \gradientframe[5mm]{\empuse{unique_name}} + \end{empfile} + \end{center} +\end{lstlisting} +\resultarrow +\begin{center} + \begin{empfile} + \begin{empcmds} + input metauml; + \end{empcmds} + \begin{empdef}[unique_name](0,0) + save start, end; + Begin.start; + End.end; + leftToRight(15)(start, end); + drawObjects(start, end); + clink(transition)(start, end); + \end{empdef} + \gradientframe[5mm]{\empuse{unique_name}} + \end{empfile} +\end{center} +Alternatively, you could outsource both, the |empdef| environment and the |\empuse| command to a separate file, and use +|\input{|\meta{filename}|}| as argument to the |\gradientframe| command. + + +\StopEventually{ + \typeout{****************************************************} + \typeout{* To finish the installation, you have to move the} + \typeout{* following file into a directory searched by TeX:} + \typeout{*} + \typeout{* \space\space \jobname.sty} + \typeout{*} + \typeout{* Documentation is in \jobname.\ifpdf pdf\else dvi\fi.} + \typeout{*} + \typeout{* Happy TeXing!} + \typeout{****************************************************} + \end{document} +} + + +\clearpage +\DocInput{\jobname.dtx} + + +\clearpage +\phantomsection +\addcontentsline{toc}{section}{Change History} +\PrintChanges + + +%\phantomsection +%\addcontentsline{toc}{section}{Index} +%\PrintIndex + + +\Finale +%</batchfile> +% \fi +% +% \section{Implementation} +% +% \changes{v0.1}{2011/02/10}{Initial version.} +% \changes{v0.1a}{2011/02/10}{Fixed charset encoding issues on CTAN.} +% +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e}[1999/12/01] +\ProvidesPackage{gradientframe}[2011/02/10 v0.1a simple gradient frames around objects] +\RequirePackage{color} +% \end{macrocode}%^^A must be exactly 4 spaces +% +% \begin{macro}{\gradientframe} +% This command defines the grayscale gradient frame around objects, with variable space between object and frame. +% \begin{macrocode} +\newcommand{\gradientframe}[2][0mm]{% + % Grayscale colors. + \definecolor{gray98}{gray}{.98}% + \definecolor{gray96}{gray}{.96}% + \definecolor{gray94}{gray}{.94}% + \definecolor{gray92}{gray}{.92}% + \definecolor{gray90}{gray}{.90}% + \definecolor{gray88}{gray}{.88}% + \definecolor{gray86}{gray}{.86}% + \definecolor{gray84}{gray}{.84}% + \definecolor{gray82}{gray}{.82}% + \definecolor{gray80}{gray}{.80}% + \definecolor{gray78}{gray}{.78}% + \definecolor{gray76}{gray}{.76}% + \definecolor{gray74}{gray}{.74}% + \definecolor{gray72}{gray}{.72}% + \definecolor{gray70}{gray}{.70}% +% + % Each color's line width. + \newdimen\lineWidth% + \lineWidth=0.3px% +% + % Space between object and innermost frame line. + \newdimen\borderSpacing% + \borderSpacing=#1% +% + \fboxrule=\lineWidth% + \fboxsep=\lineWidth% + \fcolorbox{gray98}{gray96}{% + \fcolorbox{gray94}{gray92}{% + \fcolorbox{gray90}{gray88}{% + \fcolorbox{gray86}{gray84}{% + \fcolorbox{gray82}{gray80}{% + \fcolorbox{gray78}{gray76}{% + \fcolorbox{gray74}{gray72}{% + \fboxrule=\lineWidth% + \fboxsep=\borderSpacing% + \fcolorbox{gray70}{white}{% + #2% + }% + }% + }% + }% + }% + }% + }% + }% +}% +% \end{macrocode}%^^A must be exactly 4 spaces +% \end{macro} +% +\endinput +% \endinput |