Debian Codegraph @

texmf-dist/source/latex/litetable/litetable.dtx

raw
1 % \iffalse meta-comment
2 %
3 % File: litetable.dtx
4 % -----------------------------------------------------------------------
5 % Copyright (C) 2023-2026 by Mingyu Xia <[email protected]> *
6 % -----------------------------------------------------------------------
7 % This work may be distributed and/or modified under the conditions *
8 % of the LaTeX Project Public License (LPPL), either version 1.3c of *
9 % this license or (at your option) any later version. *
10 % The latest version of this license is in *
11 % *
12 % http://www.latex-project.org/lppl.txt *
13 % *
14 % and version 1.3c or later is part of all distributions of LaTeX *
15 % version 2008 or later. *
16 % *
17 % This work has the LPPL maintenance status `maintained'. *
18 % *
19 % The Current Maintainer of this work is Mingyu Xia. *
20 % -----------------------------------------------------------------------
21 % This work consists of the files litetable.dtx, *
22 % litetable.ins, *
23 % the derived files litetable.sty, *
24 % the documentation files litetable.pdf, *
25 % and README.md. *
26 % -----------------------------------------------------------------------
27 % *
28 % Any modification of this file should ensure that the copyright and *
29 % license information is placed in the derived files. *
30 % *
31 % -----------------------------------------------------------------------
32 %
33 %<*internal>
34 \iffalse
35 %</internal>
36 %
37 %<*readme>
38 [![CTAN Version](https://img.shields.io/ctan/v/litetable)](https://ctan.org/pkg/litetable)
39 [![GitHub Release](https://img.shields.io/github/v/release/myhsia/litetable)](https://github.com/myhsia/litetable/releases/latest)
40 [![GitHub Last Commit](https://img.shields.io/github/last-commit/myhsia/litetable)](https://github.com/myhsia/litetable/commits)
41 [![Actions Status](https://github.com/myhsia/litetable/actions/workflows/main.yaml/badge.svg?branch=main)](https://github.com/myhsia/litetable/actions)
42 [![GitHub Repo stars](https://img.shields.io/github/stars/myhsia/litetable)](https://github.com/myhsia/litetable)
43
44 The `litetable` Package
45 =======================
46
47 The `litetable` package (conducted with LaTeX3) provides a colorful design
48 of timetable.
49
50 Overview
51 --------
52
53 The package provides the `\course` macro
54
55 \course [<keys>] {<start num>} [<keys>] {<end-num>} [<keys>]
56
57 to add colorful custom course block.
58
59 See `litetable.pdf` for more. Happy TeXing!
60
61 Issues
62 ------
63
64 The issue tracker for `litetable` is currently located
65 [on GitHub](https://github.com/myhsia/litetable/issues).
66
67 Build status
68 ------------
69
70 This project uses [GitHub Actions](https://github.com/features/actions)
71 as a hosted continuous integration service. For each commit, the build status
72 is tested using the current release of TeX Live.
73
74 _Current build status:_ ![build status](https://github.com/myhsia/litetable/actions/workflows/main.yaml/badge.svg?branch=main)
75
76 Copyright and License
77 ---------------------
78
79 Copyright (C) 2023-2026 by Mingyu Xia \<[email protected]\>
80
81 This work may be distributed and/or modified under the conditions
82 of the LaTeX Project Public License (LPPL), either version 1.3c of
83 this license or (at your option) any later version.
84 The latest version of this license is in
85
86 http://www.latex-project.org/lppl.txt
87
88 and version 1.3c or later is part of all distributions of LaTeX
89 version 2008 or later.
90
91 This work has the LPPL maintenance status `maintained'.
92
93 The Current Maintainer of this work is **Mingyu Xia**.
94 %</readme>
95 %
96 %<*internal>
97 \fi
98 %</internal>
99 %
100 %<*driver>
101 \documentclass[svgnames]{l3doc}
102 \usepackage{pdfpages, twemojis}
103 \usepackage[osf, mono = false]{libertine}
104 \ExplSyntaxOn \makeatletter
105 \newcommand \mail[1]{\href{mailto:#1}{\ttfamily #1}}
106 \DeclareDocumentCommand \key { s m }
107 {
108 \IfBooleanTF {#1} { \textcolor{red}{\ttfamily \bfseries #2} }
109 {
110 \group_begin: \ttfamily
111 \seq_set_from_clist:Nn \l_tmpa_seq {#2}
112 \seq_set_map:NNn \l_tmpb_seq \l_tmpa_seq
113 { \exp_not:n { \textcolor{red}{\bfseries ##1} } }
114 \seq_use:Nn \l_tmpb_seq { ,~ } \:=\:
115 \group_end:
116 }
117 }
118 \DeclareCommandCopy \val \meta
119 \def \TTF {\textup{\textbf{true}\makebox[0pt][r]{^^A
120 \underline {\phantom{\bfseries true}\kern-0.1em}}\textbar}false}
121 \def \TFF {true\textup{\textbar\textbf{false}\makebox[0pt][r]{^^A
122 \underline {\phantom{\bfseries false}\kern-0.1em}}}}
123 \makeatother \ExplSyntaxOff
124 \newlist{keyval}{itemize}{10}
125 \setlist[keyval]{leftmargin = 0pt, labelsep = 0pt}
126 \makeindex
127 \begin{document}
128 \DocInput{\jobname.dtx}
129 \end{document}
130 %</driver>
131 % \fi
132 %
133 % \title{^^A
134 % The \cls{litetable} Package --- Colorful Timetable\thanks{^^A
135 % \url{https://github.com/myhsia/litetable},
136 % \url{https://ctan.org/pkg/litetable}^^A
137 % }\thanks{^^A
138 % \href{https://github.com/ljguo1020}{Lijun Guo} developed an interface
139 % to parse \meta{left} \texttt{->} \meta{right} data structures.^^A
140 % }^^A
141 % }
142 %
143 % \author{Mingyu Xia\thanks{\mail{[email protected]}}}
144 %
145 % \date{Released 2026-02-07\quad \texttt{v3.9A}}
146 %
147 % \maketitle
148 %
149 % \begin{documentation}
150 %
151 % \section{Introduction}
152 %
153 % The \cls{litetable} package provides a colorful design of timetable, developed
154 % by \pkg{expl3} based on Ti\textit k\/Z.
155 % It supports various compilation methods,
156 % such as \hologo{pdfLaTeX}, \hologo{XeLaTeX}, \hologo{ApLaTeX},
157 % \hologo{LuaLaTeX}, etc. Click to jump to the manual's
158 % \href{http://mirrors.ctan.org/macros/latex/contrib/litetable/litetable-zh-cn.pdf}{[\textsf{Chinese Version}]}
159 % \href{http://mirrors.ctan.org/macros/latex/contrib/litetable/litetable-zh-hk.pdf}{[\textsf{Cantonese Version}]}.
160 %
161 % \section{Usage}
162 %
163 % To load this package, write the line
164 % \begin{quote}
165 % |\usepackage [scale = |\meta{fp num}| ] {litetable}|
166 % \end{quote}
167 % The \key*{scale} key can set the scale of the timetable (Default: |1.0|).
168 % \DescribeEnv{litetable}
169 % The \env{litetable} environment can create a blank timetable frame, and it
170 % should be executed after commands \cs{timelist} and \cs{weeklist}.
171 % \begin{quote}
172 % |\begin{litetable}|
173 % \oarg{keys} \marg{title} \oarg{keys}| ... |
174 % |\end{litetable}|
175 % \end{quote}
176 % The mandatory argument can set the title of the timetable, and the
177 % optional argument accepts the following keys
178 % \begin{keyval}
179 % \item [\key{color}] \val{string} can set the background color
180 % (Default: |gray|), this key's name could be omitted.
181 % \item [\key{sem}] \val{string} can set the semester information at the
182 % northeast corner of the page.
183 % \item [\key{hline}] \val{string} can set style of the horizontal lines
184 % (Default: |solid|).
185 % \end{keyval}
186 %
187 % \begin{function}{\weeklist}
188 % \begin{syntax}
189 % \cs{weeklist} \oarg{keys} \marg{list} \oarg{keys}
190 % \end{syntax}
191 % The mandatory argument accepts an array to set a list of working days and
192 % the width of each column at the top of the timetable.
193 % The optional argument accepts the following keys
194 % \begin{keyval}
195 % \item [\key{format}] \val{format commands} can set the font for the list
196 % of working days (Default: |\bfseries|).
197 % \item [\key{sep}] \val{dim} can set the separator of
198 % the list of working days.
199 % \end{keyval}
200 % \begin{verbatim}
201 % \weeklist [ format = \bfseries \scshape, sep = \textbar ]
202 % { Mon -> 1.05, Tue -> 1.05, Wed -> 1.1, Thu -> 1.1, Fri -> .9 }
203 % \end{verbatim}
204 % \end{function}
205 %
206 % \begin{function}{\timelist}
207 % \begin{syntax}
208 % \cs{timelist} \oarg{keys} \marg{list} \oarg{keys}
209 % \end{syntax}
210 % The mandatory argument accepts an array to set the time list on the left
211 % side of the timetable. The optional argument accepts the following keys
212 % \begin{keyval}
213 % \item [\key{numformat}] \val{format commands} can set the font for the
214 % sequence number of the time list
215 % (Default: |\ttfamily \bfseries|).
216 % \item [\key{timeformat}] \val{format commands} can set the font for the
217 % time of the time list. (Default: |\ttfamily|).
218 % \item [\key{hidetime}] \val{\TFF} hide the time in the time list and only
219 % retain the sequence number. The initial value is |false|.
220 % \end{keyval}
221 % \begin{verbatim}
222 % \timelist [ numformat = \bfseries, timeformat = \ttfamily ]
223 % { 08:30 -> 10:00, 10:30 -> 12:00, 13:00 -> 14:30, 15:00 -> 16:30 }
224 % \end{verbatim}
225 % \end{function}
226 %
227 % \begin{function}{\course}
228 % \begin{syntax}
229 % \cs{course} \oarg{keys} \marg{start} \oarg{keys} \marg{end} \oarg{keys}
230 % \end{syntax}
231 % It's used to add course boxes on the current workday, and needs to be
232 % executed within the \env{litetable} environment.
233 % The two mandatory arguments can set the start and ends of the course
234 % respectively, the optional argument accepts the following keys
235 % \begin{keyval}
236 % \item [\key{color}] \val{string} can set the color of the course box
237 % (Default: |teal|), this key's name could be omitted.
238 % \item [\key{subject}] \val{string} can set the name of the course.
239 % \item [\key{location}] \val{string} can set the location of the course.
240 % \item [\key{lecture}] \val{string} can set the lecture of the course.
241 % \item [\key{comment}] \val{string} can add footnote to the course.
242 % \end{keyval}
243 % \begin{texnote}
244 % \begin{itemize}[leftmargin = 2em]
245 % \item If \meta{start} |=| \meta{end} (the height of the
246 % course box is $1$ unit), then \key*{location} and \key*{lecture} will be
247 % outputted in the same line and \key*{comment} will be hidden.
248 % \item The template will correct automatically if \meta{start} and
249 % \meta{end} were misplaced.
250 % \item If neither \key*{location} nor \key*{lecture} is assigned value,
251 % then \key*{subject} will be outputted in the vertical center of the
252 % course box.
253 % \item Course boxes that exceed the range of the timetable won't
254 % display and it will return a warning.
255 % The input example refers to Appendix \ref{mwe}.
256 % \end{itemize}
257 % \end{texnote}
258 % \end{function}
259 %
260 % \begin{function}{\newday}
261 % \begin{syntax}
262 % \cs{newday} \oarg{integral value}
263 % \end{syntax}
264 % It can move the next course boxes right \meta{integral value} working days.
265 % The default value of the optional argument is |1|.
266 % \end{function}
267 %
268 % \begin{function}{\more}
269 % \begin{syntax}
270 % \cs{more} \marg{comment}
271 % \end{syntax}
272 % It can add a comment at the southwest corner of the timetable.
273 % \end{function}
274 %
275 % \clearpage \linespread{1.3}
276 %
277 % \section{Working Example} \label{mwe}
278 %
279 % \verbatiminput{litetable-demo.tex}
280 %
281 % \includepdf{litetable-demo.pdf}
282 %
283 % \end{documentation}
284 %
285 % \appendix \pagenumbering{Roman}
286 %
287 % \begin{implementation}
288 %
289 % \section{The Source Code}
290 % Start the optionlist |package| for \pkg{l3docstrip}.
291 % \begin{macrocode}
292 %<*package>
293 % \end{macrocode}
294 %
295 % \begin{macrocode}
296 %<@@=ltbl>
297 % \end{macrocode}
298 %
299 % \begin{macrocode}
300 \ProvidesExplPackage {litetable} {2026-02-07} {v3.9A}
301 {A Colorful Timetable Design}
302 % \end{macrocode}
303 %
304 % \begin{macrocode}
305 \RequirePackage{tikz}
306 % \end{macrocode}
307 % Warning Broadcast
308 % \begin{macrocode}
309 \cs_new_protected:Npn \@@_msg_new:nn #1#2
310 { \msg_new:nnn { litetable } {#1} {#2} }
311 \cs_new_protected:Npn \@@_msg_warning:n #1
312 { \msg_warning:nn { litetable } {#1} }
313 \@@_msg_new:nn { course }
314 { \exp_not:N \course ~ box(s) ~ exceed ~ workdays ~ were ~ ignored }
315 % \end{macrocode}
316 % \begin{macro}
317 % {
318 % \@@_get_left:nN, \@@_get_right:nN,
319 % \@@_get_left:eN, \@@_get_right:eN,
320 % }
321 % Handle \meta{left} |->| \meta{right} data structures
322 % (by \href{https://github.com/ljguo1020}{Lijun Guo})
323 % \begin{macrocode}
324 \cs_new_protected_nopar:Npn \@@_get_left:nN #1#2
325 {
326 \group_begin: \seq_set_split:Nnn \l_@@_tmpa_seq { -> } {#1}
327 \exp_args:NNNe \group_end:
328 \tl_set:Nn #2 { \seq_item:Nn \l_@@_tmpa_seq { 1 } }
329 }
330 \cs_new_protected_nopar:Npn \@@_get_right:nN #1#2
331 {
332 \group_begin: \seq_set_split:Nnn \l_@@_tmpa_seq { -> } {#1}
333 \exp_args:NNNe \group_end:
334 \tl_set:Nn #2 { \seq_item:Nn \l_@@_tmpa_seq { 2 } }
335 }
336 \cs_generate_variant:Nn \@@_get_left:nN { eN }
337 \cs_generate_variant:Nn \@@_get_right:nN { eN }
338 % \end{macrocode}
339 % \end{macro}
340 %
341 % \subsection{User's Interface}
342 %
343 % \begin{variable}
344 % {
345 % \l_@@_textwidth_dim,
346 % \l_@@_textheight_dim,
347 % \l_@@_reswidth_dim,
348 % \l_@@_resheight_dim
349 % }
350 % Dimensions for the physical width and height of the timetable and margin,
351 % controlled by |\l_@@_scale_fp| in package option.
352 % \begin{macrocode}
353 \dim_new:N \l_@@_textwidth_dim
354 \dim_new:N \l_@@_textheight_dim
355 \dim_new:N \l_@@_reswidth_dim
356 \dim_new:N \l_@@_resheight_dim
357 \keys_define:nn { litetable / pkgoption }
358 {
359 scale .fp_set:N = \l_@@_scale_fp,
360 scale .initial:n = 1.0,
361 unknown .code:n = \@@_unknown_option:n {#1}
362 }
363 % \end{macrocode}
364 % \end{variable}
365 % \begin{macro}{\@@_unknown_option:n}
366 % Handel the unknown options.
367 % \begin{variable}{\g_@@_base_options_clist}
368 % \begin{macrocode}
369 \clist_new:N \g_@@_base_options_clist
370 % \end{macrocode}
371 % \end{variable}
372 % \begin{macrocode}
373 \cs_new_protected_nopar:Npn \@@_unknown_option:n #1
374 {
375 \tl_if_empty:nTF {#1}
376 {
377 \clist_gput_right:NV
378 \g_@@_base_options_clist \l_keys_key_str
379 }
380 {
381 \exp_args:NNx
382 \clist_gput_right:Nn \g_@@_base_options_clist
383 { \l_keys_key_str = \exp_not:n {#1} }
384 }
385 }
386 % \end{macrocode}
387 % \end{macro}
388 % Process the package option.
389 % \begin{macrocode}
390 \ProcessKeyOptions [ litetable / pkgoption ]
391 \dim_gset:Nn \l_@@_textwidth_dim
392 { \fp_eval:n { \l_@@_scale_fp } \paperwidth }
393 \dim_gset:Nn \l_@@_textheight_dim
394 { \fp_eval:n { \l_@@_scale_fp } \paperheight }
395 \dim_gset:Nn \l_@@_reswidth_dim
396 { \fp_eval:n { 1 - \l_@@_scale_fp } \paperwidth /2 }
397 \dim_gset:Nn \l_@@_resheight_dim
398 { \fp_eval:n { 1 - \l_@@_scale_fp } \paperheight/2 }
399 % \end{macrocode}
400 %
401 % \begin{macro}{\weeklist}
402 % Set a list of working days and the width of each column at the top of the
403 % timetable.
404 % \begin{macrocode}
405 \NewDocumentCommand \weeklist { O{} m O{} }
406 {
407 \keys_set:nn { litetable / weeklist } { #1, #3 }
408 \@@_weeklist:n {#2}
409 }
410 % \end{macrocode}
411 % \begin{variable}{\l_@@_weeklist_format_tl, \l_@@_weeklist_sep_tl}
412 % Key--value definitions for the \cs{weeklist} command.
413 % \begin{macrocode}
414 \keys_define:nn { litetable / weeklist }
415 {
416 format .tl_set:N = \l_@@_weeklist_format_tl,
417 format .initial:n = \bfseries,
418 sep .tl_set:N = \l_@@_weeklist_sep_tl
419 }
420 % \end{macrocode}
421 % \end{variable}
422 % \end{macro}
423 % \begin{macro}{\timelist}
424 % Set the time list on the left side of the timetable.
425 % \begin{macrocode}
426 \NewDocumentCommand \timelist { O{} m O{} }
427 {
428 \keys_set:nn { litetable / timelist } { #1, #3 }
429 \@@_timelist:n {#2}
430 }
431 % \end{macrocode}
432 % \begin{variable}
433 % {
434 % \l_@@_timelist_numformat_tl, \l_@@_timelist_timeformat_tl,
435 % \l_@@_timelist_hidetime_bool
436 % }
437 % Key--value definitions for the \cs{timelist} command.
438 % \begin{macrocode}
439 \keys_define:nn { litetable / timelist }
440 {
441 numformat .tl_set:N = \l_@@_timelist_numformat_tl,
442 numformat .initial:n = \ttfamily \bfseries,
443 timeformat .tl_set:N = \l_@@_timelist_timeformat_tl,
444 timeformat .initial:n = \ttfamily,
445 hidetime .bool_set:N = \l_@@_timelist_hidetime_bool,
446 hidetime .initial:n = false,
447 hidetime .default:n = true
448 }
449 % \end{macrocode}
450 % \end{variable}
451 % \end{macro}
452 % \begin{environment}{litetable}
453 % Create a blank timetable frame.
454 % \begin{macrocode}
455 \NewDocumentEnvironment { litetable } { O{} m O{} }
456 {
457 \clearpage \thispagestyle{empty}
458 \group_begin:
459 \keys_set:nn { litetable / frame } { #1, #3 }
460 \tikzpicture [ remember ~ picture, overlay ]
461 \@@_maketable:n {#2}
462 } { \endtikzpicture \group_end: \clearpage }
463 % \end{macrocode}
464 % \begin{variable}{\l_@@_bg_color_tl, \l_@@_hline_type_tl, \l_@@_bg_sem_tl}
465 % Key--value definitions for the \env{litetable} command.
466 % \begin{macrocode}
467 \keys_define:nn { litetable / frame }
468 {
469 color .tl_set:N = \l_@@_bg_color_tl,
470 color .initial:n = gray,
471 hline .tl_set:N = \l_@@_hline_type_tl,
472 hline .initial:n = solid,
473 sem .tl_set:N = \l_@@_bg_sem_tl,
474 unknown .code:n = \tl_if_novalue:nF {#1}
475 { \tl_set_eq:NN \l_@@_bg_color_tl \l_keys_key_tl }
476 }
477 % \end{macrocode}
478 % \end{variable}
479 % \end{environment}
480 % \begin{macro}{\course}
481 % Add course boxes on the current workday
482 % \begin{macrocode}
483 \NewDocumentCommand \course { O{} m O{} m O{} }
484 {
485 \group_begin:
486 \bool_lazy_any:nTF
487 {
488 {
489 \int_compare_p:nNn { \l_@@_weekday_int } >
490 { \clist_count:N \l_@@_week_clist }
491 }
492 { \int_compare_p:nNn {#2} > { \clist_count:N \l_@@_time_clist } }
493 { \int_compare_p:nNn {#4} > { \clist_count:N \l_@@_time_clist } }
494 } { \@@_msg_warning:n { course } }
495 {
496 \keys_set:nn { litetable / course } { #1, #3, #5 }
497 \int_compare:nNnTF {#2} < {#4}
498 { \@@_course_box_aux:nn {#2} {#4} }
499 { \@@_course_box_aux:nn {#4} {#2} }
500 }
501 \group_end:
502 }
503 % \end{macrocode}
504 % \begin{variable}
505 % {
506 % \l_@@_course_color_tl , \l_@@_course_subject_tl,
507 % \l_@@_course_lecture_tl , \l_@@_course_lecture_tl,
508 % \l_@@_course_location_tl, \l_@@_course_comment_tl
509 % }
510 % Key--value definitions for the \cs{course} command.
511 % \begin{macrocode}
512 \keys_define:nn { litetable / course }
513 {
514 color .tl_set:N = \l_@@_course_color_tl,
515 color .initial:n = black,
516 subject .tl_set:N = \l_@@_course_subject_tl,
517 lecture .tl_set:N = \l_@@_course_lecture_tl,
518 location .tl_set:N = \l_@@_course_location_tl,
519 comment .tl_set:N = \l_@@_course_comment_tl,
520 unknown .code:n = \tl_if_novalue:nF {#1}
521 { \tl_set_eq:NN \l_@@_course_color_tl \l_keys_key_tl }
522 }
523 % \end{macrocode}
524 % \end{variable}
525 % \end{macro}
526 % \begin{macro}{\more}
527 % Add a comment at the southwest corner of the timetable.
528 % \begin{macrocode}
529 \NewDocumentCommand \more { m }
530 {
531 \node [ yshift = .5\l_@@_time_vunit_dim, left = 1ex,
532 darkgray, font = \small \bfseries
533 ] at ([shift =
534 {(-\l_@@_reswidth_dim, \l_@@_resheight_dim)}
535 ]current ~ page.south ~ east) {#1};
536 }
537 % \end{macrocode}
538 % \end{macro}
539 % \begin{macro}{\newday}
540 % Move the next course boxes right \meta{integral value} working days.
541 % \begin{macrocode}
542 \NewDocumentCommand \newday { O{1} } { \int_add:Nn \l_@@_weekday_int {#1} }
543 \int_new:N \l_@@_weekday_int
544 \int_set:Nn \l_@@_weekday_int { 1 }
545 % \end{macrocode}
546 % \end{macro}
547 %
548 % \subsection{Internal Auxiliary}
549 %
550 % \begin{variable}
551 % {
552 % \l_@@_week_ratio_clist, \l_@@_week_accum_clist,
553 % \l_@@_week_num_fp , \l_@@_week_hunit_dim
554 % }
555 % The ratios of every working days, the accumulation of the ratios of every
556 % working days, the sequence number of every working days, the horizontal
557 % width unit of the timetable.
558 % \begin{macrocode}
559 \clist_new:N \l_@@_week_ratio_clist
560 \clist_new:N \l_@@_week_accum_clist
561 \fp_new:N \l_@@_week_num_fp
562 \dim_new:N \l_@@_week_hunit_dim
563 % \end{macrocode}
564 % \end{variable}
565 % \begin{macro}{\@@_weeklist:n}
566 % Define the auxiliary command of \cs{weeklist}.
567 % \begin{macrocode}
568 \cs_new_protected_nopar:Npn \@@_weeklist:n #1
569 {
570 \clist_set:Nn \l_@@_week_clist {#1}
571 \exp_args:NNf \clist_map_inline:Nn \l_@@_week_clist
572 {
573 \@@_get_right:eN {##1} \l_@@_tmpb_tl
574 \clist_put_right:Ne \l_@@_week_ratio_clist { \l_@@_tmpb_tl }
575 }
576 \int_step_inline:nn { \clist_count:N \l_@@_week_clist }
577 {
578 \clist_clear:N \l_@@_week_accumtmp_clist
579 \int_step_inline:nn {##1}
580 {
581 \clist_put_right:Ne \l_@@_week_accumtmp_clist
582 { \clist_item:Nn \l_@@_week_ratio_clist {####1} }
583 }
584 \clist_put_right:Ne \l_@@_week_accum_clist
585 { \fp_eval:n { \clist_use:Nn \l_@@_week_accumtmp_clist { + } } }
586 }
587 \fp_set:Nn \l_@@_week_num_fp
588 {
589 \clist_item:Nn \l_@@_week_accum_clist
590 { \clist_count:N \l_@@_week_clist }
591 }
592 \dim_set:Nn \l_@@_week_hunit_dim
593 { \fp_eval:n { 14/\l_@@_week_num_fp/15 } \l_@@_textwidth_dim }
594 }
595 % \end{macrocode}
596 % \end{macro}
597 % \begin{variable}{\l_@@_time_num_int, \l_@@_time_vunit_dim}
598 % The sequence number of the time list, and the vertical gap between the
599 % start and end time.
600 % \begin{macrocode}
601 \int_new:N \l_@@_time_num_int
602 \dim_new:N \l_@@_time_vunit_dim
603 % \end{macrocode}
604 % \end{variable}
605 % \begin{macro}{\@@_timelist:n}
606 % Define the auxiliary command of \cs{timelist}.
607 % \begin{macrocode}
608 \cs_new_protected_nopar:Npn \@@_timelist:n #1
609 {
610 \clist_set:Nn \l_@@_time_clist {#1}
611 \int_set:Nn \l_@@_time_num_int { \clist_count:N \l_@@_time_clist }
612 \dim_set:Nn \l_@@_time_vunit_dim
613 { \fp_eval:n { 1/(2\l_@@_time_num_int + 3.5) } \l_@@_textheight_dim }
614 }
615 % \end{macrocode}
616 % \end{macro}
617 % \begin{variable}{\l_@@_timelist_shift_dim}
618 % Store the vertical shift of the sequence number of the time list.
619 % \begin{macrocode}
620 \dim_new:N \l_@@_timelist_shift_dim
621 % \end{macrocode}
622 % \end{variable}
623 % \begin{macro}{\@@_maketable:n}
624 % Define the auxiliary command of the \env{litetable} environment.
625 % \begin{macrocode}
626 \cs_new_protected_nopar:Npn \@@_maketable:n #1
627 {
628 \fill [ \l_@@_bg_color_tl!5 ]
629 ([shift =
630 {(\l_@@_reswidth_dim, -\l_@@_resheight_dim)}
631 ]current ~ page.north ~ west) rectangle +
632 (\l_@@_textwidth_dim, -1.5\l_@@_time_vunit_dim)
633 node [ midway, black, font = \huge \bfseries ] {#1};
634 \tl_if_empty:NF \l_@@_bg_sem_tl
635 {
636 \node [ shift = {(-.02\paperwidth, -.75\l_@@_time_vunit_dim)},
637 left, rectangle, fill = DarkBlue!10, text = DarkBlue!60,
638 inner ~ sep = 2ex, rounded ~ corners = 8pt, font = \large
639 ] at ([shift =
640 {(-\l_@@_reswidth_dim, -\l_@@_resheight_dim)}
641 ]current ~ page.north ~ east) { \l_@@_bg_sem_tl };
642 }
643 \int_step_inline:nnnn { 0 } { 2 } { \l_@@_time_num_int }
644 {
645 \bool_lazy_and:nnTF
646 { \int_if_even_p:n { \l_@@_time_num_int } }
647 { \int_compare_p:nNn { ##1 } = { \l_@@_time_num_int } }
648 {
649 \filldraw [ fill = \l_@@_bg_color_tl!5, thick,
650 draw = gray, \l_@@_hline_type_tl ]
651 ([shift = {(
652 {-.4pt + \l_@@_reswidth_dim},
653 {\fp_eval:n { -2 * ##1 - 2.5 } \l_@@_time_vunit_dim
654 - \l_@@_resheight_dim})}
655 ]current ~ page.north ~ west
656 ) rectangle
657 ([shift =
658 {(.4pt - \l_@@_reswidth_dim, .4pt + \l_@@_resheight_dim)}
659 ]current ~ page.south ~ east);
660 }
661 {
662 \filldraw [ fill = \l_@@_bg_color_tl!5, thick,
663 draw = gray, \l_@@_hline_type_tl ]
664 ([shift = {(
665 {-.4pt + \l_@@_reswidth_dim},
666 {\fp_eval:n { -2 * ##1 - 2.5 } \l_@@_time_vunit_dim
667 - \l_@@_resheight_dim})}
668 ]current ~ page.north ~ west
669 ) rectangle +
670 (\l_@@_textwidth_dim + .8pt, -2\l_@@_time_vunit_dim);
671 }
672 }
673 \bool_if:NTF \l_@@_timelist_hidetime_bool
674 {
675 \dim_set:Nn \l_@@_timelist_shift_dim
676 { -1.5\l_@@_time_vunit_dim }
677 }
678 {
679 \dim_set:Nn \l_@@_timelist_shift_dim
680 { -\l_@@_time_vunit_dim }
681 }
682 \int_step_inline:nn { \l_@@_time_num_int }
683 {
684 \node [ darkgray!80, shift =
685 {(
686 \l_@@_textwidth_dim/30,
687 -2 * ##1 \l_@@_time_vunit_dim +
688 \l_@@_timelist_shift_dim
689 )}, font = \large \l_@@_timelist_numformat_tl
690 ] at ([shift =
691 {(\l_@@_reswidth_dim, -\l_@@_resheight_dim)}
692 ]current ~ page.north ~ west) {##1};
693 }
694 \bool_if:NF \l_@@_timelist_hidetime_bool
695 {
696 \int_step_inline:nn { \clist_count:N \l_@@_time_clist }
697 {
698 \@@_get_left:eN { \clist_item:Nn \l_@@_time_clist {##1} }
699 \l_@@_tmpa_tl
700 \@@_get_right:eN { \clist_item:Nn \l_@@_time_clist {##1} }
701 \l_@@_tmpb_tl
702 \node [ gray, align = center, shift =
703 {(
704 \l_@@_textwidth_dim/30,
705 \fp_eval:n { -1.85 - 2 * ##1 } \l_@@_time_vunit_dim
706 )}, font = \l_@@_timelist_timeformat_tl
707 ] at ([shift =
708 {(\l_@@_reswidth_dim, -\l_@@_resheight_dim)}
709 ]current ~ page.north ~ west)
710 { \l_@@_tmpa_tl\\ \l_@@_tmpb_tl };
711 }
712 }
713 \int_step_inline:nn { \clist_count:N \l_@@_week_clist }
714 {
715 \int_compare:nNnF {##1} = { \clist_count:N \l_@@_week_clist }
716 {
717 \node [ shift =
718 {(\fp_eval:n
719 {
720 14 * \clist_item:Nn \l_@@_week_accum_clist {##1}/
721 \l_@@_week_num_fp/15 + 1/15
722 } \l_@@_textwidth_dim, -2\l_@@_time_vunit_dim
723 )}, darkgray, font = \ttfamily
724 ] at ([shift =
725 {(\l_@@_reswidth_dim, -\l_@@_resheight_dim)}
726 ]current ~ page.north ~ west)
727 { \l_@@_weeklist_sep_tl };
728 }
729 \@@_get_left:eN { \clist_item:Nn \l_@@_week_clist {##1} }
730 \l_@@_tmpa_tl
731 \node [ shift =
732 {(\fp_eval:n
733 {
734 14(
735 \clist_item:Nn \l_@@_week_accum_clist {##1} -
736 \clist_item:Nn \l_@@_week_ratio_clist {##1}/2
737 )/\l_@@_week_num_fp/15 + 1/15
738 } \l_@@_textwidth_dim, -2\l_@@_time_vunit_dim
739 )}, font = \large \l_@@_weeklist_format_tl
740 ] at ([shift =
741 {(\l_@@_reswidth_dim, -\l_@@_resheight_dim)}
742 ]current ~ page.north ~ west) { \l_@@_tmpa_tl };
743 }
744 \draw [ gray, very ~ thick ]
745 ([shift =
746 {({-.4pt +\l_@@_reswidth_dim}, {-.4pt -\l_@@_resheight_dim})}
747 ]current ~ page.north ~ west) rectangle
748 ([shift =
749 {({.4pt - \l_@@_reswidth_dim}, {.4pt + \l_@@_resheight_dim})}
750 ]current ~ page.south ~ east);
751 }
752 % \end{macrocode}
753 % \end{macro}
754 % \begin{variable}{\l_@@_course_shift_dim}
755 % Store the vertical shift of the course subject in course box.
756 % \begin{macrocode}
757 \dim_new:N \l_@@_course_shift_dim
758 % \end{macrocode}
759 % \end{variable}
760 % \begin{macro}{\@@_course_box_aux:nn}
761 % Define the auxiliary command of \cs{course}.
762 % \begin{macrocode}
763 \cs_new_protected_nopar:Npn \@@_course_box_aux:nn #1#2
764 {
765 \begin{scope}
766 \clip [ preaction = { draw, ultra ~ thick, \l_@@_course_color_tl!60 },
767 preaction = { fill, \l_@@_course_color_tl!10 },
768 rounded ~ corners = 8pt ]
769 ([shift =
770 {(
771 \fp_eval:n
772 {
773 \clist_item:Nn \l_@@_week_accum_clist
774 { \l_@@_weekday_int } -
775 \clist_item:Nn \l_@@_week_ratio_clist
776 { \l_@@_weekday_int }
777 } \l_@@_week_hunit_dim + \l_@@_textwidth_dim/15
778 + \l_@@_reswidth_dim + 1.2pt,
779 \fp_eval:n { -.5 - 2 * #1 } \l_@@_time_vunit_dim
780 - \l_@@_resheight_dim - 1.2pt
781 )}]current ~ page.north ~ west) rectangle +
782 (
783 \clist_item:Nn \l_@@_week_ratio_clist
784 { \l_@@_weekday_int } \l_@@_week_hunit_dim - 2.4pt,
785 \fp_eval:n { 2(#1 - #2 - 1) } \l_@@_time_vunit_dim + 2.4pt
786 );
787 \fill [ \l_@@_course_color_tl!60 ]
788 ([shift =
789 {(
790 \fp_eval:n
791 {
792 \clist_item:Nn \l_@@_week_accum_clist
793 { \l_@@_weekday_int } -
794 \clist_item:Nn \l_@@_week_ratio_clist
795 { \l_@@_weekday_int }
796 } \l_@@_week_hunit_dim
797 + \l_@@_reswidth_dim + \l_@@_textwidth_dim/15,
798 \fp_eval:n { -.5 - 2 * #1 } \l_@@_time_vunit_dim
799 - \l_@@_resheight_dim
800 )}]current ~ page.north ~ west) rectangle +
801 (
802 \clist_item:Nn \l_@@_week_ratio_clist
803 { \l_@@_weekday_int } \l_@@_week_hunit_dim,
804 -\l_@@_time_vunit_dim/2
805 );
806 \end{scope}
807 \int_compare:nNnTF {#1} = {#2}
808 {
809 \bool_lazy_and:nnTF
810 { \tl_if_empty_p:N \l_@@_course_location_tl }
811 { \tl_if_empty_p:N \l_@@_course_lecture_tl }
812 { \tl_set:Nn \l_@@_course_anchor_tl { } }
813 { \tl_set:Nn \l_@@_course_anchor_tl { above } }
814 \node
815 [ \l_@@_course_anchor_tl, \l_@@_course_color_tl!60, shift =
816 {(
817 \fp_eval:n
818 {
819 \clist_item:Nn \l_@@_week_accum_clist
820 { \l_@@_weekday_int } -
821 \clist_item:Nn \l_@@_week_ratio_clist
822 { \l_@@_weekday_int }/2
823 } \l_@@_week_hunit_dim + \l_@@_textwidth_dim/15,
824 \fp_eval:n { -1.75 - #1 - #2 } \l_@@_time_vunit_dim
825 )}, align = center, font = \bfseries
826 ] at ([shift =
827 {(\l_@@_reswidth_dim, -\l_@@_resheight_dim)}
828 ]current ~ page.north ~ west) { \l_@@_course_subject_tl };
829 \bool_lazy_or:nnTF
830 { \tl_if_empty_p:N \l_@@_course_location_tl }
831 { \tl_if_empty_p:N \l_@@_course_lecture_tl }
832 { \tl_set:Nn \l_@@_s@course_sep_tl { } }
833 { \tl_set:Nn \l_@@_s@course_sep_tl { ,~ } }
834 \node
835 [ shift =
836 {(
837 \fp_eval:n
838 {
839 \clist_item:Nn \l_@@_week_accum_clist
840 { \l_@@_weekday_int } -
841 \clist_item:Nn \l_@@_week_ratio_clist
842 { \l_@@_weekday_int }/2
843 } \l_@@_week_hunit_dim + \l_@@_textwidth_dim/15,
844 \fp_eval:n { -1.75 - #1 - #2 } \l_@@_time_vunit_dim
845 )}, below, \l_@@_course_color_tl!60, align = center
846 ] at ([shift =
847 {(\l_@@_reswidth_dim, -\l_@@_resheight_dim)}
848 ]current ~ page.north ~ west)
849 {
850 \l_@@_course_location_tl
851 \l_@@_s@course_sep_tl
852 \l_@@_course_lecture_tl
853 };
854 }
855 {
856 \bool_lazy_and:nnTF
857 { \tl_if_empty_p:N \l_@@_course_location_tl }
858 { \tl_if_empty_p:N \l_@@_course_lecture_tl }
859 {
860 \tl_set:Nn \l_@@_course_anchor_tl { }
861 \dim_set:Nn \l_@@_course_shift_dim { 0pt }
862 }
863 {
864 \tl_set:Nn \l_@@_course_anchor_tl { above }
865 \dim_set:Nn \l_@@_course_shift_dim { \l_@@_time_vunit_dim/8 }
866 }
867 \node
868 [ \l_@@_course_color_tl!60, align = center, shift =
869 {(
870 \fp_eval:n
871 {
872 \clist_item:Nn \l_@@_week_accum_clist
873 { \l_@@_weekday_int } -
874 \clist_item:Nn \l_@@_week_ratio_clist
875 { \l_@@_weekday_int }/2
876 } \l_@@_week_hunit_dim + \l_@@_textwidth_dim/15,
877 \fp_eval:n { -1.5 - #1 - #2 } \l_@@_time_vunit_dim +
878 \l_@@_course_shift_dim
879 )}, font = \large \bfseries, \l_@@_course_anchor_tl
880 ] at ([shift =
881 {(\l_@@_reswidth_dim, -\l_@@_resheight_dim)}
882 ]current ~ page.north ~ west) { \l_@@_course_subject_tl };
883 \bool_lazy_or:nnTF
884 { \tl_if_empty_p:N \l_@@_course_location_tl }
885 { \tl_if_empty_p:N \l_@@_course_lecture_tl }
886 { \tl_set:Nn \l_@@_course_sep_tl { } }
887 { \tl_set:Nn \l_@@_course_sep_tl { \\ } }
888 \node
889 [ shift =
890 {(
891 \fp_eval:n
892 {
893 \clist_item:Nn \l_@@_week_accum_clist
894 { \l_@@_weekday_int } -
895 \clist_item:Nn \l_@@_week_ratio_clist
896 { \l_@@_weekday_int }/2
897 } \l_@@_week_hunit_dim + \l_@@_textwidth_dim/15,
898 \fp_eval:n { -1.625 - #1 - #2 } \l_@@_time_vunit_dim
899 )}, below, \l_@@_course_color_tl!60, align = center
900 ] at ([shift =
901 {(\l_@@_reswidth_dim, -\l_@@_resheight_dim)}
902 ]current ~ page.north ~ west)
903 {
904 \l_@@_course_location_tl
905 \l_@@_course_sep_tl
906 \l_@@_course_lecture_tl
907 };
908 \node
909 [ shift =
910 {(
911 \clist_item:Nn \l_@@_week_accum_clist
912 { \l_@@_weekday_int } \l_@@_week_hunit_dim +
913 \l_@@_textwidth_dim/15,
914 \fp_eval:n { -2.5 - 2 * #2 } \l_@@_time_vunit_dim
915 )}, above ~ left, \l_@@_course_color_tl!60, outer ~ sep = .5ex
916 ] at ([shift =
917 {(\l_@@_reswidth_dim, -\l_@@_resheight_dim)}
918 ]current ~ page.north ~ west) { \l_@@_course_comment_tl };
919 }
920 }
921 % \end{macrocode}
922 % \end{macro}
923 %
924 % \begin{macrocode}
925 \file_input_stop:
926 % \end{macrocode}
927 % End the optionlist |package| for \pkg{l3docstrip}.
928 % \begin{macrocode}
929 %</package>
930 % \end{macrocode}
931 %
932 % \end{implementation}
933 % \clearpage
934 % \PrintIndex