| 1 |
%% |
| 2 |
%% This is file `sampleshape.tex', |
| 3 |
%% generated with the docstrip utility. |
| 4 |
%% |
| 5 |
%% The original source files were: |
| 6 |
%% |
| 7 |
%% makeshape.dtx (with options: `sample') |
| 8 |
%% |
| 9 |
%% Copyright (C) 2013 by Adrian P Robson |
| 10 |
%% [email protected] |
| 11 |
%% |
| 12 |
%% This work may be distributed and/or modified under the |
| 13 |
%% conditions of the LaTeX Project Public License, either |
| 14 |
%% version 1.3c of this license or (at your option) any later |
| 15 |
%% version. The latest version of this license is in |
| 16 |
%% http://www.latex-project.org/lppl.txt |
| 17 |
%% |
| 18 |
%% This work has the LPPL maintenance status `maintained'. |
| 19 |
%% The Current Maintainer of this work is Adrian Robson. |
| 20 |
%% |
| 21 |
%% This work consists of the files makeshape.ins |
| 22 |
%% makeshape.dtx and |
| 23 |
%% ontesting.dtx |
| 24 |
%% and the derived files makeshape.sty |
| 25 |
%% makeshape.pdf |
| 26 |
%% sampleshape.tex |
| 27 |
%% ontesting.pdf |
| 28 |
%% testsample.tex and |
| 29 |
%% testsample.pdf |
| 30 |
%% |
| 31 |
%%-------------------------------------------------- |
| 32 |
%% |
| 33 |
%% This is a sample shape for the makeshape package |
| 34 |
%% |
| 35 |
%% It can be adapted for other shapes. See |
| 36 |
%% makeshape.pdf for instructions. |
| 37 |
%% |
| 38 |
%% 25 January 2013 |
| 39 |
|
| 40 |
\usepackage{makeshape} |
| 41 |
\makeatletter |
| 42 |
|
| 43 |
%% Constant for sample shape |
| 44 |
\def\gap{4pt} |
| 45 |
|
| 46 |
%% Anchor path <- change and rename as required |
| 47 |
\def\sampleanchor{ |
| 48 |
% get corrected text box |
| 49 |
\pgf@xa=\ctbnex |
| 50 |
\pgf@ya=\ctbney |
| 51 |
% make room for shape |
| 52 |
\advance\pgf@xa by \gap |
| 53 |
\advance\pgf@ya by \gap |
| 54 |
% correct for minheight and minwidth and |
| 55 |
% for outerxsep or outerysep |
| 56 |
\mincorrect{\pgf@xa}{\pgfshapeminwidth} |
| 57 |
\advance\pgf@xa\pgfshapeouterxsep |
| 58 |
\mincorrect{\pgf@ya}{\pgfshapeminheight} |
| 59 |
\advance\pgf@ya\pgfshapeouterysep |
| 60 |
% draw the path |
| 61 |
\pgfpathmoveto{\pgfpoint{\pgf@xa}{\pgf@ya}} |
| 62 |
\pgfpathlineto{\pgfpoint{\pgf@xa}{-\pgf@ya}} |
| 63 |
\pgfpathlineto{\pgfpoint{-\pgf@xa}{-\pgf@ya}} |
| 64 |
\pgfpathlineto{\pgfpoint{-\pgf@xa}{\pgf@ya}} |
| 65 |
\pgfpathclose |
| 66 |
} |
| 67 |
|
| 68 |
%% Background path <- change and rename as required |
| 69 |
\def\sampleborder{ |
| 70 |
% get corrected text box |
| 71 |
\pgf@xa=\ctbnex |
| 72 |
\pgf@ya=\ctbney |
| 73 |
% make room for shape |
| 74 |
\advance\pgf@xa by \gap |
| 75 |
\advance\pgf@ya by \gap |
| 76 |
% correct for minheight and minwidth but |
| 77 |
% not for outerxsep or outerysep |
| 78 |
\mincorrect{\pgf@xa}{\pgfshapeminwidth} |
| 79 |
\mincorrect{\pgf@ya}{\pgfshapeminheight} |
| 80 |
% draw outer shape |
| 81 |
\pgfpathmoveto{\pgfpoint{\pgf@xa}{\pgf@ya}} |
| 82 |
\pgfpathlineto{\pgfpoint{\pgf@xa}{-\pgf@ya}} |
| 83 |
\pgfpathlineto{\pgfpoint{-\pgf@xa}{-\pgf@ya}} |
| 84 |
\pgfpathlineto{\pgfpoint{-\pgf@xa}{\pgf@ya}} |
| 85 |
\pgfpathclose |
| 86 |
% draw inner shape |
| 87 |
\advance\pgf@xa by -\gap |
| 88 |
\advance\pgf@ya by -\gap |
| 89 |
\pgfpathmoveto{\pgfpoint{\pgf@xa}{\pgf@ya}} |
| 90 |
\pgfpathlineto{\pgfpoint{\pgf@xa}{-\pgf@ya}} |
| 91 |
\pgfpathlineto{\pgfpoint{-\pgf@xa}{-\pgf@ya}} |
| 92 |
\pgfpathlineto{\pgfpoint{-\pgf@xa}{\pgf@ya}} |
| 93 |
\pgfpathclose |
| 94 |
} |
| 95 |
|
| 96 |
%%------------------------------------------------ |
| 97 |
%% Shape declaration <- Change name as required |
| 98 |
\pgfdeclareshape{sample}{ |
| 99 |
|
| 100 |
% Set paths <- change path macros as required |
| 101 |
\setpaths{\sampleanchor}{\sampleborder} |
| 102 |
|
| 103 |
% Saved anchors <- change as required |
| 104 |
\savedanchor{\northeast}{ |
| 105 |
\pgf@x = \ctbnex |
| 106 |
\pgf@y = \ctbney |
| 107 |
\advance\pgf@x by \gap |
| 108 |
\advance\pgf@y by \gap |
| 109 |
\mincorrect{\pgf@x}{\pgfshapeminwidth} |
| 110 |
\mincorrect{\pgf@y}{\pgfshapeminheight} |
| 111 |
\advance\pgf@x\pgfshapeouterxsep |
| 112 |
\advance\pgf@y\pgfshapeouterysep |
| 113 |
} |
| 114 |
|
| 115 |
% Anchors <- change as required |
| 116 |
\anchor{north}{\northeast \pgf@x=0pt} |
| 117 |
\anchor{north east}{\northeast} |
| 118 |
\anchor{east}{\northeast \pgf@y=0pt} |
| 119 |
\anchor{south east}{\northeast \pgf@y=-\pgf@y} |
| 120 |
\anchor{south}{\northeast \pgf@x=0pt \pgf@y=-\pgf@y} |
| 121 |
\anchor{south west}{\northeast \pgf@x=-\pgf@x \pgf@y=-\pgf@y} |
| 122 |
\anchor{west}{\northeast \pgf@x=-\pgf@x \pgf@y=0pt} |
| 123 |
\anchor{north west}{\northeast \pgf@x=-\pgf@x} |
| 124 |
|
| 125 |
} |
| 126 |
|
| 127 |
\makeatother |
| 128 |
|
| 129 |
\endinput |
| 130 |
%% |
| 131 |
%% End of file `sampleshape.tex'. |