\documentclass[svgnames, onlydoc, quiet]{l3doc}
\usepackage{litetable, twemojis}
\usepackage[mono = false]{libertine}
\usepackage{ctex}
\setlength \parindent {0pt}
\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@ApLaTeX #1%
  {\HOLOGO@mbox {A\kern -.05em p\kern -.05em \hologo{LaTeX}}}
\newlist{keyval}{itemize}{10}
\setlist[keyval]{leftmargin = 0pt, labelsep = 0pt}
\makeatother
\makeindex

\title{%
  \bfseries \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} \texttt{->} \meta{right} 型數據結構嘅接口，
    並為低版本 \hologo{TeX} Live 做兼容.
  }
}

\date{Released 2025-03-26\quad \texttt{v3.3F}}

\begin{document}

\maketitle

\begin{documentation}

\section{介紹}

\pkg{litetable} 宏包提供咗一個多彩嘅課程表設計，
基於 \pkg{tikz} 由 \pkg{expl3} 開發.
支援 \hologo{pdfLaTeX}，\hologo{XeLaTeX}，\hologo{ApLaTeX} 同
\hologo{LuaLaTeX} 等多種編譯方式. 點擊跳轉到
\href{litetable.pdf}{[\textsf{English}]}
\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} 可設定課程表框架嘅背景色
  （默認值：|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}
    可設置工作日列表格式 （默認值：|\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}
    可設定時間列表嘅序號字體，
    （默認值：|\ttfamily \bfseries|）.
    \item [\key{timefont}] \val{format} 可設定時間列表嘅時間字體，
    （默認值：|\ttfamily|）.
    \item [\key{hidetime}] \val\TFF 用於隱藏時間列表中嘅時間，只保留序號.
    （初始值：|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} 用於設置課程盒子嘅顏色，
    （默認值：|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} |=| \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} 個工作日.
  可選參數嘅默認值係 |1|.
\end{function}

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

\appendix \linespread{1.25}

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

\begin{verbatim}
  \documentclass[svgnames]{article}

  \usepackage{litetable, twemojis}
  \usepackage[mono = false]{libertine}
  \usepackage[T1]{fontenc}

  \begin{document}

  \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}
\end{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{documentation}

\PrintIndex

\end{document}