7

I'd like to create a matrix that has some positive power and negative power. I'd like to have an alignment to right, so for example:

\begin{array}{rr}
   3 \times 10^3 & 2 \times 10^3 \\
   3 \times 10^{-3} & 2 \times 10{-3}
\end{array}

In this case, the column alignment isn't good, because the negative sign at the exponent takes a little space, so the numbers aren't aligned. How can I fix this? (I think I should add a little space at the positive power too)

Then...is want to create 3 matrices in the page that should result aligned, indipendently from the values they have. For example if I write the previous matrix and then this:

  \begin{array}{rr}
      0 & 0 \\
      0 & 1 
  \end{array}

they won't be aligned because the second is smaller than the first. Is there a way to set a fixed size to both matrices?

2
  • Besides the problem in the question, the given code example is not correct. The column formatting specifiers have to be within a mandatory argument instead of an optional one: \begin{array}{rr}.
    – Stefan Kottwitz
    Jan 8, 2011 at 17:09
  • Yes, you are right. I made a mistake reporting the code..
    – user2835
    Jan 8, 2011 at 17:13

2 Answers 2

7
\documentclass{article}
\usepackage{siunitx}
\begin{document}

\begin{tabular}{S[table-format=2e-1]S[table-format=2e-1]}
       3e3  &  2e3 \\
       3e-3 & 12e-3
\end{tabular}

\end{document}

alt text

1

For matrices you could use one of the matrix environments of amsmath.

With array, you could use more columns for finer alignment. For example:

\documentclass{article}
\begin{document}
\[
    \begin{array}{r@{}rr@{}r}
       3 \times {} & 10^3    &  2 \times {} & 10^3 \\
       3 \times {} & 10^{-3} & 12 \times {} & 10^{-3}
    \end{array}
\]
\end{document}

alt text

You could even put \times into @{} to be aligned between columns.

You must log in to answer this question.

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