\section{Change the improper fractions to a mixed number.}
\begin{tabularx}{\linewidth}{|X|X|} \hline
$\dfrac{29}{3}$ & $\dfrac{30}{4}$ \\ \hline
$\dfrac{22}{5}$ & $\dfrac{48}{5}$ \\ \hline
$\dfrac{47}{8}$ & $\dfrac{73}{8}$ \\ \hline
$\dfrac{29}{9}$ & $\dfrac{55}{9}$ \\ \hline
$\dfrac{31}{6}$& $\dfrac{57}{6}$ \\ \hline
\end{tabularx}
这对于水平拉伸表格以适应页面宽度非常有效,但我还想为学生留出空白空间,那么,如何拉伸表格以适应页面上剩余的垂直空间?我目前正在使用文档类 article 和 tabularx 包,但如果有其他合适的东西,可以更改它们。
编辑:我不需要将元素包含在框中,但我认为框可以帮助学生保持他们的工作整洁(或至少包含)。我确实需要将元素正确排列,而使用列时不会发生这种情况。
编辑:我查看了 tabularht,但我仍然需要猜测和检查才能使框的大小正确。我希望有更自动化的功能,类似于 tabular 的 \linewidth。我还希望问题位于框的左上角。
答案1
尝试使用包制作的以下代码tabularht
:
\documentclass{article}
\usepackage{amsmath}
\usepackage{calc}
\usepackage{tabularx}
\usepackage[vlines]{tabularht}
\begin{document}
\section{Change the improper fractions to a mixed number.}
\begin{tabularhtx}{\textheight-0.55in}{\linewidth}{|X|X|}
\hline
\interrowfill
$\dfrac{29}{3}$ & $\dfrac{30}{4}$\\
\interrowfill
\hline
\interrowfill
$\dfrac{22}{5}$ & $\dfrac{48}{5}$\\
\interrowfill
\hline
\interrowfill
$\dfrac{47}{8}$ & $\dfrac{73}{8}$\\
\interrowfill
\hline
\interrowfill
$\dfrac{29}{9}$ & $\dfrac{55}{9}$\\
\interrowfill
\hline
\interrowfill
$\dfrac{31}{6}$ & $\dfrac{57}{6}$\\
\interrowfill
\hline
\end{tabularhtx}
\end{document}
编辑
看到编辑的问题,以下可以作为解决方案,使用长度\pagetotal
来确定表格前页面的确切位置(请注意,您必须\clearpage
在新页面之前放置一个):
\documentclass{article}
\usepackage{amsmath}
\usepackage{calc}
\usepackage{tabularx}
\usepackage[vlines]{tabularht}
\begin{document}
\section{Change the improper fractions to a mixed number.}
\begin{tabularhtx}{\textheight-\the\pagetotal-10pt}{\linewidth}{|X|X|}
\hline
\interrowspace{5pt}
$\dfrac{29}{3}$ & $\dfrac{30}{4}$\\
\interrowfill
\hline
\interrowspace{5pt}
$\dfrac{22}{5}$ & $\dfrac{48}{5}$\\
\interrowfill
\hline
\interrowspace{5pt}
$\dfrac{47}{8}$ & $\dfrac{73}{8}$\\
\interrowfill
\hline
\interrowspace{5pt}
$\dfrac{29}{9}$ & $\dfrac{55}{9}$\\
\interrowfill
\hline
\interrowspace{5pt}
$\dfrac{31}{6}$ & $\dfrac{57}{6}$\\
\interrowfill
\hline
\end{tabularhtx}
\clearpage
\section{Do whatever you want here.}
\begin{tabularhtx}{\textheight-\the\pagetotal-10pt}{\linewidth}{|X|X|}
\hline
\interrowspace{5pt}
$\dfrac{29}{3}$ & $\dfrac{30}{4}$\\
\interrowfill
\hline
\interrowspace{5pt}
$\dfrac{22}{5}$ & $\dfrac{48}{5}$\\
\interrowfill
\hline
\interrowspace{5pt}
$\dfrac{47}{8}$ & $\dfrac{73}{8}$\\
\interrowfill
\hline
\interrowspace{5pt}
$\dfrac{29}{9}$ & $\dfrac{55}{9}$\\
\interrowfill
\hline
\interrowspace{5pt}
$\dfrac{31}{6}$ & $\dfrac{57}{6}$\\
\interrowfill
\hline
\end{tabularhtx}
\end{document}