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.

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?

share|improve this question
    
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 '11 at 17:09
    
Yes, you are right. I made a mistake reporting the code.. –  user2835 Jan 8 '11 at 17:13
add comment

2 Answers

\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

share|improve this answer
add comment

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.

share|improve this answer
add comment

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.