I am trying to crate a "grid" of custom shapes that takes 8 inputs:
1 = origin x
2 = origin y
3 = box length x
4 = box height y
5 = # of columns x
6 = # of rows y
7 = column space x
8 = row space y
What I've attempted is this:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\newcommand{\boxarray}[8]{
\foreach \k in {1,...,#6}
\foreach \i in {1,...,#5}
\def\xo{{#1 + (\i - 1)(#3 + #7)}}
\def\yo{{#2 + (\k - 1)(#4 + #8)}}
\draw (\xo + .1, \yo)
-- (\xo + #3 - .1,\yo)
arc (180:270:.1)
-- (\xo + #3,\yo - #4 - .1)
arc (90:180:.1)
-- (\xo + .1,\yo - #4)
arc (0:90:.1)
-- (\xo,\yo-.1)
arc (270:360:.1)
-- cycle;
}
\end{document}
However, I keep getting two "illegal unit of measure" and a "missing number" error. I know this is quite messy, but when I used the command I've created to make the shape inside the \foreach, it got around 23 errors. I'm really new to loops inside of latex, so any help would be appreciated.
Here is the shape I am trying to create:
\draw (6.6, 0)
-- (10.4,0)
arc (180:270:.1)
-- (10.5,-7.9)
arc (90:180:.1)
-- (6.6,-8)
arc (0:90:.1)
-- (6.5, -.1)
arc (270:360:.1)
-- cycle;

\documentclass{...}, the required\usepackage's,\begin{document}, and\end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – dexteritas Jul 27 '17 at 12:03tikzpictureenvironment when you issue the\draw, so you are bound to get errors. At least, that's what it looks like. You haven't shown us how you're trying to use the macro. – cfr Jul 27 '17 at 12:27