[Tex/LaTex] How to split cell text into multiline in table

tables

I'm writing a paper using the ACM double column template, and I have a table which I want to fit to just one column, and in order to do so, I want to split the text inside the cells to multiple lines. I have the following code segment:

\documentclass{paper}
\begin{document}

\begin{table}[thb]
\centering
\begin{tabular}{|l|c|l|} \hline
\textbf{Col1} & \textbf{Col2} & \textbf{Col3} \\ \hline
This is a \\very long line \\of text & Short text & Another long \\line of text \\ \hline
$\pi$ & 1 in 5& Common in math\\ 
\hline\end{tabular}
\end{table}

\end{document}

But, what it gives me an output which is not quite right, as can be seen below.

enter image description here

First of all, the second part of the text of the last column is pushed into the first column. Then, also the last columns borders are not full. Any idea how to split a text to multiline in table cell?

Best Answer

Package tabularx is your friend:

enter image description here

\documentclass[twocolumn]{paper}
\usepackage{tabularx}
    \newcolumntype{L}{>{\raggedright\arraybackslash}X}

\begin{document}
    \begin{table}
    \centering
\begin{tabularx}{\linewidth}{|L|c|L|} 
    \hline
\textbf{Col1} & \textbf{Col2} & \textbf{Col3} \\ 
    \hline
This is a very long line of text & Short text & Another long line of text \\ 
    \hline
$\pi$ & 1 in 5& Common in math\\
    \hline
\end{tabularx}
    \end{table}
\end{document}