\documentclass[svgnames, onlydoc]{l3doc}
\usepackage{litetable, twemojis, titlesec}
\usepackage[mono = false]{libertine}
\usepackage[fontset = none]{ctex} \setlength \parindent {0pt}
\setCJKmainfont{LXGW WenKai}
\setCJKsansfont[AutoFakeBold]{LXGW Marker Gothic}
\setCJKmonofont{LXGW WenKai Mono}
\titleformat*{\section}{\sffamily\Large\bfseries}
\AddToHook{env/function/before}{\vspace*{-.65\baselineskip}}
\AddToHook{env/syntax/after}{\par\vspace*{.15\baselineskip}}
\makeatletter
\def \@key #1{\textcolor{red}{\textbf{\texttt{#1}}}~\normalfont \texttt{=}~}
\def \s@key #1{\textcolor{red}{\textbf{\texttt{#1}}}}
\DeclareRobustCommand \key {\@ifstar\s@key\@key}
\def \val #1{\meta{\textup{#1}}}
\def \TFF {true\textbar \textbf{false}}
\def \TTF {\textbf{true}\textbar false}
\def \HoLogo@ApTeX #1{\HOLOGO@mbox {Ap\kern -.1667em\TeX}}
\newlist{keyval}{itemize}{10}
\setlist[keyval]{leftmargin = 0pt, labelsep = 0pt}
\makeatother
\makeindex

