1

I am working on a table with a lot of formulas (Laplace Transforms of various functions). Using a standard command (\[2mm]), I am able to generate spacings for the denominators. But the numerators look cramped and the formulas do not read well. Is there a smart way to manage tables in LaTeX involving many mathematical fractions? Kindly help me on this! Thanks.

 \begin{table}
  \begin{center}
 \begin{tabular}{|c|c|c|} \hline 
No. & $f(t)$ & $F(s) = {\cal L}[f(t)]$ \\ \hline
  1 & $1$ & ${1 \over s}$ \\[2mm] \hline 
 2 & $t$ & ${1 \over s^2}$ \\[2mm] \hline 
  3 & $t^n$ & ${ n! \over s^{n + 1}}$ \\[2mm] \hline 
  4 & $e^{a t}$ & ${1 \over s - a}$ \\[2mm] \hline
  5 & $\sin \omega t$ & ${\omega \over s^2 + \omega^2}$ \\[2mm] \hline
  6 & $\cos \omega t$ & ${s \over s^2 + \omega^2}$ \\[2mm] \hline 
 \end{tabular}
  \end{center}
  \end{table}
  • 1
    Unless you give us some code to look at, aka a Minimal Working Example MWE, helping you is difficult since it involves guessing what you are trying to do. – Denis Mar 10 '22 at 08:28
  • 2
    Just out of curiosity: Why are you using PlainTeX \over notation instead of LaTeX \frac notation? – Mico Mar 10 '22 at 08:51

6 Answers6

6

By far the most elegant way to avoid having to deal with math expressions, esp. expressions that contain fraction terms, coming too close to horizontal lines in a table is not to draw the horizontal lines in the first place.

Here's a solution which replaces most \hline directives with \addlinespace, a macro that's provided by the booktabs package. It further "opens up" the table by omitting all vertical lines. Finally, since virtually all of the table's contents are "math-y", I suggest you employ an array environment instead of a tabular environment.

Oh, and I'd replace all Plain-TeX syntax -- cf. \over and \cal -- with equivalent LaTeX syntax.

enter image description here

\documentclass{article} % or some other suitalbe document class
\usepackage{booktabs,array}
\newcolumntype{C}{>{$}c<{$}} % automatic text mode in an array env.
\begin{document}
\begin{table}
\[
\begin{array}{@{} C cc @{}} 
\toprule
No. & f(t) & F(s) = \mathcal{L}[f(t)] \\ 
\midrule
  1 & 1       & \frac{1}{s}   \\  \addlinespace
  2 & t       & \frac{1}{s^2} \\  \addlinespace
  3 & t^n     & \frac{n!}{s^{n + 1}} \\  \addlinespace
  4 & e^{a t} & \frac{1}{s - a}      \\  \addlinespace
  5 & \sin \omega t & \frac{\omega}{s^2 + \omega^2} \\  \addlinespace
  6 & \cos \omega t & \frac{s}{s^2 + \omega^2}      \\ 
\bottomrule 
\end{array}
\]
\end{table}
\end{document}
Mico
  • 506,678
3

The simplest, in my opinion, consists in using the cellspace package, which enables you to define a minimal vertical spacing at the top & bottom of cells in columns with specifier prefixed with the letter S(or C if you load siunitx, or whatever letter you please with the column= some letter loading option).

\documentclass{article}
\usepackage{cellspace}
\setlength{\cellspacetoplimit}{4pt}
\setlength{\cellspacebottomlimit}{4pt}

\begin{document}

\begin{table} \centering \begin{tabular}{|c|c|Sc|} \hline No. & $f(t)$ & $F(s) = {\cal L}[f(t)]$ \ \hline 1 & $1$ & ${1 \over s}$ \[2mm] \hline 2 & $t$ & ${1 \over s^2}$ \[2mm] \hline 3 & $t^n$ & ${ n! \over s^{n + 1}}$ \[2mm] \hline 4 & $e^{a t}$ & ${1 \over s - a}$ \[2mm] \hline 5 & $\sin \omega t$ & ${\omega \over s^2 + \omega^2}$ \[2mm] \hline 6 & $\cos \omega t$ & ${s \over s^2 + \omega^2}$ \[2mm] \hline \end{tabular}

