1

I'm redrawing these symbols (don't ask why :)) How can I draw them more properly? enter image description here

(Circle and line segments do not exactly intersect)

My Code:

\documentclass[a4paper]{article}
\usepackage[margin=1.5cm]{geometry}
\usepackage{amsmath}
\usepackage{tikz}

\newcommand{\mycupsymbol}{     
\hspace{1.1mm}\tikz[baseline, line width=0.6 pt, line cap=round]{
  \draw (1.103,0.08) -- ++(0,0.15);
  \draw (0.903,0.08) -- ++(0,0.15);
  \draw (1.103,0.08) arc (0:-180:0.1);
}
\hspace{1.1mm}}
\newcommand{\mycup}{\mycupsymbol}

\newcommand{\mycapsymbol}{     
\hspace{1.1mm}\tikz[baseline, line width=0.6 pt, line cap=round]{
  \draw[line width=0.581] (1.1033,-0.022) -- ++(0,0.15);
  \draw[line width=0.581] (0.9033,-0.022) -- ++(0,0.15);
  \draw (1.103,0.13) arc (0:180:0.1);
}
\hspace{1.1mm}}
\newcommand{\mycap}{\mycapsymbol}


\begin{document}

$$A_2\mycup \mycap S_2$$

\end{document}
2
  • 2
    This has nothing to do with amsmath. (The usage example doesn't even use \[ ... \].) A more appropriate tag might be symbols. Sep 15 '21 at 19:06
  • I know you told us not to ask why, but, well, why?
    – Gaussler
    Sep 21 '21 at 7:54
3

A couple of suggestions:

  1. It's better to use scalable units w.r.t. the font (ex as in my example, or em).
  2. Draw all the paths with only one \draw, it's easier this way.
  3. Create only one macro (\mysymbol in my case) with a parameter and rotate it.
  4. Define before the macro variables with all the dimensions involved. This way it's easy to modify until you have exactly what you need.

That said, this is my example, edited as suggested by egreg in the comments. Previously there could be conflicts with the names of the macros. I also changed \def for \newcommand to make this macros.

\documentclass[a4paper]{article}
\usepackage{tikz}

\newcommand\myheight{1.5ex} % cup and cap height
\newcommand\mywidth {1.2ex} % cup and cap width
\newcommand\mylinew {0.1ex} % cup and cap line width
\newcommand\spaceba {0.4ex} % space before and after
\newcommand{\mysymbol}[1]
{
  \hspace{\spaceba}
  \tikz[line width=\mylinew,line cap=round,rotate=#1]
    \draw (0,\myheight) -- (0,0.5*\mywidth) arc (-180:0:0.5*\mywidth) -- (\mywidth,\myheight);
  \hspace{\spaceba}
}
\newcommand{\mycup}{\mysymbol{0}}
\newcommand{\mycap}{\mysymbol{180}}

\begin{document}
\[A_2\mycup \mycap S_2\]
\huge
\[A_2\mycup \mycap S_2\]
\end{document}

And the output:

enter image description here

5
  • How can I get the arc a little lower? @JuanCastaño
    – cufcuf
    Sep 15 '21 at 20:35
  • 2
    @cufcuf, you need to change the baseline but in that case there are some changes needed in the path too. Something like this: \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);} Sep 16 '21 at 6:16
  • Thank you @JuanCastaño
    – suarez
    Sep 16 '21 at 6:24
  • 1
    Using \def is not recommended. And in fact users of your code run into errors, see tex.stackexchange.com/q/615996/4427. Please, replace \h, \w, \lw and \sp with other names less likely to conflict with someone else's code.
    – egreg
    Sep 20 '21 at 13:49
  • @egreg, it's now edited, thanks for pointing it!!! Sep 21 '21 at 6:58

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.