3

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

  • Welcome to TeX.SX! Go with only one $. – Henri Menke Apr 6 '14 at 18:51
  • I tried to use 1 $, that also didnt help. – user3201911 Apr 6 '14 at 18:53
  • Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – jub0bs Apr 6 '14 at 19:02
  • Great tip, I didnt even thought about that ! I will do so the next time :) – user3201911 Apr 6 '14 at 19:04
7

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

3

Let's consider your title's topic with a little more challenging input with integrals. I find Andrew's \eqbreak in \begin{aligned} ... \end{aligned} in table as a more configurable option here. Your table goes well with Henri's example but if you get integrals and other challenging operators eqbreak is useful. Changes

  • no booktabs with vertical lines [Zarko]
  • Andrew's \eqbreak for challenging operators etc integrals
  • \bgroup\def\arraystretch{1.5} ... \egroup for more space in cells
  • Explicitly \begin{aligned}...\end{aligned} [Andrew2]

Your example with integrals

\documentclass[english]{article}
\pagestyle{empty}% for cropping
\usepackage{amsmath, amsfonts,rotating}
\usepackage{physics}
% http://tex.stackexchange.com/a/139450/13173
% http://tex.stackexchange.com/a/324197/13173
\newcommand{\eqbreak}[1][2]{\\&\hskip#1em}
\begin{document}
\bgroup
\def\arraystretch{1.5}%  1 is the default, change whatever you need
\begin{tabular}{| l | p{0.7\linewidth} |}
    \hline
    Hardware & Rekensom \\ \hline
    6506E &
    $\begin{aligned}
        1 - (1 - 0.9999909)^2 \eqbreak[-2] \times \int\limits_{-\infty}^{+\infty} A x \cdot \int\limits_{-\infty}^{+\infty} B y \times Z \alpha \, \text{dy} \, \text{dx} \\ &= 0.99999999991 \cdot 100\,\% \\
        &= 99.9999999917\,\%
    \end{aligned}$ \\ \hline
    6509E &
    $\begin{aligned}
        1 - (1 - 0.9999885)^2 &= 0.99999999986 \cdot 100\,\% \\
        &= 99.9999999868\,\%
    \end{aligned}$ \\ \hline
\end{tabular}
\egroup
\end{document}

Output

enter image description here

Limitations

  • no known
  • 1
    nice solution (+1), however, never mix booktabs rules with vertical lines: result is ugly. Also instead your interesting macro might to be better to use multline environment from asmamth/mathtool package (just my opinion). – Zarko Aug 10 '16 at 12:38
  • @Zarko Please, feel free to show us how you can do the thing with multiline and amsmath/mathtool. – Léo Léopold Hertz 준영 Aug 10 '16 at 12:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.