Closer slanted parallel symbol

Looking the @egreg's answer where I have deleted some parts of code

\documentclass[12pt]{article}
\newcommand{\parallelsum}{\mathbin{\!/\mkern-5mu/\!}}
\begin{document}
$AB \parallelsum CD$
\end{document}


I would to change the classical symbol of \parallel

to obtain another same symbol of parallel

where the slanted should not be above and below the two red lines, are closer to each other and are in line with the text, in mathematical mode in both subscript and overscript mode. If there's already a symbol like this I'm searching for even better for me.

2 Answers

Raise and scale.

\documentclass{article}
\usepackage{amsmath,graphicx}

\makeatletter
\newcommand{\newparallel}{\mathrel{\mathpalette\new@parallel\relax}}
\newcommand{\new@parallel}[2]{%
\begingroup
\sbox\z@{$#1T$}% get the height of an uppercase letter
\resizebox{!}{\ht\z@}{\raisebox{\depth}{$\m@th#1/\mkern-5mu/$}}%
\endgroup
}
\makeatother

\begin{document}

$AB\newparallel CD$

$\scriptstyle AB\newparallel CD$

\end{document}


A different implementation with picture mode. One can easily vary the slope by acting on the second argument to \mathpalette.

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

\makeatletter
\newcommand{\newparallel}{\mathrel{\mathpalette\new@parallel{0.3}}}
\newcommand{\new@parallel}[2]{%
\begingroup
\settoheight{\unitlength}{$#1T$}% get the height of an uppercase letter
\sbox\z@{\new@parallel@slash{#1}{#2}}%
\mkern0.5mu\copy\z@\mkern-0.5mu\copy\z@\mkern0.5mu
\endgroup
}
\newcommand{\new@parallel@slash}[2]{%
\begin{picture}(#2,1)
\roundcap
\new@parallel@linethickness{#1}
\Line(0,0)(#2,1)
\end{picture}%
}
\newcommand{\new@parallel@linethickness}[1]{%
\linethickness{%
\ifx#1\displaystyle \fontdimen8\textfont\else
\ifx#1\textstyle \fontdimen8\textfont\else
\ifx#1\scriptstyle \fontdimen8\scriptfont\else
1.1\fontdimen8\scriptscriptfont\fi\fi\fi 3
}%
}
\makeatother

\begin{document}

$AB\newparallel CD$ ${\newparallel}/$

$\scriptstyle AB\newparallel CD$ $\scriptstyle{\newparallel}/$

$\scriptscriptstyle AB\newparallel CD$ $\scriptscriptstyle{\newparallel}/$

{\Large$AB\newparallel CD$ ${\newparallel}/$}

\end{document}


This is for Computer Modern fonts; for different fonts, \roundcap might be omitted. In the example I show the standard slash to compare the line thickness.

• Always my infinite...."grazie di cuore". But if you put this simbol as subscript _ or as exponent is the same the measure? – Sebastiano Sep 11 '19 at 22:18
• Wouldn't it be better to keep the aspect of the symbol, and also increase the line widths back to normal? – user194703 Sep 11 '19 at 22:33
• @Schrödinger'scat Possibly. No time now: with pict2e it should be possible. – egreg Sep 11 '19 at 22:39
• @Sebastiano The symbol scales correctly in subscripts/superscripts. I added a different implementation. – egreg Sep 12 '19 at 8:09
• @egreg Impressive your work. Using newtxtext as text which code should I use the second maybe? Always thank you. – Sebastiano Sep 12 '19 at 14:51

A solution with stmaryrd and \clipbox:

\documentclass[12pt]{article}
\usepackage{adjustbox}
\usepackage{stmaryrd}

\newcommand{\mysslash}{\mathrel{\mkern-5mu\clipbox{0 0.75ex 0 0}{${\sslash}$}\!}}

\begin{document}

$AB\mysslash CD$

\end{document}


• Try $\scriptstyle AB\mysslash CD$. – user194703 Sep 11 '19 at 23:28
• It's of course designed for \display or \textstyle. For the other cases, one should recompute the clipping and use \mathpalette. – Bernard Sep 11 '19 at 23:38