13

The minus sign in arevmath is too long. In particular, it is longer than the plus sign. Is there a way to correct this?

\documentclass{article}

\usepackage{arevmath}
\usepackage{xcolor}

% \DeclareSymbolFont{mathdesignC}{OMS}{zavm}{m}{n}
% \DeclareMathSymbol{-}{\mathrel}{mathdesignC}{"01}

\begin{document}

\begin{tabular}{|@{}l@{}|}
  $+$\\
  \color{red}$-$\\
  $\pm$
\end{tabular}

\end{document}

enter image description here

1 Answer 1

14

Indeed!

\documentclass{article}

\usepackage{arevmath}
\usepackage{xcolor}

\begin{document}

\fboxsep=0pt \fboxrule=0.1pt

\sbox0{$+$}\the\wd0\fbox{\box0}

\sbox0{$-$}\the\wd0\fbox{\box0}

\makebox[0pt][l]{\color{red}$-$}$+$

\makebox[0pt][l]{\color{red}$+$}$-$

\end{document}

enter image description here

However, as you see, the bounding boxes have the same width.

What can we do? We might horizontally scale the minus sign (exploiting the rectangular shape) but keep the original width.

\documentclass{article}
\usepackage{amsmath} % always do it for math

\usepackage{arevmath}
\usepackage{graphicx}
\usepackage{xcolor}

\makeatletter
\DeclareRobustCommand{\scaledarevminus}{\mathbin{\mathpalette\scaledarevminus@\relax}}
\newcommand{\scaledarevminus@}[2]{%
  \begingroup
  \sbox\z@{$\m@th#1\std@minus$}%
  \makebox[\wd\z@]{\kern-0.01\wd\z@\scalebox{0.85}[1]{\usebox\z@}}%
  \endgroup
}
\AtBeginDocument{%
  \begingroup\lccode`~=`-\lowercase{\endgroup\let~}\scaledarevminus
  \mathcode`-="8000
}
\def\newmcodes@{% fix the amsopn.sty definition
  \mathcode`\'39 \mathcode`\*42 \mathcode`\."613A
  \mathcode`\-45\mathcode`\/47\mathcode`\:"603A
  \relax
}
\makeatother

\begin{document}

\fboxsep=0pt \fboxrule=0.1pt
\sbox0{$+$}\the\wd0\fbox{\box0}
\sbox0{$-$}\the\wd0\fbox{\box0}

\makebox[0pt][l]{\color{red}$-$}$+$
\makebox[0pt][l]{$+$}\textcolor{red}{$-$}
\makebox[0pt][l]{\color{red}$\scriptstyle -$}$\scriptstyle +$
\makebox[0pt][l]{$\scriptstyle +$}\textcolor{red}{$\scriptstyle -$}
\makebox[0pt][l]{\color{red}$\scriptscriptstyle -$}$\scriptscriptstyle +$
\makebox[0pt][l]{$\scriptscriptstyle +$}\textcolor{red}{$\scriptscriptstyle -$}

\end{document}

enter image description here

A zoomed version

enter image description here

The symbols are placed asymmetrically in their bounding box, but that's a choice of the font designer. But we can fix also that.

\documentclass{article}
\usepackage{amsmath} % always do it for math

\usepackage{arevmath}
\usepackage{graphicx}
\usepackage{xcolor}

\makeatletter
\mathchardef\std@plus=\mathcode`+
\DeclareRobustCommand{\scaledarevminus}{\mathbin{\mathpalette\scaledarevminus@\relax}}
\DeclareRobustCommand{\movedarevplus}{\mathbin{\mathpalette\movedarevplus@\relax}}
\newcommand{\scaledarevminus@}[2]{%
  \begingroup
  \sbox\z@{$\m@th#1\std@minus$}%
  \makebox[\wd\z@]{\kern0.06\wd\z@\scalebox{0.85}[1]{\usebox\z@}}%
  \endgroup
}
\newcommand{\movedarevplus@}[2]{%
  \begingroup
  \sbox\z@{$\m@th#1\std@plus$}%
  \makebox[\wd\z@]{\kern0.07\wd\z@\usebox\z@}%
  \endgroup
}
\AtBeginDocument{%
  \begingroup\lccode`~=`-\lowercase{\endgroup\let~}\scaledarevminus
  \begingroup\lccode`~=`+\lowercase{\endgroup\let~}\movedarevplus
  \mathcode`-="8000
  \mathcode`+="8000
}

\def\newmcodes@{% fix the amsopn.sty definition
  \mathcode`\'39 \mathcode`\*42 \mathcode`\."613A
  \mathcode`\-45\mathcode`\/47\mathcode`\:"603A
  \relax
}
\makeatother

\begin{document}

\fboxsep=0pt \fboxrule=0.1pt
\sbox0{$+$}\the\wd0\fbox{\box0}
\sbox0{$-$}\the\wd0\fbox{\box0}

\makebox[0pt][l]{\color{red}$-$}$+$
\makebox[0pt][l]{$+$}\textcolor{red}{$-$}
\makebox[0pt][l]{\color{red}$\scriptstyle -$}$\scriptstyle +$
\makebox[0pt][l]{$\scriptstyle +$}\textcolor{red}{$\scriptstyle -$}
\makebox[0pt][l]{\color{red}$\scriptscriptstyle -$}$\scriptscriptstyle +$
\makebox[0pt][l]{$\scriptscriptstyle +$}\textcolor{red}{$\scriptscriptstyle -$}

\end{document}

enter image description here

2
  • Could be useful to add your patch to \newmcodes@ to your second solution. Thanks again for all. Works like a charm
    – user94293
    Commented Dec 21, 2022 at 14:30
  • @user94293 done, thanks for asking to
    – egreg
    Commented Dec 21, 2022 at 14:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .