8 May 10:33 2012

## Re: How to create new node shapes ?

Thank you Mark for the example.
Where is the 'outer sep' defined, i.e., why the edge between the cloud and
cable modem doesn't touch the borders?

Thank you,

Ignasi

On Tue, 08 May 2012 09:58:42 +0200, Mark Wibrow <m.wibrow <at> gmail.com> wrote:

> \documentclass{article}
> \usepackage{tikz}
> \usetikzlibrary{shapes.symbols}
> \begin{document}
> \makeatletter
> \tikzset{
> 	symbol/.style={
> 		execute at begin node={
> 			\begin{tikzpicture}
> 				\def\tikz <at> atbegin <at> node{}
> 				\tikzset{symbols/#1}
> 			\end{tikzpicture}
> 		}
> 	}
> }
> \makeatother
> \tikzset{
> 	symbol lines/.style={
> 		very thick,


8 May 11:06 2012

### Re: How to create new node shapes ?

Hi,

The symbol is placed inside a rectangle node (the default node shape)
whose border is used to calculate points for tree edges.

You can see this if you add the draw' key to the symbol style.

If you want exact border edges then you would have to define the shape
using \pgfdeclareshape and define anchors appropriately. The following
is incomplete, and it is cheating a bit to use tikz code in the shape
(and may result in undesirable behaviours in some circumstances), but it
shows how to approach the problem.

Doing things purely in PGF would give maximum control, but is a bit more
work.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric,shapes.symbols}
\begin{document}

\tikzset{
symbol lines/.style={
very thick,
line join=round,
},
}
\colorlet{symbol fill}{black!50}
\colorlet{symbol draw}{black!25}



8 May 20:14 2012

### Re: How to create new node shapes ?

Hi again,

The following (although far from perfect) shows how the approach can be
used to build symbols from other symbols:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric,shapes.symbols}
\begin{document}

\makeatletter
\tikzset{
symbol/.style={
inner sep=0pt,
shape=rectangle,
execute at begin node={
\begin{tikzpicture}
\def\tikz <at> atbegin <at> node{}
\tikzset{symbols/.cd, #1}
\end{tikzpicture}
}
}
}
\makeatother

\tikzset{
symbol lines/.style={
very thick,
line join=round,
},


9 May 18:06 2012

### Re: How to create new node shapes ?

Mark,

thank you again. I will have to study your code, but I'm sure I'll use it
in my class notes.

Ignasi

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

22 May 11:56 2012

### Re: How to create new node shapes ?


Hi,

Sorry for my late answer, I can't have the internet easily...
Thank you SO MUCH for your code. Unfortunately most of it is not
understandable for me, and I would like to draw a terminal (like a PC or a
laptop). Could you please (or someone else) draw one ? I did it with you
previous example, but it won't fit with the design of this one.

Btw, if someone is interested here is what I did with the previous example
(I just added some elements, and draw an example with labels like IP
addresses). I prefer to warn sensitive persons, or people who have a heart
condition that my code may be very ugly due to my lack of experience.

Ignaci if you want to share some example from your class note I would be
very grateful :p

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes.symbols}
\usetikzlibrary{intersections}
\usetikzlibrary{positioning}
\usetikzlibrary{mindmap}
\begin{document}
\makeatletter
\tikzset{
symbol/.style={
execute at begin node={
\begin{tikzpicture}
\def\tikz <at> atbegin <at> node{}


22 May 12:28 2012

### Re: How to create new node shapes ?

Hi,

For a (rather crude) PC how about the following (I've included
everything else from the previous post, which may or may not be helpful).

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric,shapes.symbols}
\begin{document}

\makeatletter
\tikzset{
symbol/.style={
inner sep=0pt,
shape=rectangle,
execute at begin node={
\begin{tikzpicture}
\def\tikz <at> atbegin <at> node{}
\tikzset{symbols/.cd, #1}
\end{tikzpicture}
}
}
}
\makeatother

\tikzset{
symbol lines/.style={
very thick,
line join=round,
},
`