# In a table how do I add vertical lines between each column?

I have this as my current table which is fine, but I would like there to be vertical lines too just to make it look that bit neater. I'd also like horizontal lines between each row but this would require resizing the rows to avoid the fractions on the right column clashing with the line?

\begin{center}
\begin{tabular}{cc}
\toprule
\bfseries $f(t)$ &
\bfseries $\Lap[f(t)]$\\
\midrule
$k$ & $\frac ks$ \\ $e^{at}$ & $\frac{1}{s-a}$ \\ $\sin{(at)}$ & $\frac{a}{s^2+a^2}$ \\ $\cos{(at)}$ & $\frac{s}{s^2+a^2}$ \\ $t^n$ & $\frac{n!}{s^{n+1}}$ \\ $\sinh{(at)}$ & $\frac{a}{s^2-a^2}$ \\ $\cosh{(at)}$ & $\frac{s}{s^2-a^2}$ \\
\bottomrule

\end{tabular}
\end{center}

-
Do you mean somethin like \begin{tabular}{|c|c|}? –  xfoo Feb 5 '13 at 14:21
Vertical rules doesn't work well with booktabs, see the manual or tex.stackexchange.com/questions/88929/…. With \midrules you won't get any clashing, by the way. –  Torbjørn T. Feb 5 '13 at 14:23
@ChristianR. This won't really work acceptably with booktabs. The booktabs documentation has some very good arguments about why for most tables, vertical lines are not appropriate. See e.g. Vertical lines are discontinuous with booktabs. –  Alan Munn Feb 5 '13 at 14:24
There is no use loading booktabs if you want vertical lines, the package explicitly introduces constructs that are incompatible with vertical lines and documents that vertical lines are evil. So If you want vertical lines (which are not always evil:-) use the standard latex \hline for horizontal lines. –  David Carlisle Feb 5 '13 at 14:34
@MarcvanDongen The presence of \toprule, \midrule entails booktabs use. (But I agree that Danny should turn this into a compilable example.) –  Alan Munn Feb 5 '13 at 15:02

When using a table containing only formulas it might be easier to use the array environment, which needs to be in math-mode (here displaymath). If you want to use verticle lines, you shouldn't use booktabs, simply use \hline instead.

The most of the following code is self-explanatory, but maybe not \renewcommand\arraystretch{1.5}, which is used to widen the rowheight, because otherwise the fractures will touch the lines.

Code

\documentclass{article}
\renewcommand\arraystretch{1.5}

\begin{document}
\begin{center}
\begin{displaymath}
\begin{array}{|c|c|}
\hline
\mathbf{f(t)} & \mathbf{\textbf{Lap}[f(t)]} \\ \hline \hline
k             & \frac ks           \\ \hline
e^{at}        & \frac{1}{s-a}      \\ \hline
\sin{(at)}    & \frac{a}{s^2+a^2}  \\ \hline
\cos{(at)}    & \frac{s}{s^2+a^2}  \\ \hline
t^n           & \frac{n!}{s^{n+1}} \\ \hline
\sinh{(at)}   & \frac{a}{s^2-a^2}  \\ \hline
\cosh{(at)}   & \frac{s}{s^2-a^2}  \\ \hline
\end{array}
\end{displaymath}
\end{center}
\end{document}


Result

-
This is very badly vertically positioned. It seems to me that \arraystretch isn't the right way to go here... –  yo' Feb 5 '13 at 22:49