\title{%
  \sffamily \cls{litetable} 文檔類 --- 多彩嘅課程表\thanks{%
    \url{https://github.com/myhsia/litetable},
    \url{https://ctan.org/pkg/litetable}
  }
}

\author{%
  夏明宇
  \texttt{<\href{mailto:myhsia@outlook.com}{myhsia@outlook.com}>}\thanks{
    \href{https://github.com/ljguo1020}{郭李軍}
    開發咗讀取 \meta{left} \cmd[no-index]{->} \meta{right} 型數據結構嘅接口，
    並為低版本 \hologo{TeX} Live 做兼容.
  }
}

\date{Released 2025-03-02\quad \texttt{v3.3B}}

\begin{document}

\maketitle

\section{介紹}

\cls{litetable} 文檔類提供咗一個多彩嘅課程表設計，
基於 \pkg{tikz} 由 \pkg{expl3} 開發.
其兼容發行版 \hologo{TeX} Live 2019 及更高版本，
支持 \hologo{pdfLaTeX}，\hologo{XeLaTeX}，\hologo{ApTeX} 和 \hologo{LuaLaTeX}
等多種編譯方式. 點擊跳轉至手冊嘅
\href{litetable-en-us.pdf}{[\textsf{English Version}]}
\href{litetable-zh-cn.pdf}{[\textsf{官话版本}]}.

\section{用戶接口}

要加載此宏包，只需寫下
\begin{quote}
  |\usepackage{litetable}|
\end{quote}

\DescribeEnv{litetable}
環境 \env{litetable} 可生成空白課程表框架，
需在命令 \cs{timelist} 和 \cs{weeklist} 後執行
\begin{quote}
  |\begin{litetable}|
    \oarg{keys} \marg{title} \oarg{keys}| ... |%
  |\end{litetable}|
\end{quote}
強制參數用於設定課程表標題，
可選參數接受以下鍵
\begin{keyval}
  \item [\key{color}] \val{color} 可設置課程表框架嘅背景色
  （默認值：\cmd[no-index]{gray}），鍵名可省略.
  \item [\key{sem}] \val{string}
  可設置頁面右上角嘅學期信息.
\end{keyval}

\begin{function}{\weeklist}
  \begin{syntax}
    \cs{weeklist} \oarg{keys} \marg{list} \oarg{keys}
  \end{syntax}
  強制參數接收數組，
  用於設置課程表頂部嘅工作日列表和列寬.
  可選參數接受以下鍵
  \begin{keyval}
    \item [\key{format}] \val{format commands}
    可設置工作日列表格式 （默認值：\cmd[no-index]{\bfseries}）.
    \item [\key{sep}] \val{string} 可設置工作日列表嘅分隔符
    （默認為空）.
  \end{keyval}
  \begin{verbatim}
    \weeklist [ format = \bfseries \scshape, sep = \textbar ]
      { Mon -> 1, Tue -> 1, Wed -> 1, Thu -> 1, Fri -> 1 }
  \end{verbatim}
\end{function}

\begin{function}{\timelist}
  \begin{syntax}
    \cs{timelist} \oarg{keys} \marg{list} \oarg{keys}
  \end{syntax}
  強制參數均接收數組，用於設置課程表嘅左側嘅時間列表.
  可選參數接受以下鍵
  \begin{keyval}
    \item [\key{numformat}] \val{format}
    可設置時間列表嘅序號字體，
    （默認值：\cmd[no-index]{\ttfamily} \cmd[no-index]{\bfseries}）.
    \item [\key{timefont}] \val{format} 可設置時間列表嘅時間字體，
    （默認值：\cmd[no-index]{\ttfamily}）.
    \item [\key{hidetime}] \val\TFF 用於隱藏時間列表中嘅時間，只保留序號.
    （初始值：\cmd[no-index]{false}）.
  \end{keyval}
  \begin{verbatim}
    \timelist [ numformat = \bfseries, timeformat = \ttfamily ]
      { 08:30 -> 10:00, 10:30 -> 12:00, 13:00 -> 14:30, 15:00 -> 16:30 }
  \end{verbatim}
\end{function}

\begin{function}{\course}
  \begin{syntax}
    \cs{course} \oarg{keys} \marg{start} \oarg{keys} \marg{end} \oarg{keys}
  \end{syntax}
  用於在當前工作日添加課程盒子，
  需在 \env{litetable} 環境中執行.
  兩個強制參數分別用於設置課程嘅開始和結束序號.
  可選參數接收下列鍵
  \begin{keyval}
    \item [\key{color}] \val{color} 用於設置課程盒子嘅顏色，
    （默認值：\cmd[no-index]{teal}）. 鍵名可省略.
    \item [\key{subject}] \val{string} 用於設置課程名稱.
    \item [\key{location}] \val{string} 用於設置課程地點.
    \item [\key{lecture}] \val{string} 用於設置授課教師.
    \item [\key{comment}] \val{string} 用於給課程添加腳注.
  \end{keyval}
  \begin{texnote}
    \begin{itemize}[leftmargin = 2em]
      \item 若 \meta{start} \cmd[no-index]{=} \meta{end}（課程盒子嘅高度為 $1$），
      則 \key*{location} 和 \key*{lecture} 將輸出在同一行，
      並且 \key*{comment} 將隱藏.
      \item 即使誤將 \meta{start} 與 \meta{end} 寫反，
      模板也會自動糾正.
      \item 若 \key*{location} 和 \key*{lecture} 均未使用，
      則 \key*{subject} 將輸出在課程盒子嘅
      竪直方向中心.
      \item 超出課程表範圍嘅課程盒子將不顯示，
      並會返回警告.
      輸入用例見 Appendix \ref{mwe}.
    \end{itemize}
  \end{texnote}
\end{function}

\begin{function}{\newday}
  \begin{syntax}
    \cs{newday} \oarg{integral value}
  \end{syntax}
  使其後面添加嘅課程盒子後移 \meta{intergal value} 個工作日.
  可選參數嘅默認值為 \cmd[no-index]{1}.
\end{function}

\begin{function}{\more}
  \begin{syntax}
    \cs{more} \marg{comment}
  \end{syntax}
  在課程表嘅右下角添加備注.
\end{function}

\appendix \linespread{1.05}

\section{工作範例} \label{mwe}

\begin{verbatim}
  \weeklist [ format = \bfseries \scshape, sep = \textbar ]
    {
      \texttwemoji{1f312} Mon -> 1, \texttwemoji{1f525} Tue -> 1,
      \texttwemoji{1f30a} Wed -> 1, \texttwemoji{1f332} Thu -> 1,
      \texttwemoji{1fa99} Fri -> 1
    }
  \timelist [ numformat = \ttfamily \bfseries, timeformat = \ttfamily ]
    {
      08:05 -> 08:50, 08:55 -> 09:40, 10:00 -> 10:45, 10:50 -> 11:35,
      11:40 -> 12:25, 13:30 -> 14:15, 14:20 -> 15:05, 15:15 -> 16:00,
      16:05 -> 16:50, 18:30 -> 19:15, 19:20 -> 20:05, 20:10 -> 20:55
    }
  \begin{litetable} [ MidnightBlue, sem = SEM 7 ] { Course Schedule }
    \course [ subject = interface3, comment = \TeX{} Live 2025,
              lecture = The \LaTeX{} Project, DarkBlue ] {4} {5}
    \newday
    \course [ subject = expl3, lecture = The \LaTeX{} Project ] {8} {8}
    \newday
    \course [ subject = Keep on \TeX ing, lecture = Donald E. Knuth,
              location = Stanford University, Purple ] {10} {11}
    \newday
    \course [ subject = Ti\textit k\/Z, lecture = \textsc{pgf},
              Crimson, comment = Version 3.1.10 ] {3} {5}
    \more { Programme Duration: 09 / 2021 -- 07 / 2025 }
  \end{litetable}  
\end{verbatim}

\PrintIndex

\weeklist [ format = \bfseries \scshape, sep = \textbar ]
  {
    \texttwemoji{1f312} Mon -> 1, \texttwemoji{1f525} Tue -> 1,
    \texttwemoji{1f30a} Wed -> 1, \texttwemoji{1f332} Thu -> 1,
    \texttwemoji{1fa99} Fri -> 1
  }
\timelist [ numformat = \ttfamily \bfseries, timeformat = \ttfamily ]
  {
    08:05 -> 08:50, 08:55 -> 09:40, 10:00 -> 10:45, 10:50 -> 11:35,
    11:40 -> 12:25, 13:30 -> 14:15, 14:20 -> 15:05, 15:15 -> 16:00,
    16:05 -> 16:50, 18:30 -> 19:15, 19:20 -> 20:05, 20:10 -> 20:55
  }
\begin{litetable} [ MidnightBlue, sem = SEM 7 ] { Course Schedule }
  \course [ subject = interface3, comment = \TeX{} Live 2025,
            lecture = The \LaTeX{} Project, DarkBlue ] {4} {5}
  \newday
  \course [ subject = expl3, lecture = The \LaTeX{} Project ] {8} {8}
  \newday
  \course [ subject = Keep on \TeX ing, lecture = Donald E. Knuth,
            location = Stanford University, Purple ] {10} {11}
  \newday
  \course [ subject = Ti\textit k\/Z, lecture = \textsc{pgf},
            Crimson, comment = Version 3.1.10 ] {3} {5}
  \more { Programme Duration: 09 / 2021 -- 07 / 2025 }
\end{litetable}

\end{document}