For example, let's say I wanted to make this diagram of a board in the game 2048:

$$ \begin{array}{|r|r|} \hline 1024 & \color{white}{0}512 & \color{white}{00}16 & \color{white}{000}2 \\ \hline 2 & 2 & 4 & 2 \\ \end{array} \\ \text{(etc.)} $$

Here's the source for the first row:

1024 & \color{white}{0}512 & \color{white}{00}16 & \color{white}{000}2 \\

As you can see, it's very hacky, and coloring the zeroes white isn't the best solution since it won't work on sites with different backgrounds. (It's also extremely limited, and only works for purely numbers in the cells.)

Is there any way I could make these columns the same width, without having to add ugly invisible zeroes?

  • $\begingroup$ You can use \phantom to make white space of a particular width, but it's not much less hacky than what you've done already. $\endgroup$ – Peter Phipps May 21 '14 at 13:06
  • 7
    $\begingroup$ \phantom{whatever} is a better hack than \color{white}{whatever}. Imagine you highlight the text. $\endgroup$ – user1551 May 21 '14 at 13:56
  • $\begingroup$ I know TeX lets you specify a template for each column; if that is supported here you could use \hphantom{0000} as the template. But I don't know if it is supported here. $\endgroup$ – MJD May 21 '14 at 20:16
  • $\begingroup$ Interesting question. This is hard in TeX but trivial in MathML -- <mtable> comes with an equalcolumns attribute. You could file a feature request at MathJax's github tracker; not sure how we'd integrate it but it seems an interesting question. $\endgroup$ – Peter Krautzberger May 23 '14 at 13:10

You must log in to answer this question.

Browse other questions tagged .