我无法创建两列表格。我想并排创建两个两列表格,但我的代码似乎不起作用:
\documentclass{article}
\usepackage[english]{babel}
\usepackage{array}
\begin{document}
\title{Example: Exponents}
\author{Ms. Lampianerani}
\date{}
\pagenumbering{gobble}
\maketitle
\begin{center}
\setlength\extrarowheight{6pt}
\begin{tabular}{ | l | p{4.5cm} |}
\hline
Expression & Equivalent Value Simplified\\ \hline
$2^2 $& 4 \\ \hline
$2^1$ & 2 \\ \hline
$2^0$ & 1 \\ \hline
$2^-1$ & $\frac{1}{2}$ \\ \hline
$2^-2$ & $\frac{1}{4}$ \\ \hline
\end{tabular}
\end{center}
\begin{center}
\setlength\extrarowheight{6pt}
\begin{tabular}{ | l | p{4.5 cm} |}
\hline
Expression & Equivalent Value Simplified\\ \hline
$3^2$ & \\ \hline
$3^1 $ & \\ \hline
$3^0$ & \\ \hline
$3^{-1}$ & \\ \hline
$3^{-2} $ & \\ \hline
\end{tabular}
\end{center}
\end{document}
我想要一个在左侧有 2 的幂的表,另一个在右侧有 3 的幂的表,但是此代码甚至不适用于 2 的幂。
编辑:我现在可以创建一个具有 2 的幂的表。我只需要代码来创建并排的列,其间有空格。
答案1
\documentclass[a4paper]{article}
\usepackage[english]{babel}
\usepackage{array}
\begin{document}
\title{Example: Exponents}
\author{Ms. Lampianerani}
\date{}
\pagenumbering{gobble}
\maketitle
\begin{center}\small
% \setlength\extrarowheight{6pt}
\renewcommand\arraystretch{2}
\begin{tabular}{ | l | p{3cm} |}
\hline
Expression & Equivalent Value Simplified\\ \hline
$2^2 $& 4 \\ \hline
$2^1$ & 2 \\ \hline
$2^0$ & 1 \\ \hline
$2^{-1}$ & $\frac{1}{2}$ \\ \hline
$2^{-2}$ & $\frac{1}{4}$ \\ \hline
\end{tabular}%
\hfill
\begin{tabular}{ | l | >{\centering\arraybackslash}p{3cm} |}
\hline
Expression & Equivalent Value Simplified\\ \hline
$3^2$ & 9 \\ \hline
$3^1 $ & 3 \\ \hline
$3^0$ & 1 \\ \hline
$3^{-1}$ & $\frac{1}{3}$ \\ \hline
$3^{-2} $ & $\frac{1}{9}$ \\ \hline
\end{tabular}
\end{center}
or
\begin{center}\small
% \setlength\extrarowheight{6pt}
\renewcommand\arraystretch{2}
\begin{tabular}{ | l | >{\centering\arraybackslash}p{3cm} |c| l | >{\centering\arraybackslash}p{3cm} |}
\cline{1-2}\cline{4-5}
Expression & Equivalent Value Simplified&&
Expression & Equivalent Value Simplified\\ \cline{1-2}\cline{4-5}
$2^2 $& 4 &&
$3^2 $& 9 \\ \cline{1-2}\cline{4-5}
$2^1$ & 2 &&
$3^1$ & 3 \\ \cline{1-2}\cline{4-5}
$2^0$ & 1 &&
$3^0$ & 1 \\ \cline{1-2}\cline{4-5}
$2^{-1}$ & $\frac{1}{2}$ &&
$3^{-1}$ & $\frac{1}{3}$ \\ \cline{1-2}\cline{4-5}
$2^{-2}$ & $\frac{1}{4}$ &&
$3^{-2}$ & $\frac{1}{9}$ \\ \cline{1-2}\cline{4-5}
\end{tabular}
\end{center}
\end{document}