\documentclass[cn,fancy,blue,11pt]{elegantbook} \title{ElegantBook:优美的 \LaTeX{} 书籍模板} \subtitle{Elegant\LaTeX{} 经典之作} \author{Ethan Deng \& Liam Huang} \institute{Elegant\LaTeX{} Program} \date{\today} \version{3.07} \equote{Victory won\rq t come to us unless we go to it. --- M. Moore} \logo{logo.png} \cover{cover.jpg} \usepackage[authoryear]{gbt7714} \begin{document} \maketitle \tableofcontents % \thispagestyle{empty} \mainmatter \hypersetup{pageanchor=true} \chapter{Elegant\LaTeX{} 系列模板介绍} Elegant\LaTeX{} 项目组致力于打造一系列美观、优雅、简便的模板方便用户使用。Elegant\LaTeX{} 系列模板目前由 \href{https://github.com/ElegantLaTeX/ElegantNote}{ElegantNote},\href{https://github.com/ElegantLaTeX/ElegantBook}{ElegantBook},\href{https://github.com/ElegantLaTeX/ElegantPaper}{ElegantPaper} 组成,分别用于排版笔记,书籍和工作论文。如果你在使用本模板,推荐最新版本!最新正式版下载地址:\href{https://github.com/ElegantLaTeX/ElegantBook/releases}{Github}。本文将介绍本模板的一些设置内容以及基本使用方法。如果您有其他问题,建议或者意见,欢迎在 Github 上给我们提交 \href{https://github.com/ElegantLaTeX/ElegantBook/issues}{issues} 或者邮件\footnote{\email{elegantlatex2e@gmail.com}.}联系我们。 \section{ElegantBook 更新说明} 在这几年间,我们收到了很多用户的反馈,主要的问题涉及到字体安装,编码支持,定理浮动,定理跨页,交叉引用等等。我们思前想后,原先让用户安装字体以追求视觉上的美观并不完美,用户陷入了巨大的麻烦,这违背了我们的模板初衷。因此我们在新版中删除了这部分,用户无需安装任何字体。ElegantBook 3.x 版本更新的主要内容有: \begin{enumerate} \item 删除了自定义字体设置,改用 \lstinline{ctex} 宏包支持中文; \item 模板拆分为中英文模式(\lstinline{lang=cn/en}); \item 支持 \lstinline{PDFLaTeX} 与 \lstinline{XeLaTeX}; \item 使用 \lstinline{tcolorbox} 宏包改写定理类环境,可跨页; \item 定理类环境名字更新,修复定理环境交叉引用; \item 更新颜色主题,增加灰色和黑色主题; \item 颜色名字更新,统一链接颜色; \item 重新绘制 Elegant\LaTeX{} 的 Logo; \item 更新封面与装饰物,删除水印; \item 修正附录相关内容; \item 增加代码高亮; \item 美化列表环境; \item 增加简化模式; \item 增加 base 隐藏选项。 \end{enumerate} \begin{note} 由于新版本进行了重构,3.x 版本并不兼容 2.x 版本,如果你想把 2.x 版本的文件转为 3.x 版本,请查看\href{https://github.com/ElegantLaTeX/ElegantBook/wiki/convert}{跨版本转换}。今后不再回答关于 2.x 版本的问题。 \end{note} \chapter{ElegantBook 设置说明} \section{编译方式} 本模板基于基础的 book 文类,所以 book 的选项对于本模板也是有效的。默认编码为 UTF-8,推荐使用 \TeX{} Live 编译。本文编写环境为 Win10 (64bit) + \TeX{} Live 2018,支持 \lstinline{PDFLaTeX} 以及 \lstinline{XeLaTeX} 编译。 \section{语言模式} 本模板内含两套语言环境,改变语言环境会改变图表标题的引导词(图,表),文章结构词(比如目录,参考文献等),以及定理环境中的引导词(比如定理,引理等)。不同语言模式的启用如下: \begin{lstlisting} \documentclass[cn]{elegantbook} \documentclass[lang=cn]{elegantbook} \end{lstlisting} \begin{remark} 不管选用中文环境(\lstinline{lang=cn})还是英文环境(\lstinline{lang=en})均可输入中文。另外如果在笔记中使用了抄录环境(\lstinline{lstlisting}),并抄录代码中有中文,请务必使用 \lstinline{XeLaTeX} 编译。 \end{remark} \section{颜色主题} 本模板内置 5 组颜色主题,分别为 \textcolor{main1}{\lstinline{green}}\footnote{为原先默认主题}、\textcolor{main2}{\lstinline{cyan}}、\textcolor{main3}{\lstinline{blue}}(默认)、\textcolor{main4}{\lstinline{gray}}、\textcolor{main5}{\lstinline{black}}。另外还有一个自定义的选项 \lstinline{nocolor}。调用颜色主题 \lstinline{green} 的方法为 \begin{lstlisting} \documentclass[green]{elegantbook} %or \documentclass[color=green]{elegantbook} \end{lstlisting} \begin{table}[htbp] \caption{ElegantBook 模板中的颜色主题\label{tab:color thm}} \centering \begin{tabular}{ccccccc} \toprule & \textcolor{main1}{green} & \textcolor{main2}{cyan} & \textcolor{main3}{blue} & \textcolor{main4}{gray} & \textcolor{main5}{black} & 主要使用的环境\\ \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 \ solution \\ 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} 如果需要自定义颜色的话请选择 \lstinline{nocolor} 选项或者使用 \lstinline{color=none},然后在导言区定义 structure、main、second、third 颜色,具体方法如下: \begin{lstlisting} \definecolor{structurecolor}{RGB}{0,0,0} \definecolor{main}{RGB}{70,70,70} \definecolor{second}{RGB}{115,45,2} \definecolor{third}{RGB}{0,80,80} \end{lstlisting} \section{章标题显示风格} 本模板内置 2 套\textit{章标题显示风格},包含 \lstinline{hang}(默认)与 \lstinline{display} 两种风格,区别在于章标题单行显示(\lstinline{hang})与双行显示(\lstinline{display}),本说明使用了 \lstinline{hang}。调用方式为 \begin{lstlisting} \documentclass[hang]{elegantbook} %or \documentclass[titlestyle=hang]{elegantbook} \end{lstlisting} \section{数学环境简介} 在我们这个模板中,我们定义了两种不同的定理模式 \lstinline{mode},包括简单模式(\lstinline{simple})和炫彩模式(\lstinline{fancy}),默认为 \lstinline{fancy} 模式,不同模式的选择为 \begin{lstlisting} \documentclass[simple]{elegantbook} %or \documentclass[mode=simple]{elegantbook} \end{lstlisting} 本模板定义了四大类环境 \begin{itemize} \item \textit{定理类环境},包含标题和内容两部分,全部定理类环境的编号均以章节编号。根据格式的不同分为 3 种 \begin{itemize} \item \textcolor{main}{\textbf{definition}} 环境,颜色为 \textcolor{main}{main}; \item \textcolor{second}{\textbf{theorem、lemma、corollary}} 环境,颜色为 \textcolor{second} {second}; \item \textcolor{third}{\textbf{proposition}} 环境,颜色为 \textcolor{third}{third}。 \end{itemize} \item \textit{示例类环境},有 \textbf{example、exercise、problem} 环境(对应于例,练习,例题),自动编号,编号以章节为单位。 \item \textit{证明类环境},有 \textbf{proof、note} 环境,特点是,有引导符或者结尾符,\textbf{note} 环境有引导符号,\textbf{proof} 环境有证明完毕符号。 \item \textit{结论类环境},有 \textbf{conclusion、assumption、property,remark、solution} 环境\footnote{本模板还添加了一个 result 选项,用于隐藏 \lstinline{solution} 和 \lstinline{proof} 环境,默认为显示(\lstinline{result=answer}),隐藏使用 \lstinline{result=noanswer}。},三者均以粗体的引导词为开头,和普通段落格式一致。 \end{itemize} \subsection{定理类环境的使用} 由于本模板使用了 \lstinline{tcolorbox} 宏包来定制定理类环境,所以和普通的定理环境的使用有些许区别,定理的使用方法如下: \begin{lstlisting} \begin{theorem}{}{