5

I'm writing a document with many numbers in scientific notation, with LuaTeX.
I don't like \cdot because it leaves too much white space on both sides of the number.
I don't like {\cdot} because it leaves too little space. Using \times creates a x too large.

I would like to redefine \times at the beginning of the document to change the behavior of all subsequent occurrences of that command, I would like to get a smaller "x" every time I type \times, and keep it at mid height.

How can I redefine the size of \times?
How can I also control the space on both sides of the "x" and the thickness of the symbol?

I know I could also use siunitx, but now it would be more difficult to modify all my tables without getting unexpected errors.

Original size

Size I need

I don't have the knowledge to figure out myself any solution but I have tried two things I've found googleing:

\usepackage{scalerel}
\newcommand\Times{\scaleobj{0.6}{\times}}


\usepackage{relsize}
\newcommand{\Times}{\mbox{\smaller$\times$}}

But they leave the "x" on the bottom and very thin.

enter image description here

3

3 Answers 3

3

I'd not do it. In any case I'd not redefine \times, but use a different name for the specific purpose.

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

\makeatletter
\let\skan@times\times
\DeclareRobustCommand{\rtimes}{% you may want to redefine \times, but don't
  \mathbin{%
    \nonscript\mspace{-0.75\medmuskip}%
    \mspace{1mu}\mathpalette\rtimes@\relax\mspace{1mu}%
    \nonscript\mspace{-0.75\medmuskip}%
  }%
}
\newcommand{\rtimes@}[2]{%
  \vcenter{\hbox{%
    \begingroup
    \settoheight{\unitlength}{$#1\skan@times$}%
    \setlength{\unitlength}{0.5\unitlength}%
    \begin{picture}(1,1)
    \roundcap
    \linethickness{1\getfontdimen{8}{#1}{3}}
    \Line(0,0)(1,1)\Line(1,0)(0,1)
    \end{picture}%
    \endgroup
  }}%
}
\newcommand{\getfontdimen}[3]{%
  \fontdimen#1
  \ifx#2\displaystyle\textfont\else
  \ifx#2\textstyle\textfont\else
  \ifx#2\scriptstyle\scriptfont\else
  \scriptscriptfont\fi\fi\fi #3%
}
\makeatother

\begin{document}

$5.12\times 10^{-49}$

$5.12\rtimes 10^{-49}$ $\scriptstyle5.12\rtimes 10^{-49}$

\num{5.12e-49}

\sisetup{exponent-product=\rtimes}

\num{5.12e-49}

\end{document}

enter image description here

This exploits that \times in Computer Modern is a very simple geometric shape with rounded caps. With other fonts it would be different.

You should consider typing in such numbers with siunitx that allows for a very simple syntax and doesn't require to explicitly mention the symbol for the operation, so you can change your mind anytime.

The control of the thickness is done by using the default thickness of the fraction line, which is stored in \fontdimen8 of the font in math group 3.

Note that \rtimes won't behave properly in every context (next to a parenthesis, for instance), but for your purpose it will.

1
  • OK, thanks. Maybe I'll try to change all my document to use \num. Though, this solution wouldn't work if I have $p=3.22\times 10^{-6}$, typically used to report p-values. How can I increase the "x" thickness with siunitx's \num?
    – skan
    Nov 29, 2020 at 20:18
4

This keeps the same line thickness, but shrinks it down to .6 scale. If you need this in smaller math styles, let me know.

\documentclass{article}
\usepackage{scalerel,stackengine}
\newcommand\shortminus{\ensuremath{\hstretch{0.6}{-}}}
\newcommand\Times{\mathbin{\!\rotatebox[origin=c]{45}{\stackinset{c}{}{c}{}{%
  \rotatebox[origin=c]{90}{\shortminus}}{\shortminus}}\!}}
\begin{document}
$5.12\times10^{-49}$

$5.12\Times10^{-49}$
\end{document}

enter image description here

3

You can play with scale, margin and raise to form a desired output.

\documentclass{article}
\usepackage{fontspec}
\usepackage{unicode-math}
\usepackage{amsmath}
\usepackage{adjustbox}


\setmainfont{TeX Gyre Termes}
\setmathfont[FakeBold=4.0, version=bold]{TeX Gyre Termes Math}
\setmathfont[version=default]{TeX Gyre Termes Math}


\begin{document}
% use default math font
\mathversion{default}

\let\oldtimes\times
\renewcommand{\times}{%
\adjustbox{scale=0.6, margin=-0.2pt, raise=0.4pt}{$\mathversion{bold}\boldsymbol{\oldtimes}$}%
}

$a \oldtimes b$

$a \times b$

\end{document}
2
  • It works but the new symbol is too thin. How can I make it thicker?
    – skan
    Nov 28, 2020 at 16:14
  • @skan Since you are using LuaTeX, let's assume OTF/TTF fonts are used. In this case, you can make use of the FakeBold option provided by fontspec and unicode-math to increase the thickness of symbols.
    – Alan Xiang
    Nov 28, 2020 at 22:47

You must log in to answer this question.

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