2

enter image description here
How do we make it like this: (Rounded corners and more thinner)
........enter image description here

\documentclass{beamer}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{tgheros}
\renewcommand\familydefault{\sfdefault}
\usepackage{mathastext}
%
\makeatletter
\mathchardef\standardplus=\mathcode`+
\DeclareRobustCommand{\tauyecoplus}{%
\mathbin{\mathpalette\tauyeco@plus\relax}%
}
\newcommand{\tauyeco@plus}[2]{
\raisebox{-0.1\height}{\scalebox{1.4}{\hspace{-0.1mm}$\m@th#1\standardplus$}}%
}
\begingroup\lccode`~=`+ \lowercase{\endgroup\let~}\tauyecoplus
\AtBeginDocument{\mathcode`+="8000 }
\makeatother
%
\begin{document}
\begin{frame}
\[+\]
\end{frame}
\end{document}
Pitaya88
  • 377

2 Answers2

2

I have conformed the scale and position of the macro \+ to your redefined +. Of course, it can be tuned by changing the dimensions specified, since it is composed by overlaying two "round rules", as defined in the roundrule package found only here: Is there such a thing as a `\mathrule`? (rounded endcaps). Works as is in pdflatex. The dimensions would need to be adjustment in lualatex. Doesn't work in xelatex.

The MWE shows the result in all math styles.

\documentclass{beamer}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{tgheros}
\renewcommand\familydefault{\sfdefault}
\usepackage{mathastext}
%
\makeatletter
\mathchardef\standardplus=\mathcode`+
\DeclareRobustCommand{\tauyecoplus}{%
\mathbin{\mathpalette\tauyeco@plus\relax}%
}
\newcommand{\tauyeco@plus}[2]{
\raisebox{-0.1\height}{\scalebox{1.4}{\hspace{-0.1mm}$\m@th#1\standardplus$}}%
}
\begingroup\lccode`~=`+ \lowercase{\endgroup\let~}\tauyecoplus
\AtBeginDocument{\mathcode`+="8000 }
\makeatother
%
\usepackage{roundrule,stackengine,scalerel}
\renewcommand\scriptstyleScaleFactor{.83}
\renewcommand\scriptscriptstyleScaleFactor{.66}
\newcommand\+{\mathbin{\kern1pt\ThisStyle{\ensurestackMath{%
  \stackinset{c}{}{c}{}{\roundrule[2.7\LMpt]{.8\LMpt}{6.5\LMpt}}%
  {\roundrule[2.7\LMpt]{6.5\LMpt}{.8\LMpt}}}}\kern1pt}}
\begin{document}
\begin{frame}
\[{+}{\+}\quad\scriptstyle +\+\quad\scriptscriptstyle+\+\]
\end{frame}
\end{document}

enter image description here

This of course can be made the default plus, using the same \mathcode approach as the OP was using:

\documentclass{beamer}
\usepackage{roundrule,stackengine,scalerel}
\renewcommand\scriptstyleScaleFactor{.83}
\renewcommand\scriptscriptstyleScaleFactor{.66}
\newcommand\myplus{\mathbin{\kern1pt\ThisStyle{\ensurestackMath{%
  \stackinset{c}{}{c}{}{\roundrule[2.7\LMpt]{.8\LMpt}{6.5\LMpt}}%
  {\roundrule[2.7\LMpt]{6.5\LMpt}{.8\LMpt}}}}\kern1pt}}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{tgheros}
\renewcommand\familydefault{\sfdefault}
\usepackage{mathastext}
%
\makeatletter
\begingroup\lccode`~=`+ \lowercase{\endgroup\let~}\myplus
\AtBeginDocument{\mathcode`+="8000 }
\makeatother
%
\begin{document}
\begin{frame}
\[a+b\quad\scriptstyle a+b\quad\scriptscriptstyle a+b\]
\end{frame}
\end{document}

enter image description here

  • I made the compiler lualatex. But it gives an error when I write the code in overleaf. – Pitaya88 Sep 10 '21 at 14:25
  • @Pitaya88 I am sure overleaf knows nothing about roundrule.sty, unless you copied it over from the link I provided. – Steven B. Segletes Sep 10 '21 at 14:28
  • I'm sorry but I couldn't understand. I'm using overleaft, is it possible for me to open this code there? – Pitaya88 Sep 10 '21 at 14:30
  • Error is: `Type X to quit or to proceed, or enter new name. (Default extension: sty)

    Enter file name: ! Emergency stop. <read *>

    l.3 \renewcommand \scriptstyleScaleFactor{.83} *** (cannot \read from terminal in nonstop modes)`

    – Pitaya88 Sep 10 '21 at 14:32
  • @Pitaya88 That error seems to be associated with not understanding the existence of the scalerel package. Normally, \usepackage{scalerel} would be sufficient to trigger it's loading. However, I do not use overleaf and so am of limited assistance on such things. – Steven B. Segletes Sep 10 '21 at 14:34
  • I understand, thank you for your help. @Steven B. Segletes – Pitaya88 Sep 10 '21 at 14:41
2

I did with \usepackage{MnSymbol}:

\documentclass{beamer}
\usepackage{tgheros}
\usepackage{mathastext}
\usepackage{MnSymbol}
%
\makeatletter
\mathchardef\standardplus=\mathcode`+
\DeclareRobustCommand{\tauyecoplus}{%
  \mathbin{\mathpalette\tauyeco@plus\relax}%
}
\newcommand{\tauyeco@plus}[2]{
  \raisebox{-0.05\height}{\scalebox{1.4}{\hspace{-0.1mm}$\m@th#1\standardplus$}}%
}
\begingroup\lccode`~=`+ \lowercase{\endgroup\let~}\tauyecoplus
\AtBeginDocument{\mathcode`+="8000 }
\makeatother
%
\begin{document}
$$+$$
\end{document}

enter image description here

cufcuf
  • 594