I would like to create some new shape in order to use it with tiKz. The problem I'm front facing is how to access edged of the newly created shapes.
So far I got this :
\documentclass[paper=a4,11pt,parskip=half,twoside]{scrartcl}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\usepackage[pdftex]{graphicx}
\usepackage{tikz}
\usepackage{circuitikz}
\usepackage{pgfplots}
\def\convEl{%
++(-.5,-.5) -- ++(1,0) -- ++(0,1) -- ++(-1,0) -- cycle
}
\def\convEm{%
++(0,0) circle (.5)
}
\def\convMe{%
++(-.5,-.5) -- ++(.5,1) -- ++(.5,-1) -- cycle
}
\def\accEn{%
++(-.5,-.5) -- ++(.5,0) -- ++(0,1) -- ++(-.5,0) -- cycle ++(0,-1) -- ++(.5,1)
}
\begin{document}
\begin{tikzpicture}
\filldraw[draw=red,ultra thick,fill=orange] (0,0) \convEl node (a) {};
\filldraw[draw=red,ultra thick,fill=orange] (2,0) \convEm node (b) {};
\filldraw[draw=red,ultra thick,fill=orange] (4,0) \convMe;
\filldraw[draw=red,ultra thick,fill=orange] (6,0) \accEn;
\end{tikzpicture}
\end{document}
Well maybe I should precise some more in comparison to the code provided. I want to access specific positions of my shapes, like bottom center and +30°/-30° on each side to connect arrows. Here is a little scheme of the behaviour expected. This is why I need to create / access some more anchors. If i draw a simple rectangle, I can do it, but with new/special shapes like the one I need…
Best Answer
Using Spike's approach is for sure a possibility, but the shape to be defined is quite simple, so I think there's a simplest way. Credit should go to Jake's answer How to have a cross out rectangle in tikz?, because here I just adapted things.
Result:
The edit of the question was very useful to better understand the request. In this case perhaps it is better to define a new shape, but that's Spike's domain: I provide you an alternative. Ok, it could be an alternative if one is used to the
calc
library.The basic hint is that
regular polygons
define alsocorner
anchors so, by taking them as reference, it is possible to access every position without defining a new shape.The revised example:
Result: