答案1
当 TeX 构造一条线时,它可以划掉一些水平维度,甚至是两个\sqcup
s 之间的维度,它们仍然充当二进制符号。
我建议做出以下修改:
\newcommand{\shuprod}{\mathbin{{\sqcup}\mspace{-3mu}{\sqcup}}}
\mathbin
让新建筑充当一二进制符号。{\sqcup}
禁用作为二进制符号的符号。\mkern-3mu
(或\mspace{-3mu}
用amsmath
)而不是 ,\hspace
使间距依赖于字体大小。
这仍然不能解决在不同数学风格中使用时出现的间距问题。为此,您可以使用\mathchoice
指定不同数学风格的空间。
\newcommand{\shuprod}{\mathbin{{\sqcup}\mathchoice{\mspace{-3mu}}
{\mspace{-3mu}}
{\mspace{-3mu}}
{\mspace{-4mu}}{\sqcup}}}
当然,这些值与字体有关。
代码
\documentclass{article}
\usepackage{amsmath}
%\newcommand{\shuprod}{\mathbin{{\sqcup}\mspace{-3mu}{\sqcup}}}
\newcommand{\Shuprod}{\sqcup \hspace{-.137cm} \sqcup \;} % do not use
\newcommand{\shuprod}{\mathbin{{\sqcup}\mathchoice{\mspace{-3mu}}
{\mspace{-3mu}}
{\mspace{-3mu}}
{\mspace{-4mu}}{\sqcup}}}
\begin{document}
\( \displaystyle A \sqcup B \)
\( A \sqcup B \)
\( {}_{A \sqcup B} \)
\( {}_{{}_{A \sqcup B}} \)
\( \displaystyle A \shuprod B \)
\( A \shuprod B \)
\( {}_{A \shuprod B} \)
\( {}_{{}_{A \shuprod B}} \)
Abca Abca Abca Abca Abca Abca Abca Abca Abca Abca Abca Abca $ a \shuprod b $
Abca Abca Abca Abca Abca Abca Abca Abca Abca
Abca Abca Abca Abca Abca Abca Abca Abca Abca Abca Abca Abca $ a \Shuprod b $
Abca Abca Abca Abca Abca Abca Abca Abca Abca
\Huge
$ a \shuprod b $\par
Abca Abca Abca Abca Abca Abca Abca Abca Abca Abca Abc $ a \shuprod b $
$ a \Shuprod b $\par
Abca Abca Abca Abca Abca Abca Abca Abca Abca Abca Abc $ a \Shuprod b $ %‽
\end{document}
输出
答案2
有shuffle
包裹提供符号,但仅限于位图格式。
不过,因为这是一个简单的符号\sqcup
,所以手动绘制它并不难。
下面,符号的高度与 相同\sqcup
,但宽度不是两倍,因为这样看起来太多了。
\documentclass{article}
\usepackage{amsmath}
\usepackage{pict2e}
\makeatletter
\newcommand{\shuprod}{\mathbin{\mathpalette\shuprod@\relax}}
\newcommand{\shuprod@}[2]{%
\begingroup
\setlength{\dimen@}{\shuprod@width{#1}}%
\sbox\z@{$\m@th#1\sqcup$}%
\setlength{\unitlength}{\wd\z@}%
\raisebox{0.5\dimen@}{%
\begin{picture}(1.5,0.805)
\linethickness{\dimen@}%
\roundcap\roundjoin
\polyline(0.12,0.84)(0.12,0)(1.38,0)(1.38,0.84)
\Line(0.75,0)(0.75,0.84)
\end{picture}%
}%
\endgroup
}
\newcommand{\shuprod@width}[1]{%
\ifx#1\displaystyle \fontdimen8\textfont\else
\ifx#1\textstyle \fontdimen8\textfont\else
\ifx#1\scriptstyle 1.1\fontdimen8\scriptfont\else
1.25\fontdimen8\scriptscriptfont\fi\fi\fi 3
}
\makeatother
\begin{document}
$A\shuprod B$
$\shuprod \scriptstyle \shuprod \scriptscriptstyle \shuprod$
$\sqcup \scriptstyle \sqcup \scriptscriptstyle \sqcup$
\setlength{\fboxsep}{0pt}
\setlength{\fboxrule}{0.1pt}
\fbox{$\sqcup$}\fbox{$\shuprod$}
\end{document}