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.

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?

I add here a MWE, as asked by some.

\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}
share|improve this question
2  
You shouldn't use \times as a placeholder like that. –  Jubobs Mar 23 at 16:18
    
Can you add a minimal example from \documentclass to \end{document}? –  egreg Mar 23 at 16:19
2  
What about using some mono spaced font: \texttt{000 xxx}? –  Sigur Mar 23 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 at 16:27
    
@mwoua, so change the font. See my answer. –  Sigur Mar 23 at 16:28

4 Answers 4

up vote 7 down vote accepted

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}

enter image description here

share|improve this answer
\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}

enter image description here

share|improve this answer
    
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 at 16:33
    
@mwoua, you're welcome. –  Sigur Mar 23 at 16:37

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} 

enter image description here

share|improve this answer
    
It's quite nice too! –  mwoua Mar 23 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}
share|improve this answer
3  
Did you try with three \times? –  egreg Mar 23 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 at 16:36
    
@egreg, good question! –  Sigur Mar 23 at 16:36
    
Hum, sorry, this isn't working with 3 \times. But this does: $0000\;1\times\!\!\times\!\times$. –  Spin Mar 23 at 16:38
1  
Yep, I figured this out... It's not a very good idea to use this symbol in that kind of situation. –  Spin Mar 23 at 16:40

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.