Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question
1  
Do you mean somethin like \begin{tabular}{|c|c|}? –  xfoo Feb 5 '13 at 14:21
1  
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
3  
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
1  
@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

1 Answer 1

up vote 2 down vote accepted

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

share|improve this answer
    
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.