diff options
Diffstat (limited to 'info/examples/lgc2/0-0-4.ltx')
-rw-r--r-- | info/examples/lgc2/0-0-4.ltx | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/info/examples/lgc2/0-0-4.ltx b/info/examples/lgc2/0-0-4.ltx new file mode 100644 index 0000000000..53bbfa01f7 --- /dev/null +++ b/info/examples/lgc2/0-0-4.ltx @@ -0,0 +1,65 @@ +%% +%% The LaTeX Graphics Companion, 2ed (first printing May 2007) +%% +%% Example 0-0-4 on page xxxiii. +%% +%% Copyright (C) 2007 Michel Goossens, Frank Mittelbach, Denis Roegel, Sebastian Rahtz, Herbert Vo\ss +%% +%% It may be distributed and/or modified under the conditions +%% of the LaTeX Project Public License, either version 1.3 +%% of this license or (at your option) any later version. +%% +%% See http://www.latex-project.org/lppl.txt for details. +%% + +\documentclass{ttctexa} +\pagestyle{empty} +\setcounter{page}{6} +\setlength\textwidth{135.83385pt} +\usepackage{pstricks,pst-xkey} +\makeatletter % `@' now normal "letter" +\newif\ifHRInner +\def\psset@HRInner#1{\@nameuse{HRInner#1}} +\psset@HRInner{false} +% +\def\psHexagon{\pst@object{psHexagon}} +\def\psHexagon@i{% + \@ifnextchar({\psHexagon@ii}% + {\psHexagon@ii(0,0)}% specify center? +} +\def\psHexagon@ii(#1)#2{% + \begin@ClosedObj% closed object + \pst@@getcoor{#1}% get center + \pssetlength\pst@dimc{#2}% set radius to pt + \addto@pscode{% PostScript + \pst@coor T % xM yM new origin + \psk@dimen CLW mul % set line width + /Radius \pst@number\pst@dimc\space % save radius + \ifHRInner\space 3 sqrt 2 div div \fi def % inner? + /angle \ifHRInner 30 \else 0 \fi def % starting angle + Radius angle PtoC moveto % go to first point + 6 { % 6 iterations + /angle angle 60 add def % alpha = alpha+60 + Radius angle PtoC L % line to next point + } repeat + closepath % closed object + }% + \def\pst@linetype{3}% set linetype + \showpointsfalse% do not show base points + \end@ClosedObj% end + \ignorespaces% swallow spaces +} +\makeatother % `@' is restored as "non-letter" +\StartShownPreambleCommands + +\StopShownPreambleCommands +\begin{document} +\psset{unit=7mm} +\begin{pspicture}(-3,-3)(3,3) + \psHexagon[linewidth=3pt,linecolor=red]{2.5} + \pscircle[linestyle=dashed,linecolor=red]{2.5} +% + \psHexagon[linewidth=3pt,linecolor=blue,HRInner=true]{2.5} + \pscircle[linestyle=dashed,linecolor=blue]{2.17} +\end{pspicture} +\end{document} |