Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I would like to find or create a math relation symbol that resembles a division sign, except that the horizontal bar would instead be a tilde (\sim). Can anyone help with this?

share|improve this question
    
Just to go safe: Did you search already in How to look up a symbol or identify a math alphabet? –  Speravir Mar 6 at 3:33
    
yes, and failed. –  Bob Harper Mar 6 at 3:36
    
I am not an expert for math mode. In text mode something should be possible with kerning, perhaps also \sim and \colon? Let’s wait for our TeXperts. –  Speravir Mar 6 at 3:46
3  
this looks to me a lot like unicode U+223B (homothetic); there's also U+2A6B (tilde operator with rising dots). these would be in the stix or xits fonts. –  barbara beeton Mar 6 at 21:38
    
@barbarabeeton: Yes, it is the “Homothetic”. It is also in other Open-/Truetype fonts included. –  Speravir Mar 6 at 21:55
show 1 more comment

4 Answers 4

up vote 13 down vote accepted

Here, I build a generic form with stacks, and then use scalerel package's

\ThisStyle{...\SavedStyle...}

and \mathchoice to make it work for the various mathstyles. The optional arguments to \genericform are the distances the under and over dots are vertically shifted. They can be tweaked to suit.

\documentclass{article}
\usepackage{stackengine}
\usepackage{graphicx}
\usepackage{scalerel}
\stackMath
\def\ccdot{\scalebox{1.15}{$\SavedStyle\cdot$}}
\def\genericform#1#2{\stackunder[#1]{\stackon[#2]{\SavedStyle\sim}{\ccdot}}{\ccdot}}
\def\altdiv{\mathbin{\ThisStyle{\mathchoice%
  {\genericform{-2.5pt}{-1.5pt}}%
  {\genericform{-2.5pt}{-1.5pt}}%
  {\genericform{-2.0pt}{-1.1pt}}%
  {\genericform{-1.4pt}{-0.8pt}}%
}}}
\begin{document}
$A \altdiv B ~~A \div B$\par
$\scriptstyle A \altdiv B ~~A \div B$\par
$\scriptscriptstyle A \altdiv B ~~A \div B$\par
\end{document}

enter image description here


Note: Modifications to scalerel package discussed below have been implemented into scalerel V1.6 (10 MAR 2014). New lengths that scale with the mathstyle, inside of \ThisStyle{}, are available as \LMex and \LMpt.

This answer got me thinking about an improvement to my scalerel package. In particular, the \ThisStyle{...\SavedStyle...} syntax allows me to access glyphs in the current mathstyle (because it internally performs a \mathchoice), but my answer above still requires an additional \mathchoice because lengths (even scalable ones like "ex") do not scale with the current mathstyle.

What I need is for \ThisStyle{} to additionally create a length that does scale with the current math style. So I do that below, and call it \LMex (Local Mathstyle "ex"). It is 1ex in \displaystyle and \textsstyle, 0.7ex in \scriptstyle and 0.5ex in \scriptscriptstyle (inside the argument of \ThisStyle).

In so doing, I can avoid an inefficient nesting of \mathchoicees and avoid the use of my \genericform altogether, if I express the length shifts of my stack in terms of multiples of \LMex.

