I'm trying to make a large table that has four columns, with two columns that are numbered incrementally. Note that the real table will have around 40 numbered entries.
Here's roughly the desired behavior and a kludgy MWE, using two counters with the totcount
package (rowA
and rowB
, note the use of \setcounter{rowB}{\totvalue{rowA}}
).
\documentclass[11pt,letterpaper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{totcount}
\usepackage{array}
\newtotcounter{rowA}
\newcommand\rowA{\stepcounter{rowA}{\bf \arabic{rowA}.~}}
\newcounter{rowB}
\newcommand\rowB{\stepcounter{rowB}{\bf \arabic{rowB}.~}}
\renewcommand{\arraystretch}{2}
\begin{document}
\setcounter{rowB}{\totvalue{rowA}}
\[ \begin{array}{*2{>{\displaystyle}l}*2{>{\displaystyle}l}}
f(t) & \mathcal{L}\{f\}(s) & f(t) & \mathcal{L}\{f\}(s) \\ \hline
\rowA e^{at} & \frac{1}{s-a} & \rowB t^n & \frac{n!}{s^{n+1}} \\
\rowA \sin(bt) & \frac{b}{s^2 + b^2} & \rowB u(t-a), \, a\geq 0 & \frac{e^{-as}}{s}\\
\rowA \cos(bt) & \frac{s}{s^2+b^2} & \rowB \delta(t-a), \, a \geq 0 & e^{-as}
\end{array}\]
\end{document}
Questions
- Is there a less kludgy way to do this? Ideally something that only requires one counter and numbering command?
- I'm particularly annoyed with this solution in that I have to decide what information ends up in each column at the start---very WYSIWYG/non-TeX. I would love to be able to enter the formulas as a two column table and then wrap with
multicols
. I'm trying to do this withlongtable
and repeated headers, but no joy thus far.
\bf
is a deprecated command, just as side-note