I'm writing a distilled latex manual for my students, and I want to use tables with one column displaying the code and another column displaying the outcome, for all the commands that we need in class.
So far I managed to make it work, but the code is messy, and I would like to create a new column type, something like
\newcolumntype{E}{>{\begin{minipage}{5cm}\begin{equation*}}c<{\end{equation*}\end{minipage}}}
The working code I have is:
\usepackage{mathtools}
\begin{table*}[ht]
\centering
\begin{tabular}{|c |c |}
\hline
\texttt{Code} & Output \\
\hline
\hphantom{-} & \hphantom{-} \\
\begin{minipage}{5cm}
\begin{verbatim}
\begin{equation*}
\begin{matrix}
a_1 & a_2 & a_3 \\
b_1 & b_2 & b_3 \\
c_1 & c_2 & c_3
\end{matrix}
\end{equation*}
\end{verbatim}
\end{minipage}
& \begin{minipage}{3cm}
\begin{equation*}
\begin{matrix}
a_1 & a_2 & a_3 \\
b_1 & b_2 & b_3 \\
c_1 & c_2 & c_3
\end{matrix}
\end{equation*}
\end{minipage} \\
\hphantom{-} & \hphantom{-}\\
\hline
\hphantom{-} & \hphantom{-}\\
\end{tabular}
\end{table*}

pcolumn, there is essentially no difference between minipage and p – David Carlisle Jun 18 '16 at 10:47\begin{tabular}{|p{5cm}|c|}instead of the new columntype – Jun 18 '16 at 10:48Is there any way, though, to define a p column that includes the verbatim or the equation environments within the column? Since I will use it for each and every row, it would be ideal if I could define a column with such properties, and just focus on the code
– Mahoma Jun 18 '16 at 10:53