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.

For an equation that has an array we use \\ for new row as well, and \newline didn't work, and this is understood by the tabular environment as a new row! Would appreciate all the help!

share|improve this question
    
Welcome to TeX.SX! It would be good if you would show the code of this equation, so we can help to fix it. –  Stefan Kottwitz May 25 '11 at 16:54
    
\begin{tabular}{p{10em }p{4em }} $\mathbf{P} = \left[ \begin{array}{cc} 1 - \alpha & \alpha \\beta & 1 - \beta \end{array} \right]$ & –  emy May 25 '11 at 16:59
    
You can edit your question to add the source code. Please indent it by 4 spaces or use the '101010' button to format it as code. –  Martin Scharrer May 25 '11 at 17:13
    
Try to wrap the whole array inside braces { } and see if it helps. –  Martin Scharrer May 25 '11 at 17:13
    
An array environment should be in math mode, so surround it with $ signs. –  egreg Jun 18 '11 at 22:09
show 1 more comment

3 Answers

With regard to the code snippet you provided in a comment: Yes, this array may be put into a cell of a tabular environment, and no, \newline is not understood as a new row inside a p column.

\documentclass{article}

\begin{document}

\begin{tabular}{p{10em}p{4em}}
A & Bla\newline bla \\
\( \mathbf{P} = \left[ \begin{array}{cc} 1 - \alpha & \alpha \\ \beta & 1 - \beta \end{array} \right] \) & D
\end{tabular}

\end{document}
share|improve this answer
add comment

For smaller (single column) inclusions of an array/tabular-style object in your table, you may also consider using the the makecell package in the following way:

\documentclass{minimal}
\usepackage{makecell}
\begin{document}
  \begin{tabular}{ccc}
    A & B & C \\
    D & \makecell[c]{$E$ \\ F} & G \\
    H & I & J
  \end{tabular}
\end{document}
share|improve this answer
add comment

Use minipage:

\documentclass{article}
\begin{document}
\begin{tabular}{p{10em }p{4em }} 
  \begin{minipage}{10em} %%
    \begin{math} %%
      \mathbf{P} = \left[ \begin{array}{cc} %%
          1 - \alpha & \alpha \\ %%
          \beta & 1 - \beta %%
        \end{array} \right] %%
    \end{math} %%
  \end{minipage} & \it table \\
  \it table & \it table
\end{tabular}
\end{document}
share|improve this answer
2  
Why the minipage? Your code works without it. Also, you should use \itshape instead of \it. –  Gonzalo Medina Jun 15 '11 at 19:57
    
minipage is my goto for solving these kinds of problems. Good to know it's not absolutely necessary. –  Justin Bailey Jun 15 '11 at 20:09
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.