# Remove the spaces between \times in mathmode

My problem seems rather simple but I can't manage it. I want to describe bytes in this way

0000 xxxx
0010 1xxx


I tried by writing

0000 \times\times\times\times
0010 1\times\times\times


but this gave me too much spaces between the crosses (something like :

0000 x x x x
0010 1 x x x


I removed some spaces by doing like here (Removing spaces between "words" in math mode)

0000 {\times}{\times}{\times}{\times}


but this is not enough... Do you have any idea on how to do so?

\documentclass[a4paper,titlepage]{article}
\usepackage{mathtools}
\usepackage{amssymb, scalerel}

\begin{document}
I want the bytes $0000\;1{\times}{\times}{\times}$ to express an error in my algorithm.
\end{document}

• You shouldn't use \times as a placeholder like that. – jub0bs Mar 23 '14 at 16:18
• Can you add a minimal example from \documentclass to \end{document}? – egreg Mar 23 '14 at 16:19
• What about using some mono spaced font: \texttt{000 xxx}? – Sigur Mar 23 '14 at 16:22
• @Sigur I'm satisfied with this solution for now... But the x is not really a cross, which does not really solve my problem. Thanks anyway! – mwoua Mar 23 '14 at 16:27
• @mwoua, so change the font. See my answer. – Sigur Mar 23 '14 at 16:28

The symbol \times has rather wide sidebearings. I propose two solutions:

1. a reduced size symbol that occupies the same horizontal space as a digit;

2. the \times symbol at its natural width, with reduced sidebearings

\documentclass[a4paper]{article}

\newcommand{\plh}{%
{\ooalign{$\phantom{0}$\cr\hidewidth$\scriptstyle\times$\cr}}%
}
\newcommand{\PLH}{{\mkern-2mu\times\mkern-2mu}}

\begin{document}
I want the bytes $0000\;1\plh\plh\plh$ to express an error in my algorithm.

I want the bytes $0000\;1\PLH\PLH\PLH$ to express an error in my algorithm.
\end{document}


• Can I renewcommand \times? – Hotschke May 23 '18 at 11:03
• @Hotschke You could, but why? – egreg May 23 '18 at 12:24
• I have a densely packed table with math entries which I need to squeeze together. My first naive attempt using your answer by replacing \newcommcand{\plh} with \renewcommand{\times} did not work. However, I already resolved this with \setlength{\medmuskip}{0mu}. I was afraid that this would have too many side effects. – Hotschke May 23 '18 at 12:53
• @Hotschke That setting has many side effects if you don't control precisely the environment where you issue it. – egreg May 23 '18 at 13:15
\documentclass{article}
\begin{document}
I want the bytes $0000\;1{\times}{\times}{\times}$ to express an error in my algorithm.

I want the bytes \texttt{0000 1xxx} to express an error in my algorithm.

I want the bytes \textsf{0000 1xxx} to express an error in my algorithm.

\end{document}


• Event if I don't think it answers correctly my question, I will use your solutions. It looks better in my work. Thanks! – mwoua Mar 23 '14 at 16:33

What do you think of using mathsf?

    \documentclass[a4paper,titlepage]{article}
\usepackage{mathtools}
\usepackage{amssymb, scalerel}

\newcommand*{\x}{\mathsf{x}\mskip1mu}

\begin{document}

I want the bytes $0000\;1\x\x\x$ to express an error in my algorithm.

\end{document}


• It's quite nice too! – mwoua Mar 23 '14 at 17:48

You can use negative spaces \!, or \!\! if one is not enough, which gives:

\documentclass[a4paper,titlepage]{article}
\usepackage{mathtools}
\usepackage{amssymb, scalerel}

\begin{document}
I want the bytes $0000\;1\times\!\!\times\!\times$ to express an error in my algorithm.
\end{document}

• Did you try with three \times? – egreg Mar 23 '14 at 16:33
• Yes I do. It works too. You may refer to that question if you want to use more complex negative spacings: tex.stackexchange.com/questions/67912/large-negative-spaces. – Spin Mar 23 '14 at 16:36
• @egreg, good question! – Sigur Mar 23 '14 at 16:36
• Hum, sorry, this isn't working with 3 \times. But this does: $0000\;1\times\!\!\times\!\times$. – Spin Mar 23 '14 at 16:38
• Yep, I figured this out... It's not a very good idea to use this symbol in that kind of situation. – Spin Mar 23 '14 at 16:40