6

I'm trying to make a table of formulae. I've tried a bunch of different approaches (including \parbox, align, eqnarray, etc.), but none of these satisfy all of the requirements:

  • \hline (or something equivalent) can still be used.
  • Vertical lines can be put between columns
  • Every cell can contain a formula in \displaystyle
  • Formulae are centered both horizontally and vertically.

Does anybody know an environment that does this?

Thorsten
  • 12,872
Martijn
  • 205

4 Answers4

6
\documentclass[11pt]{scrartcl}
\usepackage{array}
\newcolumntype{C}{>{$\displaystyle} c <{$}}
\begin{document} 

\def\arraystretch{2}
\begin {tabular}{| C | C |}\hline
\frac1{1+x^2} & \mathrm{atan}(x)+C \\\hline
\sqrt{x^2+h}  & \ln\left(x+\sqrt{x^2+h}\right)+C\\\hline
\end{tabular}
\end{document}

enter image description here

5

Perhaps the array packages offers a partial solution:

\documentclass{article}
\usepackage{array}
\setlength{\extrarowheight}{8pt}
\begin{document}
$\begin{array}{>{\displaystyle}c|>{\displaystyle}c>{\displaystyle}c|>{\displaystyle}c}
\frac{x}{y}&z&\frac{x}{y}&\frac{x}{y}\\[1em]\hline
\frac{x}{y}&\frac{x}{y}&z&\frac{x}{y}\\[1em]\hline
\end{array}$
\end{document}

enter image description here

uli
  • 4,315
4

For this kind of table, it's also possible to use the next code. I keep \tvito get the same height for each row and I use p{#1} to control the width of each column.

\documentclass[11pt]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage{fourier}
\usepackage{array} 
\usepackage{booktabs,amsmath}      
\begin{document}

\newcommand{\tvi}{\vrule height 17pt depth15pt width 0pt} 

\newcolumntype{x}[1]{>{\hfil$\displaystyle} p{#1} <{$\hfil}} 

\begin{tabular}{x{4cm} x{4cm} }\\
\text{\bfseries{Fonctions}}   & \text{\bfseries{ Primitives}}       \\ \midrule
\tvi   \frac{ 1} {1+x^2 }     & \mathrm{ arctan}\,(x)+C             \\ \midrule 
\tvi   \frac{1}{\sqrt{x^2+h}} & \log\bigl(x+\sqrt{x^2+h}\,\bigr)+C  \\                                                                         
\end{tabular}

\end{document} 

enter image description here

Without an environment but with an old method : TeX

\def\hfq{\hfill\quad}
\def\cc#1{\hfq#1\hfq}
\def\tvi{\vrule height 12pt depth 5pt width 0pt}
\def\tv{\tvi\vrule}

\vbox{\offinterlineskip
\halign {\tv#&&\cc{$\displaystyle#$}&\tv#\cr
\noalign{\hrule}
&\omit\cc{\bf Fonctions}&&\omit\cc{\bf Primitives}&\cr
\noalign{\hrule}
height 17pt depth15pt&{1\over 1+x^2}&&{\rm Arctg}\,(x)+C&\cr
\noalign{\hrule}
height 17pt depth17pt&{1\over\displaystyle\sqrt{x^2+h}}&&
\log\bigl(x+\sqrt{x^2+h}\,\bigr)+C&\cr
\noalign{\hrule}}} 

enter image description here

Moriambar
  • 11,466
Alain Matthes
  • 95,075
1

Just to offer an alternatively solution. I wouldn't use any lines to box the equations, especially as this is a "Table of Formulae", which should have a similar style to the rest of the tables of contents. It is also likely that the table will go over a page so rather use a longtable. It is also a good idea to include the page reference where the equation was firstly described.

You should have the notation or lists of symbols preceding such a table,

enter image description here

Followed by a pagebreak and the Table of Formulas

enter image description here

Here is the minimal,

\documentclass[crown]{octavo}
\usepackage{longtable,fancyhdr}
\usepackage{amsmath}[2000/07/18] 
\usepackage{amssymb}[2002/01/22] 
\newcommand{\DittoMark}{``}%''
\newcommand{\Ditto}{\quad\DittoMark\quad}
\newcommand{\Headings}[1]{\textbf{\small#1}}
\begin{document}
\chapter{General}
\label{aref}%
 \[e= \frac{2}{a}
             \sqrt{s(s-a)(s-b)(s-c)} \] 

\chapter{TABLE OF FORMULAS.}
\markboth{\Headings{PLANE GEOMETRY.}}{\Headings{TABLE OF FORMULAS.}}%

\subsection{PLANE FIGURES.}

\subsection{NOTATION.}

\begin{tabular}{r@{~}c@{~}l}
$P$ &=& perimeter. \\
$h$ &=& altitude. \\
$b$ &=& lower base. \\
$b'$ &=& upper base. \\
$R$ &=& radius of circle. \\
$D$ &=& diameter of circle. \\
$C$ &=& circumference of circle. \\
$r$ &=& apothem of regular polygon. \\
$a$, $b$, $c$ &=& sides of triangle. \\
$s$ &=& \( \frac{1}{2}(a+b+c) \). \\
$p$ &=& perpendicular of triangle. \\
$m,n$ &=& segments of third side of triangle adjacent to \\
&& sides $b$ and $a$, respectively. \\
$S$ &=& area. \\
$\pi$ &=& 3.1416.
\end{tabular}

\newpage
\subsection{FORMULAS.}

\noindent\begin{longtable}{lr@{~}c@{~}l@{\qquad}r}
\multicolumn{5}{l}{\hspace{-2ex}\textbf{Line Values.}} \\
\multicolumn{5}{r}{\tiny PAGE}\\
\multicolumn{4}{l}{Altitude of triangle on side $a$,} \\
& $h$ &=& \( \displaystyle \frac{2}{a}
             \sqrt{s(s-a)(s-b)(s-c)} \) & \pageref{aref} \\
\multicolumn{4}{l}{Median of triangle on side $a$,} \\
& $m$ &=& \( \frac{1}{2} \sqrt{2(b^2+c^2) - a^2} \) & \pageref{aref} \\
\multicolumn{5}{l}{\hspace{-2ex}\textbf{Areas.}} \\
Rectangle,     & $S$ &=& $b\times h$ & \pageref{aref} \\
Square,        & $S$ &=& $b^2$ & \pageref{aref} \\
\end{longtable}
\end{document}
Moriambar
  • 11,466
yannisl
  • 117,160