5

The package stmaryrd defines two symbols \varoslash and \varobslash which resemble the "circled division slash" ⊘ and an similar backslash.

However, when mixing these circled slashes and regular slashes /, \, the differences in size and angle makes the formulas look weird.

What is the easiest way for me to get slashes which are similar to these slashes in their size and angle, but don't have the circle?

3

You can get round caps using picture mode:

\documentclass{article}
\usepackage{amsmath,stmaryrd,pict2e,picture}

\newcommand{\varbslash}{%
  \mathbin{\mathpalette\pictvarbslash\relax}%
}

\newcommand{\pictvarbslash}[2]{%
  \vcenter{\hbox{%
    \sbox0{$#1\varobslash$}\dimen0=.55\wd0
    \begin{picture}(\dimen0,\dimen0)
    \roundcap
    \put(0,\dimen0){\line(1,-1){\dimen0}}
    \end{picture}%
  }}%
}

\begin{document}
$\varobslash\varbslash_{\varobslash\varbslash}$
\end{document}

enter image description here

Here's an expanded version with \varslash

\documentclass{article}
\usepackage{amsmath,stmaryrd,pict2e,picture}

\newcommand{\varslash}{%
  \mathbin{\mathpalette\pictslash{{0}{1}}}%
}
\newcommand{\varbslash}{%
  \mathbin{\mathpalette\pictslash{{1}{-1}}}%
}

\makeatletter
\newcommand{\pictslash}[2]{%
  \vcenter{\hbox{%
    \sbox0{$\m@th#1\varobslash$}\dimen0=.55\wd0
    \pictslash@aux#2%
  }}%
}
\newcommand{\pictslash@aux}[2]{%
    \begin{picture}(\dimen0,\dimen0)
    \roundcap
    \put(0,#1\dimen0){\line(1,#2){\dimen0}}
    \end{picture}%
}
\makeatother

\begin{document}

$\varobslash\varbslash_{\varobslash\varbslash}$

$\varoslash\varslash_{\varoslash\varslash}$

\end{document}

enter image description here

Another variant where the new symbols occupy the same space as the corresponding circled ones:

\documentclass{article}
\usepackage{amsmath,stmaryrd,pict2e,picture}

\newcommand{\varslash}{%
  \mathbin{\mathpalette\pictslash{{0}{1}}}%
}
\newcommand{\varbslash}{%
  \mathbin{\mathpalette\pictslash{{1}{-1}}}%
}

\makeatletter
\newcommand{\pictslash}[2]{%
  \vcenter{%
    \sbox0{$\m@th#1\varobslash$}\dimen0=.55\wd0
    \hbox to\wd 0{%
      \hfil\pictslash@aux#2\hfil
    }%
  }%
}
\newcommand{\pictslash@aux}[2]{%
    \begin{picture}(\dimen0,\dimen0)
    \roundcap
    \put(0,#1\dimen0){\line(1,#2){\dimen0}}
    \end{picture}%
}
\makeatother

\begin{document}

$\varobslash\varobslash_{\varobslash\varobslash}$

$\varobslash\varbslash_{\varobslash\varbslash}$

$\varoslash\varslash_{\varoslash\varslash}$

\end{document}

enter image description here

  • I'm guessing the slash shouldn't be too different--moving the origin back to 0, changing the line's direction vector. However, could you perhaps explain what you're using the original, circled character for? And what the meaning of the variables dimen0 and wd0 are? – wen Mar 26 '15 at 12:32
  • And is there, using those variables, some way I can make varslash and varbslash's bounding boxes be the same as those for varoslash and varobslash--i.e. make them take up as much space without making the actual characters bigger? – wen Mar 26 '15 at 12:44
  • I measure the diameter of \varobslash which is available as \wd0 (because it was in box register 0); then the scratch length parameter \dimen0 is set to 55% of the width. I'll add also the variant for the increased space. – egreg Mar 26 '15 at 12:55
3

I'm not sure what math class you would like these symbols to be, so I did not assign that. But you could add \mathbin, \mathop, etc. to the definition to suit.

I have EDITED the answer to let them operate inside of sub/super-scripts.

I have RE-EDITED to make the rules rounded, using my roundrule.sty package found only at Is there such a thing as a `\mathrule`? (rounded endcaps), which provides a drop-in replacement for \rule called \roundrule, giving rounded end-caps.

\documentclass{article}
\usepackage{stmaryrd,graphicx,scalerel,roundrule}
\def\varslash{\ThisStyle{\rotatebox{48}{\roundrule{1.4\LMex}{.1\LMex}}}}
\def\varbslash{\ThisStyle{\rotatebox[origin=right]{-48}{\roundrule{1.4\LMex}{.1\LMex}}}}
\begin{document}
${\varoslash} {\varslash} {\varobslash} {\varbslash}$\par
\LARGE${\varoslash} {\varslash} {\varobslash} {\varbslash}$\par
$x_{{\varoslash} {\varslash} {\varobslash} {\varbslash}}$\par
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.