3

I am trying to write the following line as can be seen below

\documentclass[border=1mm]{standalone}
\usepackage{graphicx}
\begin{document}
\Huge $\cup \ \cap \ \raisebox{0.30 ex}{\scalebox{1}[0.62]{$\mid$}}$ 
\end{document}

Which results in

enter image description here

Is there an easier or better way to make sure the vertical line \mid is scaled correctly to \cup and \cap? In particular

  • They should have the same baseline, height and width.

My solution feels very hackish and not quite right.

4

For Computer Modern, use pict2e:

\documentclass{article}
\usepackage{pict2e}
\usepackage{color} % for the comparison

\makeatletter
\newcommand{\cbar}{\mathbin{\mathpalette\c@bar\relax}}
\newcommand{\c@bar}[2]{%
  \begingroup
  \sbox\z@{$#1\cup$}%
  \setlength{\unitlength}{\dimexpr\ht\z@+\dp\z@}%
  \mkern1mu
  \raisebox{-\dp\z@}{%
    \begin{picture}(0,1)
    \roundcap
    \c@bar@thickness{#1}%
    \Line(0,0)(0,1.03)
    \end{picture}%
  }%
  \mkern1mu
  \endgroup
}
\newcommand{\c@bar@thickness}[1]{%
  \linethickness{%
    \ifx#1\displaystyle 1\fontdimen8\textfont\else
    \ifx#1\textstyle 1\fontdimen8\textfont\else
    \ifx#1\scriptstyle 0.85\fontdimen8\scriptfont\else
    0.75\fontdimen8\scriptscriptfont\fi\fi\fi 3
  }%
}
\makeatother

\begin{document}

${\cup}{\cap}{\cbar}$

$\scriptstyle{\cup}{\cap}{\cbar}$

$\scriptscriptstyle{\cup}{\cap}{\cbar}$

${\cup}\mkern-2.3mu{\textcolor{red}{\cbar}}{\textcolor{red}{\cup}}\mkern-2.3mu{\cbar}$
${\cap}\mkern-2.3mu{\textcolor{red}{\cbar}}{\textcolor{red}{\cap}}\mkern-2.3mu{\cbar}$

$\scriptstyle{\cup}\mkern-2.4mu{\textcolor{red}{\cbar}}{\textcolor{red}{\cup}}\mkern-2.4mu{\cbar}$
$\scriptstyle{\cap}\mkern-2.4mu{\textcolor{red}{\cbar}}{\textcolor{red}{\cap}}\mkern-2.4mu{\cbar}$

$\scriptscriptstyle{\cup}\mkern-2.8mu{\textcolor{red}{\cbar}}{\textcolor{red}{\cup}}\mkern-2.8mu{\cbar}$
$\scriptscriptstyle{\cap}\mkern-2.8mu{\textcolor{red}{\cbar}}{\textcolor{red}{\cap}}\mkern-2.8mu{\cbar}$

\end{document}

enter image description here

5

\stretchrel from the scalerel package allows you to do such things.

\documentclass[border=1mm]{standalone}
\usepackage{scalerel}
\begin{document}
\Huge $\cup \ \cap \ \stretchrel*{\mid}{\cap}$ 
\end{document}

enter image description here

  • This seems closer, but still not a perfect match. When I overlay the vertical line and the intersection symbol it looks like this i.imgur.com/8bm55vi.png – N3buchadnezzar Sep 16 at 12:08
  • @N3buchadnezzar I see. I am actually surprised because I always thought \stretchrel would provide perfect fits. – Schrödinger's cat Sep 16 at 16:20
  • Interestingly the \cap and \cup claim to have zero depth. – Schrödinger's cat Sep 16 at 17:02

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.