I will ask you for solution about a little bit more complex problem. Maybe it isn't so hard as it seems to be but, for me it is hard one. Let's say that i want to create four own macros \objecta
, \objectb
, \objectc
, \objectd
of these drawings:
\documentclass{article}
\usepackage{tikz}
\newcommand{\objecta}[1]{
\begin{tikzpicture}\draw (0,0)--(1,0)--(1,1)--(0,1)--cycle;
\draw [->](-0.2,0.5)--(0.5,1.2);
\node at (-0.5,0.5){#1};
\end{tikzpicture}}
\newcommand{\objectb}[2]{
\begin{tikzpicture}
\draw (0,0)--(2,0)--(2,1)--(0,1)--cycle;
\draw (0.3,0.5)--(0.5,0.5);
\draw (1.5,0.5)--(1.7,0.5);
\draw (0.5,0.35)--(1.5,0.35)--(1.5,0.65)--(0.5,0.65)--cycle;
\node at (0.2,0.8){$\triangledown$};
\node at (1.8,0.2){$T$};
\node at (0.4,1.2){#1};
\node at (-0.3,0.5){#2};
\end{tikzpicture}}
\newcommand{\objectc}{
\begin{tikzpicture}
\node[minimum height=2cm,minimum width=2cm, draw, rectangle] at (0,0) {PI};
\draw (0.3,-1)--(1,0)--(0.3,1);
\end{tikzpicture}}
\def\objectd{\node [circle,draw] {M};}
\begin{document}
.
.
.
\end{document}
ObjectA has only 1 node (label). ObjectB has four nodes (labels) (drawing under first with all labels), but only one is default (T). The rest two objects have default nodes. So my first question is how to specify macro where when I put nothing in {#1} {#2} {#3} ...
the default text will be displayed.
So I have these macros, now I want to connect them together like this:
It is possible to create a macro or procedure for positioning those objects and macro/procedure for creating paths? Something that i will specify only node of first macro, node of second macro and path will be created.
Many thanks. ( sorry for the grammar if it is bad )
EDIT:
- Sorry I'm quite new so don't know right now what I can define as node,anchor,label when I have it only in my mind and you can have different solution. Due that i didn't post any code, because though that for you it will be easier to work with own code not with mine clumsy one.
- problem with the default text of node is minor, mainly I want help with positioning and creating paths from macro to another macro. And if it's possible and how to create macro or procedure for it.
- Added macro code, as you see it is clumsy code. Don't know how to work with node placement (text) to be ok.
- Hmm again my post has to be edited - due pictures
- Will appreciate any help, due I'm hopelessly lost and don't know how to move with it.
- I would like to help more if I could, but dunno move with it
xparse
documentation for further information. – Matthew Leingang Mar 8 '12 at 12:57\documentclass
and all the appropriate packages and be compilable. – Peter Grill Mar 8 '12 at 17:52