\documentclass{article}
\usepackage{stackengine}
\usepackage{graphicx}
\usepackage{scalerel}
\stackMath
%%%%% scalerel MODIFICATION
\makeatletter
\newlength\LMex
\renewcommand\ThisStyle[1]{%
  \ifmmode%
    \def\@mmode{T}\mathchoice%
      {\edef\m@switch{D}\LMex=1ex\relax#1}%
      {\edef\m@switch{T}\LMex=1ex\relax#1}%
      {\edef\m@switch{S}\LMex=.7ex\relax#1}%
      {\edef\m@switch{s}\LMex=.5ex\relax#1}%
  \else%
    \def\@mmode{F}%
    \edef\m@switch{T}#1%
  \fi%
}
\makeatother
%%%%% END scalerel MODIFICATION
\def\ccdot{\scalebox{1.15}{$\SavedStyle\cdot$}}
\def\altdiv{\mathbin{\ThisStyle{%
  \stackunder[-.6\LMex]{\stackon[-.45\LMex]{\SavedStyle\sim}{\ccdot}}{\ccdot}}}}
\begin{document}
$A \altdiv B ~~A \div B$\par
$\scriptstyle A \altdiv B ~~A \div B$\par
$\scriptscriptstyle A \altdiv B ~~A \div B$\par
\end{document}

enter image description here

share|improve this answer
1  
this worked beautifully, without having to change over all of my fonts. (i used the first version above.) –  Bob Harper Mar 7 at 4:48
add comment

The way of definition is ugly but, it works.

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

\newcommand{\mydiv}{%
  \mathbin{\text{%
    \mathsurround=0pt
    \ooalign{%
      \hidewidth\vphantom{$\div$}\raisebox{.95ex}{\scalebox{1.2}{.}}\hidewidth\cr
      $\sim$\cr
      \hidewidth\vphantom{$\div$}\raisebox{-.05ex}{\scalebox{1.2}{.}}\hidewidth\cr
    }%
  }}%
}
\begin{document}
  $A\mydiv B$ $A\div B$
\end{document}

enter image description here

share|improve this answer
14  
Wow, this is neat! Can I name this symbol? I'd go with \dancingdiv. :) Update: oh wait, there's a better one: \wibblywobblydivysymbol. :) –  Paulo Cereda Mar 6 at 11:31
add comment

The following example deals with the following issues:

  • The symbol automatically changes its size according to the current math style.
  • Correct bounding box.
  • The dots are centered around the math axis.

It makes the following assumptions:

  • \sim is centered around the math axis.
  • The dot is located right above the baseline.

It follows \div:

  • The dots are slightly larger, the example uses a scale factor of 1.15.
  • The lower dot is slightly below the baseline, the example puts the dot a quarter of its height below the baseline and shifts the upper dot by the same amount to the top.
\documentclass{article}

\usepackage{graphicx}

\makeatletter
\newcommand*{\mydiv}{%
  \mathbin{%
    \mathpalette\@mydiv{}%
  }%
}
% #1: math style
% #2: unused
\newcommand*{\@mydiv}[2]{%
  \sbox0{$#1\vcenter{}$}%
  \sbox2{\scalebox{1.15}{$#1.\m@th$}}%
  \sbox0{%
    \raisebox{-.25\ht2}{\rlap{\copy2}}%
    \raisebox{\dimexpr2\ht0-\ht2+.25\ht2\relax}{\copy2}%
  }%
  \sbox2{$#1\sim$}%
  \rlap{\copy2}%
  \hbox to \wd2{\hfil\copy0\hfil}%
}
\makeatother

\begin{document}
% Comparison
\[
  A \div B \mydiv C
\]
% Automatic adaptations to math style
\[
  A \mydiv B^{A \mydiv B^{A \mydiv B}}
\]
% Show bounding box
\[
  \setlength{\fboxsep}{0pt}
  \setlength{\fboxrule}{0.1pt}
  A \mathbin{\fbox{$\mydiv$}} B
\]
\end{document}

Result

share|improve this answer
add comment

this looks to me a lot like unicode U+223B (homothetic); there's also U+2A6B (tilde operator with rising dots). these would be in the stix or xits fonts.

Speravir confirms the identify of U+2238 and also points out in a comment that it is included in other opentype and truetype fonts (see below for his edit).

it's not found either in the comprehensive symbols list, or by detexify.

it's usually not desirable to replace entire fonts to make just one or two missing symbols available. that situation is addressed by this question: Importing a Single Symbol From a Different Font.


(Edit by Speravir after requested by Barbara, cf. comments)

Without trying to be complete I can confirm, that these Open- or Truetype fonts contain the symbol “Homothetic”:

Both already named by Barbara and included in TeX distributions. For the following I did not look, whether they are available as TeX package (actually I know for some of them, that they are).

share|improve this answer
    
you have found the right character, but i don't know how to use it without changing over all of my fonts, which i'd rather not do. –  Bob Harper Mar 7 at 4:51
    
@BobHarper -- i've added a link to a question that might be helpful. –  barbara beeton Mar 7 at 13:26
    
@Speravir -- please do add the names of the fonts you know contain this symbol, and thanks for the info. if you could also mention whether they require xetex/luatex, or have support for use with pdflatex, that would be a plus. –  barbara beeton Mar 7 at 13:29
    
@barbarabeeton: Only for DejaVu fonts a Type1 version is available, as far as I see. But I do not know, whether this version contains the symbol in question. –  Speravir Mar 8 at 0:13
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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