summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/litetable/tex/litetable.cls
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/litetable/tex/litetable.cls')
-rw-r--r--macros/latex/contrib/litetable/tex/litetable.cls210
1 files changed, 105 insertions, 105 deletions
diff --git a/macros/latex/contrib/litetable/tex/litetable.cls b/macros/latex/contrib/litetable/tex/litetable.cls
index 50c979fdd0..647d078520 100644
--- a/macros/latex/contrib/litetable/tex/litetable.cls
+++ b/macros/latex/contrib/litetable/tex/litetable.cls
@@ -6,14 +6,17 @@
%% * either version 1.3c of this license or any later * * * ** * ***** * *
%% * version. * * * ** * * * * *
%% ****************************************************** ***** ** * * *** * * *
-%% start of file `notebeamer.cls'. *
+%% start of file `litetable.cls'. *
%% Copyright 2023 LiteLaTeX (xiamyphys@gmail.com) *
%% available at https://github.com/xiamyphys/LiteTable *
%% !Mode:: "TeX:UTF-8" *
%% ************************************************************************************************************
\NeedsTeXFormat{LaTeX2e}
-\ProvidesClass{litetable}[2023/11/05 v2.1a LiteTable document class]
-\LoadClass[tikz,margin=10pt]{standalone}
+\PassOptionsToPackage{quiet}{xeCJK}
+\PassOptionsToPackage{quiet}{fontspec}
+\PassOptionsToPackage{no-math}{fontspec}
+\ProvidesClass{litetable}[2024/01/31/ v2.2a LiteTable document class]
+
% ---------- 全局选项 ---------- %
\RequirePackage{kvoptions}
\RequirePackage{etoolbox}
@@ -30,28 +33,18 @@
\DeclareStringOption[times]{font}
\DeclareVoidOption{times}{\ekv{date=times}}
-\DeclareVoidOption{libertinus}{\ekv{date=libertinus}}
+\DeclareVoidOption{libertinuTs}{\ekv{date=libertinus}}
-\DeclareDefaultOption{\PassOptionsToClass{\CurrentOption}{book}}
+\DeclareDefaultOption{\PassOptionsToClass{\CurrentOption}{standalone}}
\ProcessKeyvalOptions*\relax
-
-% ---------- 中文字体 ---------- %
-\RequirePackage{ctex}
+\LoadClass[tikz,margin=6pt]{standalone}
% ---- 文本中的数字 & 字母设置 ---- %
-\PassOptionsToPackage{no-math}{fontspec}
-\PassOptionsToPackage{quiet}{fontspec}
+\RequirePackage{ctex}
\ifdefstring{\LITE@font}{libertinus}{
\setmainfont{Libertinus Serif}
\setsansfont{Libertinus Sans}
-\setmonofont{NotoSansMono}[
- Scale=MatchLowercase,
- Extension=.ttf,
- UprightFont=*-Light,
- BoldFont=*-Medium
-]
}{\relax}
-\RequirePackage{iftex}
\ifdefstring{\LITE@font}{times}{
\ifXeTeX
\RequirePackage[no-math]{fontspec}
@@ -79,7 +72,7 @@
% ---------- 色彩组合 ---------- %
\definecolor{darkgray}{HTML}{727477}% 时间颜色
\definecolor{darkergray}{HTML}{F1F3F5}% 深色块
-\definecolor{lightergray}{HTML}{F8F9FA}% 浅色块
+\definecolor{lightergray}{HTML}{FCFDFE}% 浅色块
\definecolor{blackgray}{HTML}{1A1D21}% 序号颜色
\definecolor{H1}{HTML}{74A7A2}% 深绿
\definecolor{H1*}{HTML}{E9EEED}
@@ -109,107 +102,114 @@
\definecolor{H9*}{HTML}{F2E0D0}
\definecolor{H9**}{HTML}{C96F1C}
\pagecolor{lightergray}
-\newcommand{\xscale}{2.2733}
-\newcommand{\yscale}{0.4291}
-
-\usetikzlibrary{calc}
-\ifdefstring{\LITE@style}{round}{
-\newcommand{\course}[8]{
- \fill [#1,rounded corners=5pt] ($({(-23+32*(#2))*\xscale},{-\yscale*(21+93*#3)-0.2})$) rectangle ($({(9+32*(#2))*\xscale},{-\yscale*(114+93*#4)+0.2})$);
- \fill [#1*,rounded corners=5pt] ($({(-23+32*(#2))*\xscale+0.1},{-\yscale*(42+93*#3)})$) -- ($({(-23+32*(#2))*\xscale+0.1},{-\yscale*(114+93*#4)+0.3})$) -- ($({(9+32*(#2))*\xscale-0.1},{-\yscale*(114+93*#4)+0.3})$) -- ($({(9+32*(#2))*\xscale-0.1},{-\yscale*(42+93*#3)})$);
- \node [#1**,anchor=south] at ($({((-23+32*(#2))*\xscale+(9+32*(#2))*\xscale)/2},{(-\yscale*(21+93*#3)-\yscale*(114+93*#4))/2})$) {\heiti\bfseries #5};
- \node [#1**,anchor=north] at ($({((-23+32*(#2))*\xscale+(9+32*(#2))*\xscale)/2},{(-\yscale*(21+93*#3)-\yscale*(114+93*#4))/2-21*\yscale})$) {\heiti\bfseries\footnotesize #6};
- \node [#1**,anchor=north] at ($({((-23+32*(#2))*\xscale+(9+32*(#2))*\xscale)/2},{(-\yscale*(21+93*#3)-\yscale*(114+93*#4))/2-42*\yscale})$) {\heiti\footnotesize #7};
- \node [#1**,anchor=south east] at ($({(9+32*(#2))*\xscale-0.1},{-\yscale*(114+93*#4)+0.3})$) {\heiti\footnotesize #8};
- }
- }{\relax}
-\ifdefstring{\LITE@style}{sharp}{
-\newcommand{\course}[8]{
- \fill [#1] ($({(-23+32*(#2))*\xscale},{-\yscale*(21+93*#3)-0.2})$) rectangle ($({(9+32*(#2))*\xscale},{-\yscale*(114+93*#4)+0.2})$);
- \fill [#1*] ($({(-23+32*(#2))*\xscale+0.1},{-\yscale*(42+93*#3)})$) rectangle ($({(9+32*(#2))*\xscale-0.1},{-\yscale*(114+93*#4)+0.3})$);
- \node [#1**,anchor=south] at ($({((-23+32*(#2))*\xscale+(9+32*(#2))*\xscale)/2},{(-\yscale*(21+93*#3)-\yscale*(114+93*#4))/2})$) {\heiti\bfseries #5};
- \node [#1**,anchor=north] at ($({((-23+32*(#2))*\xscale+(9+32*(#2))*\xscale)/2},{(-\yscale*(21+93*#3)-\yscale*(114+93*#4))/2-21*\yscale})$) {\heiti\bfseries\footnotesize #6};
- \node [#1**,anchor=north] at ($({((-23+32*(#2))*\xscale+(9+32*(#2))*\xscale)/2},{(-\yscale*(21+93*#3)-\yscale*(114+93*#4))/2-42*\yscale})$) {\heiti\footnotesize #7};
- \node [#1**,anchor=south east] at ($({(9+32*(#2))*\xscale-0.1},{-\yscale*(114+93*#4)+0.3})$) {\heiti\footnotesize #8};
- }
- }{\relax}
-
-\newcounter{number}
-\RequirePackage{fontawesome5}
\definecolor{丹色}{HTML}{E45E32}
\definecolor{紅緋}{HTML}{E83929}
\definecolor{紺碧}{HTML}{007BBB}
\definecolor{青碧}{HTML}{478384}
\definecolor{金色}{HTML}{E6B422}
+
+\def\pagewidth{8.5 in}
+\def\pageheight{-11 in}
+\usetikzlibrary{calc}
+\ifdefstring{\LITE@style}{round}{\def\corners{round corners=6pt}}{\relax}
+\ifdefstring{\LITE@style}{sharp}{\def\corners{}}{\relax}
+
+\ExplSyntaxOn % 二维数组
+\seq_new:N \l_node_row_seq
+\seq_new:N \l_node_tmp_seq
+\cs_set:Npn \timelist #1 {
+ \gdef\@timelist{#1} % 用于判断\@timelist是否存在
+ \seq_set_split:Nnn \l_node_row_seq {;} {#1}
+ \int_step_inline:nn{\seq_count:N \l_node_row_seq}
+ {
+ \seq_if_exist:cF {l_node_row_##1_seq}
+ {
+ \seq_new:c {l_node_row_##1_seq}
+ }
+ \exp_args:Ncx\seq_set_from_clist:Nn {l_node_row_##1_seq} {\seq_item:Nn \l_node_row_seq{##1}}
+ }
+}
+
+\cs_set:Npn \PrintTime [#1][#2] {
+ \tl_if_empty:nTF { #1 }
+ {
+ \tl_if_empty:nTF { #2 }
+ {
+ \seq_use:Nn \l_node_row_seq {,}
+ }
+ {
+ \int_step_inline:nn{\seq_count:N \l_node_row_seq}
+ {
+ \seq_put_right:Nn \l_node_tmp_seq {\seq_item:cn {l_node_row_##1_seq}{#2}}
+ }
+ \seq_use:Nn \l_node_tmp_seq {,}
+ }
+ }
+ {
+ \tl_if_empty:nTF {#2}
+ {
+ \seq_use:cn {l_node_row_#1_seq}{,}
+ }
+ {
+ \seq_item:cn {l_node_row_#1_seq}{#2}
+ }
+ }
+}
+\ExplSyntaxOff
+\RequirePackage{fontawesome5}
+\newcounter{number}
+\def\sticker{\gdef\@sticker}
\newcommand{\makeframe}[1]{
- \ifdefstring{\LITE@style}{round}{
- \fill [fill=darkergray,rounded corners=8pt] (0,0) rectangle ($({169*\xscale},{-\yscale*72})$);% 顶部深灰色块
+ \draw [gray!75] (0,0) rectangle (8.5 in,-11 in);
+ \fill [fill=darkergray,\corners] (0,0) rectangle (\pagewidth,1.5*\pageheight/27.5);% 顶部深灰色块
+ \node at (.5*\pagewidth,.75*\pageheight/27.5) {\huge\bfseries\sffamily #1};
\foreach \a in {2,4,...,12}
- \fill [fill=darkergray,yshift=\yscale*72 cm-\yscale*93*\a cm,rounded corners=8pt] (0,0) rectangle ($({169*\xscale},{-\yscale*93})$);% 中间深灰色块(循环)
- \fill [fill=darkergray,yshift=-\yscale*114 cm-\yscale*93*12 cm,rounded corners=8pt] (0,0) rectangle ($({169*\xscale},{-\yscale*36})$);% 底部深灰色块
- }{\relax}
- \ifdefstring{\LITE@style}{sharp}{
- \fill [fill=darkergray] (0,0) rectangle ($({169*\xscale},{-\yscale*72})$);% 顶部深灰色块
- \foreach \a in {2,4,...,12}
- \fill [fill=darkergray,yshift=\yscale*72 cm-\yscale*93*\a cm] (0,0) rectangle ($({169*\xscale},{-\yscale*93})$);% 中间深灰色块(循环)
- \fill [fill=darkergray,yshift=-\yscale*114 cm-\yscale*93*12 cm] (0,0) rectangle ($({169*\xscale},{-\yscale*36})$);% 底部深灰色块
- }{\relax}
+ \fill [fill=darkergray,yshift=2.5*\pageheight/27.5+2*(\a-2)*\pageheight/27.5,\corners] (0,0) rectangle (\pagewidth,2*\pageheight/27.5);% 中间深灰色块(循环)
+ \fill [fill=darkergray,yshift=2.5*\pageheight/27.5+2*12*\pageheight/27.5,\corners] (0,0) rectangle (\pagewidth,\pageheight/27.5);% 底部深灰色块
\foreach \a in {0,1,2,...,12}
- \draw [densely dashed,gray!75,yshift=-\yscale*114 cm-\yscale*93*\a cm] ($({9*\xscale},0)$)--($({169*\xscale},0)$);% 分割虚线
- \node at ($({169*\xscale/2},{-\yscale*72/2})$) {\huge\bfseries\sffamily #1};
+ \draw [densely dashed,gray!75,yshift=2.5*\pageheight/27.5+2*\a*\pageheight/27.5,] (0,0)--(\pagewidth,0);% 分割虚线
% 时间标注
\setcounter{number}{0}
\foreach \a in {1,2,...,12}
- \node [yshift=-93*\yscale*(\a-1)*0.05 cm] at ($({9*\xscale/2},{-\yscale*135})$) {\bfseries\color{blackgray}\texttt{\textit{\refstepcounter{number}\thenumber}}};
- \node at ($({9*\xscale/2},{-\yscale*171})$) {\footnotesize\color{darkgray}\texttt{8:05}};
- \node at ($({9*\xscale/2},{-\yscale*195})$) {\footnotesize\color{darkgray}\texttt{8:50}};
-
- \node [yshift=-93*\yscale*0.05 cm] at ($({9*\xscale/2},{-\yscale*171})$) {\footnotesize\color{darkgray}\texttt{8:55}};
- \node [yshift=-93*\yscale*0.05 cm] at ($({9*\xscale/2},{-\yscale*195})$) {\footnotesize\color{darkgray}\texttt{9:40}};
-
- \node [yshift=-2*93*\yscale*0.05 cm] at ($({9*\xscale/2},{-\yscale*171})$) {\footnotesize\color{darkgray}\texttt{10:00}};
- \node [yshift=-2*93*\yscale*0.05 cm] at ($({9*\xscale/2},{-\yscale*195})$) {\footnotesize\color{darkgray}\texttt{10:45}};
-
- \node [yshift=-3*93*\yscale*0.05 cm] at ($({9*\xscale/2},{-\yscale*171})$) {\footnotesize\color{darkgray}\texttt{10:50}};
- \node [yshift=-3*93*\yscale*0.05 cm] at ($({9*\xscale/2},{-\yscale*195})$) {\footnotesize\color{darkgray}\texttt{11:35}};
-
- \node [yshift=-4*93*\yscale*0.05 cm] at ($({9*\xscale/2},{-\yscale*171})$) {\footnotesize\color{darkgray}\texttt{11:40}};
- \node [yshift=-4*93*\yscale*0.05 cm] at ($({9*\xscale/2},{-\yscale*195})$) {\footnotesize\color{darkgray}\texttt{12:25}};
-
- \node [yshift=-5*93*\yscale*0.05 cm] at ($({9*\xscale/2},{-\yscale*171})$) {\footnotesize\color{darkgray}\texttt{13:30}};
- \node [yshift=-5*93*\yscale*0.05 cm] at ($({9*\xscale/2},{-\yscale*195})$) {\footnotesize\color{darkgray}\texttt{14:15}};
-
- \node [yshift=-6*93*\yscale*0.05 cm] at ($({9*\xscale/2},{-\yscale*171})$) {\footnotesize\color{darkgray}\texttt{14:20}};
- \node [yshift=-6*93*\yscale*0.05 cm] at ($({9*\xscale/2},{-\yscale*195})$) {\footnotesize\color{darkgray}\texttt{15:05}};
-
- \node [yshift=-7*93*\yscale*0.05 cm] at ($({9*\xscale/2},{-\yscale*171})$) {\footnotesize\color{darkgray}\texttt{15:15}};
- \node [yshift=-7*93*\yscale*0.05 cm] at ($({9*\xscale/2},{-\yscale*195})$) {\footnotesize\color{darkgray}\texttt{16:00}};
-
- \node [yshift=-8*93*\yscale*0.05 cm] at ($({9*\xscale/2},{-\yscale*171})$) {\footnotesize\color{darkgray}\texttt{16:05}};
- \node [yshift=-8*93*\yscale*0.05 cm] at ($({9*\xscale/2},{-\yscale*195})$) {\footnotesize\color{darkgray}\texttt{16:50}};
-
- \node [yshift=-9*93*\yscale*0.05 cm] at ($({9*\xscale/2},{-\yscale*171})$) {\footnotesize\color{darkgray}\texttt{18:30}};
- \node [yshift=-9*93*\yscale*0.05 cm] at ($({9*\xscale/2},{-\yscale*195})$) {\footnotesize\color{darkgray}\texttt{19:15}};
-
- \node [yshift=-10*93*\yscale*0.05 cm] at ($({9*\xscale/2},{-\yscale*171})$) {\footnotesize\color{darkgray}\texttt{19:20}};
- \node [yshift=-10*93*\yscale*0.05 cm] at ($({9*\xscale/2},{-\yscale*195})$) {\footnotesize\color{darkgray}\texttt{20:05}};
-
- \node [yshift=-11*93*\yscale*0.05 cm] at ($({9*\xscale/2},{-\yscale*171})$) {\footnotesize\color{darkgray}\texttt{20:10}};
- \node [yshift=-11*93*\yscale*0.05 cm] at ($({9*\xscale/2},{-\yscale*195})$) {\footnotesize\color{darkgray}\texttt{20:55}};
+ \node [yshift=2.5*\pageheight/27.5+2*(\a-.8)*\pageheight/27.5] at (\pagewidth/32,0) {\bfseries\color{blackgray}\texttt{\refstepcounter{number}\thenumber}};
+ \ifcsname @timelist\endcsname % 若 `\@timelist == empty', 跳过该函数
+ \foreach \x in {1,2,...,12}
+ {
+ \node[yshift=2.5*\pageheight/27.5+2*(\x-.475)*\pageheight/27.5] at (\pagewidth/32,0) {\color{darkgray}\texttt{\PrintTime[1][\x]}};
+ \node[yshift=2.5*\pageheight/27.5+2*(\x-.2)*\pageheight/27.5] at (\pagewidth/32,0) {\color{darkgray}\texttt{\PrintTime[2][\x]}};
+ }\fi
% 星期标注
\ifdefstring{\LITE@date}{en}{
- \node [xshift=\xscale*25*0.05 cm] at ($(0,{-\yscale*93})$) {\color{丹色}\faIcon{moon}\;\bfseries\heiti{Monday}};
- \node [xshift=\xscale*57*0.05 cm] at ($(0,{-\yscale*93})$) {\color{紅緋}\faIcon{fire}\;\bfseries\heiti{Tuesday}};
- \node [xshift=\xscale*89*0.05 cm] at ($(0,{-\yscale*93})$) {\color{紺碧}\faIcon{water}\;\bfseries\heiti{Wednesday}};
- \node [xshift=\xscale*121*0.05 cm] at ($(0,{-\yscale*93})$) {\color{青碧}\faIcon{tree}\;\bfseries\heiti{Thursday}};
- \node [xshift=\xscale*153*0.05 cm] at ($(0,{-\yscale*93})$) {\color{金色}\faIcon{sun}\;\bfseries\heiti{Friday}};
+ \node [xshift=2.5*\pagewidth/16] at (0,2*\pageheight/27.5) {\color{丹色}\faIcon{moon}\;\bfseries\heiti{Monday}};
+ \node [xshift=5.5*\pagewidth/16] at (0,2*\pageheight/27.5) {\color{紅緋}\faIcon{fire}\;\bfseries\heiti{Tuesday}};
+ \node [xshift=8.5*\pagewidth/16] at (0,2*\pageheight/27.5) {\color{紺碧}\faIcon{water}\;\bfseries\heiti{Wednesday}};
+ \node [xshift=11.5*\pagewidth/16] at (0,2*\pageheight/27.5) {\color{青碧}\faIcon{tree}\;\bfseries\heiti{Thursday}};
+ \node [xshift=14.5*\pagewidth/16] at (0,2*\pageheight/27.5) {\color{金色}\faIcon{sun}\;\bfseries\heiti{Friday}};
}{\relax}
\ifdefstring{\LITE@date}{cn}{
- \node [xshift=\xscale*25*0.05 cm] at ($(0,{-\yscale*93})$) {\color{丹色}\faIcon{moon}\;\bfseries\heiti{星期一}};
- \node [xshift=\xscale*57*0.05 cm] at ($(0,{-\yscale*93})$) {\color{紅緋}\faIcon{fire}\;\bfseries\heiti{星期二}};
- \node [xshift=\xscale*89*0.05 cm] at ($(0,{-\yscale*93})$) {\color{紺碧}\faIcon{water}\;\bfseries\heiti{星期三}};
- \node [xshift=\xscale*121*0.05 cm] at ($(0,{-\yscale*93})$) {\color{青碧}\faIcon{tree}\;\bfseries\heiti{星期四}};
- \node [xshift=\xscale*153*0.05 cm] at ($(0,{-\yscale*93})$) {\color{金色}\faIcon{sun}\;\bfseries\heiti{星期五}};
+ \node [xshift=2.5*\pagewidth/16] at (0,2*\pageheight/27.5) {\color{丹色}\faIcon{moon}\;\bfseries\heiti{星期一}};
+ \node [xshift=5.5*\pagewidth/16] at (0,2*\pageheight/27.5) {\color{紅緋}\faIcon{fire}\;\bfseries\heiti{星期二}};
+ \node [xshift=8.5*\pagewidth/16] at (0,2*\pageheight/27.5) {\color{紺碧}\faIcon{water}\;\bfseries\heiti{星期三}};
+ \node [xshift=11.5*\pagewidth/16] at (0,2*\pageheight/27.5) {\color{青碧}\faIcon{tree}\;\bfseries\heiti{星期四}};
+ \node [xshift=14.5*\pagewidth/16] at (0,2*\pageheight/27.5) {\color{金色}\faIcon{sun}\;\bfseries\heiti{星期五}};
}{\relax}
+ \ifcsname @sticker\endcsname
+ \node [opacity=.3,anchor=south east,yshift=1.5*\pageheight/27.5+2*12*\pageheight/27.5,inner sep=0pt,scale=3] at (\pagewidth,\pageheight/27.5) {\includegraphics[width=\dimeval{\pagewidth/16}]{\@sticker}};\fi
}
-\newcommand{\more}[1]{\node [yshift=-\yscale*0.05*114 cm-\yscale*0.05*93*12 cm,anchor=east] at ($({169*\xscale},{-\yscale*18})$) {\small\color{darkgray}#1};} \ No newline at end of file
+
+\newcounter{weekday}
+\def\newday{\addtocounter{weekday}{1}}
+\AtEndEnvironment{tikzpicture}{\setcounter{weekday}{0}}
+\newcommand{\course}[7]
+{
+ \fill [#1,\corners,yshift=2*(#2-1)*\pageheight/27.5,xshift=3*\theweekday*\pagewidth/16] (\pagewidth/16,2.5*\pageheight/27.5) rectangle ($({4*\pagewidth/16},{(4.5+2*(#3-#2))*\pageheight/27.5})$); % frame
+ \fill [#1*,\corners,yshift=(2*(#2-1)+.5)*\pageheight/27.5,xshift=3*\theweekday*\pagewidth/16] (\pagewidth/16,2.5*\pageheight/27.5) rectangle ($({4*\pagewidth/16},{(4+2*(#3-#2))*\pageheight/27.5})$); % content
+ \node [#1**,yshift=(#2+#3-1.25)*\pageheight/27.5,xshift=3*\theweekday*\pagewidth/16] at (2.5*\pagewidth/16,2.5*\pageheight/27.5) {\heiti\large\bfseries #4}; % course
+ \node [#1**,anchor=south,yshift=(#2+#3-.2)*\pageheight/27.5,xshift=3*\theweekday*\pagewidth/16] at (2.5*\pagewidth/16,2.5*\pageheight/27.5) {\heiti\bfseries\small #5}; % location
+ \node [#1**,anchor=north,yshift=(#2+#3-.2)*\pageheight/27.5,xshift=3*\theweekday*\pagewidth/16] at (2.5*\pagewidth/16,2.5*\pageheight/27.5) {\heiti\bfseries\small #6}; % teacher
+ \node [#1**,anchor=south east,yshift=2*#3*\pageheight/27.5,xshift=3*\theweekday*\pagewidth/16] at (4*\pagewidth/16,2.5*\pageheight/27.5) {\heiti\footnotesize #7}; % weeks
+}
+
+\def\more#1{
+ \node [xshift=-1em,yshift=2.5*\pageheight/27.5+2*12*\pageheight/27.5,anchor=east] at (\pagewidth,.5*\pageheight/27.5){\small\bfseries\color{darkgray}#1};
+} \ No newline at end of file