SchoolWork-LaTeX/数据库系统原理与实践/平时作业/mypreamble.tex
2024-11-02 14:07:35 +08:00

143 lines
4.7 KiB
TeX
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

\usepackage{tasks}
\usepackage[framemethod=TikZ]{mdframed}
% \usepackage[tikz]{bclogo}
\usepackage{fontawesome5}
\usepackage{underscore}
\usepackage{booktabs}
\usepackage[l3]{csvsimple}
\usepackage{amssymb, amsfonts, amstext, amsmath, amsopn, amsthm}
\usepackage{booktabs}
\usepackage{hyperref}
\usepackage{fancyhdr}
\usepackage{enumitem}
\usepackage{totpages}
\usepackage{mylatex}
\usepackage{subfiles}
\title{《数据库系统原理与实践》作业}
\author{岳锦鹏}
\newcommand{\mysignature}{10213903403 岳锦鹏}
\date{2024年9月11日}
\setlist[1]{listparindent=\parindent}
\setlist[2]{label=\textbf{\alph{enumii}.},listparindent=\parindent}
\setlist[3]{label=\textbf{\alph{enumii}.},listparindent=\parindent}
\definecolor{shadecolor}{RGB}{204,232,207}
\definecolor{verificationColor}{RGB}{85,206,255} % 这颜色误差确实有点大啊,目前手动调的
\setitemize[1]{label=\textbullet}
\settasks{label=\Alph*.}
\newmdenv[%
frametitle={%
\tikz[]
\node[anchor=east,rectangle,fill=verificationColor]
{ \faIcon{search}\ 验证一下};}, %
% frametitlerule=true, %
% frametitlebelowskip=10pt, %
roundcorner=5pt, %
innertopmargin=10pt,linecolor=verificationColor,%
linewidth=2pt,topline=true, %
frametitleaboveskip=\dimexpr-\ht\strutbox\relax,
]{verification}
\setminted{breaklines=true}
% 将minted的外框修复为framed修复换行的问题
\setlength{\FrameRule}{0pt}
\ExplSyntaxOn
% \debug_on:n {all}
\newcommand{\choice}[3][4]{
\seq_clear:N \l_tmpa_seq
\tl_clear:N \l_tmpa_tl
% 这种情况还是re.split好用search和findall都不好用
\regex_split:nnNT {[\c{par}\ ]+[A-Z]\ } {#2} \l_tmpa_seq {
\seq_pop_left:NN \l_tmpa_seq \l_tmpa_tl
\tl_put_right:Nn \l_tmpa_tl {\begin{tasks}[](#1)}
\seq_map_indexed_inline:Nn \l_tmpa_seq {
\tl_if_eq:nnTF {##1}{#3} {
\tl_set:Nn \l_tmpb_tl {##2}
% \tl_show:N \l_tmpb_tl
\regex_replace_once:nnNTF {\c{mint}} {\c{mint}[frame=single]}\l_tmpb_tl {
\tl_put_right:Nn \l_tmpa_tl {\task}
\tl_put_right:No \l_tmpa_tl {\l_tmpb_tl}
}{
\tl_put_right:Nn \l_tmpa_tl {\task \fbox {##2}}
}
} {
\tl_put_right:Nn \l_tmpa_tl {\task ##2}
}
}
\tl_put_right:Nn \l_tmpa_tl {\end{tasks}}
% 唉弄半天还是这种好用token list就直接手动插入这就完全不用考虑在环境中的扩展了
\l_tmpa_tl
}
}
% https://zhuanlan.zhihu.com/p/557120394
\tl_const:Nn \c_csv_blank_line { \par }
\cs_set:Npn \__csv_read:nV #1#2 {
\ior_open:Nn \g_tmpa_ior {#1}
\int_gzero:N \g_tmpa_int
\tl_clear:N \g_tmpa_tl
\tl_clear:N \l_tmpa_tl
\bool_until_do:nn {\ior_if_eof_p:N \g_tmpa_ior}{
\ior_get:NN \g_tmpa_ior \l_csv_line_tl
\int_gincr:N \g_tmpa_int % 行计数
\tl_clear:N \g_tmpb_tl
\tl_if_eq:NNF \l_csv_line_tl \c_csv_blank_line % 判断空行
{
\seq_set_split:NnV \l_tmpa_seq {,} \l_csv_line_tl
\int_gzero:N \g_tmpb_int
\tl_gset:Nn \rownum {\int_use:N \g_tmpa_int} %行号接口
\seq_map_inline:Nn \l_tmpa_seq {
\int_gincr:N \g_tmpb_int % 列计数
% 提供列接口
% \tl_gset:cn {col \int_to_roman:n \g_tmpb_int}{##1}
\int_compare:nNnTF \g_tmpb_int = 1 { % 判断首列
\tl_put_right:Nn \g_tmpb_tl {##1}
}{
\tl_put_right:Nn \g_tmpb_tl {& ##1}
}
}
\tl_put_right:Nn \g_tmpb_tl {\\} % 一行结束
\int_compare:nNnT \g_tmpa_int = 1 { % 判断首行
\tl_set:Nx \l_tmpa_tl {\prg_replicate:nn \g_tmpb_int c}
\tl_show:N \l_tmpa_tl
\tl_put_right:Nn \g_tmpa_tl {\begin{tabular}}
\tl_put_right:Nx \g_tmpa_tl {{\tl_use:N \l_tmpa_tl}}
\tl_put_right:Nn \g_tmpa_tl {\toprule}
}
\tl_show:N \g_tmpa_tl
\tl_put_right:Nx \g_tmpa_tl {\tl_use:N \g_tmpb_tl}
\int_compare:nNnT \g_tmpa_int = 1 {
\tl_put_right:Nn \g_tmpa_tl {\midrule}
}
}
}
\tl_put_right:Nn \g_tmpa_tl {\bottomrule \end{tabular}}
\tl_use:N \g_tmpa_tl
\ior_close:N \g_tmpa_ior
}
\newcommand{\readcsv}[2]{ % L2命令
\__csv_read:nV {#1}{#2}
}
\newenvironment{csv}{
\VerbatimEnvironment
\begin{VerbatimOut}[codes={\catcode`\^^I=12},firstline,lastline]{rawfile.csv}%
}{
\end{VerbatimOut}%
% \readcsv {rawfile.csv}{}
\csvautotabular{rawfile.csv}
}
\ExplSyntaxOff