用 LaTeX 制作值日表、打卡表

值日表

前言

为了方便排值日表,想到用宏控制每个人的名字,加上预定的组合,就可以轻松输入了。但还是有点麻烦。

正文

\documentclass[zihao=-4]{ctexart}
\usepackage[a4paper,margin=1cm]{geometry}
\usepackage{tabularx}
\newcolumntype{Y}{>{\centering\arraybackslash}X}
\renewcommand\arraystretch{1.3}
\pagestyle{empty}


\def\peopleA{路人A}
\def\peopleB{路人B}
\def\peopleC{路人C}
\def\peopleD{路人D}
\def\peopleE{路人E}
\def\peopleF{路人F}

\def\zhia{\peopleA & \peopleB & \peopleC & \peopleD & \peopleE & \peopleF & \peopleA}
\def\zhib{\peopleB & \peopleC & \peopleD & \peopleE & \peopleF & \peopleA & \peopleB}
\def\zhic{\peopleC & \peopleD & \peopleE & \peopleF & \peopleA & \peopleB & \peopleC}
\def\zhid{\peopleD & \peopleE & \peopleF & \peopleA & \peopleB & \peopleC & \peopleD}
\def\zhie{\peopleE & \peopleF & \peopleA & \peopleB & \peopleC & \peopleD & \peopleE}
\def\zhif{\peopleF & \peopleA & \peopleB & \peopleC & \peopleD & \peopleE & \peopleF}

\def\shua{\peopleA & \peopleB & \peopleD & \peopleE & \peopleA & \peopleB & \peopleD}
\def\shub{\peopleE & \peopleA & \peopleB & \peopleD & \peopleE & \peopleA & \peopleB}
\def\shuc{\peopleD & \peopleE & \peopleA & \peopleB & \peopleD & \peopleE & \peopleA}
\def\shud{\peopleB & \peopleD & \peopleE & \peopleA & \peopleB & \peopleD & \peopleE}

\begin{document}
\begin{figure}
\centering
\begin{tabularx}{\textwidth}{|c*{7}{|Y}|}
\hline
周一的时间 & 周一 & 周二 & 周三 & 周四 & 周五 & 周六 & 周日 \\
\hline
\multicolumn{8}{|c|}{暑假} \\
\hline
2020/07/20 & \shua \\
2020/07/27 & \shub \\
2020/08/03 & \shuc \\
2020/08/10 & \shud \\
2020/08/17 & \shua \\
2020/08/24 & \shub \\
2020/08/31 & \shuc \\
\hline
\multicolumn{8}{|c|}{开学} \\
\hline
2020/09/07 & \zhib \\
2020/09/14 & \zhic \\
2020/09/21 & \zhid \\
2020/09/28 & \zhie \\
2020/10/05 & \zhif \\
2020/10/12 & \zhia \\
2020/10/19 & \zhib \\
2020/10/26 & \zhic \\
2020/11/02 & \zhid \\
2020/11/09 & \zhie \\
2020/11/16 & \zhif \\
2020/11/23 & \zhia \\
2020/11/30 & \zhib \\
2020/12/07 & \zhic \\
2020/12/14 & \zhid \\
2020/12/21 & \zhie \\
2020/12/28 & \zhif \\
2021/01/04 & \zhia \\
2021/01/11 & \zhib \\
\hline
\end{tabularx}
\end{figure}
\end{document}

效果

打卡表

\pnext 命令去自动增加日期,只需要控制起始日期 \setdate{2021}{7}{27} 即可。

\documentclass{ctexart}
\usepackage{datenumber}
\setdate{2021}{7}{27}
\newcommand{\pnext}{%
\thedateyear/%
\ifnum\value{datemonth}<10 0\fi
\thedatemonth/%
\ifnum\value{dateday}<10 0\fi
\thedateday%
\nextdate%
}
\usepackage{sourceserifpro}
\usepackage[a4paper,margin=1cm,headsep=0pt]{geometry}
\usepackage{tabularx}
\newcolumntype{Y}{>{\centering\arraybackslash}X}
\usepackage{pgffor}
\usepackage{fancyhdr}
\fancyhf{}
\fancyhead[C]{\bfseries 张三·打卡表}
\renewcommand{\headrulewidth}{0pt}
\pagestyle{fancy}
\begin{document}
\noindent\parbox{0.5\textwidth}{%
\begin{tabularx}{0.5\textwidth}{|c|Y|Y|Y|Y|Y|}
\hline
日期 & 上午 & 下午 & 晚上 & 英语 & CS \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\end{tabularx}}%
\parbox{0.5\textwidth}{%
\begin{tabularx}{0.5\textwidth}{c|Y|Y|Y|Y|Y|}
\hline
日期 & 上午 & 下午 & 晚上 & 英语 & CS \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\pnext &&&&& \\
\hline
\end{tabularx}}%
\end{document}
文章作者: sikouhjw
文章链接: https://sikouhjw.github.io/2020/07/05/2020-07-05-rota/
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 sikouhjw.github.io
支付宝捐赠
微信捐赠