diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..8ab318d --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,116 @@ +{ + "latex-workshop.latex.autoBuild.run": "onSave", + "latex-workshop.showContextMenu": true, + "latex-workshop.intellisense.package.enabled": true, + "latex-workshop.message.error.show": false, + "latex-workshop.message.warning.show": false, + "latex-workshop.latex.tools": [ + { + "name": "xelatex", + "command": "xelatex", + "args": [ + "-synctex=1", + "-interaction=nonstopmode", + "-file-line-error", + "%DOCFILE%" + ] + }, + { + "name": "pdflatex", + "command": "pdflatex", + "args": [ + "-synctex=1", + "-interaction=nonstopmode", + "-file-line-error", + "%DOCFILE%" + ] + }, + { + "name": "latexmk", + "command": "latexmk", + "args": [ + "-synctex=1", + "-interaction=nonstopmode", + "-file-line-error", + "-pdf", + "-outdir=%OUTDIR%", + "%DOCFILE%" + ] + }, + { + "name": "bibtex", + "command": "bibtex", + "args": [ + "%DOCFILE%" + ] + } + ], + "latex-workshop.latex.recipes": [ + { + "name": "XeLaTeX", + "tools": [ + "xelatex" + ] + }, + { + "name": "PDFLaTeX", + "tools": [ + "pdflatex" + ] + }, + { + "name": "BibTeX", + "tools": [ + "bibtex" + ] + }, + { + "name": "LaTeXmk", + "tools": [ + "latexmk" + ] + }, + { + "name": "xelatex -> bibtex -> xelatex*2", + "tools": [ + "xelatex", + "bibtex", + "xelatex", + "xelatex" + ] + }, + { + "name": "pdflatex -> bibtex -> pdflatex*2", + "tools": [ + "pdflatex", + "bibtex", + "pdflatex", + "pdflatex" + ] + }, + ], + "latex-workshop.latex.clean.fileTypes": [ + "*.aux", + "*.bbl", + "*.blg", + "*.idx", + "*.ind", + "*.lof", + "*.lot", + "*.out", + "*.toc", + "*.acn", + "*.acr", + "*.alg", + "*.glg", + "*.glo", + "*.gls", + "*.ist", + "*.fls", + "*.log", + "*.fdb_latexmk" + ], + "latex-workshop.latex.autoClean.run": "onFailed", + "latex-workshop.latex.recipe.default": "xelatex", + "latex-workshop.view.pdf.internal.synctex.keybinding": "double-click" +} \ No newline at end of file diff --git a/TestFile.pdf b/TestFile.pdf new file mode 100644 index 0000000..3e96ffc Binary files /dev/null and b/TestFile.pdf differ diff --git a/TestFile.tex b/TestFile.tex new file mode 100644 index 0000000..88fdd59 --- /dev/null +++ b/TestFile.tex @@ -0,0 +1,53 @@ +\documentclass[lang=cn,10pt]{elegantbook} +\begin{document} +\tableofcontents + +\chapter{这是我测试的第一个章节捏} +首先测试一下,能不能自定义一个环境吧~ + +\section{这是我测试的一个子章节} + +我将在这个子章节这里进行我书籍的自定义环境的测试 + +先来一个mightguy环境试一试\ref{pro:你好} + +\begin{proposition}\label{pro:你好} + duiduidui +\end{proposition} + +\begin{theorem} + Theorem +\end{theorem} + +\begin{lemma} + Lemma +\end{lemma} + +\begin{corollary} + Corollary +\end{corollary} +\begin{mightguy} + 首先请将上面那一条里面提到的自动清理中间文件的语句清除掉,保证你编译出来的报错信息能存下来。 + + LATEX的报错很奇葩,有时候它不会把报错信息输出到VSCODE的问题工作区里面,它只是单纯的无法编译出来结果然后P都不放一个,让人很烦,这时候我们就需要去.log文件里面搜索关键词error然后一个一个的找,看看包含这个单词的错误有多少,得到报错之后再一个一个的搜或者拿去问AI得到结果。 + + 需要注意的是,先改正比较靠前的报错在该正比较靠前的错误。因为LATEX在报错后并不会停止编译文件,而是直接把整个文档编译完了然后把所有的报错都集中起来。所以说有时候一个报错会因为在原文中反复出现而出现十几一二十次,你先把报错文件最开始出现的报错解决掉,后面的报错可能就连带解决了。 + + 如果你还是找不到问题所在的话,可以把你的项目压缩成一个压缩包然后把整个项目上传到OVERLEAF里面,首先这个网站的LATEX宏包非常非常的多,至少可以帮你规避掉一点没有安装某个宏包而引发的错误。其次这个网站在编译失败之后会把所有的失败文档分条归总起来,比一个一个的搜索要好很多。 + + 如果你找到了问题所在,最好的解决方法不是直接去原文里面直接进行改正。你也看到了,木叶之秋这本书很长,合计起来有一两万字,如果你一开始就在原文里面进行改正的话,有很大的概率导致报错结果过长而难以找到你改了之后引发的次生灾害。 + + 这时候就要把你的问题提炼出来,在另外一个分支里面写一个小项目进行改正(专注于某一个小BUG而写的这个项目其实也叫最小工作流程),在小项目里面解决掉这个问题之后再把解决方案汇总到木叶之秋这个大方案里面,这样才能高效地解决问题。 + + 最后也是最重?要的一步就是,把你遇到的问题写到这个文档里面。毕竟你写下来的话总过是要比放到你那个不太充裕的记忆宫殿里面要有效得多,而且还能拿出来帮助后面的同学们。 +\end{mightguy} + + +\customsf{bold}{你好} + +\customsf{normal}{你好} + +\begin{bluespace} + 真的假的? +\end{bluespace} +\end{document} \ No newline at end of file diff --git a/customclass.cls b/customclass.cls new file mode 100644 index 0000000..acf525e --- /dev/null +++ b/customclass.cls @@ -0,0 +1,158 @@ +\ProvidesClass{customclass}[2024/09/12 Custom Class] + +% Load the ctexart class +\LoadClass[UTF8]{ctexart} + +% 导入所需的包 +\RequirePackage{amsmath, amsthm, amssymb, amsfonts} +\RequirePackage{thmtools} +\RequirePackage{graphicx} +\RequirePackage{setspace} +\RequirePackage{geometry} +\RequirePackage{float} +\RequirePackage[english]{babel} +\RequirePackage{framed} +\RequirePackage[dvipsnames]{xcolor} +\RequirePackage[many]{tcolorbox} +\RequirePackage{xeCJK} +\RequirePackage{tikz} +\RequirePackage{indentfirst} +\RequirePackage{hyperref} +\RequirePackage{cleveref} +\RequirePackage{enumitem} +\RequirePackage{ifthen} +\RequirePackage{moresize} +\RequirePackage{graphicx} +\RequirePackage{pifont} + +% 设置颜色 +\definecolor{hashiramacolor}{RGB}{255,0,0} +\definecolor{tobiramacolor}{RGB}{169, 166, 171} +\definecolor{madaracolor}{RGB}{68, 89, 210} +\definecolor{mightguycolor}{RGB}{64, 111, 77} +\definecolor{talkcolor}{RGB}{34, 139, 34} +\definecolor{cqqcolor}{RGB}{252, 194, 0} +\definecolor{whitehatcolor}{RGB}{220,220,220} +\definecolor{bluespaceprojekt}{RGB}{100, 149, 237} +\definecolor{outsiderbackgroundcolor}{RGB}{50, 39, 27} +\definecolor{outsidertextcolor}{RGB}{245, 245, 220} + +% 自定义命令 +\newcommand{\customsf}[2]{% + \ifthenelse{\equal{#1}{bold}}{\textbf{\textsf{#2}}}{\textsf{#2}}% +} + +% 段落首行缩进 +\setlength{\parindent}{2em} + +% 设置一个自定义命令,被用于设置封面的字体划线 +\newcommand{\HRule}[1]{\rule{\linewidth}{#1}} + +% 将引用里面的section 更改为章节,免得出戏 +\crefname{section}{章节}{章节} + +% 设置默认文本框格式 +\tcbset{ + colframe=magenta, + colback=magenta!12!white, + boxed title style={colback=magenta}, + breakable, + enhanced, + sharp corners, + boxsep=1pt, + attach boxed title to top left={yshift=-\tcboxedtitleheight, yshifttext=-.75\baselineskip}, + boxed title style={boxsep=1pt,sharp corners}, + fonttitle=\bfseries\sffamily, + drop lifted shadow +} + +% 定义一个新的计数器 +\newcounter{mytcbcounter}[section] +\renewcommand{\themytcbcounter}{\thesection.\arabic{mytcbcounter}} + +\newcommand{\customtcolorbox}[4][]{% + \newtcolorbox[use counter=mytcbcounter, number within=section, number format=\arabic,#1]{#2}[1][]{ + title={#3~\themytcbcounter}, + colframe=#4, + colback=#4!12!white, + boxed title style={colback=#4}, + overlay unbroken and first={ + \node[below right,font=\small,color=#4,text width=.8\linewidth] + at (title.north east) {##1}; + }, + fontupper=\color{black}, + before skip=8pt, + after skip=8pt, + before upper={\parindent=2em} + } +} + +% 使用通用命令创建不同的 tcolorbox 环境 +\customtcolorbox{madara}{宇智波斑}{madaracolor} +\customtcolorbox{outsider}{界外魔}{outsiderbackgroundcolor} +\customtcolorbox{justtalk}{火影新编}{talkcolor} +\customtcolorbox{hashirama}{千手柱间}{hashiramacolor} +\customtcolorbox{tobirama}{千手扉间}{tobiramacolor} +\customtcolorbox{mightguy}{迈特凯}{mightguycolor} +\customtcolorbox{cqq}{CQQ}{cqqcolor} +\customtcolorbox{whitehat}{白帽}{whitehatcolor} + +\newtcolorbox{remark}[1][]{ + title={\scalebox{1.75}{\raisebox{-.25ex}{\ding{43}}}~Remark}, + colframe=yellow!45!white, + colback=yellow!45!white, + coltitle=Red, + fontupper=\sffamily, + boxed title style={colback=yellow!45!white}, + boxed title style={boxsep=1ex,sharp corners},%% + overlay unbroken and first={ + \node[below right,font=\normalsize,color=red,text width=.8\linewidth] + at (title.north east) {#1}; + } +} + +\newtcolorbox{note}[1][]{ + title={\scalebox{1.75}{\raisebox{-0.1ex}{\ding{45}}}~Note}, + colframe=yellow!45!white, + colback=yellow!45!white, + coltitle=Red, + fonttitle=\bfseries\sffamily, + % fontupper=\frfamily, + boxed title style={colback=yellow!45!white}, + boxed title style={boxsep=1ex,sharp corners},%% + overlay unbroken and first={ + \node[below right,font=\normalsize,color=red,text width=.8\linewidth] + at (title.north east) {#1}; + } +} + +\newtcolorbox[auto counter, number within=section]{bluespace}[1][]{ + reset, % 这一句话可以重置掉所有的预设 + title={\kaishu\scalebox{1.75}{\ding{99} \ding{99} 蓝色空间号 + \ding{99} \ding{99}}}, % 设置标题样式 + colframe=bluespaceprojekt, % 设置边框颜色 + colback=bluespaceprojekt!12!white, % 设置背景颜色 + coltitle=white, % 设置标题颜色 + fontupper=\heiti, % 设置正文字体 + boxed title style={colback=bluespaceprojekt!12!white}, % 设置标题框样式 + boxed title style={boxsep=1ex,sharp corners}, % 设置标题框的边框间距和直角边框 + % overlay unbroken and first={ + % \node[below right,font=\normalsize,color=red,text width=.8\linewidth] + % at (title.north east) {#1}; % 在标题右上角显示自定义文本 + % }, + halign title=center, % 标题居中 + before upper={\parindent=2em} % 设置首行缩进 +} + +% 设置文字行距,免得过于拥挤 +\setstretch{1.2} + +% 设置文字占用页面比例,免得页面过空 +\geometry{ + textwidth=5.5in, + top=1in, + bottom=0.7in, + headheight=12pt, + headsep=25pt, + footskip=30pt +} diff --git a/elegantbook-cn.tex b/elegantbook-cn.tex index e289e77..8cc4344 100644 --- a/elegantbook-cn.tex +++ b/elegantbook-cn.tex @@ -70,7 +70,7 @@ \subsection{本地免安装使用} \subsection{发行版安装与更新} -本模板测试环境为 +本模板测试环境为 \begin{enumerate} \item Win10 + \TeX{} Live 2022; \item Ubuntu 20.04 + \TeX{} Live 2022; @@ -110,7 +110,7 @@ \section{语言模式} \begin{itemize} \item 由 \href{https://github.com/VincentMVV}{VincentMVV} 提供的意大利语翻译 \lstinline{lang=it},相关讨论见 \href{https://github.com/ElegantLaTeX/ElegantBook/issues/85}{Italian translation}; \item 由 \href{https://github.com/abfek66}{abfek66} 提供的法语翻译 \lstinline{lang=fr},相关讨论见 \href{https://github.com/ElegantLaTeX/ElegantBook/issues/85}{Italian translation}; - % \item 由 \href{https://github.com/stultus}{stultus} 提供的马拉雅拉姆语翻译 \lstinline{lang=},相关讨论见 \href{https://github.com/ElegantLaTeX/ElegantBook/issues/90}{Malayalam translation}; + % \item 由 \href{https://github.com/stultus}{stultus} 提供的马拉雅拉姆语翻译 \lstinline{lang=},相关讨论见 \href{https://github.com/ElegantLaTeX/ElegantBook/issues/90}{Malayalam translation}; \item 由 \href{https://github.com/inktvis75}{inktvis75} 提供的荷兰语翻译 \lstinline{lang=nl},相关讨论见 \href{https://github.com/ElegantLaTeX/ElegantBook/issues/108}{Dutch Translation}; \item 由 \href{https://github.com/palkotamas}{palkotamas} 提供的匈牙利语翻译 \lstinline{lang=hu},相关讨论见 \href{https://github.com/ElegantLaTeX/ElegantBook/issues/111}{Hungarian translation}; \item 由 Lisa 提供的德语翻译 \lstinline{lang=de},相关讨论见 \href{https://github.com/ElegantLaTeX/ElegantBook/issues/113}{Deutsch translation}; @@ -122,7 +122,7 @@ \section{语言模式} \begin{remark} -以上各个语言的设定均为网友设定,我们未对上述翻译进行过校对,如果有问题,请在对应的 issue 下评论。并且,只有中文环境(\lstinline{lang=cn})才可以输入中文。 + 以上各个语言的设定均为网友设定,我们未对上述翻译进行过校对,如果有问题,请在对应的 issue 下评论。并且,只有中文环境(\lstinline{lang=cn})才可以输入中文。 \end{remark} \section{设备选项} @@ -134,7 +134,7 @@ \section{设备选项} \section{颜色主题} -本模板内置 5 组颜色主题,分别为 \textcolor{structure1}{\lstinline{green}}\footnote{为原先默认主题。}、\textcolor{structure2}{\lstinline{cyan}}、\textcolor{structure3}{\lstinline{blue}}(默认)、\textcolor{structure4}{\lstinline{gray}}、\textcolor{structure5}{\lstinline{black}}。另外还有一个自定义的选项 \lstinline{nocolor}。调用颜色主题 \lstinline{green} 的方法为 +本模板内置 5 组颜色主题,分别为 \textcolor{structure1}{\lstinline{green}}\footnote{为原先默认主题。}、\textcolor{structure2}{\lstinline{cyan}}、\textcolor{structure3}{\lstinline{blue}}(默认)、\textcolor{structure4}{\lstinline{gray}}、\textcolor{structure5}{\lstinline{black}}。另外还有一个自定义的选项 \lstinline{nocolor}。调用颜色主题 \lstinline{green} 的方法为 \begin{lstlisting} \documentclass[green]{elegantbook} %or \documentclass[color=green]{elegantbook} @@ -145,39 +145,39 @@ \section{颜色主题} \caption{ElegantBook 模板中的颜色主题\label{tab:color thm}} \centering \begin{tabular}{ccccccc} - \toprule - & \textcolor{structure1}{green} - & \textcolor{structure2}{cyan} - & \textcolor{structure3}{blue} - & \textcolor{structure4}{gray} - & \textcolor{structure5}{black} - & 主要使用的环境\\ - \midrule + \toprule + & \textcolor{structure1}{green} + & \textcolor{structure2}{cyan} + & \textcolor{structure3}{blue} + & \textcolor{structure4}{gray} + & \textcolor{structure5}{black} + & 主要使用的环境 \\ + \midrule structure & \ccr{structure1} - & \ccr{structure2} - & \ccr{structure3} - & \ccr{structure4} - & \ccr{structure5} - & chapter \ section \ subsection \\ + & \ccr{structure2} + & \ccr{structure3} + & \ccr{structure4} + & \ccr{structure5} + & chapter \ section \ subsection \\ main & \ccr{main1} - & \ccr{main2} - & \ccr{main3} - & \ccr{main4} - & \ccr{main5} - & definition \ exercise \ problem \\ + & \ccr{main2} + & \ccr{main3} + & \ccr{main4} + & \ccr{main5} + & definition \ exercise \ problem \\ second & \ccr{second1} - & \ccr{second2} - & \ccr{second3} - & \ccr{second4} - & \ccr{second5} - & theorem \ lemma \ corollary\\ + & \ccr{second2} + & \ccr{second3} + & \ccr{second4} + & \ccr{second5} + & theorem \ lemma \ corollary \\ third & \ccr{third1} - & \ccr{third2} - & \ccr{third3} - & \ccr{third4} - & \ccr{third5} - & proposition\\ - \bottomrule + & \ccr{third2} + & \ccr{third3} + & \ccr{third4} + & \ccr{third5} + & proposition \\ + \bottomrule \end{tabular} \end{table} @@ -200,16 +200,16 @@ \subsection{封面个性化} \caption{封面元素信息} \begin{tabular}{p{0.07\textwidth}p{0.15\textwidth}|p{0.07\textwidth}p{0.15\textwidth}|p{0.07\textwidth}p{0.15\textwidth}} \hline - 信息 & 命令 & 信息 & 命令 & 信息 & 命令 \\ + 信息 & 命令 & 信息 & 命令 & 信息 & 命令 \\ \hline - 标题 & \lstinline|\title| & 副标题 & \lstinline|\subtitle| & 作者 & \lstinline|\author| \\ - 机构 & \lstinline|\institute| & 日期 & \lstinline|\date| & 版本 & \lstinline|\version| \\ - 箴言 & \lstinline|\extrainfo| & 封面图 & \lstinline|\cover| & 徽标 & \lstinline|\logo| \\ + 标题 & \lstinline|\title| & 副标题 & \lstinline|\subtitle| & 作者 & \lstinline|\author| \\ + 机构 & \lstinline|\institute| & 日期 & \lstinline|\date| & 版本 & \lstinline|\version| \\ + 箴言 & \lstinline|\extrainfo| & 封面图 & \lstinline|\cover| & 徽标 & \lstinline|\logo| \\ \hline \end{tabular} \end{table} -另外,额外增加一个 \lstinline{\bioinfo} 命令,有两个选项,分别是信息标题以及信息内容。比如需要显示{\kaishu User Name:111520},则可以使用 +另外,额外增加一个 \lstinline{\bioinfo} 命令,有两个选项,分别是信息标题以及信息内容。比如需要显示{\kaishu User Name:111520},则可以使用 \begin{lstlisting} \bioinfo{User Name}{115520} \end{lstlisting} @@ -258,11 +258,11 @@ \section{数学环境简介} \begin{itemize} \item \textit{定理类环境},包含标题和内容两部分,全部定理类环境的编号均以章节编号。根据格式的不同分为 3 种 - \begin{itemize} - \item \textcolor{main}{\textbf{definition}} 环境,颜色为 \textcolor{main}{main}; - \item \textcolor{second}{\textbf{theorem、lemma、corollary、axiom、postulate}} 环境,颜色为 \textcolor{second} {second}; - \item \textcolor{third}{\textbf{proposition}} 环境,颜色为 \textcolor{third}{third}。 - \end{itemize} + \begin{itemize} + \item \textcolor{main}{\textbf{definition}} 环境,颜色为 \textcolor{main}{main}; + \item \textcolor{second}{\textbf{theorem、lemma、corollary、axiom、postulate}} 环境,颜色为 \textcolor{second} {second}; + \item \textcolor{third}{\textbf{proposition}} 环境,颜色为 \textcolor{third}{third}。 + \end{itemize} \item \textit{示例类环境},有 \textbf{example、problem、exercise} 环境(对应于例、例题、练习),自动编号,编号以章节为单位,其中 \textbf{exercise} 有提示符。 \item \textit{提示类环境},有 \textbf{note} 环境,特点是:无编号,有引导符。 \item \textit{结论类环境},有 \textbf{conclusion、assumption、property、remark、solution} 环境\footnote{本模板还添加了一个 \lstinline|result| 选项,用于隐藏 \lstinline{solution} 和 \lstinline{proof} 环境,默认为显示(\lstinline{result=answer}),隐藏使用 \lstinline{result=noanswer}。},三者均以粗体的引导词为开头,和普通段落格式一致。 @@ -323,19 +323,19 @@ \subsubsection{\texttt{fancy} 模式} \begin{table}[htbp] \centering \caption{定理类环境} - \begin{tabular}{llll} + \begin{tabular}{llll} \toprule - 环境名 & 标签名 & 前缀 & 交叉引用 \\ + 环境名 & 标签名 & 前缀 & 交叉引用 \\ \midrule - definition & label & def & \lstinline|\ref{def:label}| \\ - theorem & label & thm & \lstinline|\ref{thm:label}| \\ - postulate & label & pos & \lstinline|\ref{pos:label}| \\ - axiom & label & axi & \lstinline|\ref{axi:label}|\\ - lemma & label & lem & \lstinline|\ref{lem:label}| \\ - corollary & label & cor & \lstinline|\ref{cor:label}| \\ - proposition & label & pro & \lstinline|\ref{pro:label}| \\ + definition & label & def & \lstinline|\ref{def:label}| \\ + theorem & label & thm & \lstinline|\ref{thm:label}| \\ + postulate & label & pos & \lstinline|\ref{pos:label}| \\ + axiom & label & axi & \lstinline|\ref{axi:label}| \\ + lemma & label & lem & \lstinline|\ref{lem:label}| \\ + corollary & label & cor & \lstinline|\ref{cor:label}| \\ + proposition & label & pro & \lstinline|\ref{pro:label}| \\ \bottomrule - \end{tabular}% + \end{tabular}% \label{tab:theorem-class}% \end{table}% @@ -459,9 +459,9 @@ \subsection{自定义定理类环境} \begin{itemize} \item 在炫彩模式(\lstinline{fancy})下,需要 5 个参数来定义一个新的定理类环境,分别是: - 定理类环境名,定理类环境的标题,定理类环境的样式,该定理类环境的前缀,(可选)该定理类环境继承的定理类环境: + 定理类环境名,定理类环境的标题,定理类环境的样式,该定理类环境的前缀,(可选)该定理类环境继承的定理类环境: -\begin{lstlisting} + \begin{lstlisting} % 导言区 \elegantnewtheorem{examplefancy}{自定义定理类环境}{thmstyle}{exfancy} % 正文 @@ -473,8 +473,8 @@ \subsection{自定义定理类环境} \end{examplefancy*} \end{lstlisting} - 如果不给出第四个参数,或第四个参数置空的话,将会用定理类环境名来作为默认前缀,即 -\begin{lstlisting} + 如果不给出第四个参数,或第四个参数置空的话,将会用定理类环境名来作为默认前缀,即 + \begin{lstlisting} % 导言区 \elegantnewtheorem{test}{TEST}{thmstyle} % 或 @@ -486,9 +486,9 @@ \subsection{自定义定理类环境} \end{test} \end{lstlisting} -这时会在终端以及 \verb|.log| 文件中输出一个警告信息来提示用户没有定义前缀: + 这时会在终端以及 \verb|.log| 文件中输出一个警告信息来提示用户没有定义前缀: -\begin{lstlisting}[language=bash] + \begin{lstlisting}[language=bash] Class elegantbook Warning: Because you didn't provide a prefix. (elegantbook) We use test as the default prefix. (elegantbook) You have to use @@ -498,8 +498,8 @@ \subsection{自定义定理类环境} \end{lstlisting} \item 在简单模式(\lstinline{simple})下,需要 4 个参数来定义一个新的定理类环境,分别是: - 定理类环境名,定理类环境的标题,定理类环境的样式,该定理类环境的前缀,(可选)该定理类环境继承的定理类环境: -\begin{lstlisting} + 定理类环境名,定理类环境的标题,定理类环境的样式,该定理类环境的前缀,(可选)该定理类环境继承的定理类环境: + \begin{lstlisting} % 导言区 \elegantnewtheorem{examplesimple}{自定义定理类环境}{thmstyle} % 正文 @@ -511,8 +511,8 @@ \subsection{自定义定理类环境} \end{examplesimple*} \end{lstlisting} - 如果此时错误地给出了第四个参数,那么将会在终端以及 \verb|.log| 文件中输出一个错误信息: -\begin{lstlisting} + 如果此时错误地给出了第四个参数,那么将会在终端以及 \verb|.log| 文件中输出一个错误信息: + \begin{lstlisting} % elegantbook-cn.tex \elegantnewtheorem{test}{TEST}{thmstyle}{} % .log file @@ -546,28 +546,28 @@ \section{列表环境} \begin{itemize} \item first item of nesti; \item second item of nesti; - \begin{itemize} - \item first item of nestii; - \item second item of nestii; - \begin{itemize} - \item first item of nestiii; - \item second item of nestiii. - \end{itemize} - \end{itemize} + \begin{itemize} + \item first item of nestii; + \item second item of nestii; + \begin{itemize} + \item first item of nestiii; + \item second item of nestiii. + \end{itemize} + \end{itemize} \end{itemize} \end{minipage} \begin{minipage}[b]{0.49\textwidth} \begin{enumerate} \item first item of nesti; \item second item of nesti; - \begin{enumerate} - \item first item of nestii; - \item second item of nestii; - \begin{enumerate} - \item first item of nestiii; - \item second item of nestiii. - \end{enumerate} - \end{enumerate} + \begin{enumerate} + \item first item of nestii; + \item second item of nestii; + \begin{enumerate} + \item first item of nestiii; + \item second item of nestiii. + \end{enumerate} + \end{enumerate} \end{enumerate} \end{minipage} @@ -619,7 +619,7 @@ \subsection{修改文献格式} \section{添加序章} -如果你想在第一章前面添序章,不改变原本章节序号,可以在第一章内容前面使用 +如果你想在第一章前面添序章,不改变原本章节序号,可以在第一章内容前面使用 \begin{lstlisting} \chapter*{Introduction} \markboth{Introduction}{Introduction} @@ -691,11 +691,11 @@ \section{章后习题} \end{problemset} \begin{remark} -如果你想把 \lstinline{problemset} 环境的标题改为其他文字,你可以类似于 introduction 环境修改 problemset 的可选参数。另外,目前这个环境会自动出现在目录中,但是不会出现在页眉页脚信息中(待解决)。 + 如果你想把 \lstinline{problemset} 环境的标题改为其他文字,你可以类似于 introduction 环境修改 problemset 的可选参数。另外,目前这个环境会自动出现在目录中,但是不会出现在页眉页脚信息中(待解决)。 \end{remark} \begin{solution} -如果你想把 \lstinline{problemset} 环境的标题改为其他文字,你可以类似于 introduction 环境修改 problemset 的可选参数。另外,目前这个环境会自动出现在目录中,但是不会出现在页眉页脚信息中(待解决)。 + 如果你想把 \lstinline{problemset} 环境的标题改为其他文字,你可以类似于 introduction 环境修改 problemset 的可选参数。另外,目前这个环境会自动出现在目录中,但是不会出现在页眉页脚信息中(待解决)。 \end{solution} \section{旁注} @@ -703,9 +703,9 @@ \section{旁注} 在 3.08 版本中,我们引入了 旁注设置选项 \lstinline{marginpar=margintrue} 以及测试命令 \lstinline{\elegantpar} ,但是由此带来一堆问题。我们决定在 3.09 版本中将其删除,并且,在旁注命令得到大幅度优化之前,不会将此命令再次引入书籍模板中。对此造成各位用户的不方便,非常抱歉!不过我们保留了 \lstinline{marginpar} 这个选项,你可以使用 \lstinline{marginpar=margintrue} 获得保留右侧旁注的版面设计。然后使用系统自带的 \lstinline{\marginpar} 或者 \lstinline{marginnote} 宏包的 \lstinline{\marginnote} 命令。 \begin{remark} -在使用旁注的时候,需要注意的是,文本和公式可以直接在旁注中使用。 + 在使用旁注的时候,需要注意的是,文本和公式可以直接在旁注中使用。 -\begin{lstlisting} + \begin{lstlisting} % text \marginpar{margin paragraph text} @@ -717,9 +717,9 @@ \section{旁注} } \end{lstlisting} -但是浮动体(表格、图片)需要注意,不能用浮动体环境,需要使用直接插图命令或者表格命令环境。然后使用 \lstinline{\captionof} 为其设置标题。为了得到居中的图表,可以使用 \lstinline{\centerline} 命令或者 \lstinline{center} 环境。更多详情请参考:\href{https://tex.stackexchange.com/questions/5583/caption-of-figure-in-marginpar-and-caption-of-wrapfigure-in-margin}{Caption of Figure in Marginpar}。 + 但是浮动体(表格、图片)需要注意,不能用浮动体环境,需要使用直接插图命令或者表格命令环境。然后使用 \lstinline{\captionof} 为其设置标题。为了得到居中的图表,可以使用 \lstinline{\centerline} 命令或者 \lstinline{center} 环境。更多详情请参考:\href{https://tex.stackexchange.com/questions/5583/caption-of-figure-in-marginpar-and-caption-of-wrapfigure-in-margin}{Caption of Figure in Marginpar}。 -\begin{lstlisting} + \begin{lstlisting} % graph with centerline command \marginpar{ \centerline{ @@ -799,17 +799,17 @@ \subsection{宏包冲突} \section{中文字体选项} 模板从 3.10 版本提供中文字体选项 \lstinline{chinesefont},可选项有 \begin{enumerate} -\item \lstinline{ctexfont}:默认选项,使用 \lstinline{ctex} 宏包根据系统自行选择字体,可能存在字体缺失的问题,更多内容参考 \lstinline{ctex} 宏包\href{https://ctan.org/pkg/ctex}{官方文档}\footnote{可以使用命令提示符,输入 \lstinline{texdoc ctex} 调出本地 \lstinline{ctex} 宏包文档}。 -\item \lstinline{founder}:方正字体选项(\textbf{需要安装方正字体}),后台调用 \lstinline{ctex} 宏包并且使用 \lstinline{fontset=none} 选项,然后设置字体为方正四款免费字体,方正字体下载注意事项见后文,用户只需要安装方正字体即可使用该选项。 -\item \lstinline{nofont}:后台会调用 \lstinline{ctex} 宏包并且使用 \lstinline{fontset=none} 选项,不设定中文字体,用户可以自行设置中文字体,具体见后文。 + \item \lstinline{ctexfont}:默认选项,使用 \lstinline{ctex} 宏包根据系统自行选择字体,可能存在字体缺失的问题,更多内容参考 \lstinline{ctex} 宏包\href{https://ctan.org/pkg/ctex}{官方文档}\footnote{可以使用命令提示符,输入 \lstinline{texdoc ctex} 调出本地 \lstinline{ctex} 宏包文档}。 + \item \lstinline{founder}:方正字体选项(\textbf{需要安装方正字体}),后台调用 \lstinline{ctex} 宏包并且使用 \lstinline{fontset=none} 选项,然后设置字体为方正四款免费字体,方正字体下载注意事项见后文,用户只需要安装方正字体即可使用该选项。 + \item \lstinline{nofont}:后台会调用 \lstinline{ctex} 宏包并且使用 \lstinline{fontset=none} 选项,不设定中文字体,用户可以自行设置中文字体,具体见后文。 \end{enumerate} \subsection{方正字体选项} 由于使用 \lstinline{ctex} 宏包默认调用系统已有的字体,部分系统字体缺失严重,因此,用户希望能够使用其它字体,我们推荐使用方正字体。方正的{\songti 方正书宋}、{\heiti 方正黑体}、{\kaishu 方正楷体}、{\fangsong 方正仿宋}四款字体均可免费试用,且可用于商业用途。用户可以自行从\href{http://www.foundertype.com/}{方正字体官网}下载此四款字体,在下载的时候请\textbf{务必}注意选择 GBK 字符集,也可以使用 \href{https://www.latexstudio.net/}{\LaTeX{} 工作室}提供的\href{https://pan.baidu.com/s/1BgbQM7LoinY7m8yeP25Y7Q}{方正字体,提取码为:njy9} 进行安装。安装时,{\kaishu Win 10 用户请右键选择为全部用户安装,否则会找不到字体。} \begin{figure}[!htb] -\centering -\includegraphics[width=0.9\textwidth]{founder.png} + \centering + \includegraphics[width=0.9\textwidth]{founder.png} \end{figure} \subsection{其他中文字体} @@ -849,19 +849,19 @@ \subsection{积分的定义} 我们将通过三个步骤定义可测函数的积分。首先定义非负简单函数的积分。以下设 $E$ 是 $\mathcal{R}^n$ 中的可测集。 -\begin{definition}[可积性] \label{def:int} -设 $ f(x)=\sum\limits_{i=1}^{k} a_i \chi_{A_i}(x)$ 是 $E$ 上的\textbf{非负简单函数},中文其中 $\{A_1,A_2,\ldots,A_k\}$ 是 $E$ 上的一个可测分割,$a_1,a_2,\ldots,a_k$ 是非负实数。定义 $f$ 在 $E$ 上的积分为 $\int_{a}^b f(x)$ -\begin{equation} - \label{inter} - \int_{E} f dx = \sum_{i=1}^k a_i m(A_i) \pi \alpha\beta\sigma\gamma\nu\xi\epsilon\varepsilon. \oint_{a}^b\ointop_{a}^b\prod_{i=1}^n -\end{equation} -一般情况下 $0 \leq \int_{E} f dx \leq \infty$。若 $\int_{E} f dx < \infty$,则称 $f$ 在 $E$ 上可积。 +\begin{definition}[可积性] \label{def:int} + 设 $ f(x)=\sum\limits_{i=1}^{k} a_i \chi_{A_i}(x)$ 是 $E$ 上的\textbf{非负简单函数},中文其中 $\{A_1,A_2,\ldots,A_k\}$ 是 $E$ 上的一个可测分割,$a_1,a_2,\ldots,a_k$ 是非负实数。定义 $f$ 在 $E$ 上的积分为 $\int_{a}^b f(x)$ + \begin{equation} + \label{inter} + \int_{E} f dx = \sum_{i=1}^k a_i m(A_i) \pi \alpha\beta\sigma\gamma\nu\xi\epsilon\varepsilon. \oint_{a}^b\ointop_{a}^b\prod_{i=1}^n + \end{equation} + 一般情况下 $0 \leq \int_{E} f dx \leq \infty$。若 $\int_{E} f dx < \infty$,则称 $f$ 在 $E$ 上可积。 \end{definition} 一个自然的问题是,Lebesgue 积分与我们所熟悉的 Riemann 积分有什么联系和区别?在 4.4 在我们将详细讨论 Riemann 积分与 Lebesgue 积分的关系。这里只看一个简单的例子。设 $D(x)$ 是区间 $[0,1]$ 上的 Dirichlet 函数。即 $D(x)=\chi_{Q_0}(x)$,其中 $Q_0$ 表示 $[0,1]$ 中的有理数的全体。根据非负简单函数积分的定义,$D(x)$ 在 $[0,1]$ 上的 Lebesgue 积分为 \begin{equation} - \label{inter2} - \int_0^1 D(x)dx = \int_0^1 \chi_{Q_0} (x) dx = m(Q_0) = 0 + \label{inter2} + \int_0^1 D(x)dx = \int_0^1 \chi_{Q_0} (x) dx = m(Q_0) = 0 \end{equation} 即 $D(x)$ 在 $[0,1]$ 上是 Lebesgue 可积的并且积分值为零。但 $D(x)$ 在 $[0,1]$ 上不是 Riemann 可积的。 @@ -869,40 +869,40 @@ \subsection{积分的定义} 有界变差函数是与单调函数有密切联系的一类函数。有界变差函数可以表示为两个单调递增函数之差。与单调函数一样,有界变差函数几乎处处可导。与单调函数不同,有界变差函数类对线性运算是封闭的,它们构成一线空间。练习题 \ref{exer:43} 是一个性质的证明。 \begin{exercise}\label{exer:43} -设 $f \notin\in L(\mathcal{R}^1)$,$g$ 是 $\mathcal{R}^1$ 上的有界可测函数。证明函数 -\begin{equation} - \label{ex:1} - I(t) = \int_{\mathcal{R}^1} f(x+t)g(x)dx \quad t \in \mathcal{R}^1 -\end{equation} -是 $\mathcal{R}^1$ 上的连续函数。 + 设 $f \notin\in L(\mathcal{R}^1)$,$g$ 是 $\mathcal{R}^1$ 上的有界可测函数。证明函数 + \begin{equation} + \label{ex:1} + I(t) = \int_{\mathcal{R}^1} f(x+t)g(x)dx \quad t \in \mathcal{R}^1 + \end{equation} + 是 $\mathcal{R}^1$ 上的连续函数。 \end{exercise} \begin{solution} -即 $D(x)$ 在 $[0,1]$ 上是 Lebesgue 可积的并且积分值为零。但 $D(x)$ 在 $[0,1]$ 上不是 Riemann 可积的。 + 即 $D(x)$ 在 $[0,1]$ 上是 Lebesgue 可积的并且积分值为零。但 $D(x)$ 在 $[0,1]$ 上不是 Riemann 可积的。 \end{solution} \begin{proof} -即 $D(x)$ 在 $[0,1]$ 上是 Lebesgue 可积的并且积分值为零。但 $D(x)$ 在 $[0,1]$ 上不是 Riemann 可积的。 + 即 $D(x)$ 在 $[0,1]$ 上是 Lebesgue 可积的并且积分值为零。但 $D(x)$ 在 $[0,1]$ 上不是 Riemann 可积的。 \end{proof} -\begin{theorem}[Fubini 定理] \label{thm:fubi} -(1)若 $f(x,y)$ 是 $\mathcal{R}^p\times\mathcal{R}^q$ 上的非负可测函数,则对几乎处处的 $x\in \mathcal{R}^p$,$f(x,y)$ 作为 $y$ 的函数是 $\mathcal{R}^q$ 上的非负可测函数,$g(x)=\int_{\mathcal{R}^q}f(x,y) dy$ 是 $\mathcal{R}^p$ 上的非负可测函数。并且 -\begin{equation} - \label{eq:461} - \int_{\mathcal{R}^p\times\mathcal{R}^q} f(x,y) dxdy=\int_{\mathcal{R}^p}\left(\int_{\mathcal{R}^q}f(x,y)dy\right)dx. -\end{equation} +\begin{theorem}[Fubini 定理] \label{thm:fubi} + (1)若 $f(x,y)$ 是 $\mathcal{R}^p\times\mathcal{R}^q$ 上的非负可测函数,则对几乎处处的 $x\in \mathcal{R}^p$,$f(x,y)$ 作为 $y$ 的函数是 $\mathcal{R}^q$ 上的非负可测函数,$g(x)=\int_{\mathcal{R}^q}f(x,y) dy$ 是 $\mathcal{R}^p$ 上的非负可测函数。并且 + \begin{equation} + \label{eq:461} + \int_{\mathcal{R}^p\times\mathcal{R}^q} f(x,y) dxdy=\int_{\mathcal{R}^p}\left(\int_{\mathcal{R}^q}f(x,y)dy\right)dx. + \end{equation} -(2)若 $f(x,y)$ 是 $\mathcal{R}^p\times\mathcal{R}^q$ 上的可积函数,则对几乎处处的 $x\in\mathcal{R}^p$,$f(x,y)$ 作为 $y$ 的函数是 $\mathcal{R}^q$ 上的可积函数,并且 $g(x)=\int_{\mathcal{R}^q}f(x,y) dy$ 是 $\mathcal{R}^p$ 上的可积函数。而且~\eqref{eq:461} 成立。 + (2)若 $f(x,y)$ 是 $\mathcal{R}^p\times\mathcal{R}^q$ 上的可积函数,则对几乎处处的 $x\in\mathcal{R}^p$,$f(x,y)$ 作为 $y$ 的函数是 $\mathcal{R}^q$ 上的可积函数,并且 $g(x)=\int_{\mathcal{R}^q}f(x,y) dy$ 是 $\mathcal{R}^p$ 上的可积函数。而且~\eqref{eq:461} 成立。 \end{theorem} \begin{note} -在本模板中,引理(lemma),推论(corollary)的样式和定理~\ref{thm:fubi} 的样式一致,包括颜色,仅仅只有计数器的设置不一样。 + 在本模板中,引理(lemma),推论(corollary)的样式和定理~\ref{thm:fubi} 的样式一致,包括颜色,仅仅只有计数器的设置不一样。 \end{note} 我们说一个实变或者复变量的实值或者复值函数是在区间上平方可积的,如果其绝对值的平方在该区间上的积分是有限的。所有在勒贝格积分意义下平方可积的可测函数构成一个希尔伯特空间,也就是所谓的 $L^2$ 空间,几乎处处相等的函数归为同一等价类。形式上,$L^2$ 是平方可积函数的空间和几乎处处为 0 的函数空间的商空间。 \begin{proposition}[最优性原理] \label{pro:max} -如果 $u^*$ 在 $[s,T]$ 上为最优解,则 $u^*$ 在 $[s, T]$ 任意子区间都是最优解,假设区间为 $[t_0, t_1]$ 的最优解为 $u^*$ ,则 $u(t_0)=u^{*}(t_0)$,即初始条件必须还是在 $u^*$ 上。 + 如果 $u^*$ 在 $[s,T]$ 上为最优解,则 $u^*$ 在 $[s, T]$ 任意子区间都是最优解,假设区间为 $[t_0, t_1]$ 的最优解为 $u^*$ ,则 $u(t_0)=u^{*}(t_0)$,即初始条件必须还是在 $u^*$ 上。 \end{proposition} 我们知道最小二乘法可以用来处理一组数据,可以从一组测定的数据中寻求变量之间的依赖关系,这种函数关系称为经验公式。本课题将介绍最小二乘法的精确定义及如何寻求点与点之间近似成线性关系时的经验公式。假定实验测得变量之间的 $n$ 个数据,则在平面上,可以得到 $n$ 个点,这种图形称为 “散点图”,从图中可以粗略看出这些点大致散落在某直线近旁, 我们认为其近似为一线性函数,下面介绍求解步骤。 @@ -916,21 +916,21 @@ \subsection{积分的定义} 以最简单的一元线性模型来解释最小二乘法。什么是一元线性模型呢?监督学习中,如果预测的变量是离散的,我们称其为分类(如决策树,支持向量机等),如果预测的变量是连续的,我们称其为回归。回归分析中,如果只包括一个自变量和一个因变量,且二者的关系可用一条直线近似表示,这种回归分析称为一元线性回归分析。如果回归分析中包括两个或两个以上的自变量,且因变量和自变量之间是线性关系,则称为多元线性回归分析。对于二维空间线性是一条直线;对于三维空间线性是一个平面,对于多维空间线性是一个超平面。 \begin{property}\label{property:cauchy} -柯西列的性质 -\begin{enumerate} -\item $\{x_k\}$ 是柯西列,则其子列 $\{x_k^i\}$ 也是柯西列。 -\item $x_k\in \mathcal{R}^n$,$\rho(x,y)$ 是欧几里得空间,则柯西列收敛,$(\mathcal{R}^n,\rho)$ 空间是完备的。 -\end{enumerate} + 柯西列的性质 + \begin{enumerate} + \item $\{x_k\}$ 是柯西列,则其子列 $\{x_k^i\}$ 也是柯西列。 + \item $x_k\in \mathcal{R}^n$,$\rho(x,y)$ 是欧几里得空间,则柯西列收敛,$(\mathcal{R}^n,\rho)$ 空间是完备的。 + \end{enumerate} \end{property} \begin{conclusion} -回归分析(regression analysis) 是确定两种或两种以上变量间相互依赖的定量关系的一种统计分析方法。运用十分广泛,回归分析按照涉及的变量的多少,分为一元回归和多元回归分析;按照因变量的多少,可分为简单回归分析和多重回归分析;按照自变量和因变量之间的关系类型,可分为线性回归分析和非线性回归分析。 + 回归分析(regression analysis) 是确定两种或两种以上变量间相互依赖的定量关系的一种统计分析方法。运用十分广泛,回归分析按照涉及的变量的多少,分为一元回归和多元回归分析;按照因变量的多少,可分为简单回归分析和多重回归分析;按照自变量和因变量之间的关系类型,可分为线性回归分析和非线性回归分析。 \end{conclusion} \begin{problemset} -\item 设 $A$ 为数域 $K$ 上的 $n$ 级矩阵。证明:如果 $K^n$ 中任意非零列向量都是 $A$ 的特征向量,则 $A$ 一定是数量矩阵。 -\item 证明:不为零矩阵的幂零矩阵不能对角化。 -\item 设 $A = (a_{ij})$ 是数域 $K$ 上的一个 $n$ 级上三角矩阵,证明:如果 $a_{11} = a_{22} = \cdots = a_{nn}$,并且至少有一个 $a_{kl} \not = 0 (k < l)$,则 $A$ 一定不能对角化。 + \item 设 $A$ 为数域 $K$ 上的 $n$ 级矩阵。证明:如果 $K^n$ 中任意非零列向量都是 $A$ 的特征向量,则 $A$ 一定是数量矩阵。 + \item 证明:不为零矩阵的幂零矩阵不能对角化。 + \item 设 $A = (a_{ij})$ 是数域 $K$ 上的一个 $n$ 级上三角矩阵,证明:如果 $a_{11} = a_{22} = \cdots = a_{nn}$,并且至少有一个 $a_{kl} \not = 0 (k < l)$,则 $A$ 一定不能对角化。 \end{problemset} \chapter{常见问题集} @@ -939,23 +939,23 @@ \chapter{常见问题集} \begin{enumerate}[itemsep=1.5ex] \item \question{有没有办法章节用“第一章,第一节,(一)”这种?} - 见前文介绍,可以使用 \lstinline{scheme=chinese} 设置。 + 见前文介绍,可以使用 \lstinline{scheme=chinese} 设置。 \item \question{大佬,我想把正文字体改为亮色,背景色改为黑灰色。} - 页面颜色可以使用 \lstinline{\pagecolor} 命令设置,文本命令可以参考\href{https://tex.stackexchange.com/questions/278544/xcolor-what-is-the-equivalent-of-default-text-color}{这里}进行设置。 + 页面颜色可以使用 \lstinline{\pagecolor} 命令设置,文本命令可以参考\href{https://tex.stackexchange.com/questions/278544/xcolor-what-is-the-equivalent-of-default-text-color}{这里}进行设置。 \item \question{\lstinline{! LaTeX Error: Unknown option 'scheme=plain' for package 'ctex'.}} - 你用的 C\TeX{} 套装吧?这个里面的 \lstinline{ctex} 宏包已经是已经是 10 年前的了,与本模板使用的 \lstinline{ctex} 宏集有很大区别。不建议 C\TeX{} 套装了,请卸载并安装 \TeX{} Live 2022。 + 你用的 C\TeX{} 套装吧?这个里面的 \lstinline{ctex} 宏包已经是已经是 10 年前的了,与本模板使用的 \lstinline{ctex} 宏集有很大区别。不建议 C\TeX{} 套装了,请卸载并安装 \TeX{} Live 2022。 \item \question{我该使用什么版本?} - 请务必使用\href{https://github.com/ElegantLaTeX/ElegantBook/releases}{最新正式发行版},发行版间不定期可能会有更新(修复 bug 或者改进之类),如果你在使用过程中没有遇到问题,不需要每次更新\href{https://github.com/ElegantLaTeX/ElegantBook/archive/master.zip}{最新版},但是在发行版更新之后,请尽可能使用最新版(发行版)!最新发行版可以在 GitHub 或者 \TeX{} Live 2021 内获取。 + 请务必使用\href{https://github.com/ElegantLaTeX/ElegantBook/releases}{最新正式发行版},发行版间不定期可能会有更新(修复 bug 或者改进之类),如果你在使用过程中没有遇到问题,不需要每次更新\href{https://github.com/ElegantLaTeX/ElegantBook/archive/master.zip}{最新版},但是在发行版更新之后,请尽可能使用最新版(发行版)!最新发行版可以在 GitHub 或者 \TeX{} Live 2021 内获取。 \item \question{我该使用什么编辑器?} - 你可以使用 \TeX{} Live 2021 自带的编辑器 \TeX{}works 或者使用 \TeX{}studio,\TeX works 的自动补全,你可以参考我们的总结 \href{https://github.com/EthanDeng/texworks-autocomplete}{\TeX works 自动补全}。推荐使用 \TeX{} Live 2021 + \TeX{}studio。我自己用 VS Code 和 Sublime Text,相关的配置说明,请参考 \href{https://github.com/EthanDeng/vscode-latex}{\LaTeX{} 编译环境配置:Visual Studio Code 配置简介} 和 \href{https://github.com/EthanDeng/sublime-text-latex}{Sublime Text 搭建 \LaTeX{} 编写环境}。 + 你可以使用 \TeX{} Live 2021 自带的编辑器 \TeX{}works 或者使用 \TeX{}studio,\TeX works 的自动补全,你可以参考我们的总结 \href{https://github.com/EthanDeng/texworks-autocomplete}{\TeX works 自动补全}。推荐使用 \TeX{} Live 2021 + \TeX{}studio。我自己用 VS Code 和 Sublime Text,相关的配置说明,请参考 \href{https://github.com/EthanDeng/vscode-latex}{\LaTeX{} 编译环境配置:Visual Studio Code 配置简介} 和 \href{https://github.com/EthanDeng/sublime-text-latex}{Sublime Text 搭建 \LaTeX{} 编写环境}。 \item \question{您好,我们想用您的 ElegantBook 模板写一本书。关于机器学习的教材,希望获得您的授权,谢谢您的宝贵时间。} - 模板的使用修改都是自由的,你们声明模板来源以及模板地址(GitHub 地址)即可,其他未尽事宜按照开源协议 LPPL-1.3c。做好之后,如果方便的话,可以给我们一个链接,我把你们的教材放在 Elegant\LaTeX{} 用户作品集里。 + 模板的使用修改都是自由的,你们声明模板来源以及模板地址(GitHub 地址)即可,其他未尽事宜按照开源协议 LPPL-1.3c。做好之后,如果方便的话,可以给我们一个链接,我把你们的教材放在 Elegant\LaTeX{} 用户作品集里。 \item \question{请问交叉引用是什么?} - 本群和本模板适合有一定 \LaTeX{} 基础的用户使用,新手请先学习 \LaTeX{} 的基础,理解各种概念,否则你将寸步难行。 + 本群和本模板适合有一定 \LaTeX{} 基础的用户使用,新手请先学习 \LaTeX{} 的基础,理解各种概念,否则你将寸步难行。 \item \question{代码高亮环境能用其他语言吗?} - 可以的,ElegantBook 模板用的是 \lstinline{listings} 宏包,你可以在环境(\lstinline{lstlisting})之后加上语言(比如 Python 使用 \lstinline{language=Python} 选项),全局语言修改请使用 \lstinline{lstset} 命令,更多信息请参考宏包文档。 + 可以的,ElegantBook 模板用的是 \lstinline{listings} 宏包,你可以在环境(\lstinline{lstlisting})之后加上语言(比如 Python 使用 \lstinline{language=Python} 选项),全局语言修改请使用 \lstinline{lstset} 命令,更多信息请参考宏包文档。 \item \question{群主,什么时候出 Beamer 的模板(主题),ElegantSlide 或者 ElegantBeamer?} - 由于 Beamer 中有一个很优秀的主题 \href{https://github.com/matze/mtheme}{Metropolis}。后续确定不会再出任何主题/模板,请大家根据需要修改已有主题。 + 由于 Beamer 中有一个很优秀的主题 \href{https://github.com/matze/mtheme}{Metropolis}。后续确定不会再出任何主题/模板,请大家根据需要修改已有主题。 \end{enumerate} \chapter{版本更新历史} @@ -1155,7 +1155,7 @@ \section{求和算子与描述统计量} \textbf{求和算子} 是用以表达多个数求和运算的一个缩略符号,它在统计学和计量经济学分析中扮演着重要作用。如果 $\{x_i: i=1, 2, \ldots, n\}$ 表示 $n$ 个数的一个序列,那么我们就把这 $n$ 个数的和写为: \begin{equation} -\sum_{i=1}^n x_i \equiv x_1 + x_2 +\cdots + x_n + \sum_{i=1}^n x_i \equiv x_1 + x_2 +\cdots + x_n \end{equation} diff --git a/elegantbook-en.tex b/elegantbook-en.tex deleted file mode 100644 index c581abc..0000000 --- a/elegantbook-en.tex +++ /dev/null @@ -1,805 +0,0 @@ -\documentclass[11pt]{elegantbook} - -\title{An Elegant \LaTeX{} Template for Books} -\subtitle{Classic Elegant\LaTeX{} Template} - -\author{Ethan Deng, Liam Huang, syvshc, sikouhjw \& Osbert Wang} -\institute{Elegant\LaTeX{} Program} -\date{Dec. 31, 2022} -\version{4.5} -\bioinfo{Bio}{Information} - -\extrainfo{\textcolor{red}{\bfseries Caution: This template will no longer be maintained since January 1st, 2023.}} - -\logo{logo-blue.png} -\cover{cover.jpg} - -% modify the color in the middle of titlepage -\definecolor{customcolor}{RGB}{32,178,170} -\colorlet{coverlinecolor}{customcolor} -\usepackage{cprotect} - -\addbibresource[location=local]{reference.bib} % bib - -\begin{document} - -\maketitle - -\frontmatter -\tableofcontents - -\mainmatter - -\chapter{Elegant\LaTeX{} Templates} -Elegant\LaTeX{} Program developers are intended to provide you beautiful, elegant, user-friendly templates. Currently, the Elegant\LaTeX{} is composed of \href{https://github.com/ElegantLaTeX/ElegantNote}{ElegantNote}, \href{https://github.com/ElegantLaTeX/ElegantBook}{ElegantBook}, \href{https://github.com/ElegantLaTeX/ElegantPaper}{ElegantPaper}, designed for typesetting notes, books, and working papers respectively. Latest releases are strongly recommended! This guide is aimed at briefly introducing the 101 of this template. For any other question, suggestion or comment, feel free to contact us on GitHub \href{https://github.com/ElegantLaTeX/ElegantBook/issues}{issues} or email us at \email{elegantlatex2e@gmail.com}. - -Contact Infos: -\begin{itemize} - \item GitHub: \href{https://github.com/ElegantLaTeX/}{https://github.com/ElegantLaTeX/} - \item CTAN: \href{https://ctan.org/pkg/elegantbook}{https://ctan.org/pkg/elegantbook} - \item Download: \href{https://github.com/ElegantLaTeX/ElegantBook/releases}{release}, \href{https://github.com/ElegantLaTeX/ElegantBook/archive/master.zip}{latest version} -\end{itemize} - - -\section{Online Usage} -You can visit \href{https://www.overleaf.com/}{Overleaf} to use our template online anywhere and anytime without local installation. To find our template, search \lstinline{elegantlatex} in the \lstinline{templates} or simply visit \href{https://www.overleaf.com/latex/templates?addsearch=elegantlatex}{search result}, choose the template you prefer and \lstinline{Open as Template} to own a copy yourself to edit freely. To learn more about Overleaf, please refer to \href{https://www.overleaf.com/learn}{Documentation}. - - -\section{Portable Version} -For portable version, simply download lastest ElegantBook-master from GitHub or CTAN (to be more accurate, download \lstinline{elegantbook.cls}) and save the file(s) under your working directory. This way of installation is simple and convenient, but you have to manually update \lstinline{cls} now and then. - - -\section{Update Templates} -You can use cmd/terminal to update the tlmgr itself and all the packages, the commands are: -\begin{lstlisting} -tlmgr update --self -tlmgr update --all -\end{lstlisting} - -To learn more, please refer to \href{https://tex.stackexchange.com/questions/55437/how-do-i-update-my-tex-distribution}{How do I update my \TeX{} distribution?} - -\section{Other Release Versions} -If you are a \TeX{} Live 2018/2019/2020/2021 user and would like to update, the official solution is to uninstall the previous version. If you want to save the bother of uninstallation and re-installation, please copy \lstinline{elegantbook.cls} to the installation directory of \TeX{} Live 2022 (default: \lstinline|C:\texlive\2022\texmf-dist\tex\latex\elegantbook| ), run \lstinline{texhash} in cmd. - -\chapter{ElegantBook Settings} -This template is based on the Standard \LaTeX{} book class, so the options of book class work as well (Note that the option of papersize has no effect due to \lstinline{device} option). The default encoding is UTF-8 while \TeX{} Live is recommended. The test environments are Win10/Ubuntu 20.04/macOS + \TeX{} Live 2022/ Mac\TeX{} 2022, either \hologo{pdfLaTeX} or \hologo{XeLaTeX} works fine for \lstinline{lang=en}. - -\section{Languages} -We defined one option named \lstinline{lang} which has two basic values, \lstinline{lang=en} (default) , \lstinline{lang=cn}. Different values will alter the captions of figure/table, abstract name, refname, etc. You can use this option as - -\begin{lstlisting} -\documentclass[en]{elegantbook} -\documentclass[lang=en]{elegantbook} -\end{lstlisting} - -Besides the two basic language translation, our user provide more options, here is a short brief introduction to these translation. Since I am not familiar with these languages, I can't guarantee that the translations are correct, please comment on GitHub if you have some questions. - -\begin{itemize} - \item Italian translation \lstinline{lang=it}, provided by \href{https://github.com/VincentMVV}{VincentMVV} , please refer to \href{https://github.com/ElegantLaTeX/ElegantBook/issues/85}{Italian translation}; - \item French translation \lstinline{lang=fr}, provided by \href{https://github.com/abfek66}{abfek66} , please refer to \href{https://github.com/ElegantLaTeX/ElegantBook/issues/85}{Italian translation}; - \item Dutch Translation \lstinline{lang=nl}, provided by \href{https://github.com/inktvis75}{inktvis75} , please refer to \href{https://github.com/ElegantLaTeX/ElegantBook/issues/108}{Dutch Translation}; - \item Hungarian translation \lstinline{lang=hu}, provided by \href{https://github.com/palkotamas}{palkotamas}, please refer to \href{https://github.com/ElegantLaTeX/ElegantBook/issues/111}{Hungarian translation}; - \item Deutsch translation \lstinline{lang=de}, provided by Lisa, please refer to \href{https://github.com/ElegantLaTeX/ElegantBook/issues/113}{Deutsch translation}; - \item Spanish translation \lstinline{lang=es}, provided by Gustavo A. Corradi, please refer to \href{https://github.com/ElegantLaTeX/ElegantBook/issues/133}{Spanish translation}; - \item Mongolian translation \lstinline{lang=mn}, provided by \href{https://github.com/Altantsooj}{Altantsooj}, please refer to \href{https://github.com/ElegantLaTeX/ElegantBook/issues/137}{Mongolian translation}; - \item Japanese translation \lstinline{lang=jp}, provided by \href{https://github.com/inusturbo}{inusturbo}, please refer to \href{https://github.com/ElegantLaTeX/ElegantBook/issues/172}{Japanese translation}. -\end{itemize} - -\begin{remark} -Chinese Characters are acceptable \textbf{ONLY} in \lstinline{lang=cn}. -\end{remark} - -\section{Device Mode Option} -The option for device (\lstinline{device}) was originally used in ElegantNote, now we include this option in ElegantBook\footnote{Pictures have to be modified accordingly.} as well. Activate iPad mode in the following way\footnote{Default size: normal, A4 paper.}: -\begin{lstlisting} -\documentclass[pad]{elegantbook} %or -\documentclass[device=pad]{elegantbook} -\end{lstlisting} - -\section{Color Themes} -This template contains 5 color themes, i.e., \textcolor{structure1}{\lstinline{green}}\footnote{Original default theme.}, \textcolor{structure2}{\lstinline{cyan}}, \textcolor{structure3}{\lstinline{blue}}(default), \textcolor{structure4}{\lstinline{gray}}, \textcolor{structure5}{\lstinline{black}}. You can choose \lstinline{green} with -\begin{lstlisting} -\documentclass[green]{elegantbook} %or -\documentclass[color=green]{elegantbook} -\end{lstlisting} - - -\begin{table}[htbp] -\caption{ElegantBook Themes\label{tab:color thm}} -\centering -\begin{tabular}{ccccccc} -\toprule - & \textcolor{structure1}{green} - & \textcolor{structure2}{cyan} - & \textcolor{structure3}{blue} - & \textcolor{structure4}{gray} - & \textcolor{structure5}{black} - & Main Environments\\ -\midrule -structure & \makecell{{\color{structure1}\rule{1cm}{1cm}}} - & \makecell{{\color{structure2}\rule{1cm}{1cm}}} - & \makecell{{\color{structure3}\rule{1cm}{1cm}}} - & \makecell{{\color{structure4}\rule{1cm}{1cm}}} - & \makecell{{\color{structure5}\rule{1cm}{1cm}}} - & chapter section subsection \\ -main & \makecell{{\color{main1}\rule{1cm}{1cm}}} - & \makecell{{\color{main2}\rule{1cm}{1cm}}} - & \makecell{{\color{main3}\rule{1cm}{1cm}}} - & \makecell{{\color{main4}\rule{1cm}{1cm}}} - & \makecell{{\color{main5}\rule{1cm}{1cm}}} - & definition exercise problem \\ -second & \makecell{{\color{second1}\rule{1cm}{1cm}}} - & \makecell{{\color{second2}\rule{1cm}{1cm}}} - & \makecell{{\color{second3}\rule{1cm}{1cm}}} - & \makecell{{\color{second4}\rule{1cm}{1cm}}} - & \makecell{{\color{second5}\rule{1cm}{1cm}}} - & theorem lemma corollary\\ -third & \makecell{{\color{third1}\rule{1cm}{1cm}}} - & \makecell{{\color{third2}\rule{1cm}{1cm}}} - & \makecell{{\color{third3}\rule{1cm}{1cm}}} - & \makecell{{\color{third4}\rule{1cm}{1cm}}} - & \makecell{{\color{third5}\rule{1cm}{1cm}}} - & proposition\\ -\bottomrule -\end{tabular} -\end{table} - -If you want to customize the colors, please select \lstinline{nocolor} or use \lstinline{color=none} and declare the main, second, and third colors in the preamble section as follows: -\begin{lstlisting}[frame=single] -\definecolor{structurecolor}{RGB}{60,113,183} -\definecolor{main}{RGB}{0,166,82}% -\definecolor{second}{RGB}{255,134,24}% -\definecolor{third}{RGB}{0,174,247}% -\end{lstlisting} - -\section{Cover} -\subsection{Customized Cover} -From v3.10, customized cover is allowed, you can choose or hide any element as you prefer. Current optional elements are: -\begin{itemize} - \item title: \lstinline{\title} - \item subtitle: \lstinline{\subtitle} - \item author: \lstinline{\author} - \item institute: \lstinline{\institute} - \item date: \lstinline{\date} - \item version: \lstinline{\version} - \item extra information: \lstinline{\extrainfo} - \item cover image: \lstinline{\cover} - \item logo: \lstinline{\logo} -\end{itemize} - -Besides, an extra command \lstinline{\bioinfo} is provided with two options--caption and content. For instance, if you want to display \lstinline{Username: 111520}, just type in - -\begin{lstlisting} -\bioinfo{Username}{115520} -\end{lstlisting} - -You can change the color of the horizontal bar of the cover by -\begin{lstlisting} - \definecolor{customcolor}{RGB}{32,178,170} - \colorlet{coverlinecolor}{customcolor} -\end{lstlisting} - -\subsection{Cover Image} -The cover image used in this template is from \href{https://pixabay.com/en/tea-time-poetry-coffee-reading-3240766/}{pixabay.com}. The image is completely free and can be used under any circumstance. The cover image size is $1280 \times 1024$. If you would like to change the cover, please crop it according to the size of the cover picture strictly. One free online image clipping site: \href{https://www.fotor.com/cn}{fotor.com}. Feel free to join our QQ Group to get more elegant covers. - -\subsection{Logo} -Aspect ratio of the logo is 1:1 in this guide, i.e. a square picture. To replace the logo, do remember to choose the appropriate picture. - -\subsection{Stylized Cover} -Want to use stylized cover?(For instance, A4-sized PDF designed by Adobe Illustrator) Please comment out \lstinline{\maketitle} and use \lstinline{pdfpages} to insert the cover. Similar for using \lstinline{titlepage}. If you would like to use the cover in version 2.x, please refer to \href{https://github.com/EthanDeng/etitlepage}{etitlepage}. - -\section{Chapter Title Display Styles} - -This template contains 2 sets of \textit{title display styles},\lstinline{hang}(default) and \lstinline{display} style. For the former, chapter title is displayed on a single line (\lstinline{hang}). For the latter, chapter title is displayed on a double line (\lstinline{display}).In this guide, we use \lstinline{hang} . To change display style, use: -\begin{lstlisting} -\documentclass[hang]{elegantbook} %or -\documentclass[titlestyle=hang]{elegantbook} -\end{lstlisting} - - -\section{Introduction of Math Environments} -We defined two sets of theorem modes, \lstinline{simple} style and \lstinline{fancy} style (default). You may change to \lstinline{simple} mode by - -\begin{lstlisting} -\documentclass[simple]{elegantbook} %or -\documentclass[mode=simple]{elegantbook} -\end{lstlisting} - -In this template, we defined four different theorem class environments - -\begin{itemize} -\item \textit{Theorem Environments}, including title and content, numbering corresponding to chapter. Three types depending on the format: - \begin{itemize} - \item \textcolor{main}{\textbf{definition}} environment, the color is \textcolor{main}{main}; - \item \textcolor{second}{\textbf{theorem, lemma, corollary, axiom, postulate}} environment, the color is \textcolor{second} {second}; - \item \textcolor{third}{\textbf{proposition}} environment, the color is \textcolor{third}{third}. - \end{itemize} -\item \textit{Example Environment}, including \textbf{example, exercise, problem} environment, auto numbering according to chapter. -\item \textit{Proof Environment}, including \textbf{proof, note} environment containing introductory symbol (\textbf{note} environment) or ending symbol (\textbf{proof} environment). -\item \textit{Conclusion Environment}, including \textbf{conclusion, assumption, property, remark and solution}\footnote{We also define an option \lstinline{result}, which can hide the \lstinline{solution} and \lstinline{proof} environments. You can switch between \lstinline{result=answer} and \lstinline{result=noanswer}.} environments, all of which begin with boldfaced words, with format consistent with normal paragraphs. -\end{itemize} - -All of theorem environments have star versions: \textcolor{main}{\textbf{definition*}}, \textcolor{second}{\textbf{theorem*}}, \textcolor{second}{\textbf{lemma*}}, \textcolor{second}{\textbf{corollary*}}, \textcolor{second}{\textbf{axiom*}}, \textcolor{second}{\textbf{postulate*}}, \textcolor{third}{\textbf{proposition*}}. Environments with an asterisk are not numbered. - -\subsection{Theorem Class Environments} - -\subsubsection{\lstinline{fancy} mode} - -In \lstinline{fancy} mode, the template uses the \lstinline{tcolorbox} package to customize the theorem class environments, it is slightly different from the normal theorem environments. The usage is as follows: -\begin{lstlisting} - % name + label - \begin{theorem}{theorem name}{label} - The content of a theorem with name and label. - Use \ref{thm:label} to refer this theorem. - \end{theorem} - % no name + label - \begin{theorem}{}{label no name} - The content of a theorem without name. - Use \ref{thm:label no name} to refer this theorem. - \end{theorem} - % name + no label - \begin{theorem}{theorem name}{} - The content of a theorem without label. - Can't refer this theorem. - The last {} can be removed. - \end{theorem} - % no name + no label - \begin{theorem}{}{} - The content of a theorem without name and label. - Can't refer this theorem. - Both of {} can be removed. - \end{theorem} - \end{lstlisting} - -The first parameter \lstinline{theorem name} represents the name of the theorem. If the current theorem has no name, please use \lstinline|{}|\cprotect\footnote{Unless this theorem has neither no label, you should not omit this \verb|{}|.}, and the second parameter \lstinline{label} represents the label used in cross-reference with \verb|\ref{thm:label}|. Note that cross-references must be prefixed with \lstinline{thm:}. - -Other theorem class environments with the same usage includes: - -\begin{table}[htbp] -\centering -\caption{Theorem Class Environments} - \begin{tabular}{llll} - \toprule - Environment & Label text & Prefix & Cross-reference \\ - \midrule - definition & label & def & \lstinline|\ref{def:label}| \\ - theorem & label & thm & \lstinline|\ref{thm:label}| \\ - postulate & label & pos & \lstinline|\ref{pos:label}| \\ - axiom & label & axi & \lstinline|\ref{axi:label}|\\ - lemma & label & lem & \lstinline|\ref{lem:label}| \\ - corrlary & label & cor & \lstinline|\ref{cor:label}| \\ - proposition & label & pro & \lstinline|\ref{pro:label}| \\ - \bottomrule - \end{tabular}% -\label{tab:theorem-class}% -\end{table}% - -From version 4.1, you can write your theorem environments as follows: -\begin{lstlisting} -\begin{theorem}[theorem name]\label{thm:theorem-label} - The content of theorem. -\end{theorem} -% or -\begin{theorem}\label{thm:theorem-without-name} - The content of theorem. -\end{theorem} -\end{lstlisting} - -In this case, cross-reference don't have to be prefixed, i.e. the parameter of \lstinline{\ref} is the same as that of \lstinline{\label}. - -\subsubsection{\lstinline{simple} mode} - -In \lstinline{simple} mode, the template uses the \lstinline{amsthm} package to customize the theorem class environments. The usage is as follows: - -\begin{lstlisting} -\begin{theorem}[theorem name]\label{thm:theorem-label} - The content of theorem. -\end{theorem} -% or -\begin{theorem}\label{thm:theorem-without-name} - The content of theorem without name. -\end{theorem} -\end{lstlisting} - -\subsection{Counter for Theorem Environments} - -You can use \lstinline{thmcnt} option to control the theorem counter/number display style for the theorem environments, the acceptable options are \lstinline{chapter} (default) and \lstinline{section}: - -\begin{lstlisting} -\documentclass[section]{elegantbook} % turn the Theorem 4.1 to Theorem 4.1.1 -\documentclass[thmcnt=section]{elegantbook} -\end{lstlisting} - - -\subsection{Other Customized Environments} -The other three math environments can be called directly since there are no additional option for them, e.g. \lstinline{example}: -\begin{lstlisting} -\begin{example} -This is the content of example environment. -\end{example} -\end{lstlisting} - -The effect is as follows: - -\begin{example} -This is the content of example environment. -\end{example} - -These are all similar environments with slight differences lies in: - -\begin{itemize} - \item Example, exercise, problem environments number within chapter; - \item Note begins with introductory symbol and proof ends with ending symbol; - \item Conclusion and other environments are normal paragraph environments with boldfaced introductory words. -\end{itemize} - - -\section{List Environments} -This template uses \lstinline{tikz} to customize the list environments, with \lstinline{itemize} environment customized to the third depth and \lstinline{enumerate} environment customized to fourth depth. The effect is as follows\\[2ex] -\begin{minipage}[b]{0.49\textwidth} -\begin{itemize} - \item first item of nesti; - \item second item of nesti; - \begin{itemize} - \item first item of nestii; - \item second item of nestii; - \begin{itemize} - \item first item of nestiii; - \item second item of nestiii. - \end{itemize} - \end{itemize} -\end{itemize} -\end{minipage} -\begin{minipage}[b]{0.49\textwidth} -\begin{enumerate} - \item first item of nesti; - \item second item of nesti; - \begin{enumerate} - \item first item of nestii; - \item second item of nestii; - \begin{enumerate} - \item first item of nestiii; - \item second item of nestiii. - \end{enumerate} - \end{enumerate} -\end{enumerate} -\end{minipage} - - -\section{Fonts} -\textcolor{red}{\bfseries Alert} After v3.10, newtx is reset to cm, together with other two options, the \lstinline{math} font option offers: -\begin{enumerate} - \item \lstinline{math=cm}(default), use \LaTeX{} default math font (recommended). - \item \lstinline{math=newtx}, use \lstinline{newtxmath} math font (may bring about bugs). - \item \lstinline{math=mtpro2}, use \lstinline{mtpro2} package to set math font. -\end{enumerate} - -If you use \lstinline{newtx} fonts, type in: -\begin{lstlisting} -\documentclass[math=newtx]{elegantbook} -\end{lstlisting} - -When you are using \lstinline{newtx}, please pay attention to the hyphens. For instance, -\begin{equation} -\int_{R^q} f(x,y) dy.\emph{of\kern0pt f} \sin x -\end{equation} - -The corresponding code is: -\begin{lstlisting} -\begin{equation} - \int_{R^q} f(x,y) dy.\emph{of \kern0pt f} \sin x -\end{equation} -\end{lstlisting} - -\subsection{Symbol Fonts} -Feedback from some 3.08 users claims that error occurs when using our templates with \lstinline{yhmath}, \lstinline{esvect} and other packages. -\begin{lstlisting} -LaTeX Error: -Too many symbol fonts declared. -\end{lstlisting} - -The reason is that the template redefines font for math so that no new math font is allowed to be added. To use \lstinline{yhmath} and/or \lstinline{esvect}, please locate \lstinline{yhmath} or \lstinline{esvect} in \lstinline{elegantbook.cls}, uncomment corresponding related code. - -\begin{lstlisting} -%%% use yhmath pkg, uncomment following code -% \let\oldwidering\widering -% \let\widering\undefined -% \RequirePackage{yhmath} -% \let\widering\oldwidering - -%%% use esvect pkg, uncomment following code -% \RequirePackage{esvect} -\end{lstlisting} - -\section{Bibliography} - -This template uses biblatex to generate the bibliography, the default citestyle and bibliography style are both \lstinline{numeric}. Let's take a glance at the citation effect. ~\cite{en1} use data from a major peer-to-peer lending \cite{en3} marketplace in China to study whether female and male investors evaluate loan performance differently \parencite{en2}. - -If you want to use biblatex, you must create a file named \lstinline{reference.bib}, add bib items (from Google Scholar, Mendeley, EndNote, and etc.) to \lstinline{reference.bib} file, then cite the bibkey in the \lstinline{tex} file. The biber will automatically generate the bibliography for the reference you cited. - -In order to get the editors' auto-completion working, you need to add following code in your preamble: - -\begin{lstlisting} - \addbibresource[location=local]{reference.bib} -\end{lstlisting} - -Then include the print commands where you want to print the bibliography: -\begin{lstlisting} - \printbibliography[heading=bibintoc, title=\ebibname] -\end{lstlisting} - - - - -To change the bibliography style, this version introduces two options: \lstinline{citestyle} and \lstinline{bibstyle}, please refer to \href{https://ctan.org/pkg/biblatex}{CTAN:biblatex} for more detail about these options. You can change your bibliography style as - -\begin{lstlisting} -\documentclass[citestyle=numeric-comp, bibstyle=authoryear]{elegantbook} -\end{lstlisting} - -We also add the \lstinline{bibend} option to this template, you can choose \lstinline{biber} (default) or \lstinline{bibtex} as you like, \lstinline{biber} is recommended. - -\begin{lstlisting} -\documentclass[bibtex]{elegantbook} % or -\documentclass[bibend=bibtex]{elegantbook} -\end{lstlisting} - -\section{Preface} - -If you want to add a preface before the first chapter with the number of chapter unchanged, please add the preface in the following way: -\begin{lstlisting} -\chapter*{Introduction} -\markboth{Introduction}{Introduction} -The content of introduction. -\end{lstlisting} - -\section{Content Option and Depth} -Option for content \lstinline{toc}, you can choose either one column(\lstinline{onecol}) or two columns(\lstinline{twocol}). For two columns: -\begin{lstlisting} -\documentclass[twocol]{elegantbook} -\documentclass[toc=twocol]{elegantbook} -\end{lstlisting} - -Default content depth is 1, use to use \lstinline|\setcounter{tocdepth}{2}|. - -\section{Introduction Environment} -We create a introduction environment to display the structure of chapter. The basic useage is as follows: -\begin{lstlisting} -\begin{introduction} - \item Definition of Theorem - \item Ask for help - \item Optimization Problem - \item Property of Cauchy Series - \item Angle of Corner -\end{introduction} -\end{lstlisting} -And you will get: -\begin{introduction} - \item Definition of Theorem - \item Ask for help - \item Optimization Problem - \item Property of Cauchy Series - \item Angle of Corner -\end{introduction} - -You can change the title of this environment by modifying the optional argument of this environment: -\begin{lstlisting} -\begin{introduction}[Brief Introduction] -... -\end{introduction} -\end{lstlisting} - -%\section{Problem Set} -The environment \lstinline{problemset} is used at the end of each chapter to display corresponding exercises. Just type in the following sentences: -\begin{lstlisting} -\begin{problemset} - \item exercise 1 - \item exercise 2 - \item exercise 3 -\end{problemset} -\end{lstlisting} -And you will get: -\begin{problemset} - \item exercise 1 - \item exercise 2 - \item exercise 3 - \item math equation test: - \begin{equation} - a^2+b^2=c_{2_{i}} (1,2) [1,23] - \end{equation} -\end{problemset} -\begin{remark} -If you want to customize the title of \lstinline{problemset}, please change the optional argument like in introduction environment. In this version the \lstinline{problemset} environment automatically appears in the table of contents but not in the header or footer(to be fixed). -\end{remark} - -\begin{solution} - If you want to customize the title of \lstinline{problemset}, please change the optional argument like in introduction environment. In this version the \lstinline{problemset} environment automatically appears in the table of contents but not in the header or footer(to be fixed). -\end{solution} - -\section{Margin Notes} -In 3.08, we introduced \lstinline{marginpar=margintrue} and \lstinline{\elegantpar} (Beta) with piles of bugs. Hence we decide to remove them in 3.09 and will suspend the options till revolutionary optimization. Sorry for all the bugs! However, we retain the option \lstinline{marginpar} for users to get margin motes by activating \lstinline{marginpar=margintrue} and using \lstinline{\marginpar} or \lstinline{marginnote} packages. - -\begin{remark} -Note that text and equation are both available in the margin notes. -\begin{lstlisting} -% text -\marginpar{margin paragraph text} - -% equation -\marginpar{ -\begin{equation} - a^2 + b^2 = c^2 -\end{equation} -} -\end{lstlisting} - -For tables and figures, note that floating environment is not allowed. You have to use \lstinline{includegraphics} or \lstinline{table} and use \lstinline{\captionof} to name it. To get centralized figures or tables, use \lstinline{\centerline} or \lstinline{center}. To learn more, please refer to \href{https://tex.stackexchange.com/questions/5583/caption-of-figure-in-marginpar-and-caption-of-wrapfigure-in-margin}{Caption of Figure in Marginpar}. - -\begin{lstlisting} -% graph with centerline command -\marginpar{ - \centerline{ - \includegraphics[width=0.2\textwidth]{logo.png} - } - \captionof{figure}{your figure caption} -} - -% graph with center environment -\marginpar{ - \begin{center} - \includegraphics[width=0.2\textwidth]{logo.png} - \captionof{figure}{your figure caption} - \end{center} -} -\end{lstlisting} - -\end{remark} - - - -\chapter{ElegantBook Writing Sample} - -\begin{introduction} -\item Theorem Class Envrionments -\item Cross Reference -\item Math Environments -\item List Environments -\item Logo and Base -\item $a^2+b^2=c^2$ -\end{introduction} - - -\lipsum[1] -% source: https://www.maths.tcd.ie/~dwilkins/LaTeXPrimer/Theorems.html - -\section{Writing Sample} - -We will define the integral of a measurable function in three steps. First, we define the integral of a nonnegative simple function. Let $E$ be the measurable set in $\mathcal{R}^N$. - -\begin{definition}[Left Coset] -Let $H$ be a subgroup of a group~$G$. A \emph{left coset} of $H$ in $G$ is a subset of $G$ that is of the form $xH$, where $x \in G$ and $xH = \{ xh : h \in H \}$. Similarly a \emph{right coset} of $H$ in $G$ is a subset of $G$ that is of the form $Hx$, where $Hx = \{ hx : h \in H \} \hbar$ -\end{definition} - -\begin{note} -Note that a subgroup~$H$ of a group $G$ is itself a left coset of $H$ in $G$. -\end{note} - -\lipsum[2] - -\begin{theorem}[Lagrange's Theorem] \label{thm:lg} -Let $G$ be a finite group, and let $H$ be a subgroup of $G$. Then the order of $H$ divides the order of $G$. -\end{theorem} - -As theorem \ref{thm:lg} refered. - -\lipsum[3] - - -\begin{theorem}{theorem name}{label text} - The content of theorem. -\end{theorem} - -we can refer this theorem as \ref{thm:label text}. - - -\begin{proposition}[Size of Left Coset] -Let $H$ be a finite subgroup of a group $G$. Then each left coset of $H$ in $G$ has the same number of elements as $H$. -\end{proposition} - -\begin{proof} - Let $z$ be some element of $xH \cap yH$. Then $z = xa$ for some $a \in H$, and $z = yb$ for some $b \in H$. If $h$ is any element of $H$ then $ah \in H$ and $a^{-1}h \in H$, since $H$ is a subgroup of $G$. But $zh = x(ah)$ and $xh = z(a^{-1}h)$ for all $h \in H$. Therefore $zH \subset xH$ and $xH \subset zH$, and thus $xH = zH$. Similarly $yH = zH$, and thus $xH = yH$, as required. -\end{proof} - -\begin{figure}[htbp] - \centering - \includegraphics[width=0.6\textwidth]{scatter.jpg} - \caption{Matplotlib: Scatter Plot Example\label{fig:scatter}} -\end{figure} - -Regression analysis is a powerful statistical method that allows you to examine the relationship between two or more variables of interest. While there are many types of regression analysis, at their core they all examine the influence of one or more independent variables on a dependent variable. The process of performing a regression allows you to confidently determine which factors matter most, which factors can be ignored, and how these factors influence each other. - -Let's continue using our application training example. In this case, we'd want to measure the historical levels of satisfaction with the events from the past three years or so, as well as any information possible in regards to the independent variables. - -\section{Second section} -This second section\index{S!section} may include some special word, -and expand the ones already used\index{keywords!used}. - - -\begin{table}[htbp] - \small - \centering - \caption{Auto MPG and Price \label{tab:reg}} - \begin{tabular}{lcc} - \toprule - & (1) & (2) \\ - \midrule - mpg & -238.90*** & -49.51 \\ - & (53.08) & (86.16) \\ - weight & & 1.75*** \\ - & & (0.641) \\ - constant & 11,253*** & 1,946 \\ - & (1,171) & (3,597) \\ - obs & 74 & 74 \\ - $R^2$ & 0.220 & 0.293 \\ - \bottomrule - \multicolumn{3}{l}{\scriptsize Standard errors in parentheses} \\ - \multicolumn{3}{l}{\scriptsize *** $p < 0.01$, ** $p<0.05$, * $p<0.1$} \\ - \end{tabular}% -\end{table}% - -\lipsum[1-2] - -\begin{itemize} - \item Routing and resource discovery; - \begin{itemize} - \item Language Models - \item Vector Space Models - \end{itemize} - \item Resilient and scalable computer networks; - \item Distributed storage and search. -\end{itemize} - -%\problemset -\begin{problemset} - \item Solve the equation $5(- 3x - 2) - (x - 3) = -4(4x + 5) + 13$. - \item Find the distance between the points $(-4 , -5)$ and $(-1 , -1)$. - \item Find the slope of the line $5x - 5y = 7$. -\end{problemset} - - -\chapter{FAQ} -We list some FAQs for users to refer to: -\begin{enumerate} - \item \question{Why option numbers for natbib fail to take effect in v3.07?} - In v3.07, when \lstinline{gbt7714} is introduced, option \lstinline{authoryear} is incompatible with \lstinline{natbib}. In v3.08 and 3.09, \lstinline{numbers}, \lstinline{numbers}, \lstinline{super} and \lstinline{authoryear} are introduced. - \item \question{I want to customize font and background color.} - Please use \lstinline{pagecolor} to change background color, refer to \href{https://tex.stackexchange.com/questions/278544/xcolor-what-is-the-equivalent-of-default-text-color}{this} to customize font. - \item \question{Which version should I choose?} - Please use \href{https://github.com/ElegantLaTeX/ElegantBook/releases}{Latest Release} via GitHub or \TeX{} Live 2022. - \item \question{Which editor should I choose?} - You can use \TeX{} Live 2022 built-in \TeX works or \TeX Studio. You may refer to \href{https://github.com/EthanDeng/texworks-autocomplete}{\TeX{}works autocomplete}. \TeX{} Live 2022 + \TeX{}studio is strongly recommended. Related configurations can be found at \href{https://github.com/EthanDeng/vscode-latex}{vscode-latex} and \href{https://github.com/EthanDeng/sublime-text-latex}{sublime-text-latex}. - \item \question{Hello, we want to use ElegantBook to write a book about machine learning and would like your authorization.} - Feel free to use our templates by pointing out our copyright. For other issues, please refer to LPPL-1.3c. If you want to show us your work, you can share the URL with us afterwards. - \item \question{What is cross reference?} - This template is aimed at who are not a complete beginner for \LaTeX{}. Please learn more about \LaTeX{} before using this template. - \item \question{Is the language for code highlighting optional?} - Yes, \lstinline{listings} package is used in ElegantBook, hence language is optional(e.g. \lstinline{language=Python}). For global setting, use \lstinline{lstset}. For more information, please refer to package documentations. - \item \question{When will Beamer template (ElegantSlide or ElegantBeamer) forthcoming?} - Since there is an excellent theme \href{https://github.com/matze/mtheme}{Metropolis}, no plan for Beamer theme. -\end{enumerate} - -\chapter{Version History} -We revised our templates now and then. This section shows the version story of ElegantBook. - - -\datechange{2022/12/31}{release of v4.5.} \textcolor{red}{\bfseries Stop Maintenance} - -\begin{change} - \item Add new document option \lstinline|usesamecnt| for same thm counter for all theme environments; - \item Add 5-th optional parameter for \lstinline|elegantnewtheorem|. -\end{change} - - -\datechange{2022/08/15}{release of v4.4.} - -\begin{change} - \item Add custome theorem definition command \lstinline{\elegantnewtheorem}; - \item Fix star environment(*) for inner environments (\href{https://github.com/ElegantLaTeX/ElegantBook/issues/167}{issue \#167}); - \item Change English fonts from TeX Gyre Termes to TeX Gyre TermesX; - \item Re-construct some theorem environments to enchance compatibility; - \item Remove Gitee repo due the privacy policy; - \item Re-open Github pull requests. -\end{change} - - - - -\datechange{2022/04/09}{release of v4.3.} - -\begin{change} - \item Remove part newtx settings, set TeX Gyre Termes/Heros fonts under \hologo{XeLaTeX}. - \item Fix Chinese fonts in the theorem environments. - \item Add theorem counter option, \lstinline{thmcnt=section}. - \item Add bib option \lstinline{bibend}, which can take value of biber and bibtex. - \item \textbf{! Warnings}: The multilingual option may cause some unexpected errors, you can report in this \href{https://github.com/ElegantLaTeX/ElegantBook/issues/170}{issue}. -\end{change} - - - -\datechange{2022/03/08}{release of v4.2.} - -\begin{change} - \item Bug fix due to the update of newtx fonts; - \item Add `Chapter' in TOC, and redefine \lstinline{\chaptername} to unify the logic under different languages; - \item Add language option for Japanese, \lstinline{lang=jp}. -\end{change} - - -\datechange{2021/05/02}{release of v4.1.} - -\begin{change} - \item \textbf{! Big Change}: Change the bibliography method from \hologo{BibTeX} to biblatex(with backend \lstinline{biber}); - \item \textbf{! Big Change}: Add support for the default theorem writing method (with optional name and label); - \item Add left and right space; - \item Support hyperlink from the text of TOC; - \item Remove the \hologo{pdfLaTeX} compatiblity check for Chinese. - \item Add multilingual support, for french \lstinline{lang=fr}, dutch \lstinline{lang=nl}, Hungarian \lstinline{lang=hu}, Spanish \lstinline{lang=es}, Mongolian \lstinline{lang=mn} etc. -\end{change} - -\datechange{2020/04/12}{release of v3.11, \textcolor{red}{\textbf{LAST} version of 3.x}.} - - -\begin{change} - \item \textbf{! Fix}: Fix \lstinline{natbib option clash} problems caused by \lstinline{gbt7714} updates. - \item Remove \lstinline{base} decorations and its options since \lstinline{pgfornament} package is not included in \TeX{} Live 2020. - \item Fix spacing problem in some environments. - \item Introduce language option for Italian, \lstinline{lang=it}. -\end{change} - - -\datechange{2020/02/10}{release of v3.10} - -\begin{change} - \item Introduce \lstinline{math} for math font, optional styles are \lstinline{newtx} and \lstinline{cm}.\\ - \textbf{Notice}: The math font \lstinline{newtxmath} in previous versions is reset to default \LaTeX{} math font, to keep previous math font, please declare \lstinline{math=newtx}. - \item Introduce \lstinline{chinesefont} option, with \lstinline{founder}, \lstinline{ctexfont} and \lstinline{nofont} available. - \item Turn author information on the cover optional and add customized command \lstinline{\bioinfo}. - \item Add version history with command \lstinline{\datechange} and environment \lstinline{change}. - \item Add Chinese chapter style \lstinline{scheme} with option \lstinline{chinese}. - \item Since the bug raised by \lstinline{\lvert} is fixed, exchange package positions of \lstinline{ctex} and \lstinline{amsmath}. - \item Drop \lstinline{\lastpage} from header to avoid page anchor bug and adding \lstinline{\frontmatter}. - \item Revise bibliography option \lstinline{cite} with optional styles \lstinline{numbers},\lstinline{authoryear} and \lstinline{super}. - \item Introduce bibliography style option \lstinline{bibstyle}, with default bib style \lstinline{apalike} for English mode and \lstinline{gbt7714} package for Chinese mode. -\end{change} - -\datechange{2019/08/18}{release of v3.09} - -\begin{change} - \item Remove \lstinline{\elegantpar} temporary and remind users to use \lstinline{\marginnote} and \lstinline{\marginpar} instead. - \item Use \lstinline{esint} to display integral operator. - \item Add new command \lstinline{toc}, with options \lstinline{onecol} and \lstinline{twocol}. - \item Add new option \lstinline{cite} \lstinline{super} for superscript-displayed citation. - \item Revise \lstinline{problemset}. -\end{change} - - -\nocite{en2,en3} - -\printbibliography[heading=bibintoc, title=\ebibname] -\appendix - - -\chapter{Mathematical Tools} - -This appendix covers some of the basic mathematics used in econometrics. We briefly discuss the properties of summation operators, study the properties of linear and some nonlinear equations, and review the ratios and percentages. We also introduce some special functions that are common in econometrics applications, including quadratic functions and natural logarithms. The first four sections require only basic algebraic techniques. The fifth section briefly reviews differential Calculus Although Calculus is not necessary to understand much of this book, it is used in some of the end-of-chapter appendices and in some of the more advanced topics in part 3. - -\section{Summation Operator and Description Statistics} - -\textbf{Summation Operator} is an abbreviation used to express the summation of numbers, it plays an important role in statistics and econometrics analysis. If $\{x_i: i=1, 2, \ldots, n\}$ is a sequence of $n$ numbers, the summation of the $n$ numbers is: - -\begin{equation} -\sum_{i=1}^n x_i \equiv x_1 + x_2 +\cdots + x_n -\end{equation} - - -\end{document} \ No newline at end of file diff --git a/elegantbook.cls b/elegantbook.cls index 4fb3e3d..efa9805 100644 --- a/elegantbook.cls +++ b/elegantbook.cls @@ -8,7 +8,7 @@ %%%%%%%%%%%%%%%%%%%%% % % !Mode:: "TeX:UTF-8" \NeedsTeXFormat{LaTeX2e} -\ProvidesClass{elegantbook}[2022/12/31 v4.5 ElegantBook document class] +\ProvidesClass{elegantbook}[2022/04/09 v4.3 ElegantBook document class] %%% @@ -16,6 +16,7 @@ \RequirePackage{etoolbox} \SetupKeyvalOptions{family=ELEGANT, prefix=ELEGANT@, setkeys=\kvsetkeys} \newcommand{\ekv}[1]{\kvsetkeys{ELEGANT}{#1}} + % ----- Colors ----- \DeclareStringOption[blue]{color} \DeclareStringOption[en]{lang} @@ -55,7 +56,6 @@ \DeclareVoidOption{fancy}{\ekv{mode=fancy}} \DeclareVoidOption{simple}{\ekv{mode=simple}} -\DeclareBoolOption[false]{usesamecnt} \DeclareVoidOption{answer}{\ekv{result=answer}} \DeclareVoidOption{noanswer}{\ekv{result=noanswer}} @@ -123,10 +123,6 @@ pdfborder={0 0 0}, linktocpage } -\newif\ifELEGANT@Hy@later - \@ifpackagelater{hyperref}{2022/05/16} - {\ELEGANT@Hy@latertrue} - {\ELEGANT@Hy@laterfalse} %% device settings \RequirePackage{geometry} @@ -143,16 +139,16 @@ \geometry{ marginparwidth=5cm, marginparsep=5mm, left=2cm,right=7cm}}{\relax}}{ - \relax} + \relax} \ifdefstring{\ELEGANT@device}{pad}{ -\geometry{ - paperwidth=7.5in, - paperheight=10in, - margin=16mm, - headheight=2.17cm, - footskip=4mm -}}{\relax} + \geometry{ + paperwidth=7.5in, + paperheight=10in, + margin=16mm, + headheight=2.17cm, + footskip=4mm + }}{\relax} \RequirePackage{indentfirst,comment} @@ -169,19 +165,16 @@ \PassOptionsToPackage{quiet}{fontspec} \RequirePackage{iftex} -\ifpdftex - \RequirePackage{newtxtext} - \RequirePackage[scaled=.90]{helvet} -\else +\ifXeTeX \RequirePackage[no-math]{fontspec} - \setmainfont{TeXGyreTermesX}[ - UprightFont = *-Regular , - BoldFont = *-Bold , - ItalicFont = *-Italic , - BoldItalicFont = *-BoldItalic , + \setmainfont{texgyretermes}[ + UprightFont = *-regular , + BoldFont = *-bold , + ItalicFont = *-italic , + BoldItalicFont = *-bolditalic , Extension = .otf , Scale = 1.0] - + \setsansfont{texgyreheros}[ UprightFont = *-regular , BoldFont = *-bold , @@ -189,11 +182,14 @@ BoldItalicFont = *-bolditalic , Extension = .otf , Scale = 0.9] +\else + \RequirePackage{newtxtext} + \RequirePackage[scaled=.90]{helvet} \fi \ifdefstring{\ELEGANT@lang}{cn}{ \ifdefstring{\ELEGANT@chinesefont}{founder}{ - \RequirePackage[UTF8, scheme=plain, fontset=none]{ctex} + \RequirePackage[UTF8,scheme=plain,fontset=none]{ctex} \setCJKmainfont[BoldFont={FZHei-B01},ItalicFont={FZKai-Z03}]{FZShuSong-Z01} \setCJKsansfont[BoldFont={FZHei-B01}]{FZKai-Z03} \setCJKmonofont[BoldFont={FZHei-B01}]{FZFangSong-Z02} @@ -205,17 +201,13 @@ \newcommand*{\heiti}{\CJKfamily{zhhei}} \newcommand*{\kaishu}{\CJKfamily{zhkai}} \newcommand*{\fangsong}{\CJKfamily{zhfs}}}{\relax} - + \ifdefstring{\ELEGANT@chinesefont}{nofont}{ - \RequirePackage[UTF8,scheme=plain,fontset=none]{ctex} - \xeCJKsetup{AutoFakeBold=true} - }{\relax} + \RequirePackage[UTF8,scheme=plain,fontset=none]{ctex}}{\relax} \ifdefstring{\ELEGANT@chinesefont}{ctexfont}{ - \RequirePackage[UTF8,scheme=plain]{ctex} - \xeCJKsetup{AutoFakeBold=true} - }{\relax} - + \RequirePackage[UTF8,scheme=plain]{ctex}}{\relax} + \AfterEndPreamble{ \setlength\parindent{2\ccwd}} }{\relax} @@ -246,19 +238,7 @@ \RequirePackage{anyfontsize} \ifdefstring{\ELEGANT@math}{newtx}{ - \let\oldencodingdefault\encodingdefault - \let\oldrmdefault\rmdefault - \let\oldsfdefault\sfdefault - \let\oldttdefault\ttdefault - \def\encodingdefault{T1} - \renewcommand{\rmdefault}{ntxtlf} - \renewcommand{\sfdefault}{qhv} - \renewcommand{\ttdefault}{ntxtt} \RequirePackage{newtxmath} - \let\encodingdefault\oldencodingdefault - \let\rmdefault\oldrmdefault - \let\sfdefault\oldsfdefault - \let\ttdefault\oldttdefault \let\Bbbk\relax \RequirePackage{esint} %%% use yhmath pkg, uncomment following code @@ -372,7 +352,7 @@ \RequirePackage[shortlabels,inline]{enumitem} \setlist{nolistsep} -\RequirePackage[labelfont={bf,color=structurecolor}]{caption} +\RequirePackage[labelfont={bf,color=structurecolor}]{caption} \captionsetup[table]{skip=3pt} \captionsetup[figure]{skip=3pt} @@ -452,377 +432,7 @@ \newcommand{\historyname}{版本更新历史} \newcommand{\beforechap}{第} \newcommand{\afterchap}{章} -}{\relax} - - -\ifdefstring{\ELEGANT@lang}{en}{ - \setlength\parindent{2em} - \newcommand\figref[1]{\textbf{Figure}~\ref{#1}} - \newcommand\tabref[1]{\textbf{Table}~\ref{#1}} - \renewcommand{\chaptername}{Chapter} - \renewcommand{\partname}{\color{structurecolor} Part} - \newcommand{\authorname}{\textbf{Author: }} - \newcommand{\institutename}{\textbf{Institute: }} - \newcommand{\datename}{\textbf{Date: }} - \newcommand{\versionname}{\textbf{Version: }} - \newcommand{\notename}{Note} - \newcommand{\proofname}{Proof} - \newcommand{\problemname}{Problem} - \newcommand{\definitionname}{Definition} - \newcommand{\theoremname}{Theorem} - \newcommand{\axiomname}{Axiom} - \newcommand{\postulatename}{Postulate} - \newcommand{\lemmaname}{Lemma} - \newcommand{\propositionname}{Proposition} - \newcommand{\corollaryname}{Corollary} - \newcommand{\examplename}{Example} - \newcommand{\exercisename}{Exercise} - \newcommand{\remarkname}{Remark} - \newcommand{\assumptionname}{Assumption} - \newcommand{\conclusionname}{Conclusion} - \newcommand{\solutionname}{Solution} - \newcommand{\propertyname}{Property} - \newcommand{\introductionname}{Introduction} - \renewcommand{\appendixname}{Appendix} - \newcommand{\ebibname}{Bibliography} - % \newcommand{\problemsetname}{Exercise} - \newcommand\bioinfo[2]{\gdef\@bioinfo{\textbf{#1}: #2}} - \newcommand{\updatename}{Updates:} - \newcommand{\historyname}{Version History} -}{\relax} - -\ifdefstring{\ELEGANT@lang}{it}{ - % \RequirePackage[utf8]{inputenc} - \RequirePackage[italian]{babel} - % \RequirePackage[T1]{fontenc} - \setlength\parindent{2em} - \newcommand\figref[1]{\textbf{Figura}~\ref{#1}} - \newcommand\tabref[1]{\textbf{Tabella}~\ref{#1}} - \renewcommand{\chaptername}{Chapter} - \newcommand{\authorname}{\textbf{Autore: }} - \newcommand{\institutename}{\textbf{Istituto: }} - \newcommand{\datename}{\textbf{Data: }} - \newcommand{\versionname}{\textbf{Versione: }} - \newcommand{\notename}{Nota} - \newcommand{\proofname}{Dimostrazione} - \newcommand{\problemname}{Problema} - \newcommand{\definitionname}{Definizione} - \newcommand{\theoremname}{Teorema} - \newcommand{\axiomname}{Assioma} - \newcommand{\postulatename}{Postulato} - \newcommand{\lemmaname}{Lemma} - \newcommand{\propositionname}{Proposizione} - \newcommand{\corollaryname}{Corollario} - \newcommand{\examplename}{Esempio} - \newcommand{\exercisename}{Esercizio} - \newcommand{\remarkname}{Commento} - \newcommand{\assumptionname}{Assunto} - \newcommand{\conclusionname}{Conclusione} - \newcommand{\solutionname}{Soluzione} - \newcommand{\propertyname}{Proprietà} - \newcommand{\introductionname}{Introduzione} - \newcommand\bioinfo[2]{\gdef\@bioinfo{\textbf{#1}: #2}} - \newcommand{\updatename}{Aggiornamenti:} - \newcommand{\ebibname}{Bibliografia} - \newcommand{\historyname}{Cronologia delle versioni} -}{\relax} - -\ifdefstring{\ELEGANT@lang}{fr}{ - \RequirePackage[utf8]{inputenc} - \RequirePackage[T1]{fontenc} - \RequirePackage[french]{babel} - \setlength\parindent{2em} - \renewcommand\figref[1]{\textbf{Figure}\ref{#1}} - \renewcommand\tabref[1]{\textbf{Tableau}\ref{#1}} - \renewcommand{\chaptername}{Chapitre} - \renewcommand{\authorname}{\textbf{Auteur: }} - \renewcommand{\institutename}{\textbf{Institut: }} - \renewcommand{\datename}{\textbf{Date: }} - \renewcommand{\versionname}{\textbf{Version: }} - \renewcommand{\notename}{Note} - \renewcommand{\proofname}{Démonstration} - \renewcommand{\problemname}{Problème} - \renewcommand{\definitionname}{Définition} - \renewcommand{\theoremname}{Théorème} - \renewcommand{\axiomname}{Axiôme} - \renewcommand{\postulatename}{Postulat} - \renewcommand{\lemmaname}{Lemme} - \renewcommand{\propositionname}{Proposition} - \renewcommand{\corollaryname}{Corollaire} - \renewcommand{\examplename}{Exemple} - \renewcommand{\exercisename}{Exercice} - \renewcommand{\remarkname}{Remarque} - \renewcommand{\assumptionname}{Supposition} - \renewcommand{\conclusionname}{Conclusion} - \renewcommand{\solutionname}{Solution} - \renewcommand{\propertyname}{Propriété} - \renewcommand{\introductionname}{Introduction} - \renewcommand{\problemsetname}{Exercice} - \renewcommand{\updatename}{Mises à jour:} - \newcommand{\ebibname}{Bibliographie} - \renewcommand{\historyname}{Historique des versions} -}{\relax} - - -\ifdefstring{\ELEGANT@lang}{nl}{ - \RequirePackage[dutch]{babel} - \setlength\parindent{2em} - \newcommand\figref[1]{\textbf{Figuur}~\ref{#1}} - \newcommand\tabref[1]{\textbf{Tabel}~\ref{#1}} - \renewcommand{\chaptername}{Hoofdstuk} - \newcommand{\authorname}{\textbf{Auteur: }} - \newcommand{\institutename}{\textbf{Instituut: }} - \newcommand{\datename}{\textbf{Datum: }} - \newcommand{\versionname}{\textbf{Versie: }} - \newcommand{\notename}{Opmerking} - \newcommand{\proofname}{Bewijs} - \newcommand{\problemname}{Probleem} - \newcommand{\definitionname}{Definitie} - \newcommand{\theoremname}{Stelling} - \newcommand{\axiomname}{Uitgangspunt} - \newcommand{\postulatename}{Hypothese} - \newcommand{\lemmaname}{Lemma} - \newcommand{\propositionname}{Voorstel} - \newcommand{\corollaryname}{Gevolgtrekking} - \newcommand{\examplename}{Voorbeeld} - \newcommand{\exercisename}{Oefening} - \newcommand{\remarkname}{Commentaar} - \newcommand{\assumptionname}{Veronderstelling} - \newcommand{\conclusionname}{Besluit} - \newcommand{\solutionname}{Oplossing} - \newcommand{\propertyname}{Eigenschap} - \newcommand{\introductionname}{Introductie} - \newcommand{\problemsetname}{Probleemcomplex} - \newcommand\bioinfo[2]{\gdef\@bioinfo{\textbf{#1}: #2}} - \newcommand{\updatename}{Update:} - \newcommand{\ebibname}{Bibliographie} - \newcommand{\historyname}{Versie Geschiedenis} -}{\relax} - - -\ifdefstring{\ELEGANT@lang}{hu}{ - \RequirePackage[magyar]{babel} - \setlength\parindent{2em} - \newcommand\figref[1]{\ref{#1}~\textbf{Ábra}} - \newcommand\tabref[1]{\ref{#1}~\textbf{Táblázat}} - \renewcommand{\chaptername}{Fejezet} - \newcommand{\authorname}{\textbf{Szerző: }} - \newcommand{\institutename}{\textbf{Intézmény: }} - \newcommand{\datename}{\textbf{Dátum: }} - \newcommand{\versionname}{\textbf{Verziószám: }} - \newcommand{\notename}{Jegyzet} - \newcommand{\proofname}{Bizonyítás} - \newcommand{\problemname}{Probléma} - \newcommand{\definitionname}{Definíció} - \newcommand{\theoremname}{Tétel} - \newcommand{\axiomname}{Axióma} - \newcommand{\postulatename}{Követelmény} - \newcommand{\lemmaname}{Lemma} - \newcommand{\propositionname}{Előzmény} - \newcommand{\corollaryname}{Következmény} - \newcommand{\examplename}{Példa} - \newcommand{\exercisename}{Feladat} - \newcommand{\remarkname}{Megjegyzés} - \newcommand{\assumptionname}{Sejtés} - \newcommand{\conclusionname}{Összefoglalás} - \newcommand{\solutionname}{Megoldás} - \newcommand{\propertyname}{Tulajdonság} - \newcommand{\introductionname}{Bevezetés} - \newcommand{\problemsetname}{Feladatok} - \newcommand\bioinfo[2]{\gdef\@bioinfo{\textbf{#1}: #2}} - \newcommand{\updatename}{Frissítve:} - \newcommand{\ebibname}{Bibliográfia} - \newcommand{\historyname}{Korábbi verziók} -}{\relax} - -\ifdefstring{\ELEGANT@lang}{de}{ - \setlength\parindent{2em} - \renewcommand{\contentsname}{Inhaltsverzeichnis} - \newcommand\figref[1]{\textbf{Figur}~\ref{#1}} - \newcommand\tabref[1]{\textbf{Tabelle}~\ref{#1}} - \renewcommand{\partname}{\color{structurecolor} Teil} - \renewcommand{\listfigurename}{Abbildungsverzeichnis} - \renewcommand{\listtablename}{Tabellenverzeichnis} - \renewcommand{\bibname}{Bibliographie} - \renewcommand{\appendixname}{Anhang} - \renewcommand{\chaptername}{Kapitel} - \newcommand{\authorname}{\textbf{Autor: }} - \newcommand{\institutename}{\textbf{Institut: }} - \newcommand{\datename}{\textbf{Datum: }} - \newcommand{\versionname}{\textbf{Version: }} - \newcommand{\notename}{Notiz} - \newcommand{\proofname}{Beweis} - \newcommand{\problemname}{Problem} - \newcommand{\definitionname}{Definition} - \newcommand{\theoremname}{Theorem} - \newcommand{\axiomname}{Axiom} - \newcommand{\postulatename}{Postulat} - \newcommand{\lemmaname}{Lemma} - \newcommand{\propositionname}{Behauptung} - \newcommand{\corollaryname}{Corollary} - \newcommand{\examplename}{Beispiel} - \newcommand{\instancename}{Beispiel} % - \newcommand{\exercisename}{\"{U}bung} - \newcommand{\remarkname}{Anmerkung} - \newcommand{\assumptionname}{Annahme} - \newcommand{\conclusionname}{Abschluss} - \newcommand{\solutionname}{Aufl\"{o}sung} - \newcommand{\propertyname}{Property} - \newcommand{\introductionname}{Einleitung} - \newcommand\bioinfo[2]{\gdef\@bioinfo{\textbf{#1}: #2}} - \newcommand{\updatename}{Updates:} - \renewcommand{\ebibname}{Bibliographie} - \newcommand{\historyname}{Version der Geschichte} -}{\relax} - -\ifdefstring{\ELEGANT@lang}{es}{ - \RequirePackage[spanish]{babel} - \setlength\parindent{2em} - \newcommand\figref[1]{\textbf{Figura}~\ref{#1}} - \newcommand\tabref[1]{\textbf{Tabla}~\ref{#1}} - \renewcommand{\spanishchaptername}{Capítulo} - \newcommand{\authorname}{\textbf{Autor: }} - \newcommand{\institutename}{\textbf{Instituto: }} - \newcommand{\datename}{\textbf{Fecha: }} - \newcommand{\versionname}{\textbf{Versión: }} - \newcommand{\notename}{Nota} - \newcommand{\proofname}{Demostración} - \newcommand{\problemname}{Problema} - \newcommand{\definitionname}{Definición} - \newcommand{\theoremname}{Teorema} - \newcommand{\axiomname}{Axioma} - \newcommand{\postulatename}{Postulado} - \newcommand{\lemmaname}{Lema} - \newcommand{\propositionname}{Proposición} - \newcommand{\corollaryname}{Corolario} - \newcommand{\examplename}{Ejemplo} - \newcommand{\exercisename}{Ejercicio} - \newcommand{\remarkname}{Comentario} - \newcommand{\assumptionname}{Asunto} - \newcommand{\conclusionname}{Conclusión} - \newcommand{\solutionname}{Solución} - \newcommand{\propertyname}{Propiedad} - \newcommand{\introductionname}{Introducción} - \newcommand{\problemsetname}{Ejercicio} - \newcommand\bioinfo[2]{\gdef\@bioinfo{\textbf{#1}: #2}} - \newcommand{\updatename}{Actualización:} - \newcommand{\ebibname}{Bibliografía} - \newcommand{\historyname}{Historial de versiones} -}{\relax} - -\ifdefstring{\ELEGANT@lang}{mn}{ - \RequirePackage[mongolian]{babel} - \RequirePackage[utf8]{inputenc} - \RequirePackage[T2A]{fontenc} - \setlength\parindent{2em} - \newcommand\figref[1]{\textbf{Зураг}\ref{#1}} - \newcommand\tabref[1]{\textbf{Хүснэгт}\ref{#1}} - \renewcommand{\chaptername}{Бүлэг} - \newcommand{\authorname}{\textbf{Зохиогч: }} - \newcommand{\institutename}{\textbf{Сургууль: }} - \newcommand{\datename}{\textbf{Огноо: }} - \newcommand{\versionname}{\textbf{Хувилбар: }} - \newcommand{\notename}{Тэмдэглэл} - \newcommand{\proofname}{Баталгаа} - \newcommand{\problemname}{Бодлого} - \newcommand{\definitionname}{Тодорхойлолт} - \newcommand{\theoremname}{Томьёо} - \newcommand{\axiomname}{Аксиом} - \newcommand{\postulatename}{Постулат} - \newcommand{\lemmaname}{Лемма} - \newcommand{\propositionname}{Таамаглал} - \newcommand{\corollaryname}{Үр дүн} - \newcommand{\examplename}{Жишээ} - \newcommand{\exercisename}{Дасгал} - \newcommand{\remarkname}{Тайлбар} - \newcommand{\assumptionname}{Урьдчилсан нөхцөл} - \newcommand{\conclusionname}{Дүгнэлт} - \newcommand{\solutionname}{Хариулт} - \newcommand{\propertyname}{Шинж чанар} - \newcommand{\introductionname}{Удиртгал} - \newcommand{\problemsetname}{Бодлогууд} - \newcommand\bioinfo[2]{\gdef@bioinfo{\textbf{#1}: #2}} - \newcommand{\updatename}{Шинэчлэлтүүд:} - \newcommand{\ebibname}{Ном зүй} - \newcommand{\historyname}{Хувилбарын түүх} -}{\relax} - - -\ifdefstring{\ELEGANT@lang}{pt}{ - \RequirePackage[portuguese]{babel} - \setlength\parindent{2em} - \newcommand\figref[1]{\textbf{Figura}~\ref{#1}} - \newcommand\tabref[1]{\textbf{Tabela}~\ref{#1}} - \renewcommand{\chaptername}{Capítulo} - \newcommand{\authorname}{\textbf{Autor: }} - \newcommand{\institutename}{\textbf{Instituição: }} - \newcommand{\datename}{\textbf{Data: }} - \newcommand{\versionname}{\textbf{Versão: }} - \newcommand{\notename}{Observação} - \newcommand{\proofname}{Demostração} - \newcommand{\problemname}{Problema} - \newcommand{\definitionname}{Definição} - \newcommand{\theoremname}{Teorema} - \newcommand{\axiomname}{Axioma} - \newcommand{\postulatename}{Postulado} - \newcommand{\lemmaname}{Lema} - \newcommand{\propositionname}{Proposição} - \newcommand{\corollaryname}{Corolário} - \newcommand{\examplename}{Exemplo} - \newcommand{\exercisename}{Exercício} - \newcommand{\remarkname}{Comentário} - \newcommand{\assumptionname}{Assunto} - \newcommand{\conclusionname}{Conclusão} - \newcommand{\solutionname}{Soluções} - \newcommand{\propertyname}{Propiedade} - \newcommand{\introductionname}{Introdução} - \newcommand{\problemsetname}{Questão} - \newcommand\bioinfo[2]{\gdef\@bioinfo{\textbf{#1}: #2}} - \newcommand{\updatename}{Atualização: } - \newcommand{\ebibname}{Bibliografia} - \newcommand{\historyname}{Histórico de versões} -}{\relax} - - -\ifdefstring{\ELEGANT@lang}{jp}{ - \RequirePackage{luatexja} - \setlength\parindent{2em} - \renewcommand{\contentsname}{目次} - \newcommand\figref[1]{\textbf{図}~\ref{#1}} - \newcommand\tabref[1]{\textbf{表}~\ref{#1}} - \renewcommand{\partname}{\color{structurecolor}} - \renewcommand{\listfigurename}{イラストカタログ} - \renewcommand{\listtablename}{表カタログ} - \renewcommand{\bibname}{参考文献} - \renewcommand{\appendixname}{付録} - \renewcommand{\chaptername}{第 \thechapter 章} - \newcommand{\authorname}{\textbf{著者:}} - \newcommand{\institutename}{\textbf{組織団体:}} - \newcommand{\datename}{\textbf{日付:}} - \newcommand{\versionname}{\textbf{\citshape バージョン:}} - \newcommand{\notename}{ノート} - \newcommand{\proofname}{証明} - \newcommand{\problemname}{問題} - \newcommand{\definitionname}{定義} - \newcommand{\theoremname}{定理} - \newcommand{\axiomname}{公理} - \newcommand{\postulatename}{公準} - \newcommand{\lemmaname}{補題} - \newcommand{\propositionname}{命題} - \newcommand{\corollaryname}{系} - \newcommand{\examplename}{例題} - \newcommand{\instancename}{例} - \newcommand{\exercisename}{練習} - \newcommand{\remarkname}{注} - \newcommand{\assumptionname}{仮設} - \newcommand{\conclusionname}{結論} - \newcommand{\solutionname}{解答} - \newcommand{\propertyname}{性質} - \newcommand{\introductionname}{内容概要} - \newcommand\bioinfo[2]{\gdef\@bioinfo{\textbf{#1}: #2}} - \newcommand{\updatename}{更新:} - \newcommand{\ebibname}{参考文献} - \newcommand{\historyname}{バージョン更新履歴} + \newcommand{\mightguyname}{迈特凯} }{\relax} @@ -831,7 +441,7 @@ \RequirePackage{tikz} %% load tikz without tikz \usetikzlibrary{backgrounds,calc,shadows,positioning,fit} \newcommand*\circled[1]{\tikz[baseline=(char.base)]{ - \node[shape=circle,draw,inner sep=1pt] (char) {#1};}} + \node[shape=circle,draw,inner sep=1pt] (char) {#1};}} % https://tex.stackexchange.com/questions/7032/good-way-to-make-textcircled-numbers \newcommand*{\eitemi}{\tikz \draw [baseline, ball color=structurecolor,draw=none] circle (2pt);} @@ -852,22 +462,8 @@ \ifdefstring{\ELEGANT@lang}{cn}{ \ifdefstring{\ELEGANT@scheme}{chinese}{ \newcommand{\xchaptertitle}{第\zhnumber{\arabic{chapter}}章} }{ - \newcommand{\xchaptertitle}{第 \thechapter{} 章}} -% Hyperref 2022/05/16's changelog.txt said -% * nameref is loaded always and earlier (issue#235) - \AtBeginDocument{ - \ifELEGANT@Hy@later - \patchcmd{\NR@chapter}% - {\numberline{\thechapter}}{\numberline{\xchaptertitle}}% - {}{\fail} - \else - \patchcmd{\Hy@org@chapter}% - {\numberline{\thechapter}}{\numberline{\xchaptertitle}}% - {}{\fail} - \fi - } - } - {\newcommand{\xchaptertitle}{\chaptername~\thechapter~}} + \newcommand{\xchaptertitle}{第 \thechapter{} 章}} }{ + \newcommand{\xchaptertitle}{\chaptername~\thechapter~}} \setcounter{secnumdepth}{5} \titleformat{\chapter}[\style]{\bfseries}{ @@ -888,155 +484,144 @@ -%%define the -%%definition theorem postulate axiom corollary lemma proposition -%%and proof environment +%%define the note and proof environment \RequirePackage{pifont,manfnt,bbding} \RequirePackage[many]{tcolorbox} % \newlength{\normalparindent} % \setlength{\normalparindent}{\parindent} -\newcommand{\ELEGANT@tmp@tl}{} -\ifELEGANT@usesamecnt - \newcounter{ELEGANT@samecnt} - \counterwithin{ELEGANT@samecnt}{\ELEGANT@thmcnt} - \tcbset{ - new/usesamecnt/.style = {use counter = ELEGANT@samecnt} - } -\else - \tcbset{ - new/usesamecnt/.style = {} - } -\fi - \ifdefstring{\ELEGANT@mode}{fancy}{ \tcbset{ common/.style={ - fontupper=\citshape, - lower separated=false, - % before upper={\setlength{\parindent}{\normalparindent}}, - coltitle=white, - colback=gray!5, - boxrule=0.5pt, - fonttitle=\bfseries, - enhanced, - breakable, - top=8pt, - before skip=8pt, - attach boxed title to top left={ - yshift=-0.11in, - xshift=0.15in}, - boxed title style={ - boxrule=0pt, - colframe=white, - arc=0pt, - outer arc=0pt}, - separator sign={.},}, + fontupper=\citshape, + lower separated=false, + % before upper={\setlength{\parindent}{\normalparindent}}, + coltitle=white, + colback=gray!5, + boxrule=0.5pt, + fonttitle=\bfseries, + enhanced, + breakable, + top=8pt, + before skip=8pt, + attach boxed title to top left={ + yshift=-0.11in, + xshift=0.15in}, + boxed title style={ + boxrule=0pt, + colframe=white, + arc=0pt, + outer arc=0pt}, + separator sign={.}, + before upper={\setlength{\parindent}{2em}},% 给所有的环境都设置首行缩进 + }, defstyle/.style={ - common, - colframe=main, - colback=main!5, - colbacktitle=main, - overlay unbroken and last={ - \node[anchor=south east, outer sep=0pt] at (\linewidth-width,0) { - \textcolor{main}{$\clubsuit$}};}}, + common, + colframe=main, + colback=main!5, + colbacktitle=main, + overlay unbroken and last={ + \node[anchor=south east, outer sep=0pt] at (\linewidth-width,0) { + \textcolor{main}{$\clubsuit$}};}}, thmstyle/.style={ - common, - colframe=second, - colback=second!5, - colbacktitle=second, - overlay unbroken and last={ - \node[anchor=south east, outer sep=0pt] at (\linewidth-width,0) { - \textcolor{second}{$\heartsuit$}};}}, - prostyle/.style={ - common, - colframe=third, - colback=third!5, - colbacktitle=third, - overlay unbroken and last={ - \node[anchor=south east, outer sep=0pt] at (\linewidth-width,0) { - \textcolor{third}{$\spadesuit$}};}}, - ELEGANT@title/.code n args={2} + common, + colframe=second, + colback=second!5, + colbacktitle=second, + overlay unbroken and last={ + \node[anchor=south east, outer sep=0pt] at (\linewidth-width,0) { + \textcolor{second}{$\heartsuit$}};}}, + propstyle/.style={ + common, + colframe=third, + colback=third!5, + colbacktitle=third, + overlay unbroken and last={ + \node[anchor=south east, outer sep=0pt] at (\linewidth-width,0) { + \textcolor{third}{$\spadesuit$}};}},} + % \newtcbtheorem[auto counter,number within=chapter]{definition}{\definitionname}{defstyle}{def} + \DeclareTColorBox[auto counter,number within=\ELEGANT@thmcnt]{definition}{ g o t\label g }{ + common,defstyle, + IfValueTF={#1} + {title={\definitionname~\thetcbcounter\ (#1)}} { - - \tcbset - { - title= - { - \csname #1name\endcsname~% - \ifdef{\thetcbcounter}{\thetcbcounter}{}% - \ifblank{#2}{}{\ (#2)} - } - } + IfValueTF={#2} + {title={\definitionname~\thetcbcounter\ (#2)}} + {title=\definitionname~\thetcbcounter} }, - ELEGANT@label/.code n args={2} + IfBooleanTF={#3}{label=#4}{label={def:#4}}} + % \newtcbtheorem[auto counter,number within=chapter]{theorem}{\theoremname}{thmstyle}{thm} + \DeclareTColorBox[auto counter,number within=\ELEGANT@thmcnt]{theorem}{ g o t\label g }{ + common,thmstyle, + IfValueTF={#1} + {title={\theoremname~\thetcbcounter\ (#1)}} { - \ifblank{#2} - {}{\tcbset{label={#1:#2}}} - } - } - - % define an internal control sequence \ELEGANT@newtheorem for fancy mode's newtheorem - % #1 is the environment name, #2 is the prefix of label, #3 is the style - % style: thmstyle, defstyle, prostyle - % e.g. \ELEGANT@newtheorem{theorem}{thm}{thmstyle} - % will define two environments: numbered ``theorem'' and no-numbered ``theorem*'' - % WARNING FOR MULTILINGUAL: this cs will automatically find \theoremname's definition, - % WARNING FOR MULTILINGUAL: it should be defined in language settings. - \NewDocumentCommand \ELEGANT@newtheorem { m m m O{} }{ - \ifcsundef{#1name}{% - \ClassError{elegantbook}{% - \ #1name undefined, \MessageBreak - Please check in language setting - }{} - }{\relax} - \expandafter\ifblank\expandafter{#4}{ - \tcbset{ - new/usecnt/.style={} - } - }{ - \tcbset{ - new/usecnt/.style= {use counter from = #4} - } - } - \DeclareTColorBox[auto counter,number within=\ELEGANT@thmcnt,usesamecnt,usecnt]{#1}{ g o t\label g }{ - common,#3, - IfValueTF={##1} - {ELEGANT@title={#1}{##1}} - { - IfValueTF={##2} - {ELEGANT@title={#1}{##2}} - {ELEGANT@title={#1}{}} - }, - IfValueT={##4} - { - IfBooleanTF={##3} - {label={##4}} - {ELEGANT@label={#2}{##4}} - } - } - \DeclareTColorBox{#1*}{ g o }{ - common,#3, - IfValueTF={##1} - {ELEGANT@title={#1}{##1}} - { - IfValueTF={##2} - {ELEGANT@title={#1}{##2}} - {ELEGANT@title={#1}{}} - }, - } - } - % define several environment - % we define headers like \definitionname before - \ELEGANT@newtheorem{theorem}{thm}{thmstyle} - \ELEGANT@newtheorem{definition}{def}{defstyle} - \ELEGANT@newtheorem{postulate}{pos}{thmstyle} - \ELEGANT@newtheorem{axiom}{axi}{thmstyle} - \ELEGANT@newtheorem{corollary}{cor}{thmstyle} - \ELEGANT@newtheorem{lemma}{lem}{thmstyle} - \ELEGANT@newtheorem{proposition}{pro}{prostyle} + IfValueTF={#2} + {title={\theoremname~\thetcbcounter\ (#2)}} + {title=\theoremname~\thetcbcounter} + }, + IfBooleanTF={#3}{label=#4}{label={thm:#4}}} + % \newtcbtheorem[auto counter,number within=chapter]{postulate}{\postulatename}{thmstyle}{pos} + \DeclareTColorBox[auto counter,number within=\ELEGANT@thmcnt]{postulate}{ g o t\label g }{ + common,thmstyle, + IfValueTF={#1} + {title={\postulatename~\thetcbcounter\ (#1)}} + { + IfValueTF={#2} + {title={\postulatename~\thetcbcounter\ (#2)}} + {title=\postulatename~\thetcbcounter} + }, + IfBooleanTF={#3}{label=#4}{label={pos:#4}}} + % \newtcbtheorem[auto counter,number within=chapter]{axiom}{\axiomname}{thmstyle}{axi} + \DeclareTColorBox[auto counter,number within=\ELEGANT@thmcnt]{axiom}{ g o t\label g }{ + common,thmstyle, + IfValueTF={#1} + {title={\axiomname~\thetcbcounter\ (#1)}} + { + IfValueTF={#2} + {title={\axiomname~\thetcbcounter\ (#2)}} + {title=\axiomname~\thetcbcounter} + }, + IfBooleanTF={#3}{label=#4}{label={axi:#4}}} + % \newtcbtheorem[auto counter,number within=chapter]{corollary}{\corollaryname}{thmstyle}{cor} + \DeclareTColorBox[auto counter,number within=\ELEGANT@thmcnt]{corollary}{ g o t\label g }{ + common,thmstyle, + IfValueTF={#1} + {title={\corollaryname~\thetcbcounter\ (#1)}} + { + IfValueTF={#2} + {title={\corollaryname~\thetcbcounter\ (#2)}} + {title=\corollaryname~\thetcbcounter} + }, + IfBooleanTF={#3}{label=#4}{label={cor:#4}}} + % \newtcbtheorem[auto counter,number within=chapter]{lemma}{\lemmaname}{thmstyle}{lem} + \DeclareTColorBox[auto counter,number within=\ELEGANT@thmcnt]{lemma}{ g o t\label g }{ + common,thmstyle, + IfValueTF={#1} + {title={\lemmaname~\thetcbcounter\ (#1)}} + { + IfValueTF={#2} + {title={\lemmaname~\thetcbcounter\ (#2)}} + {title=\lemmaname~\thetcbcounter} + }, + IfBooleanTF={#3}{label=#4}{label={lem:#4}}} + % \newtcbtheorem[auto counter,number within=chapter]{proposition}{\propositionname}{propstyle}{pro} + \DeclareTColorBox[auto counter,number within=\ELEGANT@thmcnt]{proposition}{ g o t\label g }{ + common,propstyle, + IfValueTF={#1} + {title={\propositionname~\thetcbcounter\ (#1)}} + { + IfValueTF={#2} + {title={\propositionname~\thetcbcounter\ (#2)}} + {title=\propositionname~\thetcbcounter} + }, + IfBooleanTF={#3}{label=#4}{label={pro:#4}}} + + }{\relax} + + \ifdefstring{\ELEGANT@mode}{simple}{ \let\openbox\relax \RequirePackage{amsthm} @@ -1044,7 +629,7 @@ % \let\proofname\relax \let\endproof\relax - % declare new theorem styles: defstyle, thmstyle, prostyle + % declare a new theorem style \newtheoremstyle{defstyle}{3pt}{3pt}{\citshape}{-3pt}{ \bfseries\color{main}}{}{0.5em}{\thmname{#1} \thmnumber{#2} \thmnote{(#3)}} \newtheoremstyle{thmstyle}{3pt}{3pt}{\citshape}{-3pt}{ @@ -1052,104 +637,102 @@ \newtheoremstyle{prostyle}{3pt}{3pt}{\citshape}{-3pt}{ \bfseries\color{third}}{}{0.5em}{\thmname{#1} \thmnumber{#2} \thmnote{(#3)}} - % define an internal control sequence \ELEGANT@newtheorem for simple mode's newtheorem - % #1 is the environment name, #2 is the style - % style: thmstyle, defstyle, prostyle - % e.g. \ELEGANT@newtheorem{theorem}{thmstyle} - % will define two environments: numbered ``theorem'' and no-numbered ``theorem*'' - % WARNING FOR MULTILINGUAL: this cs will automatically find \theoremname's definition, - % WARNING FOR MULTILINGUAL: it should be defined in language settings. - \NewDocumentCommand \ELEGANT@newtheorem { m m O{} } { - \theoremstyle{#2} - \ifELEGANT@usesamecnt - \newtheorem{#1}[ELEGANT@samecnt]{\csname #1name\endcsname} - \else - \ifblank{#3}{ - \newtheorem{#1}{\csname #1name\endcsname}[\ELEGANT@thmcnt] - }{ - \newtheorem{#1}[#3]{\csname #1name\endcsname} - } - \fi - \newtheorem*{#1*}{\csname #1name\endcsname} - } - % define several environment - % we define headers like \definitionname before - \ELEGANT@newtheorem{theorem}{thmstyle} - \ELEGANT@newtheorem{definition}{defstyle} - \ELEGANT@newtheorem{postulate}{thmstyle} - \ELEGANT@newtheorem{axiom}{thmstyle} - \ELEGANT@newtheorem{corollary}{thmstyle} - \ELEGANT@newtheorem{lemma}{thmstyle} - \ELEGANT@newtheorem{proposition}{prostyle} + \theoremstyle{defstyle} % definition style + \newtheorem{definition}{\definitionname}[\ELEGANT@thmcnt] + + \theoremstyle{thmstyle} %theorem style + \newtheorem{theorem}{\theoremname}[\ELEGANT@thmcnt] + \newtheorem{lemma}{\lemmaname}[\ELEGANT@thmcnt] + \newtheorem{corollary}{\corollaryname}[\ELEGANT@thmcnt] + \newtheorem{postulate}{\postulatename}[\ELEGANT@thmcnt] + \newtheorem{axiom}{\axiomname}[\ELEGANT@thmcnt] + + \theoremstyle{prostyle} % proposition style + \newtheorem{proposition}{\propositionname}[\ELEGANT@thmcnt] + }{\relax} -% define an user control sequence \elegantnewtheorem -% #1 is the evironment, #2 is the theorem header -% #3 is the style #4 is the prefix for fancy mode -% style: thmstyle, defstyle, prostyle -% if #4 is given in simple mode, an error will be raised -% if #4 isn't given in fancy mode, the prefix will be set equal to #1, -% and a warning will be raised -\newcommand{\ELEGANT@newtheorem@warning}{} -\newcommand{\ELEGANT@newtheorem@error}{} -\newcommand{\ELEGANT@usesamecnt@warning}{} -\NewDocumentCommand\elegantnewtheorem{ m m m g O{} } - { - \renewcommand{\ELEGANT@usesamecnt@warning}{ - \ClassWarning{elegantbook}{% - [#5] won't make sence with option \MessageBreak - `usesamecnt'. - } - } - \renewcommand{\ELEGANT@newtheorem@warning}{ - \ClassWarning{elegantbook}{% - Because you didn't provide a prefix, \MessageBreak - we use #1 as the default prefix. \MessageBreak - You have to use \MessageBreak - \ref{#1:label} to refer a \MessageBreak - \begin{#1}{name}{label} environment. \MessageBreak - } - } - \renewcommand{\ELEGANT@newtheorem@error}{ - \ClassError{elegantbook}{% - You can't set a prefix in mode ``simple''.\MessageBreak - Just use \MessageBreak - \elegantnewtheorem{#1}{#2}{#3} - }{% - We are using ``amsthm'' package to \MessageBreak - generate theorem-like theorem. \MessageBreak - The 4th parameter ``prefix'' isn't allowed. - } - } - \ifELEGANT@usesamecnt - \ifblank{#5}{}{\ELEGANT@usesamecnt@warning} - \else - \renewcommand{\ELEGANT@tmp@tl}{#5} - \fi - \expandafter\def\csname #1name\endcsname{#2} - \ifdefstring{\ELEGANT@mode}{simple}{% - \IfValueTF{#4} - {\ELEGANT@newtheorem@error} - {\ELEGANT@newtheorem{#1}{#3}[\ELEGANT@tmp@tl]} - }{\relax} - \ifdefstring{\ELEGANT@mode}{fancy}{% - \IfValueTF{#4} - { - \def\ELEGANT@temp@prefix{#4} - \ifdefempty{\ELEGANT@temp@prefix} - { - \ELEGANT@newtheorem{#1}{#1}{#3}[\ELEGANT@tmp@tl] - \ELEGANT@newtheorem@warning - } - {\ELEGANT@newtheorem{#1}{#4}{#3}[\ELEGANT@tmp@tl]} - } - { - \ELEGANT@newtheorem{#1}{#1}{#3}[\ELEGANT@tmp@tl] - \ELEGANT@newtheorem@warning - } - }{\relax} +% 自定义环境颜色 +\definecolor{mightguycolor}{RGB}{64, 111, 77} +\definecolor{hashiramacolor}{RGB}{255,0,0} +\definecolor{tobiramacolor}{RGB}{169, 166, 171} +\definecolor{madaracolor}{RGB}{68, 89, 210} +\definecolor{mightguycolor}{RGB}{64, 111, 77} +\definecolor{talkcolor}{RGB}{34, 139, 34} +\definecolor{cqqcolor}{RGB}{252, 194, 0} +\definecolor{whitehatcolor}{RGB}{220,220,220} +\definecolor{bluespaceprojekt}{RGB}{100, 149, 237} +\definecolor{outsiderbackgroundcolor}{RGB}{50, 39, 27} +\definecolor{outsidertextcolor}{RGB}{245, 245, 220} + +% 自定义的环境 +\newcommand{\createMyColorEnv}[5]{ + \ifdefstring{\ELEGANT@mode}{fancy}{ + \DeclareTColorBox[auto counter,number within=\ELEGANT@thmcnt]{#1}{ g o t\label g }{ + common,propstyle, + IfValueTF={##1} + {title={#2~\thetcbcounter\ (##1)}} + { + IfValueTF={##2} + {title={#2~\thetcbcounter\ (##2)}} + {title=#2~\thetcbcounter} + }, + IfBooleanTF={##3}{label=##4}{label={might:##4}}, + colframe=#3, % 设置边框颜色 + colback=#3!10, % 设置背景颜色 + colbacktitle=#3, % 设置标题背景颜色 + fontupper=\songti, + overlay unbroken and last={ + \node[anchor=south east, outer sep=0pt] at (\linewidth-width,0) { + \textcolor{#3}{#4}};} + }}{\relax} + + \ifdefstring{\ELEGANT@mode}{simple}{ + \theoremstyle{mightstyle} % proposition style + \newtheorem{#1}{#2}[\ELEGANT@thmcnt] } +} + +% 使用函数来设置自定义环境,更改自 prostyle 环境。 +% 第一项是源码环境名称、第二项是显示出来的环境名字、第三个是环境颜色 +% 第四项是右下角填充的小图案,分为$\clubsuit$,$\heartsuit$,$\spadesuit$,三种图案,后续可能会增加。 +% 第五项是计数器,不同的环境应该使用不同的计数器免得自动编号互相影响 +\createMyColorEnv{madara}{宇智波斑}{madaracolor}{$\clubsuit$}{mad} +\createMyColorEnv{outsider}{界外魔}{outsider}{$\heartsuit$}{out} +\createMyColorEnv{justtalk}{火影新编}{talkcolor}{$\spadesuit$}{jus} +\createMyColorEnv{hashirama}{千手柱间}{hashiramacolor}{$\clubsuit$}{has} +\createMyColorEnv{tobirama}{千手扉间}{tobiramacolor}{$\heartsuit$}{tob} +\createMyColorEnv{mightguy}{迈特凯}{mightguycolor}{$\spadesuit$}{mig} +\createMyColorEnv{cqq}{CQQ}{cqqcolor}{$\clubsuit$}{cqq} +\createMyColorEnv{whitehat}{白帽}{whitehatcolor}{$\heartsuit$}{whi} + +% 设置蓝色空间号的框子 +\newtcolorbox[auto counter, number within=section]{bluespace}[1][]{ + reset, % 这一句话可以重置掉所有的预设 + title={\kaishu\scalebox{1.75}{\ding{99} \ding{99} 蓝色空间号 + \ding{99} \ding{99}}}, % 设置标题样式 + colframe=bluespaceprojekt, % 设置边框颜色 + colback=bluespaceprojekt!12!white, % 设置背景颜色 + coltitle=white, % 设置标题颜色 + fontupper=\heiti, % 设置正文字体 + boxed title style={colback=bluespaceprojekt!12!white}, % 设置标题框样式 + boxed title style={boxsep=1ex,sharp corners}, % 设置标题框的边框间距和直角边框 + % overlay unbroken and first={ + % \node[below right,font=\normalsize,color=red,text width=.8\linewidth] + % at (title.north east) {#1}; % 在标题右上角显示自定义文本 + % }, + halign title=center, % 标题居中 + before upper={\parindent=2em} % 设置首行缩进 +} + +% 加载选项包 +\RequirePackage{ifthen} +% 自定义命令 设置奇怪的自定义加粗指令 +\newcommand{\customsf}[2]{% + \ifthenelse{\equal{#1}{bold}}{\textbf{\textsf{#2}}}{\textsf{#2}}% +} + % main(green-def): example exercise problem solution % second(orange-thm): proof note remark @@ -1172,8 +755,8 @@ \refstepcounter{exer} \par\noindent\makebox[-3pt][r]{ \scriptsize\color{red!90}\HandPencilLeft\quad} - \textbf{\color{main}{\exercisename} \theexer #1 }\rmfamily}{ - \par\ignorespacesafterend} + \textbf{\color{main}{\exercisename} \theexer #1 }\rmfamily}{ + \par\ignorespacesafterend} %% Problem with counter \newcounter{prob}[chapter] @@ -1187,7 +770,7 @@ \newenvironment{note}{ \par\noindent\makebox[-3pt][r]{ \scriptsize\color{red!90}\textdbend\quad} - \textbf{\color{second}\notename} \citshape}{\par} + \textbf{\color{second}\notename} \citshape}{\par} \newenvironment{proof}{ \par\noindent\textbf{\color{second}\proofname\;} @@ -1205,24 +788,23 @@ \RequirePackage{multicol} \tcbset{ introductionsty/.style={ - enhanced, - breakable, - colback=structurecolor!10, - colframe=structurecolor, - fonttitle=\bfseries, - colbacktitle=structurecolor, - fontupper=\citshape, - attach boxed title to top center={yshift=-3mm,yshifttext=-1mm}, - boxrule=0pt, - toprule=0.5pt, - bottomrule=0.5pt, - top=8pt, - before skip=8pt, - sharp corners - }, + enhanced, + breakable, + colback=structurecolor!10, + colframe=structurecolor, + fonttitle=\bfseries, + colbacktitle=structurecolor, + fontupper=\citshape, + attach boxed title to top center={yshift=-3mm,yshifttext=-1mm}, + boxrule=0pt, + toprule=0.5pt, + bottomrule=0.5pt, + top=8pt, + before skip=8pt, + sharp corners + }, } - \newenvironment{introduction}[1][\introductionname]{ \begin{tcolorbox}[introductionsty,title={#1}] \begin{multicols}{2} @@ -1249,9 +831,9 @@ \ifdefstring{\ELEGANT@result}{noanswer}{ \AtBeginDocument{ - \excludecomment{solution} - \excludecomment{proof} - \excludecomment{inline} + \excludecomment{solution} + \excludecomment{proof} + \excludecomment{inline} } }{\relax} @@ -1279,74 +861,74 @@ \renewcommand*{\maketitle}{% -\hypersetup{pageanchor=false} -\pagenumbering{Alph} -\begin{titlepage} - \newgeometry{margin = 0in} - \parindent=0pt - \ifdefstring{\ELEGANT@device}{normal}{ - \ifcsname @cover\endcsname - \includegraphics[width=\linewidth]{\@cover} - \else - \includegraphics[width=\linewidth]{example-image} - \fi - }{\relax} - \ifdefstring{\ELEGANT@device}{pad}{ - \ifcsname @cover\endcsname - \includegraphics[trim=0 26bp 0 26bp,clip=true, width=\linewidth]{\@cover} - \else - \includegraphics[trim=0 26bp 0 26bp,clip=true, width=\linewidth]{example-image} - \fi - }{\relax} - \setlength{\fboxsep}{0pt} - \colorbox{coverlinecolor}{\makebox[\linewidth][c]{\shortstack[c]{\vspace{0.5in}}}} - \vfill - \vskip-2ex - \hspace{2em} - \parbox{0.8\textwidth}{ - \bfseries\Huge + \hypersetup{pageanchor=false} + \pagenumbering{Alph} + \begin{titlepage} + \newgeometry{margin = 0in} + \parindent=0pt + \ifdefstring{\ELEGANT@device}{normal}{ + \ifcsname @cover\endcsname + \includegraphics[width=\linewidth]{\@cover} + \else + \includegraphics[width=\linewidth]{example-image} + \fi + }{\relax} + \ifdefstring{\ELEGANT@device}{pad}{ + \ifcsname @cover\endcsname + \includegraphics[trim=0 26bp 0 26bp,clip=true, width=\linewidth]{\@cover} + \else + \includegraphics[trim=0 26bp 0 26bp,clip=true, width=\linewidth]{example-image} + \fi + }{\relax} + \setlength{\fboxsep}{0pt} + \colorbox{coverlinecolor}{\makebox[\linewidth][c]{\shortstack[c]{\vspace{0.5in}}}} + \vfill + \vskip-2ex + \hspace{2em} + \parbox{0.8\textwidth}{ + \bfseries\Huge \ifcsname @title\endcsname \@title \fi - \par} - \vfill - \vspace{-1.0cm} - \setstretch{2.5} - \hspace{2.5em} - \begin{minipage}[c]{0.67\linewidth} - {\color{darkgray}\bfseries\Large - \ifcsname @subtitle\endcsname\@subtitle\\[2ex]\fi} - \color{gray}\normalsize - {\renewcommand{\arraystretch}{0.618} - \begin{tabular}{l} - % \ifcsname @author\endcsname \authorname \@author\\\fi - \ifx\@author\empty\else\authorname\cnormal\@author\\ \fi - \ifcsname @institute\endcsname \institutename \cnormal\@institute\\ \fi - % \ifcsname @date\endcsname \@date\\\fi - \ifx\@date\empty\else\datename\cnormal\@date \\ \fi - \ifcsname @version\endcsname \cnormal\versionname\@version\\ \fi - \ifcsname @bioinfo\endcsname \cnormal\@bioinfo\\ \fi - \end{tabular}} - \end{minipage} - \begin{minipage}[c]{0.27\linewidth} - \begin{tikzpicture}[remember picture,overlay] - \begin{pgfonlayer}{background} - \node[opacity=0.8, + \par} + \vfill + \vspace{-1.0cm} + \setstretch{2.5} + \hspace{2.5em} + \begin{minipage}[c]{0.67\linewidth} + {\color{darkgray}\bfseries\Large + \ifcsname @subtitle\endcsname\@subtitle\\[2ex]\fi} + \color{gray}\normalsize + {\renewcommand{\arraystretch}{0.618} + \begin{tabular}{l} + % \ifcsname @author\endcsname \authorname \@author\\\fi + \ifx\@author\empty\else\authorname\cnormal\@author \\ \fi + \ifcsname @institute\endcsname \institutename \cnormal\@institute \\ \fi + % \ifcsname @date\endcsname \@date\\\fi + \ifx\@date\empty\else\datename\cnormal\@date \\ \fi + \ifcsname @version\endcsname \cnormal\versionname\@version \\ \fi + \ifcsname @bioinfo\endcsname \cnormal\@bioinfo \\ \fi + \end{tabular}} + \end{minipage} + \begin{minipage}[c]{0.27\linewidth} + \begin{tikzpicture}[remember picture,overlay] + \begin{pgfonlayer}{background} + \node[opacity=0.8, anchor=south east, outer sep=0pt, inner sep=0pt] at ($(current page.south east) +(-0.8in,1.5in)$) { - \ifcsname @logo\endcsname\includegraphics[width=4.2cm]{\@logo}\fi}; - \end{pgfonlayer} - \end{tikzpicture} - \end{minipage} - \vfill - \begin{center} - \setstretch{1.3} - \parbox[t]{0.7\textwidth}{\centering \citshape - \ifcsname @extrainfo\endcsname\@extrainfo\fi} - \end{center} - \vfill -\end{titlepage} -\restoregeometry -\thispagestyle{empty}} + \ifcsname @logo\endcsname\includegraphics[width=4.2cm]{\@logo}\fi}; + \end{pgfonlayer} + \end{tikzpicture} + \end{minipage} + \vfill + \begin{center} + \setstretch{1.3} + \parbox[t]{0.7\textwidth}{\centering \citshape + \ifcsname @extrainfo\endcsname\@extrainfo\fi} + \end{center} + \vfill + \end{titlepage} + \restoregeometry + \thispagestyle{empty}} \newcommand{\dollar}{\mbox{\textdollar}} @@ -1355,8 +937,8 @@ \renewcommand{\ttdefault}{cmtt} \lstdefinestyle{mystyle}{ basicstyle=% - \ttfamily - \lst@ifdisplaystyle\small\fi + \ttfamily + \lst@ifdisplaystyle\small\fi } \lstset{basicstyle=\ttfamily,style=mystyle,breaklines=true} @@ -1370,9 +952,9 @@ breaklines=true, keywordstyle=\color{winered}, commentstyle=\color{gray}, - emph={elegantpaper,fontenc,fontspec,xeCJK,citestyle,FiraMono,xunicode,figure,fig,image,img,table,itemize,enumerate,ctex,microtype,description,times,booktabs,tabular,PDFLaTeX,XeLaTeX,type1cm,BibTeX,device,color,mode,lang,amsthm,tcolorbox,titlestyle,cite,ctex,listings,base,math,scheme,toc,esint,chinesefont,amsmath,bibstyle,natbib,pgfornament,addbibresource,printbibliography}, + emph={elegantpaper,fontenc,fontspec,xeCJK,citestyle,FiraMono,xunicode,figure,fig,image,img,table,itemize,enumerate,ctex,microtype,description,times,booktabs,tabular,PDFLaTeX,XeLaTeX,type1cm,BibTeX,device,color,mode,lang,amsthm,tcolorbox,titlestyle,cite,ctex,listings,base,math,scheme,toc,esint,chinesefont,amsmath,bibstyle,natbib,pgfornament}, emphstyle={\color{frenchplum}}, - morekeywords={DeclareSymbolFont,SetSymbolFont,toprule,midrule,bottomrule,institute,version,includegraphics,setmainfont,setsansfont,setmonofont ,setCJKmainfont,setCJKsansfont,setCJKmonofont,RequirePackage,figref,tabref,email,maketitle,keywords,definecolor,extrainfo,logo,cover,subtitle,appendix,chapter,section,hypersetup,mainmatter,frontmatter,tableofcontents,elegantpar,heiti,kaishu,lstset,pagecolor,zhnumber,marginpar,part,equote,marginnote,bioinfo,datechange,listofchange,lvert,lastpage,songti,heiti,fangsong,setCJKfamilyfont,textbf,elegantnewtheorem,thmcnt,colorlet,usesamecnt}, + morekeywords={DeclareSymbolFont,SetSymbolFont,toprule,midrule,bottomrule,institute,version,includegraphics,setmainfont,setsansfont,setmonofont ,setCJKmainfont,setCJKsansfont,setCJKmonofont,RequirePackage,figref,tabref,email,maketitle,keywords,definecolor,extrainfo,logo,cover,subtitle,appendix,chapter,hypersetup,mainmatter,frontmatter,tableofcontents,elegantpar,heiti,kaishu,lstset,pagecolor,zhnumber,marginpar,part,equote,marginnote,bioinfo,datechange,listofchange,lvert,lastpage,songti,heiti,fangsong,setCJKfamilyfont,textbf}, frame=single, tabsize=2, rulecolor=\color{structurecolor}, @@ -1387,9 +969,9 @@ % add the list of change history \newcommand{\dateinfoline}[2]{ \noindent\makebox[0pt][r]{% - \makebox[-3em][r]{% - \small - \textbf{\textcolor{structurecolor}{#1}}}\;\;}% + \makebox[-3em][r]{% + \small + \textbf{\textcolor{structurecolor}{#1}}}\;\;}% {\citshape\updatename\ignorespaces#2}} \newcommand{\datechange}[2]{% @@ -1399,11 +981,11 @@ \newcommand{\listofchanges}{% \begingroup - \renewcommand{\contentsname}{\historyname} - \let\old@starttoc\@starttoc - \def\@starttoc##1{ - \old@starttoc{dates}} - \tableofcontents% + \renewcommand{\contentsname}{\historyname} + \let\old@starttoc\@starttoc + \def\@starttoc##1{ + \old@starttoc{dates}} + \tableofcontents% \endgroup} % https://tex.stackexchange.com/questions/472931/list-of-all-dates-in-a-document @@ -1411,56 +993,43 @@ \begin{enumerate}[label=\small\protect\circled{\arabic*}]}{ \end{enumerate}} - +\addbibresource[location=local]{reference.bib} \renewcommand\tableofcontents{% \hypersetup{linktoc=all, linkcolor=black} - \if@twocolumn - \@restonecoltrue\onecolumn - \else - \@restonecolfalse - \fi - \chapter*{\contentsname - \@mkboth{% - \MakeUppercase\contentsname}{\MakeUppercase\contentsname}}% - \ifdefstring{\ELEGANT@toc}{twocol}{ - \setlength{\columnsep}{2em} - \begin{multicols}{2}% - \@starttoc{toc} - \end{multicols}}{ - \@starttoc{toc}} - \if@restonecol\twocolumn\fi - \hypersetup{linkcolor=winered}} + \if@twocolumn + \@restonecoltrue\onecolumn + \else + \@restonecolfalse + \fi + \chapter*{\contentsname + \@mkboth{% + \MakeUppercase\contentsname}{\MakeUppercase\contentsname}}% + \ifdefstring{\ELEGANT@toc}{twocol}{ + \setlength{\columnsep}{2em} + \begin{multicols}{2}% + \@starttoc{toc} + \end{multicols}}{ + \@starttoc{toc}} + \if@restonecol\twocolumn\fi + \hypersetup{linkcolor=winered}} \renewcommand*{\cleardoublepage}{\clearpage\if@twoside \ifodd\c@page\else -\hbox{}% -\thispagestyle{empty}% -\newpage% -\if@twocolumn\hbox{}\newpage\fi\fi\fi} + \hbox{}% + \thispagestyle{empty}% + \newpage% + \if@twocolumn\hbox{}\newpage\fi\fi\fi} % https://tex.stackexchange.com/questions/56839/chaptername-is-used-even-for-appendix-chapters-in-toc -\RequirePackage{calc} -\RequirePackage[titles]{tocloft} +\usepackage{calc} +\usepackage[titles]{tocloft} \ifdefstring{\ELEGANT@lang}{cn}{ - % \renewcommand{\cftchappresnum}{\beforechap\space} - % \renewcommand{\cftchapaftersnum}{\space\afterchap} - % \setlength{\cftchapnumwidth}{\widthof{\textbf{附录~十一}}} - \renewcommand{\numberline}[1]{% - \@cftbsnum #1\@cftasnum~\@cftasnumb ~% - } + \renewcommand{\cftchappresnum}{\beforechap\space} + \renewcommand{\cftchapaftersnum}{\space\afterchap} + \setlength{\cftchapnumwidth}{\widthof{\textbf{附录~999}}} \g@addto@macro\appendix{% - % recover \thechapter in the \NR@chapter's \numberline - \ifELEGANT@Hy@later - \patchcmd{\NR@chapter}% - {\numberline{\xchaptertitle}}{\numberline{\thechapter}}% - {}{\fail} - \else - \patchcmd{\Hy@org@chapter}% - {\numberline{\xchaptertitle}}{\numberline{\thechapter}}% - {}{\fail} - \fi \addtocontents{toc}{% \protect\renewcommand{\protect\cftchappresnum}{\appendixname\space}% \protect\renewcommand{\protect\cftchapaftersnum}{}%