我需要准备一个如下所示格式的时间表: 但是,我只能生成这个:
以下是我随身携带的代码:
\documentclass[a4paper,11pt,landscape]{book}
\usepackage[inner=0.3in,outer=0.3in,tmargin=1in,bmargin=1in]{geometry}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{hyperref}
\usepackage{graphicx}
\usepackage[english]{babel}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage[table,xcdraw]{xcolor}
%\setlength{\arrayrulewidth}{1mm}
%\setlength{\tabcolsep}{18pt}
\begin{document}
\pagenumbering{gobble}
% Please add the following required packages to your document preamble:
% \usepackage{multirow}
% \usepackage[table,xcdraw]{xcolor}
% If you use beamer only pass "xcolor=table" option, i.e. \documentclass[xcolor=table]{beamer}
\begin{table}[]
\centering
%\caption{My caption}
\label{my-label}
\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|
>{\columncolor[HTML]{BBDAFF}}c |c|c|c|c|c|c|c|c|}
\hline
\multicolumn{19}{|c|}{\cellcolor[HTML]{FFCC67}{\Huge Student Meeting Times and Schedule : Jan--July 2016}}\\
\hline
& \begin{tabular}[c]{@{}c@{}}08:30\\ 09:00\end{tabular}
& \begin{tabular}[c]{@{}c@{}}09:00\\ 09:30\end{tabular}
& \begin{tabular}[c]{@{}c@{}}09:30\\ 10:00\end{tabular}
& \begin{tabular}[c]{@{}c@{}}10:00\\ 10:30\end{tabular}
& \begin{tabular}[c]{@{}c@{}}10:30\\ 11:00\end{tabular}
& \begin{tabular}[c]{@{}c@{}}11:00\\ 11:30\end{tabular}
& \begin{tabular}[c]{@{}c@{}}11:30\\ 12:00\end{tabular}
& \begin{tabular}[c]{@{}c@{}}12:00\\ 12:30\end{tabular}
& \begin{tabular}[c]{@{}c@{}}12:30\\ 13:00\end{tabular}
& \begin{tabular}[c]{@{}c@{}}13:00\\ 14:00\end{tabular}
& \begin{tabular}[c]{@{}c@{}}14:00\\ 14:30\end{tabular}
& \begin{tabular}[c]{@{}c@{}}14:30\\ 15:00\end{tabular}
& \begin{tabular}[c]{@{}c@{}}15:00\\ 15:30\end{tabular}
& \begin{tabular}[c]{@{}c@{}}15:30\\ 16:00\end{tabular}
& \begin{tabular}[c]{@{}c@{}}16:00\\ 16:30\end{tabular}
& \begin{tabular}[c]{@{}c@{}}16:30\\ 17:00\end{tabular}
& \begin{tabular}[c]{@{}c@{}}17:00\\ 17:30\end{tabular}
& \begin{tabular}[c]{@{}c@{}}17:30\\ 18:30\end{tabular}
\\
\hline
Mon
& &
& \multicolumn{3}{c|}{\cellcolor[HTML]{009901}\textbf{Aa Rr}}
& \cellcolor[HTML]{F8A102}\textbf{\begin{tabular}[c]{@{}c@{}}Sssss\\ Hhhh\end{tabular}}
& \multicolumn{3}{c|}{\cellcolor[HTML]{FE0000}{\color[HTML]{FFFFFF} \begin{tabular}[c]{@{}c@{}}GGGGGGGGG \\ MMMMMM\end{tabular}}}
& \cellcolor[HTML]{BBDAFF}
& \multicolumn{2}{c|}{\cellcolor[HTML]{34CDF9}\textbf{\begin{tabular}[c]{@{}c@{}}Sssss \&\\ Mmmm\end{tabular}}}
& \cellcolor[HTML]{F8A102}\textbf{\begin{tabular}[c]{@{}c@{}}Sssss\\ Hhhh\end{tabular}}
& \multicolumn{2}{c|}{\cellcolor[HTML]{009901}\textbf{Pp Nn}}
& \multicolumn{2}{c|}{\cellcolor[HTML]{009901}\textbf{Aa Mm}}
&
\\
\cline{1-10} \cline{12-19}
Tue
& \multicolumn{3}{c|}{\cellcolor[HTML]{FFFC9E}\textbf{E 2 : Class}}
& \cellcolor[HTML]{F8A102}\textbf{\begin{tabular}[c]{@{}c@{}}Sssss\\ Hhhh\end{tabular}}
& \multicolumn{3}{c|}{\cellcolor[HTML]{009901}\textbf{Cc Mm}}
& \multicolumn{2}{c|}{\cellcolor[HTML]{34CDF9}\textbf{Aa Dd}}
& \cellcolor[HTML]{BBDAFF}
& &
& \cellcolor[HTML]{F8A102}\textbf{\begin{tabular}[c]{@{}c@{}}Sssss\\ Hhhh\end{tabular}}
& \multicolumn{2}{c|}{\cellcolor[HTML]{009901}\textbf{Aa Mm}}
& & &
\\
\cline{1-10} \cline{12-19}
Wed
& &
& \multicolumn{3}{c|}{\cellcolor[HTML]{009901}\textbf{Pp Gg}}
& \cellcolor[HTML]{F8A102}\textbf{\begin{tabular}[c]{@{}c@{}}Sssss\\ Hhhh\end{tabular}}
& \cellcolor[HTML]{340096}{\color[HTML]{FFFFFF} \textbf{Tt Kk}}
&
& \cellcolor[HTML]{340096}{\color[HTML]{FFFFFF} \textbf{Hh Ss}}
& \cellcolor[HTML]{BBDAFF}
& \multicolumn{2}{c|}{\cellcolor[HTML]{3531FF}{\color[HTML]{FFFFFF} \textbf{Cc}}}
& \cellcolor[HTML]{F8A102}\textbf{\begin{tabular}[c]{@{}c@{}}Sssss\\ Hhhh\end{tabular}}
& \multicolumn{2}{c|}{\cellcolor[HTML]{3531FF}{\color[HTML]{FFFFFF} \textbf{Cc}}}
& & &
\\
\cline{1-10} \cline{12-19}
Thu
& \multicolumn{3}{c|}{\cellcolor[HTML]{FFFC9E}\textbf{E 2 : Class}}
& \cellcolor[HTML]{F8A102}\textbf{\begin{tabular}[c]{@{}c@{}}Sssss\\ Hhhh\end{tabular}}
& \multicolumn{3}{c|}{\cellcolor[HTML]{009901}\textbf{Ss Rr}}
& \cellcolor[HTML]{F8A102}\textbf{\begin{tabular}[c]{@{}c@{}}Sssss\\ Hhhh\end{tabular}}
&
& \cellcolor[HTML]{BBDAFF}
& \multicolumn{2}{c|}{\cellcolor[HTML]{34CDF9}\textbf{\begin{tabular}[c]{@{}c@{}}Vv \&\\ Ss\end{tabular}}}
& \multicolumn{2}{c|}{\cellcolor[HTML]{3531FF}{\color[HTML]{FFFFFF} \textbf{Cc}}}
& & & &
\\
\cline{1-10} \cline{12-19}
Fri
& & &
& \cellcolor[HTML]{34CDF9}\textbf{Aa Jj}
& \cellcolor[HTML]{34CDF9}\textbf{Ss Jj}
& \multicolumn{2}{c|}{\cellcolor[HTML]{F8FF00}\textbf{\begin{tabular}[c]{@{}c@{}}Ff\\ Mm\end{tabular}}} & &
& \multirow{-8}{*}{\cellcolor[HTML]{BBDAFF}\textbf{\begin{tabular}[c]{@{}c@{}}L\\ U\\ N\\ C\\ H\end{tabular}}}
& \multicolumn{3}{c|}{\cellcolor[HTML]{FE0000}{\color[HTML]{FFFFFF} \begin{tabular}[c]{@{}c@{}}GGGGGGGGG \\ MMMMMM\end{tabular}}}
& \multicolumn{3}{c|}{\cellcolor[HTML]{F8FF00}\textbf{Ll Ss}}
& &
\\
\hline
\cellcolor[HTML]{C2E7C2}Sat
& \multicolumn{18}{c|}{\cellcolor[HTML]{C2E7C2}{\begin{tabular}[c]{@{}c@{}}~\\ ~\end{tabular}}}
\\
\hline
\end{tabular}
\end{table}
\end{document}
请提出解决方案。
答案1
这是一个解决方案(希望如此)。我引入了一些快捷宏来缩短输入重复代码的时间。
\documentclass[a4paper,11pt,landscape]{book}
\usepackage[inner=0.3in,outer=0.3in,tmargin=1in,bmargin=1in]{geometry}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{hyperref}
\usepackage{graphicx}
\usepackage[english]{babel}
\usepackage{multirow}
\usepackage[table,xcdraw, x11names]{xcolor}
\usepackage{makecell, hhline}
\usepackage{tabstackengine}
\setstackEOL{\\}
\renewcommand\theadset{\cellcolor[HTML]{BBDAFF}\renewcommand\arraystretch{1.5}}
\renewcommand\theadfont{\normalsize\bfseries\cellcolor[HTML]{BBDAFF}\color{IndianRed3}}
\renewcommand\cellset{\mdseries}
\usepackage{cellspace}
\setlength\cellspacetoplimit{1ex}
\setlength\cellspacebottomlimit{1ex}
\def\thickvrule{\vrule width 1.5mm}
\def\bluevrule{\color[HTML]{BBDAFF}\vrule width1pt}
\begin{document}
\setlength\Lstackgap{1cm}
\pagenumbering{gobble}
% Please add the following required packages to your document preamble:
% \usepackage{multirow}
% \usepackage[table,xcdraw]{xcolor}
% If you use beamer only pass "xcolor=table" option, i.e. \documentclass[xcolor=table]{beamer}
\begin{table}[]
\centering\sffamily\bfseries
\setlength\arrayrulewidth{1.5mm}
\newcommand\SsHh{\multicolumn{1}{Sc}{ \cellcolor[HTML]{F8A102}\begin{tabular}[c]{@{}c@{}}Sssss\\ Hhhh\end{tabular}}}
\newcommand\Cc{\multicolumn{2}{Sc}{\cellcolor[HTML]{3531FF}{\color[HTML]{FFFFFF}Cc}}}
\newcommand\Greencells[2]{\multicolumn{#1}{Sc}{\cellcolor[HTML]{009901}#2}}
\newcommand\Lightbluecells[2]{\multicolumn{#1}{Sc}{\cellcolor[HTML]{34CDF9}#2}}
\newcommand\emptycells[1]{\multicolumn{#1}{Sc}{}}
\label{my-label}
\begin{tabular}{!{\thickvrule}Sc!{\thickvrule} *{8}{Sc!{\bluevrule}}
Sc!{\bluevrule}>{\columncolor[HTML]{BBDAFF}}Sc!{\bluevrule}*{7}{Sc!{\bluevrule}}Sc!{\thickvrule}}
\hhline{*{19}{-}}
\multicolumn{19}{!{\thickvrule}Sc!{\thickvrule}}{\cellcolor[HTML]{FFCC67}{\Huge Student Meeting Times and Schedule : Jan--July 2016}}\\
\hhline{*{19}{-}}
& \makecell{08:30\\ 09:00}
& \makecell{09:00\\ 09:30}
& \makecell{09:30\\ 10:00}
& \makecell{10:00\\ 10:30}
& \makecell{10:30\\ 11:00}
& \makecell{11:00\\ 11:30}
& \makecell{11:30\\ 12:00}
& \makecell{12:00\\ 12:30}
& \makecell{12:30\\ 13:00}
& \makecell{13:00\\ 14:00}
& \makecell{14:00\\ 14:30}
& \makecell{14:30\\ 15:00}
& \makecell{15:00\\ 15:30}
& \makecell{15:30\\ 16:00}
& \makecell{16:00\\ 16:30}
& \makecell{16:30\\ 17:00}
& \makecell{17:00\\ 17:30}
& \makecell{17:30\\ 18:30}
\\
\hhline{*{19}{-}}
Mon
&\emptycells{2} & \Greencells{3}{Aa Rr}%
& \SsHh
& \multicolumn{3}{c}{\cellcolor[HTML]{FE0000}{\color{white}\begin{tabular}[c]{@{}c@{}}GGGGGGGGG \\ MMMMMM\end{tabular}}}
& \cellcolor[HTML]{BBDAFF}
& \multicolumn{2}{c}{\cellcolor[HTML]{34CDF9}\begin{tabular}[c]{@{}c@{}}Sssss \&\\ Mmmm\end{tabular}}
& \SsHh%
& \Greencells{2}{Pp Nn}
& \Greencells{2}{Aa Mm}
&
\\
\hhline{*{10}{-}>{\arrayrulecolor[HTML]{BBDAFF}}->{\arrayrulecolor{black}}*{8}{-}}
Tue
& \multicolumn{3}{c}{\cellcolor[HTML]{FFFC9E}\color{IndianRed3}E 2 : Class}
& \SsHh
& \Greencells{3}{Cc Mm}
& \Lightbluecells{2}{Aa Dd}
& \cellcolor[HTML]{BBDAFF}
& \emptycells{2}
& \SsHh
& \Greencells{2}{Aa Mm}
& \emptycells{2} &
\\
\hhline{*{10}{-}>{\arrayrulecolor[HTML]{BBDAFF}}->{\arrayrulecolor{black}}*{8}{-}}
Wed
& \emptycells{2}
& \Greencells{3}{Pp Gg}
& \SsHh
& \multicolumn{1}{c}{\cellcolor[HTML]{340096}{\color{white}Tt Kk}}
& \emptycells{1}
& \multicolumn{1}{c}{\cellcolor[HTML]{340096}{\color{white}Hh Ss}}
& \cellcolor[HTML]{BBDAFF}
& \Cc
&\SsHh
& \Cc
& \emptycells{2} &
\\
\hhline{*{10}{-}>{\arrayrulecolor[HTML]{BBDAFF}}->{\arrayrulecolor{black}}*{8}{-}}
Thu
& \multicolumn{3}{c}{\cellcolor[HTML]{FFFC9E}\color{IndianRed3}E 2 : Class}
& \SsHh
& \Greencells{3}{Ss Rr}
& \multicolumn{1}{c}{\cellcolor[HTML]{F8A102}\begin{tabular}[c]{@{}c@{}}Sssss\\ Hhhh\end{tabular}}
& \emptycells{1}
& \cellcolor[HTML]{BBDAFF}
& \multicolumn{2}{c}{\cellcolor[HTML]{34CDF9}\begin{tabular}[c]{@{}c@{}}Vv \&\\ Ss\end{tabular}}
& \Cc
& \emptycells{3} &
\\
\hhline{*{10}{-}>{\arrayrulecolor[HTML]{BBDAFF}}->{\arrayrulecolor{black}}*{8}{-}}
Fri
& \emptycells{3}
& \Lightbluecells{1}{Aa Jj}
& \Lightbluecells{1}{Ss Jj}
& \multicolumn{2}{Sc}{\cellcolor[HTML]{F8FF00}\begin{tabular}[c]{@{}c@{}}Ff\\ Mm\end{tabular}} &
\emptycells{2}
& \multirowthead{-12}{L\\ U\\ N\\ C\\ H}
& \multicolumn{3}{c}{\cellcolor[HTML]{FE0000}{\color[HTML]{FFFFFF}\begin{tabular}[c]{@{}c@{}}GGGGGGGGG \\ MMMMMM\end{tabular}}}
& \multicolumn{3}{c}{\cellcolor[HTML]{F8FF00}Ll Ss}
& \emptycells{1} &
\\
\hhline{*{19}{-}}
\rowcolor[HTML]{C2E7C2}
Sat
& \multicolumn{18}{c|}{\Gape[21pt][16pt]{}}
\\
\hhline{*{19}{-}}
\end{tabular}
\end{table}
\end{document}