[Tex/LaTex] Creating Table using array

arraystables

I'm trying to create entry similar to tables using array

begin{array}{*{20}{r}}
   {}| & A |& B  \\
\hline
   A_1| & {one|} & {two}  \\
   B_2| & {three|} & {four}  \\
\hline
 \end{array}

Is there any way to draw continuous vertical lines? (something like hline for drawing horizontal lines?)

Best Answer

Certainly:

\documentclass{article}

\begin{document}

\[
%\begin{array}{*{20}{r}}
\begin{array}{|*{3}{r|}} % because later only 3 columns
%   {}| & A |& B  \\
{} & A & B  \\
\hline
%   A_1| & {one|} & {two}  \\
 A_1& {one} & {two}  \\
%   B_2| & {three|} & {four}  \\
 B_2 & {three} & {four}  \\
\hline
 \end{array}
\]

\end{document}

enter image description here

Every vertical line in the description of columns (r|'s here) produces a vertical line through the whole array. I understand that your one to four words are only artificial ones.

Related Question