答案1
对于 Computer Modern,使用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}