# Undefined control sequence when using TikZ [closed]

I looked up how to use TikZ to make an ERD using crow's foot notation and found this. When I c/p the code provided there, there is no problems at all,but when the preamble is pasted into mine and the document code is pasted in the document section I get a long list of errors for each line that uses \draw.

Most of which refers to wrong use of units. After fixing these errors I end up with the preamble in the bottom. However I still get an "Undefined control sequence"-error that I can't seem to fix. Further more even though I get errors my final .pdf.document to be compiled just fine, which I find very weird.

Can anyone tell me what might be wrong?

EDIT: Marijn, pointed out that I forgot \makeatletter just after % Crowsfoot notation. Adding that and reversing the changes i made fixed the issue. An explaination why it is needed can be found here.

\documentclass[a4paper,11pt,openany, oneside]{memoir}
\let\footruleskip\undefined %footruleskip is set to undefined because both momoir and fancyhdr defines this
\usepackage{fancyhdr} % includes fancy to control header and footer
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{listings}
\usepackage{color}
\usepackage{amsfonts}
\usepackage{placeins} % Controls floats
\usepackage{pgf-umlsd} % UML and sequence diagrams
\usepackage{enumitem} % to enable roman letters in alternate usecase flows
% TiKz packages to diagrams
\usepackage{pgf}
\usepackage{tikz}
\usetikzlibrary{arrows,automata}
\usetikzlibrary{positioning}
\usetikzlibrary{shapes.multipart}
\usetikzlibrary{matrix}
\usetikzlibrary{positioning}
\usetikzlibrary{calc}
% Definition of state for a statemachine
\tikzset{
state/.style={
rectangle,
rounded corners,
draw=black, very thick,
minimum height=2em,
inner sep=2pt,
text centered,
},
%Definition af initial node
initiator/.style={
circle,
draw,
}
}

% Crowsfoot notation

\pgfarrowsdeclare{crow's foot}{crow's foot}
{
\pgfarrowsleftextend{+-.5\pgflinewidth}%
\pgfarrowsrightextend{+.5\pgflinewidth}%
}
{
\pgfutil@tempdima=0.5pt%
\pgfsetdash{}{+0pt}%
\pgfsetmiterjoin%
\pgfpathmoveto{\pgfqpoint{0pt}{-6pt\pgfutil@tempdima}}%
\pgfpathlineto{\pgfqpoint{-6pt\pgfutil@tempdima}{+0pt}}%
\pgfpathlineto{\pgfqpoint{0pt}{6pt\pgfutil@tempdima}}%
\pgfusepathqstroke%
}

{
\pgfpathmoveto{\pgfpoint{-2pt}{0pt}}
\pgfpatharc{150}{30}{1.8pt}
\pgfpatharc{-30}{-150}{1.8pt}
\pgfusepathqfill
}

\tikzset{
entity/.code={
\tikzset{
label=above:#1,
name=#1,
inner sep=0pt,
every entity/.try,
fill=white,
opacity=0.5,
fill=black!50
}
}%
\def\entityname{#1}%
},
entity anchor/.style={matrix anchor=#1.center},
every entity/.style={
draw,
},
every property/.style={
inner xsep=0.25cm, inner ysep=0.125cm, anchor=west, text width=1in
},
zig zag to/.style={
to path={(\tikztostart) -| ($(\tikztostart)!#1!(\tikztotarget)$) |- (\tikztotarget)}
},
zig zag to/.default=0.5,
one to many/.style={
-crow's foot, zig zag to
},
many to one/.style={
crow's foot-, zig zag to
},
many to many/.style={
crow's foot-crow's foot, zig zag to
}
}
\def\property#1{\node[name=\entityname-#1, every property/.try]{#1};}
\def\properties{\begingroup\catcode\_=11\relax\processproperties}
\def\processproperties#1{\endgroup%
\def\propertycode{}%
\foreach \p in {#1}{%
\expandafter\expandafter\expandafter\gdef\expandafter\expandafter\expandafter\propertycode%
\expandafter\expandafter\expandafter{\expandafter\propertycode\expandafter\property\expandafter{\p}\\}%
}%
\propertycode%
}
% /Crow's foot notation

\begin{document}

\begin{tikzpicture}[every node/.style={font=\ttfamily}, node distance=1.25in]
\matrix [entity=Class] {
\properties{
classkey,
class_type,
class_desc
}
};

\matrix [entity=Product, right=of Class-classkey, entity anchor=Product-classkey]  {
\properties{
classkey,
prodkey,
prod_name,
pkg_type
}
};

\matrix  [entity=Sales, right=of Product-classkey, entity anchor=Sales-classkey]  {
\properties{
perkey,
classkey,
prodkey,
prod_name,
storekey,
promokey,
quantity,
dollars
}
};

\matrix  [entity=Period, right=of Sales-perkey, entity anchor=Period-perkey]  {
\properties{
perkey,
date,
day,
week,
month,
qtr,
year
}
};

\matrix  [entity=Promotion, below=of Period, entity anchor=Promotion-promokey]  {
\properties{
promokey,
promo_type,
promo_desc,
value,
start_date,
end_date
}
};

\matrix  [entity=Store, below=of Product, entity anchor=Store-storekey]  {
\properties{
storekey,
mktkey,
store_type,
store_name,
street,
city,
state,
zip
}
};

\matrix  [entity=Market, left=of Store-mktkey, entity anchor=Market-mktkey]  {
\properties{
mktkey,
hq_city,
hq_state,
district,
region
}
};

\draw [one to many] (Class-classkey)   to (Product-classkey);
\draw [one to many] (Product-classkey) to (Sales-classkey);
\draw [one to many] (Product-prodkey)  to (Sales-prodkey);
\draw [many to one] (Sales-perkey)     to (Period-perkey);
\draw [one to many] (Market-mktkey)    to (Store-mktkey);
\draw [many to one] (Sales-storekey)   to (Store-storekey);
\draw [many to one] (Sales-promokey)   to (Promotion-promokey);

\end{tikzpicture}

\end{document}


This is the error output:

Undefined control sequence. ...] (Product-classkey) to (Sales-classkey);
Undefined control sequence. ...] (Product-classkey) to (Sales-classkey);
Undefined control sequence. ...] (Product-classkey) to (Sales-classkey);
Undefined control sequence. ...] (Product-classkey) to (Sales-classkey);
Overfull \hbox (136.25331pt too wide) in paragraph


## closed as off-topic by Torbjørn T., user13907, Zarko, Przemysław Scherwentke, egregOct 5 '16 at 23:18

• This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

• you forgot to copy the \makeatletter (right above the crow's foot definition) from tex.stackexchange.com/questions/133754/…. – Marijn Apr 18 '16 at 15:08
• You're right, Thanks for pointing it out :) AFAIK I can't make a comment the answer. But adding \makeatletter and then undoing the changes i made fixed my problem :) – Glaemyr Apr 20 '16 at 8:48
• I'm voting to close this question as off-topic because the problem was caused by a missing \makeatletter` due to copy-paste error. – Torbjørn T. Oct 5 '16 at 21:37
• I agree, it should be closed/marked as answered. But I do think it is relevant that people can find see that a C/P error can result in said error message. The question exists because it was not apparent – Glaemyr Oct 10 '16 at 1:10