[Tex/LaTex] Math in a table

amsmathtables

Im trying to put some \times and \power in a table, but it isn't quite working.

\usepackage{mathtools}
\usepackage{amsmath}

\begin{tabular}{| p{3cm} | p{9cm} }
\hline
\bf hardware & \bf rekensom\\
\hline
6506E & 1 - (1 - 0.9999909)^2 = 0.99999999991 * 100% = 99.9999999917%\\
\hline
6509E & 1 - (1 - 0.9999885)^2 = 0.99999999986 * 100% = 99.9999999868%\\
\hline
\end {tabular}

I also tried this, but it didnt work either:

\hline
6506E &  $$ 1 - (1 - 0.9999909)\power2 = 0.99999999991 \times 100\% $$\\
\hline

The error it gives here is

Undefined control sequence

Best Answer

This should work. Please avoid \bf in favor of \textbf{...}.

\documentclass{article}
\pagestyle{empty}% for cropping
\begin{document}
\begin{tabular}{| p{3cm} | p{9cm} }
\hline
\textbf{hardware} & \textbf{rekensom} \\
\hline
6506E & $1 - (1 - 0.9999909)^2 = 0.99999999991 * 100\% = 99.9999999917\%$ \\
\hline
6509E & $1 - (1 - 0.9999885)^2 = 0.99999999986 * 100\% = 99.9999999868\%$ \\
\hline
\end {tabular}
\end{document}

enter image description here


Here, have a slightly enhanced version:

\documentclass{article}
\pagestyle{empty}% for cropping
\usepackage{amsmath,booktabs}
\begin{document}
\begin{tabular}{lp{0.7\linewidth}}
    \toprule
    Hardware & Rekensom \cr
    \midrule
    6506E &
    $\aligned
        1 - (1 - 0.9999909)^2 &= 0.99999999991 \cdot 100\,\% \\
        &= 99.9999999917\,\%
    \endaligned$ \cr
    6509E &
    $\aligned
        1 - (1 - 0.9999885)^2 &= 0.99999999986 \cdot 100\,\% \\
        &= 99.9999999868\,\%
    \endaligned$ \cr
    \bottomrule
\end {tabular}
\end{document}

enter image description here

Related Question