0

enter image description heregood evening, some suggestion on how to use the following shapes?

enter image description here

5
  • Pretty much reminds me of this: tex.stackexchange.com/q/574693/47927 . Could you please show how these shapes are supposed to be connected to each other, especially those with multiple "connectors" (these small circles)? One could probably just use regular shapes and decorate them using append after command or the like. But it is crucial to know how these shapes are actually used. Commented Jun 30, 2023 at 20:23
  • @JasperHabicht it's exactly like in the question you sent; but I couldn't find any answer precise enough to get something exactly like that Commented Jun 30, 2023 at 21:41
  • So it is always the diamond in the center and two rectangles at each side that have the small circles pointed outwards? What about the two shapes with the double-struck arrows pointing upwards? Please advise. Are there any larger examples that show other uses of these shapes? Commented Jun 30, 2023 at 21:56
  • I'll edit the question with a new image Commented Jun 30, 2023 at 22:07
  • It is probably easiest to just use rectangle and diamond (via \usetikzlibrary{shapes.geometric}) shapes and add the other things manually, since they seem to be quite individual for each node. I don't think that there exists a package already for this style of diagrams. Commented Jul 1, 2023 at 7:57

1 Answer 1

2

I don't think that there exists a library for this kind of diagram and I think, considering the variety and uniqueness of the position of the single elements in the above diagram, it is most probably easiest to just use predefined shapes such as rectangle and diamond (the latter being available via the library shapes.geometric) and add the other things manually.

However, you could of course create your own shapes or enhance existing ones using styles, or you could make use of \pics as in the following example which might help you drawing the above diagram (but you should probably make yourself familiar with how \pics work in general):

\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows.meta}

\tikzset{
    % enhanced rectangle
    enhanced rectangle/base/.style={
        draw,
        rectangle,
        align=center,
        minimum width=7em,
        minimum height=2.5em,
        inner sep=5pt,
    },
    enhanced rectangle/text/.initial={},
    pics/enhanced rectangle/.style={
        code={
            \tikzset{#1}
            \node[enhanced rectangle/base] (-base) at (0,0) {
                \pgfkeysvalueof{/tikz/enhanced rectangle/text}
            };
            \tikzset{enhanced node additions/construction}
        }
    },
    % enhanced diamond
    enhanced diamond/base/.style={
        draw,
        diamond,
        align=center,
        minimum width=7.5em,
        minimum height=2em,
        inner sep=1pt,
    },
    enhanced diamond/text/.initial={},
    pics/enhanced diamond/.style={
        code={
            \tikzset{#1}
            \node[enhanced diamond/base] (-base) at (0,0) {
                \pgfkeysvalueof{/tikz/enhanced diamond/text}
            };
            \tikzset{enhanced node additions/construction}
        }
    },
    % enhanced node additions
    enhanced node additions/.initial={},
    enhanced node additions/node/.style={draw, circle, inner sep=2pt},
    enhanced node additions/label/.style={},
    enhanced node additions/radius/.initial={2.25cm and 1.25cm},
    enhanced node additions/connected/.code={
        \tikzset{
            enhanced node additions/connected/path/.style={draw},
            enhanced node additions/connected/node/.style={enhanced node additions/node, fill},
        }
    },
    enhanced node additions/connected/path/.style={},
    enhanced node additions/connected/node/.style={},
    enhanced node additions/connected/start angle/.initial={0},
    enhanced node additions/connected/end angle/.initial={0},
    enhanced node additions/connected/radius/.initial={1.75cm and 0.75cm},
    enhanced node additions/construction/.code={
        \pgfkeysgetvalue{/tikz/enhanced node additions}{\enhanceddiamondadditionslist}
        \ifx\enhanceddiamondadditionslist\empty\else
        \foreach \a/\s/\l [count=\i] in \enhanceddiamondadditionslist {
            \tikzset{
                enhanced node additions/node \i/.style={},
                enhanced node additions/label \i/.style={},
            }
            \node[enhanced node additions/node, enhanced node additions/node \i, label={[enhanced node additions/label, enhanced node additions/label \i]\a:\l}, \s] (-addition node \i) at (\a:\pgfkeysvalueof{/tikz/enhanced node additions/radius}) {};
            \draw (-base) -- (-addition node \i) coordinate[midway] (-addition edge \i);
        }
        \draw (\pgfkeysvalueof{/tikz/enhanced node additions/connected/start angle}:\pgfkeysvalueof{/tikz/enhanced node additions/connected/radius})
            arc (\pgfkeysvalueof{/tikz/enhanced node additions/connected/start angle}:\pgfkeysvalueof{/tikz/enhanced node additions/connected/end angle}:\pgfkeysvalueof{/tikz/enhanced node additions/connected/radius})
            node[enhanced node additions/connected/node] (-addition connect node) {};
        \fi
    },
}

\begin{document}
\begin{tikzpicture}

    \pic (rectangle 1) at (0,0) {enhanced rectangle={
        enhanced rectangle/text={Edizione corso},
        enhanced node additions={
            215//Num. part.,
            280//Data inizio,
            325//Data fine
        },
        enhanced node additions/connected,
        enhanced node additions/connected/start angle=250,
        enhanced node additions/connected/end angle=290,
    }};

    \draw (rectangle 1-base.250) -- ++(0,-2);

    \pic (diamond 1) at (5,0) {enhanced diamond={
        enhanced diamond/text={Foo},
        enhanced node additions={
            135/fill/Ciao,
            45/fill/Hello,
            0//Bye
        },
        enhanced node additions/connected,
        enhanced node additions/connected/start angle=-20,
        enhanced node additions/connected/end angle=65,
    }};

    \node[above] at (diamond 1-addition edge 1) {(1,0)};

    \draw (rectangle 1-base) -- (diamond 1-base) node[above, pos=0.25] {(1,N)};

    \draw[<-, double, double distance=2pt, >={Triangle[length=5pt]}] (diamond 1-base) -- ++(0,-2);

\end{tikzpicture}
\end{document}

enter image description here

1
  • that's great, thank you so much Commented Jul 1, 2023 at 11:56

Not the answer you're looking for? Browse other questions tagged .