\end{table}

\end{document}

enter image description here

Bernard
  • 271,350
3

With use of the tabularray package:

\documentclass{article}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}   % load booktabs package

\begin{document} [ \begin{tblr}{hlines, vlines, colspec = {ccc} }
\SetCell{mode=text} No. & f(t) & F(s) = \cal{L}[f(t)] \ 1 & 1 & \frac{1}{s} \ 2 & t & \frac{1}{s^2} \ 3 & t^n & \frac{n!}{s^{n + 1}} \ 4 & e^{a t} & \frac{1}{s - a} \ 5 & \sin\omega t & \frac{\omega}{s^2 + \omega^2} \ 6 & \cos\omega t & \frac{s}{s^2 + \omega^2} \ \end{tblr} ] or [ \begin{tblr}{colspec = {ccc} } \toprule \SetCell{mode=text} No. & f(t) & F(s) = \cal{L}[f(t)] \ \midrule 1 & 1 & \frac{1}{s} \ 2 & t & \frac{1}{s^2} \ 3 & t^n & \frac{n!}{s^{n + 1}} \ 4 & e^{a t} & \frac{1}{s - a} \ 5 & \sin\omega t & \frac{\omega}{s^2 + \omega^2} \ 6 & \cos\omega t & \frac{s}{s^2 + \omega^2} \ \bottomrule \end{tblr} ] \end{document}

enter image description here

F. Pantigny
  • 40,250
Zarko
  • 296,517
2

You can try \renewcommand{\arraystretch}{1.5} or \renewcommand{\arraystretch}{2.0} before the table. This should create more space around the objects in the table.

1

Trivial working solution:

\documentclass[10pt,a4paper]{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amssymb}

\begin{document} \begin{table} \begin{center} \begin{tabular}{ccc} \hline &&\ No. & $f(t)$ & $F(s) = {\cal L}[f(t)]$ \ \hline &&\

            1 &amp; $1$ &amp; ${1 \over s}$ \\[2mm] \hline 
            &amp;&amp;\\
            2 &amp; $t$ &amp; ${1 \over s^2}$ \\[2mm] \hline 
            &amp;&amp;\\
            3 &amp; $t^n$ &amp; ${ n! \over s^{n + 1}}$ \\[2mm] \hline 
            &amp;&amp;\\
            4 &amp; $e^{a t}$ &amp; ${1 \over s - a}$ \\[2mm] \hline
            &amp;&amp;\\
            5 &amp; $\sin \omega t$ &amp; ${\omega \over s^2 + \omega^2}$ \\[2mm] \hline
            &amp;&amp;\\
            6 &amp; $\cos \omega t$ &amp; ${s \over s^2 + \omega^2}$ \\[2mm] \hline 
            &amp;&amp;\\
        \end{tabular}
    \end{center}
\end{table}

\end{document}

Output:

enter image description here

1

With {NiceArray} of nicematrix.

\documentclass{article}
\usepackage{nicematrix}

\begin{document}

[\begin{NiceArray}{ccc}[hvlines,cell-space-limits=4pt] \text{No.} & f(t) & F(s) = {\cal L}[f(t)] \ 1 & 1 & \frac{1}{s} \ 2 & t & \frac{1}{s^2} \ 3 & t^n & \frac{n!}{s^{n + 1}} \ 4 & e^{a t} & \frac{1}{s-a} \ 5 & \sin \omega t & \frac{\omega}{s^2 + \omega^2} \ 6 & \cos \omega t & \frac{s}{s^2 + \omega^2} \ \end{NiceArray}]

\end{document}

You need several compilations (because nicematrix uses PGF/Tikz nodes under the hood).

Output of the above code

F. Pantigny
  • 40,250