Here are four MWEs that fit within their margins.
I used scrartcl from KOMA-script to have more sensible margins. You can achieve the same by loading geometry. Also, consider allowing some more vertical space (air) in the tabular. Load the array package and add the following two commands to the preamble:
\setlength{\extrarowheight}{1pt}
\renewcommand{\arraystretch}{1.1}
See the effect in example 3.
Example 1: I reduced the font size to small. scrartcl standard is 11 pt. Also, I defined a \thead
macro for the ten headings. The text is set in a narrow p
-column, and aligned at the right margin. In addition, I aligned all the column at the right, except the first and sixth.
At last, I loaded booktabs, and set a \midrule
after the heading and removed the side bearings at the left and right side of the tabular, see the @{}
in the definition of the tabular.
Example 2: Here, I used tabular* instead of tabular. I set \tabcolsep
to 0, and let tabular*
calculate the space between columns. In addition, I reduce the width of the heading cells untill all had line breaks.
Example 3: This is probably the simplest solution and what I recommend for you: Load the excellent tabulary package and let LaTeX do all the calculation. I reduced \tabcolsep
slightly more, removed the side bearings and reduced font size as in the other examples. Be aware that the first column is an ordinary l
-column. Thereafter, I have 10 right aligned R
-columns:
Example 4: Inspired by Bernhard, but slightly different. Due to how \rowcolor
and \columncolor
work, I removed side bearing by setting \tabcolsep
to 0 and added space between columns using very narrow columns (defined as new column type N
). The T
-column uses a feature described in the dcolumn manual.
Example 1 – using tabular

\documentclass{scrartcl}
\usepackage{graphicx, booktabs}
\newcommand{\thead}[1]{\multicolumn{1}{p{\dimexpr((\linewidth/11)-2\tabcolsep)\relax}}{\raggedleft #1}}
\begin{document}
\begin{table}
\small\centering
\setlength{\tabcolsep}{0.3em}
\begin{tabular}{@{}lrrrrcrrrrr@{}}
& \thead{9.00--9.45} & \thead{9.50--10.35} & \thead{10.40--11.25}
& \thead{11.30--12.15} & \thead{12.20--1.05} & \thead{1.05--1.30}
& \thead{1.30--2.15} & \thead{2.30--3.05} & \thead{3.10--3.55}
& \thead{4.00-4.45} \\ \midrule
Sun & & 717 & 717 & & & * & & & & \\
Mon & 715 & 715 & 711 & 711 & 712 & * & 712 & 719 & 719 & \\
Tue & & & & & & * & & 716 & 716 & \\
Wed & & 711 & 713 & 714 & 714 & * & 717 & 717 & 719 & 719 \\
Thu & & & & & & * & Thesis & Thesis & Thesis & Thesis \\
\end{tabular}
\end{table}
\end{document}
Example 2 – using tabular*

\documentclass{scrartcl}
\usepackage{graphicx, booktabs}
\newcommand{\thead}[1]{\multicolumn{1}{p{\dimexpr(\linewidth/13)}}{\raggedleft #1}}
\setlength{\tabcolsep}{0em}
\begin{document}
\begin{table}
\small\centering
\begin{tabular*}\linewidth{@{\extracolsep{\fill}}l*{10}{r}}
& \thead{9.00--9.45} & \thead{9.50--10.35} & \thead{10.40--11.25}
& \thead{11.30--12.15} & \thead{12.20--1.05} & \thead{1.05--1.30}
& \thead{1.30--2.15} & \thead{2.30--3.05} & \thead{3.10--3.55}
& \thead{4.00-4.45} \\ \midrule
Sun & & 717 & 717 & & & * & & & & \\
Mon & 715 & 715 & 711 & 711 & 712 & * & 712 & 719 & 719 & \\
Tue & & & & & & * & & 716 & 716 & \\
Wed & & 711 & 713 & 714 & 714 & * & 717 & 717 & 719 & 719 \\
Thu & & & & & & * & Thesis & Thesis & Thesis & Thesis \\
\end{tabular*}
\end{table}
\end{document}
Example 3 – tabulary

\documentclass{scrartcl}
\usepackage{graphicx, booktabs, tabulary, array}
\setlength{\extrarowheight}{1pt}
\renewcommand{\arraystretch}{1.1}
\begin{document}
\begin{table}
\small\centering
\setlength{\tabcolsep}{0.2em}
\begin{tabulary}\linewidth{@{}l*{10}{R}@{}}
& 9.00--9.45\, & 9.50--10.35\,
& 10.40--11.25\, & 11.30--12.15\,
& 12.20--1.05\, & 1.05--1.30\,
& 1.30--2.15\, & 2.30--3.05\,
& 3.10--3.55\, & 4.00-4.45\, \\ \midrule
Sun & & 717 & 717 & & & * & & & & \\
Mon & 715 & 715 & 711 & 711 & 712 & * & 712 & 719 & 719 & \\
Tue & & & & & & * & & 716 & 716 & \\
Wed & & 711 & 713 & 714 & 714 & * & 717 & 717 & 719 & 719 \\
Thu & & & & & & * & Thesis & Thesis & Thesis & Thesis \\
\end{tabulary}
\end{table}
\end{document}
Example 4 – tabular, dcolumn and xcolor

\documentclass{article}
\usepackage{geometry}
\usepackage{array, makecell, booktabs, dcolumn}
\usepackage{graphicx}
\usepackage[svgnames, table]{xcolor}
\newcolumntype{N}{wc{1em}}
\newcolumntype{T}{D{-}{-}{5,5}}
\begin{document}
\renewcommand{\arraystretch}{1.15}
\setlength{\extrarowheight}{2pt}
\begin{table}
\centering\small
\setlength{\tabcolsep}{0em}
\begin{tabular}{@{}>{\columncolor{Gainsboro!60!Lavender}}TN*{5}{cN}@{}}
\rowcolor{Gainsboro!60!Lavender}
&& Sunday && Monday && Tueday && Wednesday && Thursday\\
9.00-9.45 && && 715 && && && \\
9.50-10.35 && 717 && 715 && && 711 && \\
10.40-11.25 && 717 && 711 && && 713 && \\
11.30-12.15 && && 711 && && 714 && \\
12.20-1.05 && && 712 && && 714 && \\
1.05-1.30 && * && * && * && * && * \\
1.30-2.15 && && 712 && && 717 && Thesis \\
2.30-3.05 && && 719 && 716 && 717 && Thesis \\
3.10-3.55 && && 719 && 716 && 719 && Thesis \\
4.00-4.45 && && && && 719 && Thesis \\
\end{tabular}
\end{table}
\end{document}
\footnotesize
standalone
.