From 81b31d750e9806bfcd17916b130f77496b1ee9e3 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 7 Mar 2013 23:12:39 +0000 Subject: tikzsymbols (7mar13) git-svn-id: svn://tug.org/texlive/trunk@29308 c570f23f-e606-0410-a88d-b1316a301751 --- .../source/latex/tikzsymbols/tikzsymbols.dtx | 460 ++++++++++++--------- 1 file changed, 260 insertions(+), 200 deletions(-) (limited to 'Master/texmf-dist/source/latex/tikzsymbols') diff --git a/Master/texmf-dist/source/latex/tikzsymbols/tikzsymbols.dtx b/Master/texmf-dist/source/latex/tikzsymbols/tikzsymbols.dtx index 6ca905d227c..a9009216442 100644 --- a/Master/texmf-dist/source/latex/tikzsymbols/tikzsymbols.dtx +++ b/Master/texmf-dist/source/latex/tikzsymbols/tikzsymbols.dtx @@ -17,6 +17,7 @@ % \iffalse %<*driver> \documentclass{ltxdoc} +\usepackage{marvosym} \usepackage{tikzsymbols} \usepackage[english]{babel} \usepackage[T1]{fontenc} @@ -30,8 +31,8 @@ \makeatletter \DeclareRobustCommandx{\definedBasicTree}[5][1=1, usedefault]{{% \def\leaf@or@not@leaf{#5}% -\def\@y@@x@y@x{0.095*#1/100} -\begin{tikzpicture}[scale=#1+0.2,x=1.3ex,y=1.3ex, line width=0.07ex*#1] +\def\@y@@x@y@x{0.095*#1/100}% +\begin{tikzpicture}[scale=#1+0.01*#1,x=1.35ex,y=1.3ex, line width=0.07ex*#1] \ifx\leaf@or@not@leaf\@leaf@is@leaf% \draw[#2] (0-\@y@@x@y@x,0) -- (0-\@y@@x@y@x,1.08+0.05*#1/100); \draw[#3] (0-\@y@@x@y@x,1.08+0.05*#1/100) -- (1.2+\@y@@x@y@x,1.08+0.05*#1/100); @@ -43,6 +44,7 @@ \draw[#3] (0,1) -- (1.15,1); \draw[#4] (1.15,1) -- +(0,-1); \fi% + \end{tikzpicture}% }} \makeatother @@ -73,7 +75,6 @@ % % % -% %\changes {v1.0} {2013/01/19} {Initial version} %\changes {v1.05} {2013/02/13} {Deleted a ``t'' in the BasicTree-code, shortened the trunk from the tree a bit, renamed some codes, made an index} %\changes {v1.6} {2013/02/14} {Now ``Person'' can be used in sections, etc.} @@ -83,7 +84,7 @@ %\changes {v1.61} {2013/02/17} {Made an invisible box in BasicTree.} %\changes {v1.65} {2013/02/17} {Improved BasicTree; New symbols ``Schaler/peeler'', Laughey, Walley, Ninja; but didn't improve the source-description} %\changes {v1.7} {2013/02/28} {New symbols, etc.} -% +%\changes {v2.0} {2013/03/07} {Fixed Bugs, improved BasicTree, new option ``marvosym'', new symbol} % % % @@ -130,7 +131,7 @@ % \section{Options} \label{Options} %^^A This package offers exactly \textbf{one} option (and I am extremly proud of this one option. Do you know why? Because it took almost two hours to produce it. There is no thing like a ``easy'' keyval syntax! Well, maybe it took so long because it was my first time producing something like that \dots{} However, I am extremely glad that this option works \dSmiley). % -% These options are for the commands in the section ``Trees'' \ref{Trees}. +%\subsection{For Trees} These options are for the commands in the section ``Trees'' \ref{Trees}. % The trees look pretty nice, but have one drawback: \LaTeX{} needs extremely long to produce them. % So these options come in handy: by turning \verb|tree=off| or using \verb|draft| the trees will be replaced by squares (for an example see section ``Trees'' \ref{Trees}). % Those squares are fast produced by \LaTeX{} and have almost the same size as the trees, they are ``spacefillers''. @@ -166,6 +167,23 @@ % But there are no warnings, if you misspell something e.g. \verb|tree=onf|. % You will see what happens. % +% \subsection{If you load the package ``marvosym''} +% Package ``marvosym'' defines the partly the same Commands as ``tikzsymbols''. +% \emph{You should always load ``tikzsymbols'' after ``marvosym''!!} +% If you do that, ``tikzsymbols'' redefines for example marvosyms ``Smiley'' and ``Coffeecup''. +% But if you like marvosyms ``Smiley'' more than the ``Smiley'' from ``tikzpicture'', you should use the option ``marvosym'': +% +% \small +% \begin{longtable}{c|c} +% Without option ``marvosym'' \Smiley \Coffeecup & With option ``marvosym'' \mvchr{169} \mvchr{75}\\\hline\vspace{-1.5ex} \endhead +% \verb|\usepackage{marvosym}| & \verb|\usepackage{marvosym}|\\ +%\verb|\usepackage{tikzsymbols}| & \verb|\usepackage{marvosym}{tikzsymbols}| +% \end{longtable} +%\normalsize +% +% If you use the option \verb|marvosym| without loading the package, \LaTeX{} will produce an error message. +% +% % % \section{Symbols} % In this section the symbols are introduced. @@ -302,6 +320,7 @@ %\verb|\Chair| & \oarg{scale} & \Chair\\ %\verb|\Bed| & \oarg{scale} & \Bed\\ %\verb|\Moai| & \oarg{scale} & \Moai\\ +%\verb|\Tribar| & \oarg{scale} & \Tribar %\end{longtable} % @@ -332,13 +351,16 @@ % %\noindent\verb|\BasicTree| examples: % -% \verb|\BasicTree{red}{orange}{yellow}{leaf}|\BasicTree{red}{orange}{yellow}{leaf} +% \verb|\colorbox{green}{\BasicTree{red}{orange}{yellow}{leaf}}|\colorbox{green}{\BasicTree{red}{orange}{yellow}{leaf}} % % \verb|\BasicTree[5]{orange!95!black}{orange!80!black}{orange!70!black}{leaf}|\BasicTree[5]{orange!95!black}{orange!80!black}{orange!70!black}{leaf} % -% \verb|\BasicTree[2]{blue!65!white}{cyan!50!white}{cyan!50!white}{}|\BasicTree[2]{blue!65!white}{cyan!50!white}{cyan!50!white}{} +% \verb|\BasicTree[2]{blue!65!white}{cyan!50!white}{cyan!50!white}{leaf}|\BasicTree[2]{blue!65!white}{cyan!50!white}{cyan!50!white}{} +% +% +% \verb|\colorbox{black}{\BasicTree[3.75]{gray!80}{gray!50}{gray!40}{leaf}}|\colorbox{black}{\BasicTree[3.75]{gray!80}{gray!50}{gray!40}{leaf}} %\\[5ex] -% \verb|\BasicTree| example with option \verb|tree=off| or \verb|draft| (see section \ref{Options}): +% \verb|\colorbox{green}{\BasicTree{red}{orange}{yellow}{leaf}}|\colorbox{green}{\definedBasicTree{red}{orange}{yellow}{leaf}} % % % \verb|\BasicTree{red}{orange}{yellow}{leaf}|\definedBasicTree{red}{orange}{yellow}{leaf} @@ -346,6 +368,8 @@ % \verb|\BasicTree[5]{orange!95!black}{orange!80!black}{orange!70!black}{leaf}|\definedBasicTree[5]{orange!95!black}{orange!80!black}{orange!70!black}{leaf} % % \verb|\BasicTree[2]{blue!65!white}{cyan!50!white}{cyan!50!white}{}|\definedBasicTree[2]{blue!65!white}{cyan!50!white}{cyan!50!white}{} +% +% \verb|\colorbox{black}{\BasicTree[3.75]{gray!80}{gray!50}{gray!40}{leaf}}|\colorbox{black}{\definedBasicTree[3.75]{gray!80}{gray!50}{gray!40}{leaf}} %\\[1ex] % I think it's best if you define your own tree using \verb|\newcommand| and \verb|\BasicTree| (don't forget \verb|\xspace|): %\begin{verbatim} @@ -399,7 +423,7 @@ % % If you load ``marvosym'' \emph{after} ``tikzsymbols'', \LaTeX{} generates an errormessage because ``Smiley'' has already been defined. % -% If you load ``marvosym'' \emph{before} ``tikzsymbols'', ``tikzsymbols'' will overwrite marvosym's Smiley and no errormessage is generated. +% If you load ``marvosym'' \emph{before} ``tikzsymbols'', ``tikzsymbols'' will overwrite marvosym's Smiley and no errormessage is generated (if you liek the ``Simley'' from marvosym more, use the tikzsymbols option \verb|marvosym|). % % \section{Nobody is perfect} % If you are sure that you found a bug, please send me a mail involving a \emph{minimal example} of the code which shows the bug. @@ -418,7 +442,7 @@ % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}[2011/06/27] \ProvidesPackage{tikzsymbols} -[2013/02/28 v1.7 Some symbols created using tikz.] +[2013/03/07 v2.0 Some symbols created using tikz.] \RequirePackage{tikz} \RequirePackage{xargs} \RequirePackage{xcolor} @@ -438,6 +462,184 @@ % \end{macrocode} %\end{macro} + +%\begin{macro}{marvosym} +% I define the option ``marvosym'': you should use it, if you load the package ``marvosym'' +% \begin{macrocode} +\newif\if@tikzsymbols@marvosym +\DeclareOptionX{marvosym}{\@tikzsymbols@marvosymtrue} +% \end{macrocode} +%\end{macro} + +%\begin{macro}{\@leaf@is@leaf} +% We need this command for creating an errormessage if the last paramter of BasicTree is neither ``leaf'' nor empty. +% \begin{macrocode} +\def\@leaf@is@leaf{leaf} +% \end{macrocode} +%\end{macro} + + +%\begin{macro}{\if@draft \if@final} +% We need them for some package warnings. +% \begin{macrocode} +\newif\if@tikzsymbols@draft +\newif\if@tikzsymbols@final +% \end{macrocode} +%\end{macro} + + +% +%\begin{macro}{\@Tree@SetUp} +% First we define our \verb|\@Tree@SetUp| (how the trees will look like) (I used the code from the ``tikz'' manual and changed it a little bit): +% \begin{macrocode} +\DeclareRobustCommand{\@Tree@SetUp}[1][1]{\tikzset{% +ld/.style={level distance=##1ex},lw/.style={line width=##1ex},% +level 1/.style={ld=0.60, trunk, lw=0.1 ,sibling angle=60},% +level 2/.style={ld=0.20, trunk!80!leaf a, lw=.073,sibling angle=70},% +level 3/.style={ld=0.25, trunk!60!leaf a, lw=.05,sibling angle=70}, % +level 4/.style={ld=0.10, trunk!40!leaf a, lw=.025,sibling angle=60},% +level 5/.style={ld=0.15, trunk!20!leaf a, lw=.02,sibling angle=60},% +level 6/.style={ld=0.08, leaf a, lw=.021,sibling angle=60},% +}}% +% \end{macrocode} +%\end{macro} + +%\begin{macro}{\Basic@Tree} +% Now we define our \verb|\Basic@Tree|. We will need it later for our package option (basic code is also from ``tikz'' manual). +% \begin{macrocode} +\DeclareRobustCommandx{\Basic@Tree}[5][1=1, usedefault]{{% +\def\leaf@or@not@leaf{#5}% +\@Tree@SetUp[#1]% +\pgfarrowsdeclare{leaf}{leaf}% +{\pgfarrowsleftextend{-.1ex} \pgfarrowsrightextend{-0.05ex}}% +{% +\pgfpathmoveto{\pgfpoint{-.01ex}{0ex}}% +\pgfpatharc{150}{30}{0.08ex}% dicke +\pgfpatharc{-30}{-150}{0.08ex}% +\pgfusepathqfill% +}% +\colorlet{trunk}{#2}% +\colorlet{leaf a}{#3}% +\colorlet{leaf b}{#4}\begin{tikzpicture}[x=1ex,y=1ex,line width=0.07ex]% +\ifx\leaf@or@not@leaf\@leaf@is@leaf% +\draw[opacity=0,scale=#1+0.1*#1] (-0.82-0.1* #1/100,0) rectangle (0.82+0.1*#1/100, 1.4+0.01*#1/100); +\else +\draw[opacity=0,scale=#1+0.1*#1] (-0.75,-0.01) rectangle (0.75,1.3); +\fi +\pgflowlevel{\pgftransformscale{#1+0.02ex}}{\coordinate (root) [grow cyclic,rotate=90] child { +child [line cap=round] foreach \a in {0,1, 2} { child foreach \b in {0,1} { +child foreach \c in {0,1,2} { child foreach \d in {0,1} { +child foreach \leafcolor in {leaf a,leaf b} { edge from parent [color=\leafcolor,-#5] } +}}} } edge from parent [shorten >=-0.05ex,serif cm-,line cap=butt] +};}% +\end{tikzpicture}% +}} +% \end{macrocode} +%\end{macro} + +%\begin{macro}{draft} +% If the class option \verb|draft|, then Squares are typed instead of trees. Furthermore we set \verb|\@drafttrue| and \verb|\@finalfalse| for some warnings: +% \begin{macrocode} +\DeclareOptionX{draft}{\@tikzsymbols@drafttrue\@tikzsymbols@finalfalse +\def\Basic@Tree{\Basic@Tree@off}} +% \end{macrocode} +%\end{macro} +%\begin{macro}{final} +% If the class option \verb|final|, then trees. Same as before: +% \begin{macrocode} +\DeclareOptionX{final}{\@tikzsymbols@draftfalse\@tikzsymbols@finaltrue +\def\Basic@Tree{\Basic@Tree@on}} +% \end{macrocode} +% It's extremely annoying: you are working almost a day to find out how this package recognizes \verb|draft| and at the end there are just two lines of code. +% +%\end{macro} + +%\begin{macro}{tree} +% Now we declare the name of our option: ``tree'' (I could have named it stone, or wood, etc. but I used ``tree''). This code is copy \& pasted from this site: \href{http://tex.stackexchange.com/questions/13270/a-package-template-using-xkeyval}{http://tex.stackexchange.com/}. Plus some warnings, if you use class option \verb|draft| or \verb|final| with package option \verb|tree=on/off|: +% \begin{macrocode} +\DeclareOptionX{tree}{% + \def\Basic@Tree{\csname Basic@Tree@#1\endcsname}% + \if@tikzsymbols@draft% +\PackageWarningNoLine{tikzsymbols}{You can use class option \MessageBreak +draft with package option tree=on/off; +\MessageBreak but I think it would be better if you +\MessageBreak delete tree=on/off}\fi% +\if@tikzsymbols@final% +\PackageWarningNoLine{tikzsymbols}{You can use class option \MessageBreak +final with package option tree=on/off; +\MessageBreak but I think it would be better if you +\MessageBreak delete tree=on/off}\fi% + } +% \end{macrocode} +%\end{macro} + +%\begin{macro}{\Basic@Tree@off} +% We define \verb|\Basic@Tree@off|; it will be shown if \verb|tree=off|. +% It looks a bit confusing, but this syntax provides a square, which is as large as the tree. +%Furthermore, we check if the last parameter is ``leaf'': +% \begin{macrocode} +\DeclareRobustCommandx{\Basic@Tree@off}[5][1=1, usedefault]{{% +\def\leaf@or@not@leaf{#5}% +\def\@y@@x@y@x{0.095*#1/100}% +\begin{tikzpicture}[scale=#1+0.01*#1,x=1.35ex,y=1.3ex, line width=0.07ex*#1] +\ifx\leaf@or@not@leaf\@leaf@is@leaf% +\draw[#2] (0-\@y@@x@y@x,0) -- (0-\@y@@x@y@x,1.08+0.05*#1/100); +\draw[#3] (0-\@y@@x@y@x,1.08+0.05*#1/100) -- (1.2+\@y@@x@y@x,1.08+0.05*#1/100); +\draw[#4] (1.2+\@y@@x@y@x,1.08+0.05*#1/100) -- (1.2+\@y@@x@y@x,0); +\draw[#3] (1.2+\@y@@x@y@x,0) -- (0.5,0); +\draw[#4] (0.5+0.4*#1/100,0) -- (0-\@y@@x@y@x,0); +\else +\draw[#2] (0,0) -- (0,1); +\draw[#3] (0,1) -- (1.15,1); +\draw[#4] (1.15,1) -- +(0,-1); +\fi% +\end{tikzpicture}% +}} +% \end{macrocode} +%\end{macro} + +%\begin{macro}{\Basic@Tree@on} +% We define \verb|\Basic@Tree@on|; it will be shown if \verb|tree=on|: +% \begin{macrocode} +\DeclareRobustCommandx{\Basic@Tree@on}[5][1=1, usedefault]{{% +\def\leaf@or@not@leaf{#5}% +\@Tree@SetUp[#1]% +\pgfarrowsdeclare{leaf}{leaf}% +{\pgfarrowsleftextend{-.1ex} \pgfarrowsrightextend{-0.05ex}}% +{% +\pgfpathmoveto{\pgfpoint{-.01ex}{0ex}}% +\pgfpatharc{150}{30}{0.08ex}% dicke +\pgfpatharc{-30}{-150}{0.08ex}% +\pgfusepathqfill% +}% +\colorlet{trunk}{#2}% +\colorlet{leaf a}{#3}% +\colorlet{leaf b}{#4}\begin{tikzpicture}[x=1ex,y=1ex,line width=0.07ex]% +\ifx\leaf@or@not@leaf\@leaf@is@leaf% +\draw[opacity=0,scale=#1+0.1*#1] (-0.82-0.1* #1/100,0) rectangle (0.82+0.1*#1/100, 1.4+0.01*#1/100); +\else +\draw[opacity=0,scale=#1+0.1*#1] (-0.75,-0.01) rectangle (0.75,1.3); +\fi +\pgflowlevel{\pgftransformscale{#1+0.02ex}}{\coordinate (root) [grow cyclic,rotate=90] child { +child [line cap=round] foreach \a in {0,1, 2} { child foreach \b in {0,1} { +child foreach \c in {0,1,2} { child foreach \d in {0,1} { +child foreach \leafcolor in {leaf a,leaf b} { edge from parent [color=\leafcolor,-#5] } +}}} } edge from parent [shorten >=-0.05ex,serif cm-,line cap=butt] +};}% +\end{tikzpicture}% +}}% +% \end{macrocode} +%\end{macro} + +% +%\begin{macro}{\ProcessOptionsX*} +%Again a code from the internet (don't know what \verb|\relax| does): +% \begin{macrocode} +\ProcessOptionsX*\relax +% \end{macrocode} +%\end{macro} + + % \subsection{Cookingsymbolcode} % %\begin{macro}{\Kochtopf = \pot} @@ -470,10 +672,10 @@ %\begin{macro}{\Bratpfanne = \fryingpan} % You may wonder why I am writing something like: \verb|amplitude=.12ex*#1|. -% Well it' hard to explain in english, but I try my best: -% After being scaled these symbols would look not so good without \verb|*#1|. -% The lines would be too thin, the corners not rounded enough , etc. -% To prevent too thin lines due to scaling I am multiplying the line width and the corners etc. so that they look with scale=5 a like with scale=1. +% Well it's hard to explain in english, but I try my best: +% After being scaled the symbols would not look so good without \verb|*#1|. +% The lines would be too thin, the corners not rounded enough, etc. +% To prevent too thin lines due to scaling I am multiplying the line width and the corners etc. so that they look the same, no matter how you scale it. % \begin{macrocode} \DeclareRobustCommand{\Bratpfanne}[1][1]{% \begin{tikzpicture}[x=0.7ex,y=1.4ex, line width=0.07ex*#1, scale=#1] @@ -616,7 +818,7 @@ % %\begin{macro}{\Backblech = \bakingplate} -% I may overdo it a little bit \dots: +% I may have too many strange words: % \begin{macrocode} \DeclareRobustCommand{\Backblech}[1][1]{% \begin{tikzpicture}[x=6.53ex,y=5.ex, line width=0.07ex*#1,scale=#1] @@ -638,7 +840,7 @@ % %\begin{macro}{\Ofen = \oven} -% I may overdo it a little bit 2: +% I may have again too many strange words: % \begin{macrocode} \DeclareRobustCommand{\Ofen}[1][1]{% \begin{tikzpicture}[x=0.50ex,y=.5ex, line width=0.07ex*#1,scale=#1] @@ -733,7 +935,7 @@ % %\begin{macro}{\Schaler = \peeler} -% I can«t believe I forgot this command. I made it and forgot to copy and paste it inside this document!!!! +% I cannot believe I forgot this command. I made it and forgot to copy and paste it inside this document!!!! % Jedenfalls wieder \"a=a: % \begin{macrocode} \DeclareRobustCommand{\Schaler}[1][1]{% @@ -760,8 +962,8 @@ % %\begin{macro}{\Sadey \dSadey} % An other name of Sadey is Frowny, but I named it Sadey because there are enough Frownys in the world. -% All ``3D'' Emoticons start with \verb|\d...|, and all Emoticons end with an ``ey'' (exception: ``Cat''). -% The ``default color'' of the 2D Emoticons is \verb|opacity=0|, with that default option, it's useful for \verb|\colorbox{yellow}{\Sadey}| which leads to \colorbox{yellow}{\Sadey} instead of \colorbox{yellow}{\Sadey[][white]} (with default=white). +% All ``3D'' Emoticons start with \verb|\d...|, and all Emoticons end with an ``ey'' (exception: ``Cat'', ``Ninja'', and else). +% The ``default color'' of the 2D Emoticons is \verb|opacity=0|, it's useful for \verb|\colorbox{yellow}{\Sadey}| which leads to \colorbox{yellow}{\Sadey} instead of \colorbox{yellow}{\Sadey[][white]} (with default=white). % \begin{macrocode} \DeclareRobustCommandx{\Sadey}[2][1=1, 2={opacity=0}, usedefault]{% \begin{tikzpicture}[x=2.4ex, y=2.4ex, line width=0.09ex*#1,scale=#1] @@ -819,6 +1021,7 @@ %\begin{macro}{\Smiley \dSmiley} % A normal Smiley % \begin{macrocode} +\if@tikzsymbols@marvosym\relax\else% \DeclareRobustCommandx{\Smiley}[2][1=1,2={opacity=0} ,usedefault]{% \begin{tikzpicture}[x=2.4ex, y=2.4ex, line width=0.12ex*#1,scale=#1] \fill[#2,line width=0.12ex*#1] (0,0) circle (0.33); @@ -828,7 +1031,8 @@ \draw (-0.2,-0.1) .. controls (-0.1,-0.2) and (0.1,-0.2) .. (0.2,-0.1); \end{tikzpicture}% \tikzsymbolsaftersymbolinput% -} +}% +\fi \DeclareRobustCommandx{\dSmiley}[3][1=1,2=yellow,3=yellow,usedefault]{% \begin{tikzpicture}[x=2.4ex, y=2.4ex, line width=0.12ex*#1,scale=#1] \shade[ball color=#2] (0,0) circle (0.33); @@ -1342,7 +1546,7 @@ decorate {-- (-0.25,0.24)} % % -% \section{Other symbols(s)} +% \subsection{Other symbols(s)} %\begin{macro}{\Person} % My first symbol: a person. % In german it would be called ``Strichmaxerl''. @@ -1361,7 +1565,7 @@ decorate {-- (-0.25,0.24)} % \end{macrocode} %\end{macro} -%\begin{macro}{\candle} +%\begin{macro}{\Candle} % A burning candle % \begin{macrocode} \DeclareRobustCommand{\Candle}[1][1]{% @@ -1379,7 +1583,7 @@ decorate {-- (-0.25,0.24)} %\end{macro} % -%\begin{macro}{\fire} +%\begin{macro}{\Fire} % Just a fire. % \begin{macrocode} \DeclareRobustCommand{\Fire}[1][1]{% @@ -1405,9 +1609,10 @@ decorate {-- (-0.25,0.24)} %\end{macro} % -%\begin{macro}{\cofeecup} +%\begin{macro}{\Cofeecup} % Just a cup of coffee. % \begin{macrocode} +\if@tikzsymbols@marvosym\relax\else% \DeclareRobustCommand{\Coffeecup}[1][1]{% \begin{tikzpicture}[x=0.7ex,y=0.7ex, scale=#1, line width=0.07ex*#1] \draw (0,0) arc (180:269:0.8 and 1) -- ++(0.5,0) arc (269:360:0.8 and 1) -- cycle; @@ -1424,11 +1629,12 @@ decorate {-- (-0.25,0.24)} \draw (0,-1.05) -- (2.1,-1.05); \end{tikzpicture}% \tikzsymbolsaftersymbolinput% -} +}% +\fi % \end{macrocode} %\end{macro} -%\begin{macro}{\chair} +%\begin{macro}{\Chair} % A chair. % \begin{macrocode} \DeclareRobustCommand{\Chair}[1][1]{% @@ -1444,7 +1650,7 @@ decorate {-- (-0.25,0.24)} % \end{macrocode} %\end{macro} -%\begin{macro}{\bed} +%\begin{macro}{\Bed} % A chair. % \begin{macrocode} \DeclareRobustCommand{\Bed}[1][1]{% @@ -1460,8 +1666,22 @@ decorate {-- (-0.25,0.24)} } % \end{macrocode} %\end{macro} -% -% + +%\begin{macro}{\Bed} +% Also called Penrose-Triangle +% \begin{macrocode} +\DeclareRobustCommand{\Tribar}[1][1]{% +\begin{tikzpicture}[x=0.65ex,y=0.65ex,scale=#1,rounded corners=0.03ex*#1, line width=0.06ex*#1] +\draw (0,0) -- (1,0) -- (0.5,1) -- cycle; +\draw (0.15,0.3) -- (-0.15,-0.3) -- (1.75,-0.3) -- ++ (-0.15,-0.3) -- (-0.65,-0.6) -- (0.35,1.3) -- (0.8,.4); +\draw (0.9,0) -- (1.3,0) -- (0.35,1.9) -- (0.65,1.9) -- (1.75,-0.3) -- +(-.05,-0.1); +\draw (-0.6,-0.6) -- (-0.65,-0.6) -- ++ (-0.15,0.3) -- (0.35,1.9) -- (0.4,1.9); +\end{tikzpicture}% +\tikzsymbolsaftersymbolinput% +} +% \end{macrocode} +%\end{macro} + % %\begin{macro}{\tikzsymbolsMoaiscale} %\begin{macro}{\tikzsymbolsMoaithickness} @@ -1530,173 +1750,6 @@ decorate {-- (-0.25,0.24)} % Don't know who said that, but it's true. % % -%\begin{macro}{\@leaf@is@leaf} -% I this name \dots However, We need this command for creating an errormessage if the last paramter of BasicTree is neither ``leaf'' nor empty. -% \begin{macrocode} -\def\@leaf@is@leaf{leaf} -% \end{macrocode} -%\end{macro} - - -%\begin{macro}{\if@draft \if@final} -% We need them for some package warnings. -% \begin{macrocode} -\newif\if@tikzsymbols@draft -\newif\if@tikzsymbols@final -% \end{macrocode} -%\end{macro} - - -% -%\begin{macro}{\@Tree@SetUp} -% First we define our \verb|@Tree@SetUp| (how the trees will look like) (I used the code from the ``tikz'' manual and changed it a little bit): -% \begin{macrocode} -\DeclareRobustCommand{\@Tree@SetUp}[1][1]{\tikzset{% -ld/.style={level distance=##1ex},lw/.style={line width=##1ex},% -level 1/.style={ld=0.60, trunk, lw=0.1*#1 ,sibling angle=60},% -level 2/.style={ld=0.20, trunk!80!leaf a, lw=.073*#1,sibling angle=70},% -level 3/.style={ld=0.25, trunk!60!leaf a, lw=.05*#1,sibling angle=70}, % -level 4/.style={ld=0.10, trunk!40!leaf a, lw=.025*#1,sibling angle=60},% -level 5/.style={ld=0.15, trunk!20!leaf a, lw=.02*#1,sibling angle=60},% -level 6/.style={ld=0.08, leaf a, lw=.021*#1,sibling angle=60},% -}}% -% \end{macrocode} -%\end{macro} - -%\begin{macro}{\Basic@Tree} -% Now we define our \verb|\Basic@Tree|. We will need it later for our package option (basic code is also from ``tikz'' manual). -% \begin{macrocode} -\DeclareRobustCommandx{\Basic@Tree}[5][1=1, usedefault]{{% -\def\leaf@or@not@leaf{#5}% -\@Tree@SetUp[#1]% -\pgfarrowsdeclare{leaf}{leaf}% -{\pgfarrowsleftextend{-.1ex} \pgfarrowsrightextend{-0.05ex}}% -{% -\pgfpathmoveto{\pgfpoint{-.01ex}{0ex}}% -\pgfpatharc{150}{30}{0.16ex*(#1/2)}% dicke -\pgfpatharc{-30}{-150}{0.16ex*(#1/2)}% -\pgfusepathqfill% -}% -\colorlet{trunk}{#2}% -\colorlet{leaf a}{#3}% -\colorlet{leaf b}{#4}\begin{tikzpicture}[x=1ex,y=1ex, scale=#1+0.2, line width=0.07ex*#1]% -\ifx\leaf@or@not@leaf\@leaf@is@leaf% -\draw[opacity=0] (-0.82-0.1* #1/100,0) rectangle (0.82+0.1*#1/100, 1.415+0.01*#1/100); -\else -\draw[opacity=0] (-0.75,0.1) rectangle (0.75,1.3); -\fi -\coordinate (root) [grow cyclic,rotate=90] child { -child [line cap=round] foreach \a in {0,1, 2} { child foreach \b in {0,1} { -child foreach \c in {0,1,2} { child foreach \d in {0,1} { -child foreach \leafcolor in {leaf a,leaf b} { edge from parent [color=\leafcolor,-#5] } -}}} } edge from parent [shorten >=-0.05ex,serif cm-,line cap=butt] -};% -\end{tikzpicture}% -}} -% \end{macrocode} -%\end{macro} - -%\begin{macro}{draft} -% If the class option \verb|draft|, then Squares instead of trees. Furthermore we set \verb|\@drafttrue| and \verb|\@finalfalse| for some warnings: -% \begin{macrocode} -\DeclareOption{draft}{\@tikzsymbols@drafttrue\@tikzsymbols@finalfalse -\def\Basic@Tree{\Basic@Tree@off}} -% \end{macrocode} -%\end{macro} -%\begin{macro}{final} -% If the class option \verb|final|, then trees. Same as before: -% \begin{macrocode} -\DeclareOption{final}{\@tikzsymbols@draftfalse\@tikzsymbols@finaltrue -\def\Basic@Tree{\Basic@Tree@on}} -% \end{macrocode} -% It's extremely annoying: you are working almost a day to find out how this package recognizes \verb|draft| and at the end there are just two lines of code. -% -%\end{macro} - -%\begin{macro}{tree} -% Now we declare the name of our option: ``tree'' (I could have named it stone, or wood, etc. but I used ``tree''). This code is copy \& pasted from this site: \href{http://tex.stackexchange.com/questions/13270/a-package-template-using-xkeyval}{http://tex.stackexchange.com/}. Plus some warnings, if you use class option \verb|draft| or \verb|final| with package option \verb|tree=on/off|: -% \begin{macrocode} -\DeclareOption{tree}{% - \def\Basic@Tree{\csname Basic@Tree@#1\endcsname}% - \if@tikzsymbols@draft% -\PackageWarningNoLine{tikzsymbols}{You can use class option \MessageBreak -draft with package option tree=on/off; -\MessageBreak but I think it would be better if you -\MessageBreak delete tree=on/off}\fi% -\if@tikzsymbols@final% -\PackageWarningNoLine{tikzsymbols}{You can use class option \MessageBreak -final with package option tree=on/off; -\MessageBreak but I think it would be better if you -\MessageBreak delete tree=on/off}\fi% - } -% \end{macrocode} -%\end{macro} - -%\begin{macro}{\Basic@Tree@off} -% We define \verb|\Basic@Tree@off|; it will be shown if \verb|tree=off|. -% I looks a bit confusing, but this syntax provides a square, which is as large as the tree. -%Furthermore, we check if the last parameter is ``leaf'': -% \begin{macrocode} -\DeclareRobustCommandx{\Basic@Tree@off}[5][1=1, usedefault]{{% -\def\leaf@or@not@leaf{#5}% -\def\@y@@x@y@x{0.095*#1/100} -\begin{tikzpicture}[scale=#1+0.2,x=1.3ex,y=1.3ex, line width=0.07ex*#1] -\ifx\leaf@or@not@leaf\@leaf@is@leaf% -\draw[#2] (0-\@y@@x@y@x,0) -- (0-\@y@@x@y@x,1.08+0.05*#1/100); -\draw[#3] (0-\@y@@x@y@x,1.08+0.05*#1/100) -- (1.2+\@y@@x@y@x,1.08+0.05*#1/100); -\draw[#4] (1.2+\@y@@x@y@x,1.08+0.05*#1/100) -- (1.2+\@y@@x@y@x,0); -\draw[#3] (1.2+\@y@@x@y@x,0) -- (0.5,0); -\draw[#4] (0.5+0.4*#1/100,0) -- (0-\@y@@x@y@x,0); -\else -\draw[#2] (0,0) -- (0,1); -\draw[#3] (0,1) -- (1.15,1); -\draw[#4] (1.15,1) -- +(0,-1); -\fi% -\end{tikzpicture}% -}} -% \end{macrocode} -%\end{macro} - -%\begin{macro}{\Basic@Tree@on} -% We define \verb|\Basic@Tree@off|; it will be shown if \verb|tree=on|: -% \begin{macrocode} -\DeclareRobustCommandx{\Basic@Tree@on}[5][1=1, usedefault]{{% -\def\leaf@or@not@leaf{#5}% -\@Tree@SetUp[#1]% -\pgfarrowsdeclare{leaf}{leaf}% -{\pgfarrowsleftextend{-.1ex} \pgfarrowsrightextend{-0.05ex}}% -{% -\pgfpathmoveto{\pgfpoint{-.01ex}{0ex}}% -\pgfpatharc{150}{30}{0.16ex*(#1/2)}% dicke -\pgfpatharc{-30}{-150}{0.16ex*(#1/2)}% -\pgfusepathqfill% -}% -\colorlet{trunk}{#2}% -\colorlet{leaf a}{#3}% -\colorlet{leaf b}{#4}\begin{tikzpicture}[x=1ex,y=1ex, scale=#1+0.2, line width=0.07ex*#1]% -\ifx\leaf@or@not@leaf\@leaf@is@leaf% -\draw[opacity=0] (-0.82-0.1* #1/100,0) rectangle (0.82+0.1*#1/100, 1.415+0.01*#1/100); -\else -\draw[opacity=0] (-0.75,0.1) rectangle (0.75,1.3); -\fi -\coordinate (root) [grow cyclic,rotate=90] child { -child [line cap=round] foreach \a in {0,1, 2} { child foreach \b in {0,1} { -child foreach \c in {0,1,2} { child foreach \d in {0,1} { -child foreach \leafcolor in {leaf a,leaf b} { edge from parent [color=\leafcolor,-#5] } -}}} } edge from parent [shorten >=-0.05ex,serif cm-,line cap=butt] -};% -\end{tikzpicture}% -}} -% \end{macrocode} -%\end{macro} - -% -%\begin{macro}{\ProcessOptionsX*} -%Again a code from the internet (don't know what \verb|\relax| does): -% \begin{macrocode} -\ProcessOptions*\relax -% \end{macrocode} -%\end{macro} %\begin{macro}{\BasicTree} % We define our \verb|\BasicTree|. We check if the last paramter is ``leaf'', if not we check if the last paramter is empty, if not we generate an error meassge: @@ -1710,7 +1763,7 @@ child foreach \leafcolor in {leaf a,leaf b} { edge from parent [color=\leafcolor \Basic@Tree[#1]{#2}{#3}{#4}{#5}\tikzsymbolsaftersymbolinput% \else% \PackageError{tikzsymbols}{The last parameter has either to be \MessageBreak -`leaf` or has to be empty}{See the documentation. Section `Trees«.}% +`leaf` or has to be empty}{See the tikzsymbols documentation. Section ``Trees''.}% \fi\fi% } % \end{macrocode} @@ -1742,7 +1795,6 @@ child foreach \leafcolor in {leaf a,leaf b} { edge from parent [color=\leafcolor \tikzsymbolsaftersymbolinput% } % \end{macrocode} -%``Hey! That is the code from the tikzmanuel!!'' -- ``Yes, I know.'' %\end{macro} @@ -1771,6 +1823,16 @@ child foreach \leafcolor in {leaf a,leaf b} { edge from parent [color=\leafcolor % \end{macrocode} %\end{macro} %\end{macro}\end{macro}\end{macro} + +% \begin{macrocode} +\AtBeginDocument{ +\if@tikzsymbols@marvosym +\@ifpackageloaded{marvosym}{}{% +\PackageError{tikzsymbols}{Use option 'marvosym' only if you load package 'marvosym'} +{Either load package 'marvosym' or delete the tikzsymbols option 'marvosym'}} +\fi +} +% \end{macrocode} % Well that's it. Happy \TeX ing! % % PS. Something went wrong with the Change History, but I don't know what. @@ -1778,8 +1840,6 @@ child foreach \leafcolor in {leaf a,leaf b} { edge from parent [color=\leafcolor - - \DeclareRobustCommand{\@Keep@Cool@I}{% \begin{tikzpicture}[x=1em, y=1em, line width=0.03em] \fill[decorate,decoration={snake,amplitude=.02em,segment length=0.4em},cyan!20!] -- cgit v1.2.3