Create element symbol with newcommand and tikz

symbolstikz-pgf

I want to design a new element symbol. I couldn't add the middle line. How can I add the middle line to my code?

\newcommand{\myinn}[1]
{
  \hspace{\spp}
  \tikz[line width=\lw,line cap=round,rotate=#1,baseline=-0.4ex]
  {\draw (-0.5*\w,0.5*\h) -- (-0.5*\w,0.5*\w-0.5*\h)
  arc (-180:0:0.5*\w) -- (0.5*\w,0.5*\h);}
  \hspace{\spp}
}
\newcommand{\myin}{\myinn{270}}

enter image description here

My code:

\documentclass[a5paper]{article}
\usepackage[margin=1.5cm]{geometry}
\usepackage{tikz}
\def\h {1.3ex} % cup and cap height
\def\w {1.2ex} % cup and cap width
\def\lw{0.12ex} % cup and cap line width
\def\spp{0.7269ex} % space before and after

\newcommand{\myinn}[1]
{
  \hspace{\spp}
  \tikz[line width=\lw,line cap=round,rotate=#1,baseline=-0.4ex]
  {\draw (-0.5*\w,0.5*\h) -- (-0.5*\w,0.5*\w-0.5*\h)
  arc (-180:0:0.5*\w) -- (0.5*\w,0.5*\h);}
  \hspace{\spp}
}
\newcommand{\myin}{\myinn{270}}
\begin{document}
\[\myin\]
\end{document}

Best Answer

You just have to add another line to your self drawn symbol. The middle of your cup is at the x-coordinate 0 and you must go from -.5*\h to .5*\h:

\documentclass[a5paper]{article}
\usepackage[margin=1.5cm]{geometry}
\usepackage{tikz}
\newcommand*\h {1.3ex} % cup and cap height
\newcommand*\w {1.2ex} % cup and cap width
\newcommand*\lw{0.12ex} % cup and cap line width
\newcommand*\spp{0.7269ex} % space before and after

\newcommand{\myinn}[1]
{%
  \leavevmode
  \kern\spp
  \tikz[line width=\lw,line cap=round,rotate=#1,baseline=-0.4ex]
  \draw
    (-0.5*\w,0.5*\h) -- (-0.5*\w,0.5*\w-0.5*\h)
    arc (-180:0:0.5*\w) -- (0.5*\w,0.5*\h)
    (0,-.5*\h) -- (0,.5*\h)
    ;%
  \kern\spp\relax
}
\newcommand{\myin}{\myinn{270}}
\begin{document}
\[
  \myin
  \renewcommand*\h{3.5ex}\myin % <- works for other sizes as well
\]
\end{document}

enter image description here