diff --git a/cls/boxes.cls b/cls/boxes.cls new file mode 100644 index 0000000..9d2465d --- /dev/null +++ b/cls/boxes.cls @@ -0,0 +1,104 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% boxes +%% 信息框 +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%% 带标题的文本框 +\newtcolorbox{titledbox}[1]{% + tikznode boxed title, + enhanced, + arc=3pt, + interior style={white}, + attach boxed title to top center = {yshift=-\tcboxedtitleheight/2}, + fonttitle=\hm, + colbacktitle=white,coltitle=black, + boxed title style={size=normal,colframe=white,boxrule=0pt}, + boxrule=.5pt, + left=5pt, right=5pt, top=5pt, bottom=0pt, + boxsep=5pt, + title={#1}, + halign=left, + fontupper=\fzkai +} + +%% Note +\newtcolorbox{notebox}{% + enhanced, + arc=2pt, + boxrule=.5pt, + left=5pt, right=5pt, top=0pt, bottom=0pt, + boxsep=5pt, + colframe=NavyBlue, + colback=NavyBlue!5!White, + colbacktitle=NavyBlue!5!White, + coltext=NavyBlue, + title={\textcolor{NavyBlue}{\faStickyNoteO\hspace{.5em}\bfseries{\hm{笔记}}}}, + halign=left, + fontupper=\fzkai +} + +%% Important +\newtcolorbox{importantbox}{% + enhanced, + arc=2pt, + boxrule=.5pt, + left=5pt, right=5pt, top=0pt, bottom=0pt, + boxsep=5pt, + colframe=Orange, + colback=Orange!5!White, + colbacktitle=Orange!5!White, + coltext=Orange, + title={\textcolor{Orange}{\faExclamationCircle\hspace{.5em}\bfseries{\hm{重要}}}}, + halign=left, + fontupper=\fzkai +} + +%% verbatim 环境无法直接在新环境中使用 +%% 换用 \VerbatimEnvironment \begin{Verbatim} +\RequirePackage{fancyvrb} + +%% 命令行 +\newenvironment{shellbox} +{% + \VerbatimEnvironment + \begin{tcolorbox}[ + enhanced, + arc=2pt, + boxrule=.5pt, + left=5pt, right=5pt, top=0pt, bottom=0pt, + boxsep=5pt, + colframe=black, + colback=white, + coltext=black, + title={}, + fontupper=\linespread{1.2} + ]% + \begin{Verbatim} +} +{% + \end{Verbatim} + \end{tcolorbox} +} + +%% 命令行 +\newenvironment{invertedshellbox} +{% + \VerbatimEnvironment + \begin{tcolorbox}[ + enhanced, + arc=2pt, + boxrule=.5pt, + left=5pt, right=5pt, top=0pt, bottom=0pt, + boxsep=5pt, + colframe=black!70!white, + colback=black!70!white, + coltext=white, + title={}, + fontupper=\linespread{1.2} + ]% + \begin{Verbatim} +} +{% + \end{Verbatim} + \end{tcolorbox} +} \ No newline at end of file diff --git a/cls/chinesename.cls b/cls/chinesename.cls new file mode 100644 index 0000000..cc4279a --- /dev/null +++ b/cls/chinesename.cls @@ -0,0 +1,8 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Chinese names +%% 中文名称 +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\renewcommand{\figurename}{图} +\renewcommand{\tablename}{表} +\renewcommand{\lstlistingname}{代码} +\renewcommand{\abstractname}{摘要} \ No newline at end of file diff --git a/cls/code.cls b/cls/code.cls new file mode 100644 index 0000000..578b895 --- /dev/null +++ b/cls/code.cls @@ -0,0 +1,129 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% code listings +%% 代码块设定 +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\RequirePackage{listings,verbatim} + +\definecolor{codecolorkeywords}{rgb}{0,0,1} +\definecolor{codecolorcomments}{rgb}{0,0.5,0} +\definecolor{codecolorxmlcomments}{rgb}{0.5,0.5,0.5} +\definecolor{codecolorstrings}{rgb}{0.64,0.08,0.08} +\definecolor{codecolortypes}{rgb}{0.17,0.57,0.68} + +\lstdefinelanguage{JavaScript}{ + keywords={do, if, in, for, let, new, try, var, case, else, enum, eval, null, this, true, void, with, await, break, catch, class, const, false, super, throw, while, yield, delete, export, import, public, return, static, switch, typeof, default, extends, finally, package, private, continue, debugger, function, arguments, interface, protected, implements, instanceof}, + sensitive=true, + comment=[l]{//}, + morecomment=[s]{/*}{*/}, + morestring=[b]', + morestring=[b]" +} + +\lstdefinelanguage{TypeScript}{ + keywords={abstract, break, case, catch, class, const, continue, debugger, default, delete, do, else, enum, export, extends, false, finally, for, function, if, import, in, instanceof, new, null, return, super, switch, this, throw, true, try, typeof, var, void, while, with, as, implements, interface, let, package, private, protected, public, static, yield, any, boolean, constructor, declare, get, module, require, number, set, string, symbol, type, from, of}, + sensitive=true, + comment=[l]{//}, + morecomment=[s]{/*}{*/}, + morestring=[b]', + morestring=[b]" +} + +\lstdefinelanguage{golang}{ + keywords={break, default, func, interface, select, case, defer, go, map, struct, chan, else, goto, package, switch, const, fallthrough, if, range, type, continue, for, import, return, var}, + sensitive=true, + comment=[l]{//}, + morecomment=[s]{/*}{*/}, + morestring=[b]', + morestring=[b]" +} + +\lstdefinestyle{mystyle}{ + % Basic design + basicstyle=\linespread{1.2}\ttfamily, + frame=tb, + framesep=5pt, + framerule=.5pt, + framexleftmargin=10pt, + rulecolor=\color{black}, + abovecaptionskip=0pt, + belowcaptionskip=5pt, + aboveskip=5pt, + backgroundcolor=\color{black!5!white}, + % Code design + keywordstyle=\color{codecolorkeywords}, + commentstyle=\color{codecolorcomments}, + stringstyle=\color{codecolorstrings}, + numberstyle=\small\color{gray}, + breakatwhitespace=false, + breaklines=true, + captionpos=t, + keepspaces=true, + % Line numbers + numbers=none, + numbersep=15pt, + xleftmargin=10pt, + stepnumber=1, + firstnumber=1, + numberfirstline=true, + % Code + tabsize=4, + showspaces=false, + showstringspaces=false, + showtabs=false, + breaklines=true, +} +\lstset{style=mystyle} + +%% 命令行 +\lstdefinestyle{bashstyle}{ + backgroundcolor=\color{NavyBlue!10!white}, + basicstyle=\linespread{1.2}\ttfamily, + keepspaces=true, + numbers=none, + numbersep=10pt, + frame=l, + framerule=2pt, + framesep=5pt, + framexleftmargin=3pt, + framextopmargin=-5pt, + xleftmargin=10pt, + rulecolor=\color{NavyBlue}, + % Code + tabsize=4, + showspaces=false, + showstringspaces=false, + showtabs=false, + breaklines=true, +} + +%% 命令行输出 +\lstdefinestyle{bashoutputstyle}{ + backgroundcolor=\color{black!10!white}, + basicstyle=\linespread{1.2}\ttfamily, + keepspaces=true, + numbers=none, + numbersep=10pt, + frame=l, + framerule=2pt, + framesep=5pt, + framexleftmargin=3pt, + framextopmargin=-5pt, + xleftmargin=10pt, + rulecolor=\color{black!70!white}, + % Code + tabsize=4, + showspaces=false, + showstringspaces=false, + showtabs=false, + breaklines=true, +} + +%% 代码列表标题 +\RequirePackage{caption} +\DeclareCaptionFormat{codecaptionformat}{% + %%\colorbox{black!20}{ + %% \parbox{\textwidth}{#1#2\ttfamily#3} + %%} + \parbox{\textwidth}{\textcolor{violet}\faCode~\textcolor{violet}{#1#2}\hspace{.5em}\fzkai#3} +} +\captionsetup[lstlisting]{format=codecaptionformat} \ No newline at end of file diff --git a/cls/figs.cls b/cls/figs.cls new file mode 100644 index 0000000..c694ab4 --- /dev/null +++ b/cls/figs.cls @@ -0,0 +1,4 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% 图片设定 +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\graphicspath{{./figs/}{./figure/}{./figures/}{./image/}{./images/}{./graphics/}{./graphic/}{./pictures/}{./picture/}} diff --git a/cls/font.cls b/cls/font.cls new file mode 100644 index 0000000..44d311a --- /dev/null +++ b/cls/font.cls @@ -0,0 +1,96 @@ + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% fonts settings +%% 字体设定 +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%% \usepackage{ebgaramond} + +%% 开明式:句末点号用占一个汉字宽度,标号和句内点号占半个汉字宽度 +%\punctstyle{kaiming} + +%\setmainfont{Minion Pro} +% \setmainfont{Myriad Pro} +% \setsansfont{Myriad Pro} +% \setmonofont{Courier Std} + +%设置英文字体 鸿蒙字体 +% \setmainfont[ +% Path=font/, +% BoldFont=Arvo-Bold.ttf, +% ItalicFont=Arvo-Italic.ttf, +% BoldItalicFont=Arvo-BoldItalic.ttf, +% ]{Arvo-Regular.ttf} +\setmainfont[ + Path=font/, + BoldFont=HarmonyOS_Sans_Bold.ttf, + ItalicFont=HarmonyOS_Sans_Regular_Italic.ttf, + BoldItalicFont=HarmonyOS_Sans_Bold_Italic.ttf, +]{HarmonyOS_Sans_Regular.ttf} +\setsansfont[ + Path=font/, + BoldFont=HarmonyOS_Sans_Bold.ttf, + ItalicFont=HarmonyOS_Sans_Regular_Italic.ttf, + BoldItalicFont=HarmonyOS_Sans_Bold_Italic.ttf, +]{HarmonyOS_Sans_Regular.ttf} +\setmonofont[ + Path=font/ +]{HarmonyOS_Sans_Regular.ttf} + +\setCJKmainfont[ + Path=font/, + BoldFont=fangzhengxiaobiaosong_GBK.TTF, + ItalicFont=fangzhengkaiti_GBK.TTF, + BoldItalicFont=fangzhengfangsong_GBK.TTF, + ]{fangzhengshusong_GBK.TTF} +\setCJKsansfont[ + Path=font/, + BoldFont=HarmonyOS_Sans_SC_Bold.ttf, + ItalicFont=HarmonyOS_Sans_SC_Light.ttf, + BoldItalicFont=HarmonyOS_Sans_SC_Black.ttf, +]{HarmonyOS_Sans_SC_Regular.ttf} +\setCJKmonofont[ + Path=font/ +]{fangzhengzhongdengxian_GBK.TTF} + +\XeTeXlinebreaklocale "zh" +\XeTeXlinebreakskip = 0pt plus 1pt + +%方正书宋 +\setCJKfamilyfont{fzss}[ + Path=font/ +]{fangzhengshusong_GBK.TTF} +\newcommand{\fzss}{\CJKfamily{fzss}} + +%方正小标宋 +\setCJKfamilyfont{fzxbs}[ + Path=font/ +]{fangzhengxiaobiaosong_GBK.TTF} +\newcommand{\fzxbs}{\CJKfamily{fzxbs}} + +%方正楷体 +\setCJKfamilyfont{fzkai}[ + Path=font/ +]{fangzhengkaiti_GBK.TTF} +\newcommand{\fzkai}{\CJKfamily{fzkai}} + +%方正仿宋 +\setCJKfamilyfont{fzfs}[ + Path=font/ +]{fangzhengfangsong_GBK.TTF} +\newcommand{\fzfs}{\CJKfamily{fzfs}} + +%方正中等线 +\setCJKfamilyfont{fzzdx}[ + Path=font/ +]{fangzhengzhongdengxian_GBK.TTF} +\newcommand{\fzzdx}{\CJKfamily{fzzdx}} + +%鸿蒙字体 +\setCJKfamilyfont{hm}[ + Path=font/, + BoldFont=HarmonyOS_Sans_SC_Bold.ttf, + ItalicFont=HarmonyOS_Sans_SC_Light.ttf, + BoldItalicFont=HarmonyOS_Sans_SC_Black.ttf, +]{HarmonyOS_Sans_SC_Regular.ttf} +\newcommand{\hm}{\CJKfamily{hm}} \ No newline at end of file diff --git a/cls/geometry.cls b/cls/geometry.cls new file mode 100644 index 0000000..0555f6b --- /dev/null +++ b/cls/geometry.cls @@ -0,0 +1,19 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% 页面设定 +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\geometry{ + textwidth=138mm, + textheight=215mm, + left=27mm, + %% or + %% inner=23mm, + right=27mm, + %% or + %% outer=18mm, + top=25.4mm, bottom=25.4mm, + headheight=2.17cm, + headsep=4mm, + footskip=12mm, + heightrounded, +} \ No newline at end of file diff --git a/cls/global.cls b/cls/global.cls new file mode 100644 index 0000000..7424864 --- /dev/null +++ b/cls/global.cls @@ -0,0 +1,13 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% global settings +%% 全局格式设定 +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%% 添加首行缩进,两个字符 +\setlength{\parindent}{2em} + +%% 行距 +\linespread{1.5} + +%% 表格 +\captionsetup[table]{belowskip=0pt,aboveskip=5pt} \ No newline at end of file diff --git a/cls/headandfoot.cls b/cls/headandfoot.cls new file mode 100644 index 0000000..3710706 --- /dev/null +++ b/cls/headandfoot.cls @@ -0,0 +1,32 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% head and foot +%% 页眉页脚 +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \RequirePackage{fancyhdr} +% \RequirePackage{zhnumber} + +% \pagestyle{fancy} +% \fancyhf{} +% \renewcommand\headrulewidth{.5pt} +% \renewcommand\footrulewidth{0pt} +% %\futurelet\TMPheadrule\def\headrule{{\color{violet}\TMPheadrule}} + +% \renewcommand{\sectionmark}[1]{\markright{#1}} + +% \fancyhead[C]{\fzkai{\rightmark}} +% %\fancyhead[R]{\thepage} + +% \fancyfoot[L]{\fzkai{\author}} +% \fancyfoot[R]{\thepage} + +\pagestyle{fancy} +\fancyhf{} +\renewcommand\headrulewidth{.5pt} +\renewcommand\footrulewidth{0pt} +%\futurelet\TMPheadrule\def\headrule{{\color{violet}\TMPheadrule}} +%\renewcommand{\sectionmark}[1]{\markright{#1}} +\fancyhead[C]{\fzkai{\themaintitle}} +%\fancyhead[C]{\@title} +%\fancyhead[R]{\thepage} +%\fancyfoot[L]{\fzkai{\@author}} +\fancyfoot[C]{\thepage / \pageref{LastPage}} \ No newline at end of file diff --git a/cls/hyperref.cls b/cls/hyperref.cls new file mode 100644 index 0000000..cd588ba --- /dev/null +++ b/cls/hyperref.cls @@ -0,0 +1,12 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% hyperref settings +%% 超链接设定 +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\hypersetup{ + bookmarksnumbered, + colorlinks, + linkcolor={black}, + citecolor={black}, + urlcolor={black} +} \ No newline at end of file diff --git a/cls/title.cls b/cls/title.cls new file mode 100644 index 0000000..3c3855e --- /dev/null +++ b/cls/title.cls @@ -0,0 +1,54 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% 标题、目录等设定 +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%% \renewcommand\abstractname{Summary} +%%\renewenvironment{abstract}{\noindent\rule{\textwidth}{.5pt}\\[2ex] \centering\begin{minipage}{.97\textwidth}{\zihao{-4}\sffamily\bfseries \centering{\abstractname}}\\} +%%{\par\noindent\end{minipage}\\[2ex] \rule{\textwidth}{.5pt}} + +% \renewenvironment{abstract}{\noindent\rule{\textwidth}{.5pt}\\[2ex] \centering\begin{minipage}{.97\textwidth}\begin{center}{\zihao{-4}\sffamily\bfseries \abstractname} \\ \end{center}} +% {\par\end{minipage}\\[2ex] \noindent\rule{\textwidth}{.5pt}} + +%目录 +\titlecontents{section}[3.8em]%左间距 +{\zihao{-4}}%\fzss \vspace{3pt}}%字号 +{\contentslabel{2em}} +{}%\hspace*{-4em}} +{~\titlerule*[0.25pc]{$.$}~\contentspage\hspace*{1cm}}%样式,最后留出1cm的右间距 + +\titlecontents{subsection}[3.8em]%左间距 +{\zihao{-4}}%\fzss \vspace{3pt}}%字号 +{\contentslabel{2em}} +{}%\hspace*{-4em}} +{~\titlerule*[0.25pc]{$.$}~\contentspage\hspace*{1cm}}%样式,最后留出1cm的右间距 + +\titlecontents{subsubsection}[3.8em]%左间距 +{\zihao{-4}}%\fzss \vspace{3pt}}%字号 +{\contentslabel{2em}} +{}%\hspace*{-4em}} +{~\titlerule*[0.25pc]{$.$}~\contentspage\hspace*{1cm}}%样式,最后留出1cm的右间距 + +%% section +\titleformat{\section} +[hang] +{\sffamily} +{\zihao{-3}\bfseries\thesection.} +{1pt} +{\zihao{-3}\bfseries\filcenter} + +%% subsection +\titleformat{\subsection} +[hang] +{\sffamily} +{\zihao{4}\bfseries\thesubsection} +{1pt} +{\zihao{4}\bfseries\filright} + +%% subsubsection +\titleformat{\subsubsection} +[hang] +{\sffamily} +{\zihao{-4}\bfseries\thesubsubsection} +{1pt} +{\zihao{-4}\bfseries\filright} + \ No newline at end of file diff --git a/input/abstract.tex b/input/abstract.tex new file mode 100644 index 0000000..8ce3404 --- /dev/null +++ b/input/abstract.tex @@ -0,0 +1,14 @@ +\newpage +\thispagestyle{empty} +\begin{center} + {\hm\bfseries \zihao{3} \themaintitle}%摘要页面的标题 +\end{center} + +\renewcommand{\abstractname}{\hm\bfseries{\zihao{4}摘要}} + +\begin{abstract} +这是一个很好用的Latex模板,经过不断的修改和迭代进化。这里,就介绍一下这个模板的使用方法,希望对你有所帮助。 + +\vspace{2ex} +\noindent{\textbf{关键词:}Latex,\hspace{.5em}模板,\hspace{.5em}学习}%关键词不缩进 +\end{abstract} \ No newline at end of file diff --git a/input/setting.tex b/input/setting.tex index f80ee1f..6f65f52 100644 --- a/input/setting.tex +++ b/input/setting.tex @@ -3,20 +3,10 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% 页眉页脚 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\RequirePackage{fancyhdr} -\RequirePackage{zhnumber} -\RequirePackage{lastpage} -\pagestyle{fancy} -\fancyhf{} -\renewcommand\headrulewidth{.5pt} -\renewcommand\footrulewidth{0pt} -%\futurelet\TMPheadrule\def\headrule{{\color{violet}\TMPheadrule}} -%\renewcommand{\sectionmark}[1]{\markright{#1}} -\fancyhead[C]{\fzkai{\themaintitle}} -%\fancyhead[C]{\@title} -%\fancyhead[R]{\thepage} -%\fancyfoot[L]{\fzkai{\@author}} -\fancyfoot[C]{\thepage / \pageref{LastPage}} +% \RequirePackage{fancyhdr} +% \RequirePackage{zhnumber} +% \RequirePackage{lastpage} + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 设置页面水印 diff --git a/input/toc.tex b/input/toc.tex index 159f0fc..fbfb80d 100644 --- a/input/toc.tex +++ b/input/toc.tex @@ -2,4 +2,10 @@ \thispagestyle{empty} \begin{center} \tableofcontents +\newpage +\newcommand{\listoffiguresname}{插图目录} +\listoffigures +\newpage +\newcommand{\listoftablesname}{表格目录} +\listoftables \end{center} \ No newline at end of file diff --git a/report.cls b/report.cls index 2a8cd29..7605de5 100644 --- a/report.cls +++ b/report.cls @@ -20,460 +20,22 @@ \RequirePackage{graphbox} \RequirePackage{wrapfig} \RequirePackage{geometry} - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% hyperref settings -%% 超链接设定 -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \RequirePackage{hyperref} -\hypersetup{ - bookmarksnumbered, - colorlinks, - linkcolor={black}, - citecolor={black}, - urlcolor={black} -} -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% 图片设定 -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\graphicspath{{./figs/}{./figure/}{./figures/}{./image/}{./images/}{./graphics/}{./graphic/}{./pictures/}{./picture/}} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% 页面设定 -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -\geometry{ - textwidth=138mm, - textheight=215mm, - left=27mm, - %% or - %% inner=23mm, - right=27mm, - %% or - %% outer=18mm, - top=25.4mm, bottom=25.4mm, - headheight=2.17cm, - headsep=4mm, - footskip=12mm, - heightrounded, -} - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% fonts settings -%% 字体设定 -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -%% \usepackage{ebgaramond} - -%% 开明式:句末点号用占一个汉字宽度,标号和句内点号占半个汉字宽度 -%\punctstyle{kaiming} - -%\setmainfont{Minion Pro} -% \setmainfont{Myriad Pro} -% \setsansfont{Myriad Pro} -% \setmonofont{Courier Std} - -%设置英文字体 鸿蒙字体 -% \setmainfont[ -% Path=font/, -% BoldFont=Arvo-Bold.ttf, -% ItalicFont=Arvo-Italic.ttf, -% BoldItalicFont=Arvo-BoldItalic.ttf, -% ]{Arvo-Regular.ttf} -\setmainfont[ - Path=font/, - BoldFont=HarmonyOS_Sans_Bold.ttf, - ItalicFont=HarmonyOS_Sans_Regular_Italic.ttf, - BoldItalicFont=HarmonyOS_Sans_Bold_Italic.ttf, -]{HarmonyOS_Sans_Regular.ttf} -\setsansfont[ - Path=font/, - BoldFont=HarmonyOS_Sans_Bold.ttf, - ItalicFont=HarmonyOS_Sans_Regular_Italic.ttf, - BoldItalicFont=HarmonyOS_Sans_Bold_Italic.ttf, -]{HarmonyOS_Sans_Regular.ttf} -\setmonofont[ - Path=font/ -]{HarmonyOS_Sans_Regular.ttf} - -\setCJKmainfont[ - Path=font/, - BoldFont=fangzhengxiaobiaosong_GBK.TTF, - ItalicFont=fangzhengkaiti_GBK.TTF, - BoldItalicFont=fangzhengfangsong_GBK.TTF, - ]{fangzhengshusong_GBK.TTF} -\setCJKsansfont[ - Path=font/, - BoldFont=HarmonyOS_Sans_SC_Bold.ttf, - ItalicFont=HarmonyOS_Sans_SC_Light.ttf, - BoldItalicFont=HarmonyOS_Sans_SC_Black.ttf, -]{HarmonyOS_Sans_SC_Regular.ttf} -\setCJKmonofont[ - Path=font/ -]{fangzhengzhongdengxian_GBK.TTF} - -\XeTeXlinebreaklocale "zh" -\XeTeXlinebreakskip = 0pt plus 1pt - -%方正书宋 -\setCJKfamilyfont{fzss}[ - Path=font/ -]{fangzhengshusong_GBK.TTF} -\newcommand{\fzss}{\CJKfamily{fzss}} - -%方正小标宋 -\setCJKfamilyfont{fzxbs}[ - Path=font/ -]{fangzhengxiaobiaosong_GBK.TTF} -\newcommand{\fzxbs}{\CJKfamily{fzxbs}} - -%方正楷体 -\setCJKfamilyfont{fzkai}[ - Path=font/ -]{fangzhengkaiti_GBK.TTF} -\newcommand{\fzkai}{\CJKfamily{fzkai}} - -%方正仿宋 -\setCJKfamilyfont{fzfs}[ - Path=font/ -]{fangzhengfangsong_GBK.TTF} -\newcommand{\fzfs}{\CJKfamily{fzfs}} - -%方正中等线 -\setCJKfamilyfont{fzzdx}[ - Path=font/ -]{fangzhengzhongdengxian_GBK.TTF} -\newcommand{\fzzdx}{\CJKfamily{fzzdx}} - -%鸿蒙字体 -\setCJKfamilyfont{hm}[ - Path=font/, - BoldFont=HarmonyOS_Sans_SC_Bold.ttf, - ItalicFont=HarmonyOS_Sans_SC_Light.ttf, - BoldItalicFont=HarmonyOS_Sans_SC_Black.ttf, -]{HarmonyOS_Sans_SC_Regular.ttf} -\newcommand{\hm}{\CJKfamily{hm}} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% titlesec -%% 标题设定 -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -%% \renewcommand\abstractname{Summary} -%%\renewenvironment{abstract}{\noindent\rule{\textwidth}{.5pt}\\[2ex] \centering\begin{minipage}{.97\textwidth}{\zihao{-4}\sffamily\bfseries \centering{\abstractname}}\\} -%%{\par\noindent\end{minipage}\\[2ex] \rule{\textwidth}{.5pt}} - -\renewenvironment{abstract}{\noindent\rule{\textwidth}{.5pt}\\[2ex] \centering\begin{minipage}{.97\textwidth}\begin{center}{\zihao{-4}\sffamily\bfseries \abstractname} \\ \end{center}} - {\par\end{minipage}\\[2ex] \noindent\rule{\textwidth}{.5pt}} - -%% section -\titleformat{\section} -[hang] -{\sffamily} -{\centering\zihao{-3}\bfseries\thesection\enspace} -{1pt} -{\zihao{-3}\bfseries} - -%% subsection -\titleformat{\subsection} -[hang] -{\sffamily} -{\zihao{4}\bfseries\thesubsection\enspace} -{1pt} -{\zihao{4}\bfseries\filright} - -%% subsubsection -\titleformat{\subsubsection} -[hang] -{\sffamily} -{\zihao{-4}\bfseries\thesubsubsection\enspace} -{1pt} -{\zihao{-4}\bfseries\filright} - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% boxes -%% 信息框 -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -%% 带标题的文本框 -\newtcolorbox{titledbox}[1]{% - tikznode boxed title, - enhanced, - arc=3pt, - interior style={white}, - attach boxed title to top center = {yshift=-\tcboxedtitleheight/2}, - fonttitle=\hm, - colbacktitle=white,coltitle=black, - boxed title style={size=normal,colframe=white,boxrule=0pt}, - boxrule=.5pt, - left=5pt, right=5pt, top=5pt, bottom=0pt, - boxsep=5pt, - title={#1}, - halign=left, - fontupper=\fzkai -} - -%% Note -\newtcolorbox{notebox}{% - enhanced, - arc=2pt, - boxrule=.5pt, - left=5pt, right=5pt, top=0pt, bottom=0pt, - boxsep=5pt, - colframe=NavyBlue, - colback=NavyBlue!5!White, - colbacktitle=NavyBlue!5!White, - coltext=NavyBlue, - title={\textcolor{NavyBlue}{\faStickyNoteO\hspace{.5em}\bfseries{\hm{笔记}}}}, - halign=left, - fontupper=\fzkai -} - -%% Important -\newtcolorbox{importantbox}{% - enhanced, - arc=2pt, - boxrule=.5pt, - left=5pt, right=5pt, top=0pt, bottom=0pt, - boxsep=5pt, - colframe=Orange, - colback=Orange!5!White, - colbacktitle=Orange!5!White, - coltext=Orange, - title={\textcolor{Orange}{\faExclamationCircle\hspace{.5em}\bfseries{\hm{重要}}}}, - halign=left, - fontupper=\fzkai -} - -%% verbatim 环境无法直接在新环境中使用 -%% 换用 \VerbatimEnvironment \begin{Verbatim} -\RequirePackage{fancyvrb} - -%% 命令行 -\newenvironment{shellbox} -{% - \VerbatimEnvironment - \begin{tcolorbox}[ - enhanced, - arc=2pt, - boxrule=.5pt, - left=5pt, right=5pt, top=0pt, bottom=0pt, - boxsep=5pt, - colframe=black, - colback=white, - coltext=black, - title={}, - fontupper=\linespread{1.2} - ]% - \begin{Verbatim} -} -{% - \end{Verbatim} - \end{tcolorbox} -} - -%% 命令行 -\newenvironment{invertedshellbox} -{% - \VerbatimEnvironment - \begin{tcolorbox}[ - enhanced, - arc=2pt, - boxrule=.5pt, - left=5pt, right=5pt, top=0pt, bottom=0pt, - boxsep=5pt, - colframe=black!70!white, - colback=black!70!white, - coltext=white, - title={}, - fontupper=\linespread{1.2} - ]% - \begin{Verbatim} -} -{% - \end{Verbatim} - \end{tcolorbox} -} - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% head and foot -%% 页眉页脚 -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\RequirePackage{indentfirst} +\RequirePackage[singlelinecheck=false]{caption} +\RequirePackage{titletoc} \RequirePackage{fancyhdr} \RequirePackage{zhnumber} +\RequirePackage{lastpage} -\pagestyle{fancy} -\fancyhf{} -\renewcommand\headrulewidth{.5pt} -\renewcommand\footrulewidth{0pt} -%\futurelet\TMPheadrule\def\headrule{{\color{violet}\TMPheadrule}} - -\renewcommand{\sectionmark}[1]{\markright{#1}} - -\fancyhead[C]{\fzkai{\rightmark}} -%\fancyhead[R]{\thepage} - -\fancyfoot[L]{\fzkai{\author}} -\fancyfoot[R]{\thepage} - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% code listings -%% 代码块设定 -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\RequirePackage{listings,verbatim} - -\definecolor{codecolorkeywords}{rgb}{0,0,1} -\definecolor{codecolorcomments}{rgb}{0,0.5,0} -\definecolor{codecolorxmlcomments}{rgb}{0.5,0.5,0.5} -\definecolor{codecolorstrings}{rgb}{0.64,0.08,0.08} -\definecolor{codecolortypes}{rgb}{0.17,0.57,0.68} - -\lstdefinelanguage{JavaScript}{ - keywords={do, if, in, for, let, new, try, var, case, else, enum, eval, null, this, true, void, with, await, break, catch, class, const, false, super, throw, while, yield, delete, export, import, public, return, static, switch, typeof, default, extends, finally, package, private, continue, debugger, function, arguments, interface, protected, implements, instanceof}, - sensitive=true, - comment=[l]{//}, - morecomment=[s]{/*}{*/}, - morestring=[b]', - morestring=[b]" -} - -\lstdefinelanguage{TypeScript}{ - keywords={abstract, break, case, catch, class, const, continue, debugger, default, delete, do, else, enum, export, extends, false, finally, for, function, if, import, in, instanceof, new, null, return, super, switch, this, throw, true, try, typeof, var, void, while, with, as, implements, interface, let, package, private, protected, public, static, yield, any, boolean, constructor, declare, get, module, require, number, set, string, symbol, type, from, of}, - sensitive=true, - comment=[l]{//}, - morecomment=[s]{/*}{*/}, - morestring=[b]', - morestring=[b]" -} - -\lstdefinelanguage{golang}{ - keywords={break, default, func, interface, select, case, defer, go, map, struct, chan, else, goto, package, switch, const, fallthrough, if, range, type, continue, for, import, return, var}, - sensitive=true, - comment=[l]{//}, - morecomment=[s]{/*}{*/}, - morestring=[b]', - morestring=[b]" -} - -\lstdefinestyle{mystyle}{ - % Basic design - basicstyle=\linespread{1.2}\ttfamily, - frame=tb, - framesep=5pt, - framerule=.5pt, - framexleftmargin=10pt, - rulecolor=\color{black}, - abovecaptionskip=0pt, - belowcaptionskip=5pt, - aboveskip=5pt, - backgroundcolor=\color{black!5!white}, - % Code design - keywordstyle=\color{codecolorkeywords}, - commentstyle=\color{codecolorcomments}, - stringstyle=\color{codecolorstrings}, - numberstyle=\small\color{gray}, - breakatwhitespace=false, - breaklines=true, - captionpos=t, - keepspaces=true, - % Line numbers - numbers=none, - numbersep=15pt, - xleftmargin=10pt, - stepnumber=1, - firstnumber=1, - numberfirstline=true, - % Code - tabsize=4, - showspaces=false, - showstringspaces=false, - showtabs=false, - breaklines=true, -} -\lstset{style=mystyle} - -%% 命令行 -\lstdefinestyle{bashstyle}{ - backgroundcolor=\color{NavyBlue!10!white}, - basicstyle=\linespread{1.2}\ttfamily, - keepspaces=true, - numbers=none, - numbersep=10pt, - frame=l, - framerule=2pt, - framesep=5pt, - framexleftmargin=3pt, - framextopmargin=-5pt, - xleftmargin=10pt, - rulecolor=\color{NavyBlue}, - % Code - tabsize=4, - showspaces=false, - showstringspaces=false, - showtabs=false, - breaklines=true, -} - -%% 命令行输出 -\lstdefinestyle{bashoutputstyle}{ - backgroundcolor=\color{black!10!white}, - basicstyle=\linespread{1.2}\ttfamily, - keepspaces=true, - numbers=none, - numbersep=10pt, - frame=l, - framerule=2pt, - framesep=5pt, - framexleftmargin=3pt, - framextopmargin=-5pt, - xleftmargin=10pt, - rulecolor=\color{black!70!white}, - % Code - tabsize=4, - showspaces=false, - showstringspaces=false, - showtabs=false, - breaklines=true, -} - -%% 代码列表标题 -\RequirePackage{caption} -\DeclareCaptionFormat{codecaptionformat}{% - %%\colorbox{black!20}{ - %% \parbox{\textwidth}{#1#2\ttfamily#3} - %%} - \parbox{\textwidth}{\textcolor{violet}\faCode~\textcolor{violet}{#1#2}\hspace{.5em}\fzkai#3} -} -\captionsetup[lstlisting]{format=codecaptionformat} - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% Chinese names -%% 中文名称 -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\renewcommand{\figurename}{图} -\renewcommand{\tablename}{表} -\renewcommand{\lstlistingname}{代码} -\renewcommand{\abstractname}{摘要} - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% global settings -%% 以下是全局格式设定 -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -%% 添加首行缩进,两个字符 -\RequirePackage{indentfirst} -\setlength{\parindent}{2em} - -%% 行距 -\linespread{1.5} - -%% 表格 -\RequirePackage[singlelinecheck=false]{caption} -\captionsetup[table]{belowskip=0pt,aboveskip=5pt} +%引入模块 +\input{cls/global.cls}%全局设定 +\input{cls/hyperref.cls}%超链接 +\input{cls/figs.cls}%图片 +\input{cls/geometry.cls}%页面布局 +\input{cls/font.cls}%字体 +\input{cls/title.cls}%标题 +\input{cls/boxes.cls}%信息框 +\input{cls/headandfoot.cls}%页眉页脚 +\input{cls/code.cls}%代码块 +\input{cls/chinesename.cls}%中文名称 \ No newline at end of file diff --git a/report.lof b/report.lof new file mode 100644 index 0000000..6bb1472 --- /dev/null +++ b/report.lof @@ -0,0 +1,2 @@ +\contentsline {figure}{\numberline {1}{\ignorespaces 这是一个示例图片\relax }}{7}{figure.caption.2}% +\contentsfinish diff --git a/report.lot b/report.lot new file mode 100644 index 0000000..61dc290 --- /dev/null +++ b/report.lot @@ -0,0 +1,2 @@ +\contentsline {table}{\numberline {1}{\ignorespaces 一个表格的实例\relax }}{6}{table.caption.1}% +\contentsfinish diff --git a/report.pdf b/report.pdf index b54487a..cd989e7 100644 Binary files a/report.pdf and b/report.pdf differ diff --git a/report.tex b/report.tex index a387ccf..8338508 100644 --- a/report.tex +++ b/report.tex @@ -18,10 +18,10 @@ \usepackage{fontawesome} \usepackage[justification=centering]{caption} \usepackage{draftwatermark}% 所有页加水印 +\usepackage{titletoc} - -\input{input/info} -\input{input/setting} +\input{input/info.tex} +\input{input/setting.tex} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -31,24 +31,12 @@ \sloppy % 解决中英文混排文字超出边界问题 -\input{input/cover} -\input{input/toc} +\input{input/cover.tex} +\input{input/toc.tex} +\input{input/abstract.tex} \newpage -\begin{center} - {\hm\bfseries \zihao{3} \themaintitle} -\end{center} - -\thispagestyle{empty} - -\begin{abstract} -这是一个很好用的Latex模板,经过不断的修改和迭代进化。这里,就介绍一下这个模板的使用方法,希望对你有所帮助。 - -\vspace{2ex} -\textbf{关键字:}Latex,\hspace{.5em}模板,\hspace{.5em}学习 -\end{abstract} - \section{准备工作} 在正式开始使用模板之前,需要你安装LiveTex,并安装任何可用的编辑器。 diff --git a/report.toc b/report.toc index 9a9dea5..d6d7e24 100644 --- a/report.toc +++ b/report.toc @@ -1,12 +1,13 @@ -\contentsline {section}{\numberline {1}准备工作}{2}{section.1}% -\contentsline {section}{\numberline {2}字体}{2}{section.2}% -\contentsline {section}{\numberline {3}标题}{2}{section.3}% -\contentsline {subsection}{\numberline {3.1}这里是二级标题}{3}{subsection.3.1}% -\contentsline {subsubsection}{\numberline {3.1.1}这里是三级标题}{3}{subsubsection.3.1.1}% -\contentsline {section}{\numberline {4}列表}{3}{section.4}% -\contentsline {subsection}{\numberline {4.1}无序列表}{3}{subsection.4.1}% -\contentsline {subsection}{\numberline {4.2}有序列表}{3}{subsection.4.2}% -\contentsline {section}{\numberline {5}图表信息}{4}{section.5}% -\contentsline {section}{\numberline {6}代码}{4}{section.6}% -\contentsline {section}{\numberline {7}文本框}{6}{section.7}% -\contentsline {section}{\numberline {8}图标}{6}{section.8}% +\contentsline {section}{\numberline {1}准备工作}{5}{section.1}% +\contentsline {section}{\numberline {2}字体}{5}{section.2}% +\contentsline {section}{\numberline {3}标题}{5}{section.3}% +\contentsline {subsection}{\numberline {3.1}这里是二级标题}{5}{subsection.3.1}% +\contentsline {subsubsection}{\numberline {3.1.1}这里是三级标题}{5}{subsubsection.3.1.1}% +\contentsline {section}{\numberline {4}列表}{5}{section.4}% +\contentsline {subsection}{\numberline {4.1}无序列表}{5}{subsection.4.1}% +\contentsline {subsection}{\numberline {4.2}有序列表}{6}{subsection.4.2}% +\contentsline {section}{\numberline {5}图表信息}{6}{section.5}% +\contentsline {section}{\numberline {6}代码}{7}{section.6}% +\contentsline {section}{\numberline {7}文本框}{8}{section.7}% +\contentsline {section}{\numberline {8}图标}{9}{section.8}% +\contentsfinish