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 was curious if it was possible to create a matrix within a table? for example i wanted to create a 2 column table with left containing text and the right containing a matrix. Could someone tell me the syntax?

share|improve this question

2 Answers 2

up vote 4 down vote accepted

The suggested and generalized solution should be as follows. It has been used in my production. And vertical correction has been seriously taken into account for the sake of perfectness.

\documentclass[preview,border=12pt]{standalone}
\usepackage{amsmath}
\usepackage{array}
\usepackage{tikz}

\newcolumntype{A}[3]{%
    >{\minipage{\dimexpr#1\linewidth-#2\tabcolsep-#3\arrayrulewidth}\vspace\tabcolsep}%
    c
    <{\vspace\tabcolsep\endminipage}}



\def\correction#1{%
    \abovedisplayshortskip=#1\baselineskip\relax
    \belowdisplayshortskip=#1\baselineskip\relax
    \abovedisplayskip=#1\baselineskip\relax
    \belowdisplayskip=#1\baselineskip\relax
    }

\newcommand*\CL{\tabularnewline\hline}
\newcommand*\One{\[\int_a^b f(x)\,\textrm{d}x = F(b) - F(a)\]}
\newcommand*\Two{\[\lim_{x\to y} \frac{y^2-x^2}{y-x}\]}
\newcommand*\Three{\[\begin{pmatrix} a & b\\ c & d \end{pmatrix}\]}

\begin{document}
\begin{tabular}{|>{\centering}A{0.6}{2}{1.5}|>{\correction{-1}\strut}A{0.4}{2}{1.5}<{\strut}|}\hline
 Fundamental Theorem\\ of Calculus  & \One \CL
 Limit Function & \Two \CL
 \tikz \draw (2,1) circle (1) (1,1) -- (2,3) -- (3,0) -- cycle; & \Three \CL
\end{tabular}
\end{document}

enter image description here

Feel free to edit my answer if you think I did something that disobeys the best-practice protocols.

share|improve this answer
    
If you want to have a table than can be broken across pages, use longtable package instead. –  Who is crazy first Nov 7 '13 at 3:52

This is quite simple to do, but vertical spacing issues will quickly become a problem. The following example will work in a pinch, but if you search the site for "math in tables" you will find many questions regarding proper spacing of math inside a tabular environment. (Or see Marienplatz's answer. I've used the array package to create a column that is in mathmode.

\documentclass{article}
\usepackage{array}
\newcolumntype{C}{>{$}c<{$}} % centred math column
\begin{document}
\begin{tabular}{cC}
 This is an identity matrix &
\left(\begin{array}{ccc}1 & 0 & 0 \\0 & 1 & 0 \\0 & 0 & 1\end{array}\right)
\end{tabular}
\end{document}

output of code

share|improve this answer
    
I am so sorry, the op changed the accepted answer. –  Who is crazy first Dec 15 '13 at 17:02

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.