[Tex/LaTex] Math mode in longtabu

longtablemath-modetabu

I'm trying to typeset a very long table that spans a few pages and contains exclusively mathematical formulae.

In order to accomplish that I'm using the \longtabu environment provided by the tabu package, but in the tabu documentation it is stated that "longtable is not designed to work in math mode" and thus the mathematical mode doesn't work for \longtabu.

My question is: how can I still write in math mode avoiding to write each formula in between $...$ like I did in the following piece of code? Any suggestion is appreciated and can involve different packages and/or environments.

Here is my code (it's not the complete table, but gives the idea of what I'm trying to do) and the output it gives:

\documentclass{article}
\usepackage{amsmath}
\usepackage{tabu}
\usepackage{longtable}
\usepackage{booktabs}
\begin{document}
\tabulinesep=1mm
\begin{longtabu} to \linewidth  {l X[3,c] X[1,c]}
  \toprule
  & $f(t)$ & $F(s)$\\
  \midrule
  1. & Unit impulse $\delta(t)$ & 1\\
  2. & Unit step $1(t)$ & $\displaystyle \frac{1}{s}$\\
  3. & $t$ & $\displaystyle \frac{1}{s^2}$\\
  4. & $\displaystyle \frac{t^n}{(n-1)!} \quad \left(n=1,2,3,\ldots\right)$ & $\displaystyle \frac{1}{s^n}$\\
  \bottomrule
\end{longtabu}
\end{document}

example longtabu

Best Answer

You need to use $ in the columns with mixed text/math (or alternatively make those math columns and use \text for the text) but the last column is just math so there you can add the $ in the preamble. tabu unfortunately redefines the >{} <{} syntax in an incompatible way but for simple cases, as here, it still works as it should.

All entries in the final column are set in math display style, with no additional markup required for each entry.

\documentclass{article}
\usepackage{amsmath}
\usepackage{tabu}
\usepackage{longtable}
\usepackage{booktabs}
\begin{document}
\tabulinesep=1mm
\begin{longtabu} to \linewidth  {l X[3,c] >{$\displaystyle}X[1,c]<{$}}
  \toprule
  & $f(t)$ & F(s)\\
  \midrule
  1. & Unit impulse $\delta(t)$ & 1\\
  2. & Unit step $1(t)$ &  \frac{1}{s}\\
  3. & $t$ & \frac{1}{s^2}\\
  4. & $\displaystyle \frac{t^n}{(n-1)!} \quad \left(n=1,2,3,\ldots\right)$ & 
                \frac{1}{s^n}\\
  \bottomrule
\end{longtabu}
\end{document}
Related Question