6

I am a beginner in LaTeX and was wondering if someone could help me with the following problem.

I will be soon embarking on a re-formatting journey of a certain article and believe that I have most of the solutions covered. However, there is one which is beyond my current level of knowledge. The author used a certain custom symbol which I can't recreate. Please find the below screenshot:

u

I have tried joining \cup and \cap together and adjusting their position but the result was far from satisfying. Upon searching for a solution, I have stumbled upon this post:

How to add a custom symbol to LaTeX?

And was impressed what can be achieved with the TikZ and PGF packages. However, when I opened the Tikz and PGF Manual, I understood that I wouldn't get away quickly with a solution.

I wanted to ask for help in creating the above-mentioned symbol using \usepackage{tikz}, unless there is a better solution for getting the same result?

4 Answers 4

7

You could use the picture environment with the enhancements of the pict2e package.

\documentclass{article}
\usepackage{pict2e}
\newcommand*{\cupcap}{%
    \mathrel{%
        \begin{picture}(8,8)
            \roundcap
            \put(0,2){\line(0,1){5}}
            \put(2,2){\arc[180,360]{2}}
            \put(4,2){\line(0,1){3}}
            \put(6,5){\arc[180,0]{2}}
            \put(8,0){\line(0,1){5}}
        \end{picture}%
    }%
}
\begin{document}
\( X \cupcap Y \)
\end{document}
3
  • 3
    Nice. If you put \roundcap after \begin{picture} you'll get rounded line ends, which is typical for CM symbols.
    – campa
    Commented Jun 26, 2020 at 17:26
  • @campa Thanks! It indeed looks better.
    – Vincent
    Commented Jun 26, 2020 at 17:37
  • Thank you very much for taking the time to look into this. I like the result very much and feel encouraged knowing that the issue has been so elegantly solved!
    – Michal
    Commented Jun 27, 2020 at 21:40
5

Welcome to StackExchange!

Here is the symbol and its mirror. I've commented the code so that you can tailor it to your liking. I looked for a Unicode symbol for this but came up dry. Odd -- I could have sworn I've seen this in print.

\documentclass[]{standalone}

\usepackage{tikz}

\def\symbol{%
    \mathrel{%
    \begin{tikzpicture}[baseline]% Makes sure that the symbol is on the baseline
        \def\r{0.18em}% radius of the arc
        \def\h{0.475em}% determines height of the symbol
        \draw[line width=0.06em](0,\r+\h) -- %% Adjust line width to suit
            (0,\r)
            arc (180:360:\r) -- %% the lower arc overshoots the baseline as it should
            (2*\r,\h)
            arc (180:0:\r) -- 
            (4*\r,0);%
    \end{tikzpicture}%
    }%
}

\def\ssymbol{% reflected
    \mathrel{%
    \begin{tikzpicture}[baseline]% Makes sure that the symbol sits on the baseline
        \def\r{0.18em}% radius of the arc
        \def\h{0.475em}% determines height of the symbol
        \draw[line width=0.06em](0,0) -- %% Adjust line width to suit
            (0,\h)
            arc (180:0:\r) --
            (2*\r,\r)
            arc (180:360:\r) -- %% the lower arc overshoots the baseline as it should
            (4*\r,\h+\r);%
    \end{tikzpicture}%
    }%
}

\begin{document}

$x^2\symbol Z$ or $A\ssymbol B$

\end{document}

enter image description here

2
  • Thank you very much! A pleasure to be here. Exactly, I also spent quite some time looking for a Unicode and came out empty-handed – surprising. I am very grateful for your solution and comments. And thank you for the mirror image (!) All this is of great educational value to me and has given me motivation to work on the project.
    – Michal
    Commented Jun 27, 2020 at 21:59
  • Looks great. But maybe the height could be based on the H-height or the ex, which are units of font height, rather then the em, which is a measure of width?
    – Davislor
    Commented Jun 27, 2020 at 23:15
2

A solution with TikZ:

\documentclass{article}
\usepackage{tikz}
\newcommand*{\cupcap}{\mathrel{%
\def\hs{0.62em}%heigth symbol
\def\ws{0.9*\hs}%width symbol
\def\lw{0.12*\hs}%line width
\tikz[baseline=0pt]{
    \draw[rounded corners=0.15*\hs,%<-roundness of the symbol
           line width=\lw]%
     (0,0) -- ++(0,\hs+0.5*\lw) -- ++(-0.5*\ws,0) -- ++(0,-\hs) --
       ++(-0.5*\ws,0) -- +(0,\hs+0.5*\lw);%
        }%
    }%
}
\begin{document}
\( \mathsf{X} \cupcap \mathsf{Y} \)
\end{document}

math symbol with TikZ

1
  • Thank you very much for your time and expertise. I am very grateful for the solution and also excited to see it. I can now start working with a much lighter heart.
    – Michal
    Commented Jun 27, 2020 at 21:48
1

If that fit well with the default \cup and \cap is another story, but simply turning the "S" of some fonts:

mwe

\documentclass{article}
\usepackage{graphicx}
\newcommand\ui{{\:\mbox{{\font\fetamont=ffml10
\fetamont\resizebox{.75em}{!}{\rotatebox[origin=c]{90}{\char115}}}}}\:}
\begin{document}
$(X \cup  Y \cap Z \ui W)$\par
$(X \ui Y)$\par
\end{document}
2
  • Very nice like proposal.
    – Sebastiano
    Commented Jul 7, 2020 at 11:28
  • Thank you for your suggestion! It hasn't occurred to me... an Aha! moment here. :)
    – Michal
    Commented Jul 20, 2020 at 13:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .