How to align, enlarge and center the following contents?
- No vertical rule, no double rules.
- No
m
type, one can usew{c}
. - Use a local macro in order to ease inputting the coordinates.
- Add some vertical space between the points.
- Increase the value of
\jot
in order to increase the distance between rows inaligned
. - Add some vertical space below the middle rule and above the bottom rule.
\documentclass{article}
\usepackage{amsmath}
\usepackage{array,booktabs}
\begin{document}
\begin{center}
\begin{tabular}{
@{}
w{c}{0.33333\columnwidth}
@{}
w{c}{0.33333\columnwidth}
@{}
w{c}{0.33333\columnwidth}
@{}
}
\toprule
A pair of points & Slope & Type \\
\midrule
\addlinespace
$\setlength{\arraycolsep}{0pt}
\newcommand{\point}[3]{#1&(&,{}&)}
\begin{array}{ r r r l r r }
\point{A}{2}{-3} \\[2ex]
\point{B}{-1}{4}
\end{array}$
&
$\addtolength{\jot}{6pt}\begin{aligned}
m &= \frac{y_B-y_A}{x_B-x_A}\\
&= \frac{4-(-3)}{-1-2}\\
&= -\frac{7}{3}
\end{aligned}$
&
Decreasing \\
\addlinespace
\bottomrule
\end{tabular}
\end{center}
\end{document}
A approach that uses stackengine
in the left column, and eliminates the m
columns to achieve vertical centering. Also \addstackgap
was used to add vertical buffer above/below the middle column.
\documentclass[preview,varwidth,border=12pt]{standalone}
\usepackage[a5paper,margin=5mm]{geometry}
\usepackage{amsmath}
\usepackage{tabstackengine}
\TABstackMath
\setstackgap{L}{1.2\normalbaselineskip}
\renewcommand{\arraystretch}{1.5}
\begin{document}
\begingroup\tabcolsep=30pt
\begin{tabular}{|c|c|c|}\hline
A pair of points & Slope & Type \tabularnewline\hline\hline
\Matrixstack[r]{
A(&2,& -3)\\
B(&-1,& 4)
} &
\addstackgap[5pt]{$
\begin{aligned}
m &= \frac{y_B-y_A}{x_B-x_A}\\[4pt]
&= \frac{4-(-3)}{-1-2}\\[4pt]
&= -\frac{7}{3}
\end{aligned}$}
& Decreasing \tabularnewline\hline
\end{tabular}\endgroup
\end{document}
Here's a way with cellspace
, in the place of \arraystretch
, and \multirow
:
\documentclass[preview,varwidth,border=12pt]{standalone}
\usepackage[a5paper, margin=5mm]{geometry}
\usepackage{mathtools}
\usepackage{array}
\usepackage{cellspace}
\setlength{\cellspacetoplimit}{4pt}
\setlength{\cellspacebottomlimit}{4pt}
\newcolumntype{M}[1]{S{m{#1}}}
\usepackage{multirow}
\begin{document}
\begin{tabular}{|wc{0.3\linewidth}| >{\centering}M{0.3\linewidth}|wc{0.2\linewidth}|}\hline
A pair of points & Slope & Type \tabularnewline\hline\hline
\multirow{3.9}{=}{\centering$\begin{matrix}
A (\phantom{-}2,-3)\\
B(-1,\phantom{-}4)
\end{matrix}$} &
$ \begin{aligned}
m &= \frac{y_B-y_A}{x_B-x_A}\\
&= \frac{4-(-3)}{-1-2}\\
&= -\frac{7}{3}
\end{aligned} $ &
\multirow{4}{=}{\centering Decreasing} \tabularnewline\hline
\end{tabular}
\end{document}