我正在尝试用等号创建一个大的一元运算符=
,即,\mathlarger{\boldsymbol{=}}
但这些条太近,无法与一般的二进制情况区分开来。是否有一些=
间隙更大的包可供我使用?
答案1
以下是一个建议:
\documentclass{article}
\usepackage{amsmath,xparse}
\ExplSyntaxOn
\NewDocumentCommand{\uneq}{}
{
\mathbin{\mathpalette\updraft_uneq:nn {}}
}
\dim_new:N \l__updraft_width_dim
\dim_new:N \l__updraft_height_dim
\cs_new_protected:Nn \updraft_uneq:nn
{
\vcenter
{
\mathsurround=0pt
\hbox:n
{
% measure the width of the equals sign in the current style
\hbox_set:Nn \l_tmpa_box {$#1{=}$}
\dim_set:Nn \l__updraft_width_dim { \box_wd:N \l_tmpa_box }
% measure the width of 1mu in the current style
\hbox_set:Nn \l_tmpa_box {$#1\mkern1mu$}
\dim_set:Nn \l__updraft_height_dim { \box_wd:N \l_tmpa_box }
% start drawing
\driver_draw_begin:
% round caps on lines
\driver_draw_cap_round:
% set the line width (change 1.2 to your liking)
\driver_draw_linewidth:n { 1.2\l__updraft_height_dim }
% 1. cm fonts use width/10 of side bearings
% 2. the gap between lines is 5 times the line width
% bottom line
\driver_draw_moveto:nn
{ 0.1 \l__updraft_width_dim }
{ -2.5 \l__updraft_height_dim }
\driver_draw_lineto:nn
{ 0.9 \l__updraft_width_dim }
{ -2.5 \l__updraft_height_dim }
\driver_draw_stroke:
% top line
\driver_draw_moveto:nn
{ 0.1 \l__updraft_width_dim }
{ 2.5 \l__updraft_height_dim }
\driver_draw_lineto:nn
{ 0.9 \l__updraft_width_dim }
{ 2.5 \l__updraft_height_dim }
\driver_draw_stroke:
\driver_draw_end:
% occupy the space
\hspace{ \l__updraft_width_dim }
}
}
}
\ExplSyntaxOff
\begin{document}
$\mathbin{=}A$
$\uneq A$ $\scriptstyle\uneq A$ $\scriptscriptstyle\uneq A$
$A=B$
\end{document}
没有“一元运算符”类,必须使用\mathbin
,TeX 将根据上下文采取行动。您也可以决定只使用\mathord
。
答案2
可以通过改变来调整间隙4\LMpt
。
\documentclass{article}
\usepackage{scalerel,stackengine,bm}
\newcommand\bineq{\mathbin{\ThisStyle{\ensurestackMath{\vcenter{\hbox{\stackengine{%
4\LMpt}{\SavedStyle\bm{-}}{\SavedStyle\bm{-}}{O}{c}{F}{F}{L}}}}}}}
\begin{document}
${\bm{=}} A\quad\scriptstyle{\bm{=}} A\quad\scriptscriptstyle{\bm{=}} A$ bold =
$\bineq A\quad\scriptstyle\bineq A\quad\scriptscriptstyle\bineq A$ \verb|\bineq|
\end{document}