[Tex/LaTex] In a table how to add vertical lines between each column

booktabsrulestables

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}

Best Answer

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

image