2

This is a very specific question about two objects of tikz drawings. The first one shows this:

usecasediagramextendandinclude

The second is from this discussion: Crow's Foot ERM in nice way

I have to change the tikset{ or tikzpicture{ settings to get both working.

this is a MWE:

\documentclass{article}
\usepackage{array}
\renewcommand{\arraystretch}{1.1}
\usepackage{tikz}
\usetikzlibrary{shapes.multipart}
\usetikzlibrary{positioning}
\usetikzlibrary{shadows}
\usetikzlibrary{calc}

% code for "one to omany", etc. is taken from https://tex.stackexchange.com/q/141797/101651
\makeatletter
\pgfarrowsdeclare{crow's foot}{crow's foot}
{
    \pgfarrowsleftextend{+-.5\pgflinewidth}%
    \pgfarrowsrightextend{+.5\pgflinewidth}%
}
{
    \pgfutil@tempdima=0.6pt%
    %\advance\pgfutil@tempdima by.25\pgflinewidth%
    \pgfsetdash{}{+0pt}%
    \pgfsetmiterjoin%
    \pgfpathmoveto{\pgfqpoint{0pt}{-9\pgfutil@tempdima}}%
    \pgfpathlineto{\pgfqpoint{-13\pgfutil@tempdima}{0pt}}%
    \pgfpathlineto{\pgfqpoint{0pt}{9\pgfutil@tempdima}}%
    \pgfpathmoveto{\pgfqpoint{0\pgfutil@tempdima}{0\pgfutil@tempdima}}%
    \pgfpathmoveto{\pgfqpoint{-8pt}{-6pt}}% 
    \pgfpathlineto{\pgfqpoint{-8pt}{-6pt}}%  
    \pgfpathlineto{\pgfqpoint{-8pt}{6pt}}% 
    \pgfusepathqstroke%
}

\pgfarrowsdeclare{omany}{omany}
{
    \pgfarrowsleftextend{+-.5\pgflinewidth}%
    \pgfarrowsrightextend{+.5\pgflinewidth}%
}
{
    \pgfutil@tempdima=0.6pt%
    %\advance\pgfutil@tempdima by.25\pgflinewidth%
    \pgfsetdash{}{+0pt}%
    \pgfsetmiterjoin%
    \pgfpathmoveto{\pgfqpoint{0pt}{-9\pgfutil@tempdima}}%
    \pgfpathlineto{\pgfqpoint{-13\pgfutil@tempdima}{0pt}}%
    \pgfpathlineto{\pgfqpoint{0pt}{9\pgfutil@tempdima}}%
    \pgfpathmoveto{\pgfqpoint{0\pgfutil@tempdima}{0\pgfutil@tempdima}}%  
    \pgfpathmoveto{\pgfqpoint{0\pgfutil@tempdima}{0\pgfutil@tempdima}}%
    \pgfpathmoveto{\pgfqpoint{-6pt}{-6pt}}% 
    \pgfpathcircle{\pgfpoint{-11.5pt}{0}} {3.5pt}
    \pgfusepathqstroke%
}

\pgfarrowsdeclare{one}{one}
{
    \pgfarrowsleftextend{+-.5\pgflinewidth}%
    \pgfarrowsrightextend{+.5\pgflinewidth}%
}
{
    \pgfutil@tempdima=0.6pt%
    %\advance\pgfutil@tempdima by.25\pgflinewidth%
    \pgfsetdash{}{+0pt}%
    \pgfsetmiterjoin%
    \pgfpathmoveto{\pgfqpoint{0\pgfutil@tempdima}{0\pgfutil@tempdima}}%
    \pgfpathmoveto{\pgfqpoint{-6pt}{-6pt}}% 
    \pgfpathlineto{\pgfqpoint{-6pt}{-6pt}}%  
    \pgfpathlineto{\pgfqpoint{-6pt}{6pt}}% 
    \pgfpathmoveto{\pgfqpoint{0\pgfutil@tempdima}{0\pgfutil@tempdima}}%
    \pgfpathmoveto{\pgfqpoint{-8pt}{-6pt}}% 
    \pgfpathlineto{\pgfqpoint{-8pt}{-6pt}}%  
    \pgfpathlineto{\pgfqpoint{-8pt}{6pt}}%    
    \pgfusepathqstroke%
}
\makeatother

\tikzset{%
    arrow/.style={-stealth},
    %Define style for boxes around first tikzpicture
    punktblue/.style={ % <-- see here is no args as below
           rectangle,
           rounded corners,
           draw=blue, very thick,
           text centered},
    punktred/.style={
           rectangle,
           rounded corners,
           draw=red, very thick,
           %text width=6.5em,
           %minimum height=2em,
           text centered},        
    pics/entity/.style n args={3}{code={%  <-- see here are more definitions then above
            \node[draw, blue,
            shade, top color=white, bottom color=blue!30,
            drop shadow={gray!70,
                shadow xshift=3pt,
                shadow yshift=-3pt,
                rounded corners},  
            rounded corners,  
            font=\ttfamily\footnotesize, 
            rectangle
            ] (#1)
            {\color{black}\begin{tabular}{>{\raggedright\arraybackslash}p{4.5em}>{\raggedleft\arraybackslash}p{6em}}
                    #3
                \end{tabular}
            };%
            \node[font=\ttfamily\footnotesize,
            text height=1.5ex,text depth=.25ex,
            above =0pt of #1
            ] 
            {#2};%
    }},
    pics/entitysimple/.style n args={3}{code={%
            \node[draw, rounded corners,             
            rectangle split,
            rectangle split parts=2,
            font=\ttfamily\footnotesize,
            text height=1.5ex,text depth=.25ex
            ] (#1)
            {#2 \nodepart{second} 
                \begin{tabular}{>{\raggedright\arraybackslash}p{4.5em}>{\raggedleft\arraybackslash}p{6em}}
                    #3
                \end{tabular}
            };%
    }},
    zig zag to/.style={
        to path={(\tikztostart) -| ($(\tikztostart)!#1!(\tikztotarget)$) |- (\tikztotarget)}
    },
    zig zag to/.default=0.5,   
    one to one/.style={
        one-one, zig zag to
    },    
    one to many/.style={
        one-crow's foot, zig zag to,
    },
    one to omany/.style={
        one-omany, zig zag to
    },      
    many to one/.style={
        crow's foot-one, zig zag to
    },
    many to many/.style={
        crow's foot-crow's foot, zig zag to
    }, 
}
\begin{document}
%this is the first part that doesn't work since i added the second part
    \begin{tikzpicture}[node distance=0cm, auto,]
      \node[punktblue,inner sep=5pt] (A) {A};
      \node[punktred,inner sep=5pt,right=2cm of A] (B) {B};
      \node[right=of A] (t) {\footnotesize include}  edge[arrow, bend left=0] (B.west); %<-- if you comment out this line it works.
    \end{tikzpicture}
% this is the second part i added:
    \begin{center}
        \begin{tikzpicture}
        \pic {entitysimple={empl}{Employee}{%
                Username: & \textcolor{red}{(PK)} \\
                Password: & varchar(255) \\        
                Name: & varchar(255) \\
                LastName: & varchar(255) \\ 
        }};
        \pic[right=7em of empl] {entitysimple={stud}{Student}{%
                Username: & \textcolor{red}{(PK)} \\
                Password: & varchar(255) \\        
                Name: & varchar(255) \\
                LastName: & varchar(255) \\ 
        }};
        \pic[below=12ex of stud] {entitysimple={thesis}{Thesis}{%
                Title: & \textcolor{red}{(PK)} \\
                Year: & numeric(4) \\        
        }};
        \draw[one to omany] (empl.east) -- node[above]{\footnotesize\texttt{teaches}} (stud.west);
        \draw[one to one] (stud.south) -- node[left]{\footnotesize\texttt{writes}} (thesis.north);
        \draw[one to many] (empl.south) |- node[left, yshift=44pt, xshift=-2pt] {\footnotesize\texttt{supervises}} (thesis.west);
        \end{tikzpicture}
    \end{center}        
\end{document}

How can i change the first part to make both work?

Edit: seams like there is another problem i can not reproduce with the MWE. This is a Screenshoot of the errorcode. I have no idea where the thinspce (U+2009) is... inputenc manual doesn't show more helpful infos in page 4 as well. (or i don't see the meaning...) Any help apreciated...

screenshoot

  • what do you mean with make both work? – percusse Apr 30 '17 at 10:51
  • 1
    Try \node[right=of A] (t) {\footnotesize include} edge[bend left=0,->] (B.west);. Or add the removed tikset{ of arrow so we can see the problem with it. – Bobyandbob Apr 30 '17 at 11:12
  • Load \usetikzlibrary{arrows.meta} and write ` \node[right=of A] (t) {\footnotesize include} edge[-latex] (B.west);` instead of the commented line. Probably cutting and pasting you lost the definition of arrow style. – CarLaTeX Apr 30 '17 at 13:07
  • The error you've shown has nothing to do with TikZ. You have used a character in your document which is not recognised. This may be an invisible character. Try moving the cursor along line 95 and see where you need to move twice to advance a visible character. Otherwise, try retyping the line. – cfr May 8 '17 at 23:55
  • its not so easy. I tried to get rid of every possible unused character. Still i get that strange error. Because the Doc is >53 pages big i can't paste it here and i can not reproduce it with a MWE. The only thing i can do is provide the git url. thats nasty i know but i realy don't know any other poibility to do... git.2li.ch/ivan/Formelbuch the problem is in git.2li.ch/ivan/Formelbuch/src/master/sections/db/db.tex -Line#89 – novski May 12 '17 at 9:40
1

The first part gives an error, with or without the second part, because the key arrow is undefined.

Add the line

\tikzset{arrow/.style={-stealth})

to the preamble.

  • Thanks. seams like i scraped down the MWE to much. My file doesn't set anyway. I added a screenshoot to the question... – novski May 8 '17 at 18:18
  • @novski, screen shot is not very helpful. Pleas provide code, which we can copy and after then compile. Now we, if we like to help you, retype your code from scratch. Help us to help you! – Zarko May 8 '17 at 18:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.