To make this a little shorter, you can also do the following:
Put \usepackage{array}in your head and in the expression \begin{tabular}write the following:
\begin{tabular}{ | >{\centering}p{2.5cm} | >{\centering}p{2.5cm} | >{\centering}p{2.5cm} | }
Now you need to use \tabularnewlineinstead \\to declare a new line. If the column width is not important, you can also use
\begin{tabular}{ |c|c|c| }
without any further changes.
source
share