nichtich / tkz-orm

Object-Role Modeling diagrams in TeX
http://purl.org/net/tkz-orm
Other
15 stars 3 forks source link

Feature request: Objectification #8

Open RSAsterix opened 7 years ago

RSAsterix commented 7 years ago

I would love to be able to objectify fact types. As it is now, I see no (obvious) way to do that.

I have made this beautiful mockup with MS Paint: image

camilstaps commented 7 years ago

I agree. For the moment, you can hack this in by placing a \entity over a fact type and setting the text width and opacity fill (alternatively, first place the \entity and then the fact type, you probably don't need to set the opacity fill then).

This requires hard-coding the width of the fact type, unfortunately. It would be nice to have a more readable syntax and a backend that takes care of the scaling. Something like \objectify (EntityName) at (FactName) {}; would already be nice (but, I don't think I will have time to look into scaling soon - perhaps nichtich does).

For now, the hack:

\documentclass{article}
\usepackage{tkz-orm}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}[orm]

\entity (A) at (0,0) {A};
\entity (B) at (4,0) {B};

\binary (link) at (2,0) {};
\plays (A) to (link);
\plays (B) to (link);

\entity [fill opacity=0, text width=1cm] (L) at (link) {};

\entity (C) at (2,-2) {C};

\vbinary (linkb) at (2,-1) {};
\plays (L) to (linkb);
\plays (C) to (linkb);

\end{tikzpicture}
\end{document}

objectify