我試圖從等號=
,即 ,創建一個大的一元運算符,\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}