如何让表格填满整个水平空间?

如何让表格填满整个水平空间?

我希望表格适合可用的水平空间。如何解决这个问题?

\documentclass[12pt]{article}
\usepackage[a4paper,hmargin=1cm,landscape,includemp,showframe]{geometry}
\usepackage{array}
\usepackage{xcolor}
\usepackage{helvet}
\pagestyle{empty}

\begin{document}

\begin{center}
    \Huge\bfseries Mathematics and Physics Schedule
\end{center}

\noindent
\begin{tabular}{|>{\centering\arraybackslash}m{25mm}|*5{>{\centering\arraybackslash}m{\dimexpr\dimexpr\textwidth-25mm\relax/5\relax}|}}\hline
Time & Monday & Tuesday & Wednesday & Thursday & Friday \\\hline
16:00-16:30 &&&&&\\\hline
16:30-17:00 &&&&&\\\hline
17:00-17:30 &&&&&\\\hline
17:30-18:00 &&&&&\\\hline
18:00-18:30 &&&&&\\\hline
18:30-19:00 &&&&&\\\hline
\end{tabular}

\end{document}

在此处输入图片描述

答案1

\resizebox始终是一个选项:

\documentclass[12pt]{article}
\usepackage[a4paper,hmargin=1cm,landscape,includemp,showframe]{geometry}
\usepackage{array}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{helvet}
\pagestyle{empty}

\begin{document}

\begin{center}
    \Huge\bfseries Mathematics and Physics Schedule
\end{center}

\noindent%
\resizebox{\textwidth}{!}{%
\begin{tabular}{|>{\centering\arraybackslash}m{25mm}|*5{>{\centering\arraybackslash}m{\dimexpr\dimexpr\textwidth-25mm\relax/5\relax}|}}\hline
Time & Monday & Tuesday & Wednesday & Thursday & Friday \\\hline
16:00-16:30 &&&&&\\\hline
16:30-17:00 &&&&&\\\hline
17:00-17:30 &&&&&\\\hline
17:30-18:00 &&&&&\\\hline
18:00-18:30 &&&&&\\\hline
18:30-19:00 &&&&&\\\hline
\end{tabular}%
}

\end{document}

在此处输入图片描述

答案2

使用以下内容设置includemp=false并定义表格。

|>{\centering\arraybackslash}m{25mm}|*5{>{\centering\arraybackslash}m{\dimexpr\dimexpr\textwidth-25mm-12\tabcolsep-7\arrayrulewidth\relax/5\relax}|}

答案3

\documentclass[12pt]{article}
\usepackage[a4paper,hmargin=1cm,landscape,showframe]{geometry}
\usepackage{tabularx,ragged2e}
\renewcommand\tabularxcolumn[1]{m{#1}}
\begin{document}

\noindent
\begin{tabularx}{\linewidth}{|m{25mm}|*5{X|}}\hline
Time & Monday & Tuesday & Wednesday & Thursday & Friday \\\hline
16:00-16:30 &&&&&\\\hline
16:30-17:00 &&&&&\\\hline
17:00-17:30 &&&&&\\\hline
17:30-18:00 &&&&&\\\hline
18:00-18:30 &&&&&\\\hline
18:30-19:00 &&&&&\\\hline
\end{tabularx}

\end{document}

相关内容