4

I want to define a custom slanted parallel symbol, approximately like this: // $\mathrel{/ \negmedspace /}$. The approach is to input two /, followed by a command like \! to reduce the spacing. What should the spacing be? I want this parallel symbol to have the same width as the perpendicular symbol \perp, so that they align well when appearing together in text. Through testing, I found that using \negmedspace under the default font spacing looks appropriate, almost indistinguishable to the naked eye. However, when changing fonts, the difference becomes noticeable. How can I set the spacing to make the custom symbol the same width as \perp?


Looks like

\documentclass{article}

\begin{document}

\newcommand\px{\mathrel{%
{\ooalign{$\phantom\perp\vphantom/$\cr\hidewidth$/\!\!/$\hidewidth\cr}}}}

\noindent 
$
A \px B
\\
A \perp B
\\
A // B
\\
A \mathrel{/ \negmedspace /} B
$

\end{document}

enter image description here

7
  • 1
    Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}.
    – DG'
    Commented May 25 at 13:27
  • 1
    Package frenchmath` provides a \paral command, \newcommand\paral{\mathrel{\ooalign{$\mkern-1.75mu/\mkern1.75mu$\cr$\mkern1.75mu/\mkern-1.75mu$}}}
    – user691586
    Commented May 25 at 15:26
  • 1
    @user691586 \ooalign is not the right tool for the job.
    – egreg
    Commented May 25 at 15:36
  • 1
    @egreg this may have to be reported to frenchmath maintainer.
    – user691586
    Commented May 25 at 15:44
  • @user691586 I'm sorry to say that frenchmath is just a collection of badly written macros.
    – egreg
    Commented May 25 at 20:12

2 Answers 2

5

This approach should work regardless of the math font. However, this simple version will not work in the smaller script styles. If that is an issue, please see the modified approach further down.

\documentclass{article}
\usepackage{amsmath}
\newlength\mykern
\sbox0{$\perp$}
\sbox2{$/$}
\setlength\mykern{\dimexpr\wd2+\wd2-\wd0}
\newcommand\mysym{\mathrel{/\kern-\mykern/}}
\begin{document}
$\Delta \perp \Delta \perp \Delta$

$\Delta \mysym \Delta \mysym \Delta$
\end{document}

enter image description here

Here is an approach that will capture the smaller script styles, as well:

\documentclass{article}
\usepackage{amsmath,scalerel}
\newlength\mykern
\newcommand\mysym{\mathrel{\ThisStyle{%
  \sbox0{$\SavedStyle\perp$}%
  \sbox2{$\SavedStyle/$}%
  \setlength\mykern{\dimexpr\wd2+\wd2-\wd0}%
  /\kern-\mykern/}%
}}
\begin{document}
$\Delta \perp \Delta \perp \Delta$

$\Delta \mysym \Delta \mysym \Delta$

$\scriptscriptstyle\Delta \perp \Delta \perp \Delta$

$\scriptscriptstyle\Delta \mysym \Delta \mysym \Delta$
\end{document}

enter image description here

4

The idea is to measure \perp in the current math style; however, one has to take into account the side bearing of the symbol.

\documentclass{article}
\usepackage{amsmath}

\makeatletter
\NewDocumentCommand{\sparallel}{}{\mathrel{\mathpalette\sparallel@\relax}}

\newcommand{\sparallel@}[2]{%
  \begingroup
  \settowidth{\dimen@}{$\m@th#1\perp$}%
  \makebox[\dimen@][s]{$\m@th#1\mkern0.5mu/\hss/\mkern0.5mu$}%
  \endgroup
}
\makeatother

\begin{document}

$A\perp B$

$A\sparallel B$

$\scriptstyle A\perp B$

$\scriptstyle A\sparallel B$

\end{document}

enter image description here

The alternative without \mkern1mu (on either side) is less appealing, in my opinion.

enter image description here

1

You must log in to answer this question.

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