diff options
-rw-r--r-- | Master/texmf-dist/doc/latex/litetable/litetable-cn.pdf | bin | 190787 -> 189359 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/litetable/litetable-cn.tex | 18 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/litetable/litetable-demo.pdf | bin | 57383 -> 56608 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/litetable/litetable-demo.tex | 68 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/litetable/litetable-en.pdf | bin | 502959 -> 118137 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/litetable/litetable-en.tex | 24 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/litetable/litetable-hk.pdf | bin | 208137 -> 200254 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/litetable/litetable-hk.tex | 34 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/litetable/litetable.cls | 519 |
9 files changed, 366 insertions, 297 deletions
diff --git a/Master/texmf-dist/doc/latex/litetable/litetable-cn.pdf b/Master/texmf-dist/doc/latex/litetable/litetable-cn.pdf Binary files differindex f4a6fbad830..44673f1a19d 100644 --- a/Master/texmf-dist/doc/latex/litetable/litetable-cn.pdf +++ b/Master/texmf-dist/doc/latex/litetable/litetable-cn.pdf diff --git a/Master/texmf-dist/doc/latex/litetable/litetable-cn.tex b/Master/texmf-dist/doc/latex/litetable/litetable-cn.tex index e5974b21f77..0ae4001a44c 100644 --- a/Master/texmf-dist/doc/latex/litetable/litetable-cn.tex +++ b/Master/texmf-dist/doc/latex/litetable/litetable-cn.tex @@ -20,7 +20,7 @@ \affil{\href{mailto:xiamyphys@gmail.com}{xiamyphys@gmail.com}} -\date{Version 3.0a, \today} +\date{Version 3.0B, \today} \begin{document} @@ -74,13 +74,14 @@ \cs{timelist}\oarg{rows}\marg{time list} \end{example} -此命令有两个参数,第一个可选参数 \oarg{\#1} 可直接决定课程表的行数,第二个强制参数 \marg{\#2} 可在课程表的左侧添加时间列表. 输入列表格式如下:开始时间与结束时间之间用短线 (-) 分隔,并用逗号 (,) 在时间组之间分隔. 例如 +此命令有两个参数,第一个可选参数 \oarg{\#1} 可直接决定课程表的行数,第二个强制参数 \marg{\#2} 可在课程表的左侧添加时间列表. 输入数组的用例如下 \begin{Verbatim} - \timelist[13]{% - 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, + \timelist[13]{ + 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 } \end{Verbatim} @@ -119,10 +120,7 @@ 此命令有两个参数. 第一个可选参数可决定默认的星期数并会在每个课程块的右下角显示,第二个强制参数可在课程表的顶部添加对应宽度比例的工作日. 输入列表的第一行为工作日格式,第二行为对应的宽度比例,两行之间用分号 (;) 分隔. 例如 \begin{Verbatim} - \weeklist[Weeks 1 - 16]{% - \scshape Mon, \scshape Tue, \scshape Wed, - \scshape Thu, \scshape Fri; 4,5,4,6,5 - } + \weeklist[Weeks 1 - 16]{Mon -> 4, Tue -> 5, Wed -> 4, Thu -> 6, Fri -> 5} \end{Verbatim} \begin{figure}[!ht] diff --git a/Master/texmf-dist/doc/latex/litetable/litetable-demo.pdf b/Master/texmf-dist/doc/latex/litetable/litetable-demo.pdf Binary files differindex 19a726cd7c9..7b58f47b838 100644 --- a/Master/texmf-dist/doc/latex/litetable/litetable-demo.pdf +++ b/Master/texmf-dist/doc/latex/litetable/litetable-demo.pdf diff --git a/Master/texmf-dist/doc/latex/litetable/litetable-demo.tex b/Master/texmf-dist/doc/latex/litetable/litetable-demo.tex index e26d5455ea6..bbe750acb86 100644 --- a/Master/texmf-dist/doc/latex/litetable/litetable-demo.tex +++ b/Master/texmf-dist/doc/latex/litetable/litetable-demo.tex @@ -1,50 +1,70 @@ -\documentclass[letterpaper]{litetable} +\documentclass[letterpaper, svgnames]{litetable} \usepackage{twemojis,newtxtext} \usepackage[scaled = .9]{helvet} \renewcommand*\familydefault{\sfdefault} - -\timelist[13]{% - 08:05 - 08:50, 08:55 - 09:40, 10:00 - 10:45, 10:50 - 11:35, 11:40 - 12:25,% morning - 13:30 - 14:15, 14:20 - 15:05, 15:15 - 16:00, 16:05 - 16:50,% afternoon - 18:30 - 19:15, 19:20 - 20:05, 20:10 - 20:55,% evening +\timelist [ 13 ] +{ + 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 } -\weeklist[Weeks 1 - 16]{% - \scshape\texttwemoji{1f312}~Mon, \scshape\texttwemoji{1f525}~Tue, - \scshape\texttwemoji{1f30a}~Wed, \scshape\texttwemoji{1f332}~Thu, - \scshape\texttwemoji{1fa99}~Fri; 1,1,1,1,1 +\weeklist [ Weeks 1 - 16 ] +{ + \texttwemoji{1f312}\scshape~Mon -> 1, + \texttwemoji{1f525}\scshape~Tue -> 1, + \texttwemoji{1f30a}\scshape~Wed -> 1, + \texttwemoji{1f332}\scshape~Thu -> 1, + \texttwemoji{1fa99}\scshape~Fri -> 1 } \begin{document} \begin{tikzpicture}[remember picture, overlay] - \maketable{Skyrmion's Timetable}[SEM 7] + \maketable [SEM 6] {Skyrmion's Timetable} \newday - \course [subject = {xia-my@ctan}] {4} {4} - \course [color = DarkBlue, subject = interface3, teacher = The {\LaTeX} Project] {7} {9} + \course [ subject = {xia-my@ctan}] {4} {4} + \course [ color = DarkBlue, subject = interface3, + teacher = The {\LaTeX} Project + ] {7} {9} \newday - \course [color = FireBrick, subject = usrguide, teacher = {\LaTeX} Project Team, weeks = Weeks 7 - 14] {1} {2} + \course [ color = FireBrick, subject = usrguide, + teacher = {\LaTeX} Project Team, + weeks = Weeks 7 - 14 + ] {1} {2} \newday - \course [subject = Keep on {\TeX}ing] {7} {8} - \course [color = DarkGreen, subject = listofitems, location = French, teacher = Christian Tellechea] {10} {12} + \course [ color = DarkSlateGray, + subject = Keep on {\TeX}ing + ] {7} {8} + \course [ color = DarkGreen, subject = listofitems, + location = French, teacher = Christian Tellechea + ] {10} {12} \newday - \course [color = Crimson, subject = Ti\textit{k\/}Z\\library: calc, teacher = The PGF/Ti\textit{k\/}Z Team] {3} {5} + \course [ color = Crimson, + subject = Ti\textit{k\/}Z\\library: calc, + teacher = The PGF/Ti\textit{k\/}Z Team + ] {3} {5} \newday - \course [color = DarkViolet, subject = xcolor, weeks = Week 1 - 16, location = Germany, teacher = Dr. Uwe Kern] {8} {8} - \more {School Starts: 06 / 09 / 2024\quad Summer Vacation: 26 / 01 / 2025} + \course [ color = DarkViolet, subject = xcolor, + weeks = Week 1 - 16, location = Germany, + teacher = Dr. Uwe Kern + ] {8} {8} + \more {School Starts: 06 / 09 / 2024\quad + Summer Vacation: 26 / 01 / 2025 + } \end{tikzpicture} \clearpage \timelist[12]{} -\weeklist{% - \scshape\texttwemoji{1f312}~Mon, \scshape\texttwemoji{1f525}~Tue, - \scshape\texttwemoji{1f30a}~Wed, \scshape\texttwemoji{1f332}~Thu, - \scshape\texttwemoji{1fa99}~Fri; 1,1,1,1,1 +\weeklist[Weeks 1 - 16] +{ + Mon -> 1, Tue -> 1, Wed -> 1, Thu -> 1, Fri -> 1 } \begin{tikzpicture}[remember picture, overlay] - \maketable{Skyrmion's Timetable}[SEM 8] + \maketable [SEM 7] {Skyrmion's Timetable} \end{tikzpicture} \end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/litetable/litetable-en.pdf b/Master/texmf-dist/doc/latex/litetable/litetable-en.pdf Binary files differindex 996bbd37504..201030c03aa 100644 --- a/Master/texmf-dist/doc/latex/litetable/litetable-en.pdf +++ b/Master/texmf-dist/doc/latex/litetable/litetable-en.pdf diff --git a/Master/texmf-dist/doc/latex/litetable/litetable-en.tex b/Master/texmf-dist/doc/latex/litetable/litetable-en.tex index 6345b74a78b..ea1ff8b28ea 100644 --- a/Master/texmf-dist/doc/latex/litetable/litetable-en.tex +++ b/Master/texmf-dist/doc/latex/litetable/litetable-en.tex @@ -20,7 +20,7 @@ \affil{\href{mailto:xiamyphys@gmail.com}{xiamyphys@gmail.com}} -\date{Version 3.0a, \today} +\date{Version 3.0B, \today} \begin{document} @@ -58,7 +58,7 @@ The following commands need the \cmd{tikzpicture} environment with \cmd{remember \cs{maketable}\oarg{semester}\marg{title} \end{example} -This command has two arguments that can create an empty timetable frame. The first optional argument can add the semester block at the northeast corner of the page, the second mandatory argument can assign the title. +This command has two arguments that can create an empty timetable frame. The first optional argument can add the semester block at the northeast corner of the page, and the second mandatory argument can assign the title. \subsubsection{The \cs{more} command} @@ -74,13 +74,14 @@ This command can add a comment at the southwest corner of the page. \cs{timelist}\oarg{rows}\marg{time list} \end{example} -This command has two arguments, the first optional argument \oarg{\#1} can directly assign the number of rows on the timetable, and the second mandatory argument \marg{\#2} can add time to the left side of the timetable. Format for inputting array is the following: separate the start time and the end time with a dash (-) and separate the time groups with a comma (,). For example +This command has two arguments, the first optional argument \oarg{\#1} can directly assign the number of rows on the timetable, and the second mandatory argument \marg{\#2} can add time to the left side of the timetable. The following example is the format for inputting array \begin{Verbatim} - \timelist[13]{% - 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, + \timelist[13]{ + 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 } \end{Verbatim} @@ -107,7 +108,7 @@ For different usage scenarios of the two arguments, \cls{litetable} will generat \begin{itemize} \item If the mandatory argument \marg{\#2} receives $X$ sets of time, and the optional argument \oarg{\#1} receives a value of $X+a$, then only lines $1\sim X$ on the left side of the timetable display the time, while the other lines do not display the time. - \item If the mandatory argument \marg{\#2} receives $X+a$ sets of time, and the optional \oarg{\#1} receives a value of $X$, then there will generate a timetable with only $X$ rows with extra time sets ignored, and it will return a warning. + \item If the mandatory argument \marg{\#2} receives $X+a$ sets of time, and the optional \oarg{\#1} receives a value of $X$, then the extra time sets ignored, and it will return a warning. \end{itemize} \subsubsection{The \cs{weeklist} command} @@ -116,13 +117,10 @@ For different usage scenarios of the two arguments, \cls{litetable} will generat \cs{weeklist}\oarg{default weeks}\marg{week list} \end{example} -This command has two arguments. The first optional argument can determine the default number of weeks and print at every course block's southeast corner. The second mandatory argument can add workdays with corresponding width ratios at the top of the timetable. The first line of the input array is the formats of the working days, and the second line is the corresponding width ratio. Two lines are separated by a semicolon (;). For example +This command has two arguments. The first optional argument can determine the default number of weeks and print at every course block's southeast corner. The second mandatory argument can add workdays with corresponding width ratios at the top of the timetable. The following example is the format for inputting array \begin{Verbatim} - \weeklist[Weeks 1 - 16]{% - \scshape Mon, \scshape Tue, \scshape Wed, - \scshape Thu, \scshape Fri; 4,5,4,6,5 - } + \weeklist[Weeks 1 - 16]{Mon -> 4, Tue -> 5, Wed -> 4, Thu -> 6, Fri -> 5} \end{Verbatim} \begin{figure}[!ht] diff --git a/Master/texmf-dist/doc/latex/litetable/litetable-hk.pdf b/Master/texmf-dist/doc/latex/litetable/litetable-hk.pdf Binary files differindex 3d318b82cac..747410fdb44 100644 --- a/Master/texmf-dist/doc/latex/litetable/litetable-hk.pdf +++ b/Master/texmf-dist/doc/latex/litetable/litetable-hk.pdf diff --git a/Master/texmf-dist/doc/latex/litetable/litetable-hk.tex b/Master/texmf-dist/doc/latex/litetable/litetable-hk.tex index ebb2bee438b..8715b4ef51f 100644 --- a/Master/texmf-dist/doc/latex/litetable/litetable-hk.tex +++ b/Master/texmf-dist/doc/latex/litetable/litetable-hk.tex @@ -20,21 +20,21 @@ \affil{\href{mailto:xiamyphys@gmail.com}{xiamyphys@gmail.com}} -\date{Version 3.0a, \today} +\date{Version 3.0B, \today} \begin{document} \maketitle \begin{abstract} - 本文檔系 \cls{litetable} 文檔类嘅用戶手冊放. 應該文檔類提供咗個多彩嘅課程表設計. 歡迎通過郵件 \href{mailto:xiamyphys@gmail.com}{xiamyphys@gmail.com} 或者 \href{https://github.com/xiamyphys/litetable/issues}{GitHub} 建議或者反饋bug. 本手冊提供英語、中文和\textbf{粵語}版本. + 本文檔系 \cls{litetable} 文檔類嘅用户手冊放. 應該文檔類提供咗個多彩嘅課程表設計. 歡迎通過郵件 \href{mailto:xiamyphys@gmail.com}{xiamyphys@gmail.com} 或者 \href{https://github.com/xiamyphys/litetable/issues}{GitHub} 建議或者反饋bug. 本手冊提供英語、中文和\textbf{粵語}版本. \end{abstract} \section{介紹} \subsection{所使宏包} -應該文檔類基於 \cls{article} 文檔类. 要 \pkg{expl3},\pkg{xparse},\pkg{tikz},\pkg{listofitems} 同 \pkg{xcolor} 宏包. +應該文檔類基於 \cls{article} 文檔類. 要 \pkg{expl3},\pkg{xparse},\pkg{tikz},\pkg{listofitems} 同 \pkg{xcolor} 宏包. \subsection{相容性} @@ -55,10 +55,10 @@ \subsubsection{命令:\cs{maketable}} \begin{example} - \cs{maketable}\oarg{semester}\marg{title} + \cs{maketable}\marg{title}\oarg{semester} \end{example} -此命令有兩個參數,可建置一個空白嘅課程表框架. 第一個可選參數可喺頁面嘅嘅右度角添加學期塊,第二個強制參數可指定標題. +此命令有兩個參數,可建置一個空白嘅課程表框架. 第一個可選參數可喺頁面嘅嘅右度角添加學期,第二個強制參數可指定標題. \subsubsection{命令:\cs{more}} @@ -74,17 +74,18 @@ \cs{timelist}\oarg{rows}\marg{time list} \end{example} -此命令有兩個參數,第一個可選參數可直接決定課程表嘅行數,第二個強制参数可喺課程表嘅左側添加時間表. 輸入表格式如下:開始時間同結束時間之間用短線 (-) 分隔,並用逗號 (,) 系咪喺時間組之間分隔. 例如 +此命令有兩個參數,第一個可選參數可直接決定課程表嘅行數,第二個強制參數可喺課程表嘅左側添加時間表. 輸入數組嘅用例如下 \begin{Verbatim} - \timelist[13]{% - 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, + \timelist[13]{ + 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 } \end{Verbatim} -对于两个参数唔同使用情况,\cls{litetable} 会以如下规则建置对应行数嘅课程表框架. +對於兩個參數唔同使用情況,\cls{litetable} 會以如下規則建置對應行數嘅課程表框架. \begin{table}[htbp] \centering @@ -106,8 +107,8 @@ \end{table} \begin{itemize} - \item 若强制参数 \marg{\#2} 接受咗$X$组时间,可选参数 \oarg{\#1} 接受嘅值为$X+a$,就课程表嘅左侧得$1 \sim X$行会显示时间,后面几行唔显示时间. - \item 若强制参数 \marg{\#2} 接受咗$X+a$组时间,可选参数 \oarg{\#1} 接收嘅值为$X$, 就课程表嘅左侧得$X$行嘅課程表,多餘嘅時間組將畀忽略,並返回一個警告. + \item 若強制參數 \marg{\#2} 接受咗$X$組時間,可選參數 \oarg{\#1} 接受嘅值為$X+a$,就課程表嘅左側得$1 \sim X$行會顯示時間,後面幾行唔顯示時間. + \item 若強制參數 \marg{\#2} 接受咗$X+a$組時間,可選參數 \oarg{\#1} 接收嘅值為$X$, 就課程表嘅左側得$X$行嘅課程表,多餘嘅時間組將畀忽略,並返回一個警告. \end{itemize} \subsubsection{命令:\cs{weeklist}} @@ -116,13 +117,10 @@ \cs{weeklist}\oarg{default weeks}\marg{week list} \end{example} -此命令有两个参数. 第一个可选参数可决定预设嘅星期数并会喺每课程塊嘅嘅右下角显示,第二个强制参数可喺课程表嘅顶部添加对应宽度比例嘅工作日. 输入表嘅第一行为工作日格式,第二行为对应嘅宽度比例,两得之间用分号 (;) 分隔. 例如 +此命令有兩個參數. 第一個可選參數可決定預設嘅星期數並會喺每課程塊嘅嘅右下角顯示,第二個強制參數可喺課程表嘅頂部添加對應寬度比例嘅工作日. 輸入數組嘅用例如下 \begin{Verbatim} - \weeklist[Weeks 1 - 16]{% - \scshape Mon, \scshape Tue, \scshape Wed, - \scshape Thu, \scshape Fri; 4,5,4,6,5 - } + \weeklist[Weeks 1 - 16]{Mon -> 4, Tue -> 5, Wed -> 4, Thu -> 6, Fri -> 5} \end{Verbatim} \begin{figure}[!ht] diff --git a/Master/texmf-dist/tex/latex/litetable/litetable.cls b/Master/texmf-dist/tex/latex/litetable/litetable.cls index 22fffd3f7c2..a87d3cb9bd6 100644 --- a/Master/texmf-dist/tex/latex/litetable/litetable.cls +++ b/Master/texmf-dist/tex/latex/litetable/litetable.cls @@ -17,349 +17,404 @@ %% and README.md. * %% available at https://github.com/xiamyphys/litetable * %% *********************************************************** -% !Mode:: "TeX:UTF-8" -\ProvidesExplClass {litetable} {2024/09/22} {3.0a} {Colorful timetable class} +\ProvidesExplClass{litetable}{2024/09/25}{3.0B}{Course Schedule} \ExplSyntaxOff \DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}} \ProcessOptions\relax \LoadClass{article} - -\RequirePackage[svgnames]{xcolor} -\definecolor{darkergray}{HTML}{F1F3F5}% Blocks -\definecolor{lightergray}{HTML}{FCFDFE}% Pagecolor -\pagecolor{lightergray} - -\RequirePackage{tikz} -\tikzset{% - every picture/.append style = { line join = round, line cap = round } -} +\pagestyle{empty} +\RequirePackage{listofitems,tikz,xcolor} +\ignoreemptyitems\setsepchar{,/->} \usetikzlibrary{calc} - -\RequirePackage{listofitems} -\ignoreemptyitems +\definecolor{darkergray}{HTML}{F4F6F8}% Blocks \ExplSyntaxOn -\int_new:N \l_course_num_int -\dim_new:N \l_course_vunit_dim -\NewDocumentCommand{\timelist}{om}{% - \setsepchar{,/-} - \IfBlankTF{#2}{% - \int_set:Nn \l_course_num_int { #1 } +\int_new:N \l_time_num_int +\dim_new:N \l__time_vunit_dim +\msg_new:nnn {litetable} {timelist} +{\noexpand\timelist~extra~time~group(s)~were~ignored} +\NewDocumentCommand{\timelist}{om} +{ + \IfBlankTF{#2} + { + \int_set:Nn \l_time_num_int { #1 } \tl_clear:N \@timelist - }{% + }{ \readlist*\@timelist{#2} - \IfNoValueTF{#1}{% - \int_set:Nn \l_course_num_int { \@timelistlen } - }{% - \int_set:Nn \l_course_num_int { #1 } - \int_compare:nNnT {\@timelistlen} > {#1} {% - \msg_new:nnn {litetable} {timelist} - {\noexpand\timelist~extra~time~group(s)~were~ignored} + \IfNoValueTF{#1} + { + \int_set:Nn \l_time_num_int {\@timelistlen} + }{ + \int_set:Nn \l_time_num_int { #1 } + \int_compare:nNnT {\@timelistlen} > {#1} + { \msg_warning:nn {litetable} {timelist} } } } - \dim_set:Nn \l_course_vunit_dim {% - \fp_eval:n {1/(2*\l_course_num_int+3.5)}\paperheight + \dim_set:Nn \l__time_vunit_dim + { + \fp_eval:n {1/(2*\l_time_num_int+3.5)}\paperheight } } -\NewDocumentCommand{\partialsums}{mmm}{% - % #1 = list name, #2 = row, #3 = macro name for storing - \clist_set:Ne \l__sums_in_clist { #1[#2] } - \clist_clear:N \l__sums_out_clist - \int_step_inline:nn { \clist_count:N \l__sums_in_clist }{% - % ##1 is the highest term - \clist_clear:N \l__sums_tmp_clist - \int_step_inline:nn { ##1 }{% - % populate the tmp clist - \clist_put_right:Ne \l__sums_tmp_clist - { \clist_item:Nn \l__sums_in_clist {####1} } +\clist_new:N \l__week_ratios_clist +\clist_new:N \l__week_accum_clist +\int_new:N \l__week_num_int +\dim_new:N \l__week_hunit_dim +\NewDocumentCommand{\weeklist}{om} +{ + \IfValueT{ #1 }{\tl_set:Nn \l_weeks_tl { #1 }} + \readlist*\@weeklist{#2} + \int_step_inline:nn {\@weeklistlen} + { + \clist_put_right:Ne \l__week_ratios_clist + { + \@weeklist[##1,2] } - \clist_put_right:Ne \l__sums_out_clist{% - % do the partial sum - \int_eval:n { \clist_use:Nn \l__sums_tmp_clist { + } } + } + \int_step_inline:nn {\@weeklistlen} + { + \clist_clear:N \l__week_accumtmp_clist + \int_step_inline:nn { ##1 } + { + \clist_put_right:Ne \l__week_accumtmp_clist + { + \clist_item:Nn \l__week_ratios_clist { ####1 } + } + } + \clist_put_right:Ne \l__week_accum_clist + { + \int_eval:n + { + \clist_use:Nn \l__week_accumtmp_clist { + } + } } } - \tl_set:Ne #3 { \clist_use:Nn \l__sums_out_clist {,} } -} - -\dim_new:N \l_course_hunit_dim -\NewDocumentCommand{\weeklist}{om}{% - \IfValueT{#1}{\tl_set:Nn \l_weeks_tl { #1 }} - \setsepchar{;/,} - \readlist*\@weeklist{#2} - \partialsums{\@weeklist}{2}{\@weeklistaccumulate} - \int_compare:nNnT {\listlen\@weeklist[1]} > {\listlen\@weeklist[2]} {% - \msg_new:nnn {litetable} {weeklist} - {\noexpand\weeklist~extra~weekday~item(s)~were~ignored} - \msg_warning:nn {litetable} {weeklist} + \int_set:Nn \l__week_num_int + { + \clist_item:Nn \l__week_accum_clist + { + \@weeklistlen + } } - \readlist*\@weeklistshifts{\@weeklistaccumulate} - \dim_set:Nn \l_course_hunit_dim {% - \fp_eval:n {% - 1/\@weeklistshifts[1,\int_eval:n {\listlen\@weeklist[2]}]*14/15 - }\paperwidth + \dim_set:Nn \l__week_hunit_dim + { + \fp_eval:n {1/\l__week_num_int*14/15}\paperwidth } } -\NewDocumentCommand{\maketable}{mo}{% +\int_new:N \l__week_day_int +\newcommand{\newday}{\int_incr:N \l__week_day_int} +\NewDocumentCommand{\maketable}{om}{ % Gray Block at top \fill [ darkergray ] (current~page.north~west) - rectangle + (\paperwidth,{-1.5*\l_course_vunit_dim}) - node [ midway, black, font = \huge\bfseries ] {#1}; - % Semester - \IfNoValueF{#2}{% - \node [ left, rectangle, fill=DarkBlue!10, text=DarkBlue!60, - inner~sep=2ex, rounded~corners=8pt, font = \large ] - at ($ - (current~page.north~east)+ - (-.02\paperwidth,-.75*\l_course_vunit_dim) - $) {$\rightleftharpoons$~#2}; + rectangle + (\paperwidth,{-1.5*\l__time_vunit_dim}) + node [ midway, black, font = \huge\bfseries ] {#2}; + \IfValueT{#1}% Semester + { + \node [ left, rectangle, fill = DarkBlue!10, + text = DarkBlue!60, inner~sep = 2ex, + rounded~corners = 8pt, font = \large + ] at ($ + (current~page.north~east)+ + (-.02\paperwidth,-.75*\l__time_vunit_dim) + $) {\ensuremath\rightleftharpoons\ #1}; } % Darker Blocks - \foreach \a in {0,2,...,\l_course_num_int} - \fill [ densely~dashed,darkergray ] - ([yshift=-2*\a*\l_course_vunit_dim]$ - (current~page.north~west)+ - (0,-2.5*\l_course_vunit_dim) - $) rectangle + - (\paperwidth,-2*\l_course_vunit_dim); - % Sepdashes - \foreach \a in {0,1,2,...,\l_course_num_int} - \draw [ densely~dashed, gray, thick ] - ([yshift = -2*\a*\l_course_vunit_dim]$ - (current~page.north~west)+ - (0,-2.5*\l_course_vunit_dim) - $) --++ (\paperwidth,0); - \tl_if_empty:NTF {\@timelist}{% - % Classes numbering without time - \foreach \a in {1,2,...,\l_course_num_int} - \node [ yshift = -2*(\a-1)*\l_course_vunit_dim, darkgray!80, - font = \bfseries\large\ttfamily ] - at ($ - (current~page.north~west)+ - (\paperwidth/30,-3.5*\l_course_vunit_dim) - $){\a}; - }{% - % Classes numbering with time - \foreach \a in {1,2,...,\l_course_num_int} - \node [ yshift = -2*(\a-1)*\l_course_vunit_dim, - darkgray!80, font = \bfseries\large\ttfamily] - at ($ + \int_step_inline:nnnn {0} {2} {\l_time_num_int} { + \filldraw [ fill = darkergray, draw = gray, thick, + densely~dashed, line~cap = round + ] ([yshift = -2*##1*\l__time_vunit_dim]$ + (current~page.north~west)+(-.4pt,0)+ + (0,-2.5*\l__time_vunit_dim) + $) rectangle + ($ + (\paperwidth,-2*\l__time_vunit_dim)+ + (.8pt,0) + $); + } + \tl_if_empty:NTF {\@timelist}% Classes numbering + { + \int_step_inline:nn {\l_time_num_int} { + \node [ yshift = -2*##1*\l__time_vunit_dim, + darkgray!80, font = \bfseries\large\ttfamily + ] at ($ (current~page.north~west)+ - (\paperwidth/30,-3*\l_course_vunit_dim) - $){\a}; - % Classes start time - \foreach \a in {1,2,...,\@timelistlen} - \node [ yshift = -2*(\a-1)*\l_course_vunit_dim, - gray, font = \ttfamily ] - at ($ + (\paperwidth/30,-1.5*\l__time_vunit_dim) + $) {##1}; + } + }{ + \int_step_inline:nn {\l_time_num_int} { + \node [ yshift = -2*##1*\l__time_vunit_dim, + darkgray!80, font = \bfseries\large\ttfamily + ] at ($ (current~page.north~west)+ - (\paperwidth/30,-3.65*\l_course_vunit_dim) - $){\@timelist[\a,1]}; - % Classes end time - \foreach \a in {1,2,...,\@timelistlen} - \node [ yshift=-2*(\a-1)*\l_course_vunit_dim, - gray, font = \ttfamily ] + (\paperwidth/30,-\l__time_vunit_dim) + $) {##1}; + } + % Classes time + \int_step_inline:nn {\@timelistlen} { + \node [ yshift = -2*##1*\l__time_vunit_dim, + gray, font = \ttfamily ,align = center] at ($ (current~page.north~west)+ - (\paperwidth/30,-4.15*\l_course_vunit_dim) - $){\@timelist[\a,2]}; + (\paperwidth/30,-1.9*\l__time_vunit_dim) + $) {\@timelist[##1,1]\\\@timelist[##1,2]}; + } } % Weekdays - \foreach \a in {1,2,...,\listlen\@weeklist[2]} - \node [ font = \large\bfseries, - xshift = \fp_eval:n {( - \@weeklistshifts[1,\a]-\@weeklist[2,\a]/2)/ - \@weeklistshifts[1,\int_eval:n {\listlen\@weeklist[2]}] - *14/15}*\paperwidth ] + \int_step_inline:nn {\@weeklistlen} + { + \node [ font = \large\bfseries, + xshift = \clist_item:Nn \l__week_accum_clist {##1}/ + \l__week_num_int*14/15*\paperwidth + ] at ($ - (current~page.north~west)+ - (\paperwidth/15,-2*\l_course_vunit_dim) - $){\@weeklist[1,\a]}; + (current~page.north~west)- + (\fp_eval:n {( + \clist_item:Nn + \l__week_ratios_clist { ##1 } + /2)/\l__week_num_int*14/15-1/15 + }*\paperwidth,2*\l__time_vunit_dim) + $) {\@weeklist[##1,1]}; + } } -\int_new:N \l_course_weekday_int -\newcommand{\newday}{\int_add:Nn \l_course_weekday_int {1}} -\keys_define:nn{course}{% +\keys_define:nn{course}{ color.tl_set:N = \l_color_tl, - color.initial:n = DarkSlateGray, - color.default:n = DarkSlateGray, + color.initial:n = teal, subject.tl_set:N = \l_subject_tl, teacher.tl_set:N = \l_teacher_tl, location.tl_set:N = \l_location_tl, weeks.tl_set:N = \l_weeks_tl, weeks.initial:n = \l_weeks_tl, - weeks.default:n = \l_weeks_tl, } -\dim_new:N \l_course_shift_dim -\NewDocumentCommand{\course}{O{}mm}{% +\dim_new:N \l__course_infoshift_dim +\NewDocumentCommand{\course}{O{}mm} +{ \group_begin: - \keys_set:nn{course}{#1} + \keys_set:nn { course } { #1 } % Course block fg \fill [ \l_color_tl!60, rounded~corners = 8pt ] ($ (current~page.north~west)+(.4pt,-.4pt)+ - (\fp_eval:n { - \@weeklistshifts[1,\int_use:N \l_course_weekday_int]- - \@weeklist[2,\int_use:N \l_course_weekday_int] - }*\l_course_hunit_dim+\paperwidth/15, - \fp_eval:n {-.5-2*#2}*\l_course_vunit_dim) + (\fp_eval:n + { + \clist_item:Nn \l__week_accum_clist + { + \l__week_day_int + }- + \clist_item:Nn \l__week_ratios_clist + { + \l__week_day_int + } + }*\l__week_hunit_dim+\paperwidth/15, + \fp_eval:n {-.5-2*#2}*\l__time_vunit_dim) $) rectangle ($ (current~page.north~west)+(-.4pt,.4pt)+ - (\@weeklistshifts[1,\int_use:N \l_course_weekday_int] - *\l_course_hunit_dim+\paperwidth/15, - \fp_eval:n {-2.5-2*#3}*\l_course_vunit_dim) + (\clist_item:Nn \l__week_accum_clist + { + \l__week_day_int + }*\l__week_hunit_dim+\paperwidth/15, + \fp_eval:n {-2.5-2*#3}*\l__time_vunit_dim) $); % Course block bg \fill [ \l_color_tl!10 ] ($ (current~page.north~west)+(1.2pt,-.4pt)+ - (\fp_eval:n { - \@weeklistshifts[1,\int_use:N \l_course_weekday_int]- - \@weeklist[2,\int_use:N \l_course_weekday_int] - }*\l_course_hunit_dim+\paperwidth/15, - \fp_eval:n {-1-2*#2}*\l_course_vunit_dim) + (\fp_eval:n + { + \clist_item:Nn \l__week_accum_clist + { + \l__week_day_int + }- + \clist_item:Nn \l__week_ratios_clist + { + \l__week_day_int + } + }*\l__week_hunit_dim+\paperwidth/15, + \fp_eval:n {-1-2*#2}*\l__time_vunit_dim) $) -- ($ (current~page.north~west)+(-1.2pt,-.4pt)+ - (\@weeklistshifts[1,\int_use:N \l_course_weekday_int] - *\l_course_hunit_dim+\paperwidth/15, - {\fp_eval:n {-1-2*#2}*\l_course_vunit_dim}) + (\clist_item:Nn \l__week_accum_clist + { + \l__week_day_int + }*\l__week_hunit_dim+\paperwidth/15, + \fp_eval:n {-1-2*#2}*\l__time_vunit_dim) $) {[rounded~corners = 7.2pt] -- ($ (current~page.north~west)+(-1.2pt,1.2pt)+ - (\@weeklistshifts[1,\int_use:N \l_course_weekday_int] - *\l_course_hunit_dim+\paperwidth/15, - \fp_eval:n {-2.5-2*#3}*\l_course_vunit_dim) + (\clist_item:Nn \l__week_accum_clist + { + \l__week_day_int + }*\l__week_hunit_dim+\paperwidth/15, + \fp_eval:n {-2.5-2*#3}*\l__time_vunit_dim) $) -- ($ (current~page.north~west)+(1.2pt,1.2pt)+ - (\fp_eval:n { - \@weeklistshifts[1,\int_use:N \l_course_weekday_int] - -\@weeklist[2,\int_use:N \l_course_weekday_int] - }*\l_course_hunit_dim+\paperwidth/15, - \fp_eval:n {-2.5-2*#3}*\l_course_vunit_dim) + (\fp_eval:n + { + \clist_item:Nn \l__week_accum_clist + { + \l__week_day_int + }- + \clist_item:Nn \l__week_ratios_clist + { + \l__week_day_int + } + }*\l__week_hunit_dim+\paperwidth/15, + \fp_eval:n {-2.5-2*#3}*\l__time_vunit_dim) $)} -- cycle; % Course info - \tl_if_eq:NNTF {#2} {#3} {% - % Single-unit height course block - \bool_if:nTF {% + \tl_if_eq:NNTF {#2} {#3}% Single-unit height course block + { + \bool_if:nTF + { \tl_if_empty_p:N \l_location_tl && \tl_if_empty_p:N \l_teacher_tl - }{% + }{ \tl_set:Nn \l_shortcourse_anchor_tl { } - }{% + }{ \tl_set:Nn \l_shortcourse_anchor_tl { above } } - \cs_if_exist:NT {\l_subject_tl } {% + \cs_if_exist:NT {\l_subject_tl } + { \node [ \l_shortcourse_anchor_tl, \l_color_tl!60, align = center, font = \large\bfseries ] at ($ (current~page.north~west)+ - (\fp_eval:n {% - \@weeklistshifts[1, - \int_use:N \l_course_weekday_int]- - \@weeklist[2, - \int_use:N \l_course_weekday_int]/2} - *\l_course_hunit_dim+\paperwidth/15, - \fp_eval:n {-1.75-#2-#3}*\l_course_vunit_dim) + (\fp_eval:n + { + \clist_item:Nn \l__week_accum_clist + { + \l__week_day_int + }- + \clist_item:Nn \l__week_ratios_clist + { + \l__week_day_int + }/2 + }*\l__week_hunit_dim+\paperwidth/15, + \fp_eval:n {-1.75-#2-#3}*\l__time_vunit_dim) $) { \l_subject_tl }; - } - \bool_if:nTF {% + } + \bool_if:nTF + { !\tl_if_empty_p:N \l_location_tl && !\tl_if_empty_p:N \l_teacher_tl - }{% + }{ \tl_set:Nn \l_shortcourse_sep_tl { ,~ } - }{% + }{ \tl_set:Nn \l_shortcourse_sep_tl { } } \node [ below, \l_color_tl!60, align = center ] at ($ (current~page.north~west)+ - (\fp_eval:n {% - \@weeklistshifts[1, - \int_use:N \l_course_weekday_int]- - \@weeklist[2,\int_use:N \l_course_weekday_int]/2} - *\l_course_hunit_dim+\paperwidth/15, - \fp_eval:n {-1.75-#2-#3}*\l_course_vunit_dim) - $) {% + (\fp_eval:n + { + \clist_item:Nn \l__week_accum_clist + { + \l__week_day_int + }- + \clist_item:Nn \l__week_ratios_clist + { + \l__week_day_int + }/2 + }*\l__week_hunit_dim+\paperwidth/15, + \fp_eval:n {-1.75-#2-#3}*\l__time_vunit_dim) + $) { \tl_if_exist:NT { \l_location_tl } { \l_location_tl } \l_shortcourse_sep_tl \tl_if_exist:NT { \l_teacher_tl } { \l_teacher_tl } - }; - }{% - % Multiply-unit height course block - \bool_if:nTF {% + }; + }{ + \bool_if:nTF% Multiply-unit height course block + { \tl_if_empty_p:N \l_location_tl && \tl_if_empty_p:N \l_teacher_tl - }{% + }{ \tl_set:Nn \l_course_anchor_tl {} - \dim_set:Nn \l_course_shift_dim { 0\l_course_vunit_dim } - }{% + \dim_set:Nn \l__course_infoshift_dim { 0pt } + }{ \tl_set:Nn \l_course_anchor_tl { above } - \dim_set:Nn \l_course_shift_dim { .125\l_course_vunit_dim } - } - \cs_if_exist:NT { \l_subject_tl }{% - \node [% - \l_course_anchor_tl, - yshift = \dim_use:N \l_course_shift_dim, - \l_color_tl!60, align = center, - font = \large\bfseries ] - at ($ - (current~page.north~west)+ - (\fp_eval:n {% - \@weeklistshifts[1, - \int_use:N \l_course_weekday_int]- - \@weeklist[2, - \int_use:N \l_course_weekday_int]/2} - *\l_course_hunit_dim+\paperwidth/15, - \fp_eval:n {-1.5-#2-#3}*\l_course_vunit_dim) - $) { \l_subject_tl }; + \dim_set:Nn \l__course_infoshift_dim + { + .125\l__time_vunit_dim } - \bool_if:nTF {% + } + \cs_if_exist:NT { \l_subject_tl } + { + \node [ \l_course_anchor_tl, + yshift = \l__course_infoshift_dim, + \l_color_tl!60, align = center, + font = \large\bfseries + ] at ($ + (current~page.north~west)+ + (\fp_eval:n + { + \clist_item:Nn \l__week_accum_clist + { + \l__week_day_int + }- + \clist_item:Nn \l__week_ratios_clist + { + \l__week_day_int + }/2 + }*\l__week_hunit_dim+\paperwidth/15, + \fp_eval:n {-1.5-#2-#3}*\l__time_vunit_dim) + $) { \l_subject_tl }; + } + \bool_if:nTF + { !\tl_if_empty_p:N \l_location_tl && !\tl_if_empty_p:N \l_teacher_tl - }{% + }{ \tl_set:Nn \l_courseinfo_sep_tl { \\ } - }{% + }{ \tl_set:Nn \l_courseinfo_sep_tl { } } \node [ below, \l_color_tl!60, align = center ] at ($ (current~page.north~west)+ - (\fp_eval:n {% - \@weeklistshifts[1, - \int_use:N \l_course_weekday_int]- - \@weeklist[2,\int_use:N \l_course_weekday_int]/2} - *\l_course_hunit_dim+\paperwidth/15, - \fp_eval:n {-1.625-#2-#3}*\l_course_vunit_dim) - $) {% + (\fp_eval:n + { + \clist_item:Nn \l__week_accum_clist + { + \l__week_day_int + }- + \clist_item:Nn \l__week_ratios_clist + { + \l__week_day_int + }/2 + }*\l__week_hunit_dim+\paperwidth/15, + \fp_eval:n {-1.625-#2-#3}*\l__time_vunit_dim) + $) { \tl_if_exist:NT { \l_location_tl } { \l_location_tl } \l_courseinfo_sep_tl \tl_if_exist:NT { \l_teacher_tl } { \l_teacher_tl } - }; - \node [ above~left, \l_color_tl!60, - inner~sep = {7.2pt-.5ex} ] + }; + \node [ above~left, \l_color_tl!60, outer~sep = .5ex ] at ($ (current~page.north~west)+ - (\@weeklistshifts[1,\int_use:N \l_course_weekday_int] - *\l_course_hunit_dim+\paperwidth/15, - \fp_eval:n {-2.5-2*#3}*\l_course_vunit_dim) + (\clist_item:Nn \l__week_accum_clist + { + \l__week_day_int + }*\l__week_hunit_dim+\paperwidth/15, + \fp_eval:n {-2.5-2*#3}*\l__time_vunit_dim) $) { \l_weeks_tl }; } \group_end: } -% Additional info -\newcommand{\more}[1]{% - \node [ left = 1ex, darkgray, font = \small\bfseries ] at - ($(current~page.south~east)+(0,.5*\l_course_vunit_dim)$) {#1}; +\newcommand{\more}[1]% Additional info +{ + \node [ left = 1ex, darkgray, font = \small\bfseries ] + at ($ + (current~page.south~east)+(0,.5*\l__time_vunit_dim) + $) {#1}; } -\tl_clear:N \thepage -\endinput -%%
\ No newline at end of file + +\endinput
\ No newline at end of file |