8

I am trying to make a symbol for a "twisted product". I've tried stackrel:

$A \mathbin{\stackrel{\sim}{\times}} B$

but the sim floats too high above the times, causing unpleasant line spacing. I've also tried widetilde

$A \mathbin{\widetilde{\times}} B$ 

but it has the same problem. Ideally I'd like the tilde to have the same width as the times and for the spacing between the two to be pretty tight.

Sam Nead
  • 1,051

4 Answers4

11

Detexify didn't help, so maybe you really have to do it yourself:

\newcommand\simtimes{\mathbin{%
    \stackrel{\sim}{\smash{\times}\rule{0pt}{0.9ex}}%
    }}

Adjust the 0.9ex to your needs.

Hendrik Vogt
  • 37,935
4

The parameters 0.7 and 0.3 might be needed adjustment if used with different fonts.

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

% a general purpose macro
\newcommand{\xmathpalette}[2]{\mathchoice
  {#1\displaystyle\textfont{#2}}%
  {#1\textstyle\textfont{#2}}%
  {#1\scriptstyle\scriptfont{#2}}%
  {#1\scriptscriptstyle\scriptscriptfont{#2}}%
}

\makeatletter
\newcommand{\twistedproduct}{%
  \mathbin{\xmathpalette\twisted@product\relax}%
}

\newcommand{\twisted@product}[3]{%
  \vbox{%
    \ialign{\hfil##\hfil\cr
      \scalebox{0.7}{$\m@th#1\sim$}\cr
      \noalign{\nointerlineskip\kern-0.3\fontdimen5 #2 2}
      $\m@th#1\times$\cr
    }%
  }%
}
\makeatother

\begin{document}

$S^2\twistedproduct S^2$ $X_{\twistedproduct_{\twistedproduct}}$

\end{document}

The macro \xmathpalette is an extension of \mathpalette that makes also the font in the current style (\textfont, \scriptfont or \scriptscriptfont). In this case we use it to access the x-height of the symbol font for the current style.

enter image description here

egreg
  • 1,121,712
2

For slightly improved spacing displayed and inline, you can use \ooalign. The code is

\newcommand{\twprod}{\mathbin{%
    \ooalign{\raise1.15ex\hbox{$\scriptstyle\sim$}\cr\hidewidth$\times$\hidewidth\cr}%
    }}

enter image description here

If you will ever use the symbol in a subscript or superscript, \mathchoice allows for greatly improved spacing in scriptstyle. The height of the \sim is easily adjustable by changing the 1.15ex for display and inline, .85ex for script and (though I can't imagine using it) .65ex for scriptscript.

\documentclass{article}

\newcommand{\twprod}{\mathbin{\mathchoice%
    {\ooalign{\raise1.15ex\hbox{$\scriptstyle\sim$}\cr\hidewidth$\times$\hidewidth\cr}}%
    {\ooalign{\raise1.15ex\hbox{$\scriptstyle\sim$}\cr\hidewidth$\times$\hidewidth\cr}}%
    {\ooalign{\raise.85ex\hbox{$\scriptscriptstyle\sim$}\cr\hidewidth$\scriptstyle\times$\hidewidth\cr}}%
    {\ooalign{\raise.65ex\hbox{$\scriptscriptstyle\sim$}\cr\hidewidth$\scriptscriptstyle\times$\hidewidth\cr}}%   
    }}

\begin{document}

$S^2\twprod S^2\quad F_{S^2\twprod S^2}$

\end{document}
Sandy G
  • 42,558
2

As shown, \ttimes has the same spacing as \times. It adjusts automatically to the math style.

\documentclass{article}
\usepackage{stackengine,scalerel}
\newcommand\ttimes{\mathbin{\ThisStyle{\ensurestackMath{%
  \stackengine{-1\LMpt}{\SavedStyle\times}
  {\SavedStyle_{\hstretch{.9}{\mkern1mu\sim}}}{O}{c}{F}{T}{S}}}}}
\begin{document}
$ A\ttimes C$\par
$ A\times C$\par
$ \scriptstyle A\ttimes C$\par
$ \scriptstyle A\times C$\par
$ \scriptscriptstyle A\ttimes C$\par
$ \scriptscriptstyle A\times C$\par
\end{document}

enter image description here