I am attempting to add in some TikZ pictures as math symbols to represent some knot equations. Hence, I've created a couple of commands to create these images quickly.
\newcommand{\KA}[1]{
\begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1]
\draw [line width=1.5] (100.4,110.6) .. controls (119.4,71.1) and (119.4,71.1) .. (99.9,30.6) ;
\draw [line width=1.5] (150.9,110.1) .. controls (131.9,70.1) and (130.9,70.1) .. (150.4,30.1) ;
\end{tikzpicture}
}
\newcommand{\KB}[1]{
\begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1]
\draw [line width=1.5] (207.02,45.05) .. controls (246.62,63.85) and (246.62,63.85) .. (287.02,44.15) ;
\draw [line width=1.5] (207.78,95.55) .. controls (247.68,76.35) and (247.68,75.35) .. (287.78,94.65) ;
\end{tikzpicture}
}
Then, I attempt to use this in a document. In a regular environment, this is fine. However, inside mathmode, where I need it, it throws an error. For something simple like:
$$
\KA + \KB
$$
Then, I attempted to use \mathord{} around each command. Still I get the error.
Here is the MWE:
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\newcommand{\KA}[1]{
\begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1]
\draw [line width=1.5] (100.4,110.6) .. controls (119.4,71.1) and (119.4,71.1) .. (99.9,30.6) ;
\draw [line width=1.5] (150.9,110.1) .. controls (131.9,70.1) and (130.9,70.1) .. (150.4,30.1) ;
\end{tikzpicture}
}
\newcommand{\KB}[1]{
\begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1]
\draw [line width=1.5] (207.02,45.05) .. controls (246.62,63.85) and (246.62,63.85) .. (287.02,44.15) ;
\draw [line width=1.5] (207.78,95.55) .. controls (247.68,76.35) and (247.68,75.35) .. (287.78,94.65) ;
\end{tikzpicture}
}
\begin{document}
$$\KA+\KB$$
\end{document}


[1]after{\KA}and{\KB}. Also, you should use\[ .. \]instead of$$ .. $$. (https://tex.stackexchange.com/q/503/125871) – Sandy G Feb 05 '22 at 04:20