diff --git a/elegantbook-cn.tex b/elegantbook-cn.tex index 251c7d3..d0bdaff 100644 --- a/elegantbook-cn.tex +++ b/elegantbook-cn.tex @@ -1,12 +1,13 @@ \documentclass[lang=cn,10pt,founder]{elegantbook} + \title{ElegantBook:优美的 \LaTeX{} 书籍模板} \subtitle{Elegant\LaTeX{} 经典之作} \author{Ethan Deng \& Liam Huang} \institute{Elegant\LaTeX{} Program} -\date{March 8, 2022} -\version{4.2} +\date{April 9, 2022} +\version{4.3} \bioinfo{自定义}{信息} \extrainfo{不要以为抹消过去,重新来过,即可发生什么改变。—— 比企谷八幡} @@ -16,27 +17,6 @@ \logo{logo-blue.png} \cover{cover.jpg} -\usepackage{lmodern} - -\setmainfont{texgyretermes}[ - UprightFont = *-regular , - BoldFont = *-bold , - ItalicFont = *-italic , - BoldItalicFont = *-bolditalic , - Extension = .otf , - Scale = 1.0] - - -\setsansfont{texgyreheros}[ - UprightFont = *-regular , - BoldFont = *-bold , - ItalicFont = *-italic , - BoldItalicFont = *-bolditalic , - Extension = .otf , - Scale = 1.0] - - -\usepackage[]{newtxmath} % 本文档命令 \usepackage{array} \newcommand{\ccr}[1]{\makecell{{\color{#1}\rule{1cm}{1cm}}}} @@ -59,54 +39,53 @@ Elegant\LaTeX{} 项目组致力于打造一系列美观、优雅、简便的模 我们的联系方式如下,建议加入用户 QQ 群提问,这样能更快获得准确的反馈,加群时请备注 \LaTeX{} 或者 Elegant\LaTeX{} 相关内容。 \begin{itemize} - \item 官网:\href{https://elegantlatex.org/}{https://elegantlatex.org/} - \item GitHub 网址:\href{https://github.com/ElegantLaTeX/}{https://github.com/ElegantLaTeX/} + \item 官网:\href{https://elegantlatex.org/}{https://elegantlatex.org/}(暂时歇业) + \item GitHub 地址:\href{https://github.com/ElegantLaTeX/}{https://github.com/ElegantLaTeX/} + \item Gitee 地址:\href{https://gitee.com/ElegantLaTeX}{https://gitee.com/ElegantLaTeX} \item CTAN 地址:\href{https://ctan.org/pkg/elegantbook}{https://ctan.org/pkg/elegantbook} \item 下载地址:\href{https://github.com/ElegantLaTeX/ElegantBook/releases}{正式发行版},\href{https://github.com/ElegantLaTeX/ElegantBook/archive/master.zip}{最新版} - \item 微博:Elegant\LaTeX{} - \item 微信公众号:Elegant\LaTeX{} - \item 用户 QQ 群:692108391 + \item 微博:Elegant\LaTeX{}(密码有点忘了) + \item 微信公众号:Elegant\LaTeX{}(不定期更新) + \item 用户 QQ 群:692108391(建议加群) \item 邮件:\email{elegantlatex2e@gmail.com} \end{itemize} -\textsf{hello world, 中文输入法,英文 English is not good for me} - \section{模板安装与更新} 你可以通过免安装的方式使用本模板,包括在线使用和本地(文件夹内)使用两种方式,也可以通过 \TeX{} 发行版安装使用。 \subsection{在线使用模板} -我们把三套模板全部上传到 \href{https://www.overleaf.com/}{Overleaf} 上了,网络便利的用户可以直接通过 Overleaf 在线使用我们的模板。使用 Overleaf 的好处是无需安装 \TeX{} Live 2020,可以随时随地访问自己的文件。查找模板,请在 Overleaf 模板库里面搜索 \lstinline{elegantlatex} 即可,你也可以直接访问\href{https://www.overleaf.com/latex/templates?addsearch=elegantlatex}{搜索结果}。选择适当的模板之后,将其 \lstinline{Open as Template},即可把模板存到自己账户下,然后可以自由编辑以及与别人一起协作。更多关于 Overleaf 的介绍和使用,请参考 Overleaf 的\href{https://www.overleaf.com/learn}{官方文档}。 - -\begin{remark} -Overleaf 上,中文需要使用 \hologo{XeLaTeX} 进行编译,英文建议使用 \hologo{pdfLaTeX} 编译。 -\end{remark} +我们把三套模板全部上传到 \href{https://www.overleaf.com/}{Overleaf} 上了,网络便利的用户可以直接通过 Overleaf 在线使用我们的模板。使用 Overleaf 的好处是无需安装 \TeX{} Live,可以随时随地访问自己的文件。查找模板,请在 Overleaf 模板库里面搜索 \lstinline{elegantlatex} 即可,你也可以直接访问\href{https://www.overleaf.com/latex/templates?addsearch=elegantlatex}{搜索结果}。选择适当的模板之后,将其 \lstinline{Open as Template},即可把模板存到自己账户下,然后可以自由编辑以及与别人一起协作。更多关于 Overleaf 的介绍和使用,请参考 Overleaf 的\href{https://www.overleaf.com/learn}{官方文档}。 \subsection{本地免安装使用} -\textbf{免安装}使用方法如下,从 GitHub 或者 CTAN 下载最新版,严格意义上只需要类文件 \lstinline{elegantbook.cls}。然后将模板文件放在你的工作目录下即可使用。这样使用的好处是,无需安装,简便;缺点是,当模板更新之后,你需要手动替换 \lstinline{cls} 文件。 +\textbf{免安装}使用方法如下:从 GitHub 或者 CTAN 下载最新版,严格意义上只需要类文件 \lstinline{elegantbook.cls}。然后将模板文件放在你的工作目录下即可使用。这样使用的好处是,无需安装,简便;缺点是,当模板更新之后,你需要手动替换 \lstinline{cls} 文件。 -\subsection{发行版安装使用} +\subsection{发行版安装与更新} -本模板测试环境为 Win10 和 TeX Live 2021,如果你刚安装 \TeX{} Live 2021 用户,安装后建议升级全部宏包,升级方法:使用 cmd 运行 \lstinline{tlmgr update --all},如果 tlmgr 需要更新,请使用 cmd 运行 \lstinline{tlmgr update --self},如果更新过程中出现了中断,请改用 \lstinline{tlmgr update --self --all --reinstall-forcibly-removed} 更新。 +本模板测试环境为 +\begin{enumerate} + \item Win10 + \TeX{} Live 2022; + \item Ubuntu 20.04 + \TeX{} Live 2022; + \item macOS Monterey + Mac\TeX{} 2022。 +\end{enumerate} -\subsection{更新问题} +\TeX Live/Mac\TeX{} 的安装请参考啸行的\href{https://github.com/OsbertWang/install-latex-guide-zh-cn/releases/}{一份简短的关于安装 \LaTeX{} 安装的介绍}。 -如果使用 \lstinline{tlshell} 无法更新模板,请使用命令行全部更新全部宏包或者使用免安装的方法使用本模板。 - -通过命令行(管理员权限)输入下面的命令对 tlmgr 自身和全部宏包进行更新。 +安装 \TeX{} Live 之后,安装后建议升级全部宏包,升级方法:使用 cmd 或 terminal 运行 \lstinline{tlmgr update --all},如果 tlmgr 需要更新,请使用 cmd 运行 \lstinline{tlmgr update --self},如果更新过程中出现了中断,请改用 \lstinline{tlmgr update --self --all --reinstall-forcibly-removed} 更新,也即 \begin{lstlisting} tlmgr update --self tlmgr update --all + tlmgr update --self --all --reinstall-forcibly-removed \end{lstlisting} 更多的内容请参考 \href{https://tex.stackexchange.com/questions/55437/how-do-i-update-my-tex-distribution}{How do I update my \TeX{} distribution?} \subsection{其他发行版本} -由于宏包版本问题,本模板不支持 C\TeX{} 套装,请务必安装 TeX Live。更多关于 \TeX{} Live 的安装使用以及 C\TeX{} 与 \TeX{} Live 的兼容、系统路径问题,请参考官方文档以及啸行的\href{https://github.com/OsbertWang/install-latex-guide-zh-cn/releases/}{一份简短的关于安装 \LaTeX{} 安装的介绍}。 +由于宏包版本问题,本模板不支持 C\TeX{} 套装,请务必安装 TeX Live/Mac\TeX{}。更多关于 \TeX{} Live 的安装使用以及 C\TeX{} 与 \TeX{} Live 的兼容、系统路径问题,请参考官方文档以及啸行的\href{https://github.com/OsbertWang/install-latex-guide-zh-cn/releases/}{一份简短的关于安装 \LaTeX{} 安装的介绍}。 \section{关于提交} @@ -116,7 +95,7 @@ Overleaf 上,中文需要使用 \hologo{XeLaTeX} 进行编译,英文建议 \chapter{ElegantBook 设置说明} -本模板基于基础的 book 文类,所以 book 的选项对于本模板也是有效的(纸张无效,因为模板有设备选项)。默认编码为 UTF-8,推荐使用 \TeX{} Live 编译。本文编写环境为 Win10 (64bit) + \TeX{} Live 2021,英文支持 \hologo{pdfLaTeX},中文仅支持 \hologo{XeLaTeX} 编译。 +本模板基于基础的 book 文类,所以 book 的选项对于本模板也是有效的(纸张无效,因为模板有设备选项)。默认编码为 UTF-8,推荐使用 \TeX{} Live 编译。 \section{语言模式} 本模板内含两套基础语言环境 \lstinline{lang=cn}、\lstinline{lang=en}。改变语言环境会改变图表标题的引导词(图,表),文章结构词(比如目录,参考文献等),以及定理环境中的引导词(比如定理,引理等)。不同语言模式的启用如下: @@ -125,7 +104,7 @@ Overleaf 上,中文需要使用 \hologo{XeLaTeX} 进行编译,英文建议 \documentclass[lang=cn]{elegantbook} \end{lstlisting} -除模板自带的两套语言设定之外,由网友提供的其他语言环境设置如下: +除模板自带的两套语言设定之外,由\textbf{网友}提供的其他语言环境设置如下: \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}; @@ -159,6 +138,7 @@ Overleaf 上,中文需要使用 \hologo{XeLaTeX} 进行编译,英文建议 \documentclass[color=green]{elegantbook} \end{lstlisting} + \begin{table}[htbp] \caption{ElegantBook 模板中的颜色主题\label{tab:color thm}} \centering @@ -357,6 +337,17 @@ Overleaf 上,中文需要使用 \hologo{XeLaTeX} 进行编译,英文建议 % \caption{disjoint decomposition}\label{algo_disjdecomp} % \end{algorithm} + +\subsection{修改计数器} + +当前定理等环境计数器按章计数,如果想修改定理类环境按节计数,可以修改计数器选项 thmcnt: + +\begin{lstlisting} + \documentclass[section]{elegantbook} %or + \documentclass[thmcnt=section]{elegantbook} +\end{lstlisting} + + \subsection{其他环境的使用} 其他三种环境没有选项,可以直接使用,比如 \lstinline{example} 环境的使用方法与效果: @@ -606,8 +597,8 @@ LaTeX Error: 模板从 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}:方正字体选项,调用 \lstinline{ctex} 宏包并且使用 \lstinline{fontset=none} 选项,然后设置字体为方正四款免费字体,方正字体下载注意事项见后文。 -\item \lstinline{nofont}:调用 \lstinline{ctex} 宏包并且使用 \lstinline{fontset=none} 选项,不设定中文字体,用户可以自行设置中文字体,具体见后文。 +\item \lstinline{founder}:方正字体选项(\textbf{需要安装方正字体}),后台调用 \lstinline{ctex} 宏包并且使用 \lstinline{fontset=none} 选项,然后设置字体为方正四款免费字体,方正字体下载注意事项见后文,用户只需要安装方正字体即可使用该选项。 +\item \lstinline{nofont}:后台会调用 \lstinline{ctex} 宏包并且使用 \lstinline{fontset=none} 选项,不设定中文字体,用户可以自行设置中文字体,具体见后文。 \end{enumerate} \begin{remark} @@ -660,7 +651,7 @@ Lebesgue 积分有几种不同的定义方式。我们将采用逐步定义非 我们将通过三个步骤定义可测函数的积分。首先定义非负简单函数的积分。以下设 $E$ 是 $\mathcal{R}^n$ 中的可测集。 \begin{definition}[可积性] \label{def:int} -设 $ f(x)=\sum\limits_{i=1}^{k} a_i \chi_{A_i}(x)$ 是 $E$ 上的非负简单函数,其中 $\{A_1,A_2,\ldots,A_k\}$ 是 $E$ 上的一个可测分割,$a_1,a_2,\ldots,a_k$ 是非负实数。定义 $f$ 在 $E$ 上的积分为 $\int_{a}^b f(x)$ +设 $ 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 @@ -754,10 +745,10 @@ Lebesgue 积分有几种不同的定义方式。我们将采用逐步定义非 见前文介绍,可以使用 \lstinline{scheme=chinese} 设置。 \item \question{大佬,我想把正文字体改为亮色,背景色改为黑灰色。} 页面颜色可以使用 \lstinline{\pagecolor} 命令设置,文本命令可以参考\href{https://tex.stackexchange.com/questions/278544/xcolor-what-is-the-equivalent-of-default-text-color}{这里}进行设置。 - \item \question{\lstinline[breaklines]{Package ctex Error: CTeX fontset `Mac' is unavailable.}} + \item \question{\lstinline[breaklines]{Package ctex Error: CTeX fontset 'Mac' is unavailable.}} 在 Mac 系统下,中文编译请使用 \hologo{XeLaTeX}。 - \item \question{\lstinline{! LaTeX Error: Unknown option `scheme=plain' for package `ctex'.}} - 你用的 C\TeX{} 套装吧?这个里面的 \lstinline{ctex} 宏包已经是已经是 10 年前的了,与本模板使用的 \lstinline{ctex} 宏集有很大区别。不建议 C\TeX{} 套装了,请卸载并安装 \TeX{} Live 2021。 + \item \question{\lstinline{! LaTeX Error: Unknown option 'scheme=plain' for package 'ctex'.}} + 你用的 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 内获取。 \item \question{我该使用什么编辑器?} @@ -766,8 +757,6 @@ Lebesgue 积分有几种不同的定义方式。我们将采用逐步定义非 模板的使用修改都是自由的,你们声明模板来源以及模板地址(GitHub 地址)即可,其他未尽事宜按照开源协议 LPPL-1.3c。做好之后,如果方便的话,可以给我们一个链接,我把你们的教材放在 Elegant\LaTeX{} 用户作品集里。 \item \question{请问交叉引用是什么?} 本群和本模板适合有一定 \LaTeX{} 基础的用户使用,新手请先学习 \LaTeX{} 的基础,理解各种概念,否则你将寸步难行。 - \item \question{定义等环境中无法使用加粗命令么?} - 是这样的,默认中文并没加粗命令,如果你想在定义等环境中使用加粗命令,请使用 \lstinline{\heiti} 等字体命令,而不要使用 \lstinline{\textbf}。或者,你可以将 \lstinline|\textbf| 重新定义为 \lstinline|\heiti|。英文模式不存在这个问题。 \item \question{代码高亮环境能用其他语言吗?} 可以的,ElegantBook 模板用的是 \lstinline{listings} 宏包,你可以在环境(\lstinline{lstlisting})之后加上语言(比如 Python 使用 \lstinline{language=Python} 选项),全局语言修改请使用 \lstinline{lsset} 命令,更多信息请参考宏包文档。 \item \question{群主,什么时候出 Beamer 的模板(主题),ElegantSlide 或者 ElegantBeamer?} @@ -776,7 +765,17 @@ Lebesgue 积分有几种不同的定义方式。我们将采用逐步定义非 \chapter{版本更新历史} -根据用户的反馈,我们不断修正和完善模板。截止到此次更新,ElegantBook 模板在 GitHub 上有将近 100 次提交,正式发行版本(release)有 17 次。由于 3.00 之前版本与现在版本差异非常大,在此不列出 3.00 之前的更新内容。 +根据用户的反馈,我们不断修正和完善模板。由于 3.00 之前版本与现在版本差异非常大,在此不列出 3.00 之前的更新内容。 + + +\datechange{2022/04/09}{版本 4.3 正式发布。} + +\begin{change} + \item 放弃 newtx 系列宏包的设置,改用 TeX Gyre Terms,并设置其他字体; + \item 修改定理类环境内部字体设置,修复环境内部中文无法加粗问题; + \item 增加定理类环境的计数器选项 \lstinline{thmcnt},可选 \lstinline{chapter} 和 \lstinline{section}; + \item 增加 \lstinline{bibend} 选项,可选 \lstinline{bibend=biber}(默认)和 \lstinline{bibend=bibtex}。 +\end{change} diff --git a/elegantbook-en.tex b/elegantbook-en.tex index 921a762..1f940f7 100644 --- a/elegantbook-en.tex +++ b/elegantbook-en.tex @@ -1,12 +1,12 @@ -\documentclass[11pt,fancy]{elegantbook} +\documentclass[11pt,fancy,newtx]{elegantbook} \title{An Elegant \LaTeX{} Template for Books} \subtitle{Classic Elegant\LaTeX{} Template} \author{Ethan Deng \& Liam Huang} \institute{Elegant\LaTeX{} Program} -\date{March 8, 2022} -\version{4.2} +\date{April 9, 2022} +\version{4.3} \bioinfo{Bio}{Information} \extrainfo{Victory won\rq t come to us unless we go to it. } @@ -18,8 +18,6 @@ \colorlet{coverlinecolor}{customcolor} -\usepackage{mathptmx} - \begin{document} \maketitle @@ -34,15 +32,9 @@ Elegant\LaTeX{} Program developers are intended to provide you beautiful, elegan Contact Infos: \begin{itemize} - \item Homepage: \href{https://elegantlatex.org/}{https://elegantlatex.org/} \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 Wiki: \href{https://github.com/ElegantLaTeX/ElegantBook/wiki}{https://github.com/ElegantLaTeX/ElegantBook/wiki} \item Download: \href{https://github.com/ElegantLaTeX/ElegantBook/releases}{release}, \href{https://github.com/ElegantLaTeX/ElegantBook/archive/master.zip}{latest version} - \item Weibo: Elegant\LaTeX{} - \item Wechat: Elegant\LaTeX{} - \item QQ: 692108391 - \item Email: \email{elegantlatex2e@gmail.com} \end{itemize} @@ -62,8 +54,8 @@ Version 4.2 is the \textit{temporary} version before v4.3 which will be released \section{Installation and Update} Both portable version and installation package are available, online usage is optional as well. -\subsection{To Use Templates Online} -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}. +\subsection{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}. \begin{remark} On Overleaf, please use \hologo{XeLaTeX} to compile articles in Chinese and \hologo{pdfLaTeX} to compile articles in English. @@ -74,9 +66,7 @@ For portable version, simply download lastest ElegantBook-master from GitHub or \subsection{Update Templates} -If you fail to update templates using \lstinline{tlshell}, please use cmd to update all the packages or switch to portable version instead. - -Use the following commands(administrator privileges) to update: +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 @@ -237,15 +227,15 @@ We defined two sets of theorem modes, \lstinline{simple} style and \lstinline{fa In this template, we defined four different theorem class environments \begin{itemize} -\item \textit{Theorem Environment}, including title and content, numbering corresponding to chapter. Three types depending on the format: +\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}} environment, the color is \textcolor{second} {second}; \item \textcolor{third}{\textbf{proposition}} environment, the color is \textcolor{third}{third}. \end{itemize} -\item \textit{Example Environments}, including \textbf{example, exercise, problem} environment, auto numbering corresponding to chapter. +\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 Environments}, 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. +\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} \subsection{Theorem Class Environments} @@ -396,7 +386,8 @@ This template uses biblatex to generate the bibliography, the default citestyle 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. -To change the bibliography style, this version introduces \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 +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} @@ -534,7 +525,7 @@ For tables and figures, note that floating environment is not allowed. You have 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$ +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} diff --git a/elegantbook.cls b/elegantbook.cls index d20ff06..f4fe5dc 100644 --- a/elegantbook.cls +++ b/elegantbook.cls @@ -8,7 +8,7 @@ %%%%%%%%%%%%%%%%%%%%% % % !Mode:: "TeX:UTF-8" \NeedsTeXFormat{LaTeX2e} -\ProvidesClass{elegantbook}[2022/03/08 v4.2 ElegantBook document class] +\ProvidesClass{elegantbook}[2022/04/09 v4.3 ElegantBook document class] %%% @@ -27,6 +27,7 @@ \DeclareStringOption[marginfalse]{marginpar} \DeclareStringOption[onecol]{toc} \DeclareStringOption{scheme} + % ----- backward compatibility \DeclareVoidOption{green}{\ekv{color=green}} \DeclareVoidOption{cyan}{\ekv{color=cyan}} @@ -34,10 +35,10 @@ \DeclareVoidOption{gray}{\ekv{color=gray}} \DeclareVoidOption{black}{\ekv{color=black}} \DeclareVoidOption{nocolor}{\ekv{color=none}} -\DeclareStringOption[ctexfont]{chinesefont} \DeclareVoidOption{chinese}{\ekv{scheme=chinese}} +\DeclareStringOption[ctexfont]{chinesefont} \DeclareVoidOption{ctexfont}{\ekv{chinesefont=ctexfont}} \DeclareVoidOption{founder}{\ekv{chinesefont=founder}} \DeclareVoidOption{nofont}{\ekv{chinesefont=nofont}} @@ -45,7 +46,13 @@ \DeclareVoidOption{en}{\ekv{lang=en}} \DeclareVoidOption{cn}{\ekv{lang=cn}} \DeclareVoidOption{it}{\ekv{lang=it}} +\DeclareVoidOption{fr}{\ekv{lang=fr}} +\DeclareVoidOption{nl}{\ekv{lang=nl}} +\DeclareVoidOption{hu}{\ekv{lang=hu}} +\DeclareVoidOption{de}{\ekv{lang=de}} +\DeclareVoidOption{mn}{\ekv{lang=mn}} \DeclareVoidOption{pt}{\ekv{lang=pt}} +\DeclareVoidOption{jp}{\ekv{lang=jp}} \DeclareVoidOption{fancy}{\ekv{mode=fancy}} \DeclareVoidOption{simple}{\ekv{mode=simple}} @@ -59,7 +66,7 @@ \DeclareStringOption[numeric-comp]{citestyle} \DeclareStringOption[numeric]{bibstyle} - +\DeclareVoidOption{newtx}{\ekv{math=newtx}} \DeclareVoidOption{mtpro2}{\ekv{math=mtpro2}} \DeclareVoidOption{cm}{\ekv{math=cm}} @@ -70,6 +77,14 @@ \DeclareVoidOption{onecol}{\ekv{toc=onecol}} \DeclareVoidOption{twocol}{\ekv{toc=twocol}} +\DeclareStringOption[chapter]{thmcnt} +\DeclareVoidOption{chapter}{\ekv{thmcnt=chapter}} +\DeclareVoidOption{section}{\ekv{thmcnt=section}} + +\DeclareStringOption[biber]{bibend} +\DeclareVoidOption{biber}{\ekv{bibend=biber}} +\DeclareVoidOption{bibtex}{\ekv{bibend=bibtex}} + % ----- Math option ----- \newcommand\mailto[1]{\href{mailto:#1}{\nolinkurl{#1}}} @@ -135,6 +150,7 @@ footskip=4mm }}{\relax} + \RequirePackage{indentfirst,comment} % fontsetting \ifdefstring{\ELEGANT@math}{mtpro2}{ @@ -147,33 +163,51 @@ \PassOptionsToPackage{no-math}{fontspec} \RequirePackage{iftex} -\ifdefstring{\ELEGANT@lang}{cn}{ - \ifXeTeX - \ifdefstring{\ELEGANT@chinesefont}{founder}{ - \RequirePackage[UTF8,scheme=plain,fontset=none]{ctex} - \setCJKmainfont[BoldFont={FZHei-B01},ItalicFont={FZKai-Z03}]{FZShuSong-Z01} - \setCJKsansfont[BoldFont={FZHei-B01},ItalicFont={FZHei-B01}]{FZHei-B01} - \setCJKmonofont[BoldFont={FZHei-B01},ItalicFont={FZHei-B01}]{FZFangSong-Z02} - \setCJKfamilyfont{zhsong}{FZShuSong-Z01} - \setCJKfamilyfont{zhhei}{FZHei-B01} - \setCJKfamilyfont{zhkai}{FZKai-Z03} - \setCJKfamilyfont{zhfs}{FZFangSong-Z02} - \newcommand*{\songti}{\CJKfamily{zhsong}} - \newcommand*{\heiti}{\CJKfamily{zhhei}} - \newcommand*{\kaishu}{\CJKfamily{zhkai}} - \newcommand*{\fangsong}{\CJKfamily{zhfs}}}{\relax} - - \ifdefstring{\ELEGANT@chinesefont}{nofont}{ - \RequirePackage[UTF8,scheme=plain,fontset=none]{ctex}}{\relax} - \ifdefstring{\ELEGANT@chinesefont}{ctexfont}{ - \RequirePackage[UTF8,scheme=plain]{ctex}}{\relax} - \else - \ifdefstring{\ELEGANT@chinesefont}{ctexfont}{ - \RequirePackage[UTF8,scheme=plain]{ctex}}{\relax} - \fi +\ifXeTeX + \RequirePackage[no-math]{fontspec} + \setmainfont{texgyretermes}[ + UprightFont = *-regular , + BoldFont = *-bold , + ItalicFont = *-italic , + BoldItalicFont = *-bolditalic , + Extension = .otf , + Scale = 1.0] + + \setsansfont{texgyreheros}[ + UprightFont = *-regular , + BoldFont = *-bold , + ItalicFont = *-italic , + 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} + \setCJKmainfont[BoldFont={FZHei-B01},ItalicFont={FZKai-Z03}]{FZShuSong-Z01} + \setCJKsansfont[BoldFont={FZHei-B01}]{FZKai-Z03} + \setCJKmonofont[BoldFont={FZHei-B01}]{FZFangSong-Z02} + \setCJKfamilyfont{zhsong}{FZShuSong-Z01} + \setCJKfamilyfont{zhhei}{FZHei-B01} + \setCJKfamilyfont{zhkai}[BoldFont={FZHei-B01}]{FZKai-Z03} + \setCJKfamilyfont{zhfs}[BoldFont={FZHei-B01}]{FZFangSong-Z02} + \newcommand*{\songti}{\CJKfamily{zhsong}} + \newcommand*{\heiti}{\CJKfamily{zhhei}} + \newcommand*{\kaishu}{\CJKfamily{zhkai}} + \newcommand*{\fangsong}{\CJKfamily{zhfs}}}{\relax} + + \ifdefstring{\ELEGANT@chinesefont}{nofont}{ + \RequirePackage[UTF8,scheme=plain,fontset=none]{ctex}}{\relax} + + \ifdefstring{\ELEGANT@chinesefont}{ctexfont}{ + \RequirePackage[UTF8,scheme=plain]{ctex}}{\relax} + \AfterEndPreamble{ - % \renewcommand{\itshape}{\kaishu} \setlength\parindent{2\ccwd}} }{\relax} @@ -202,6 +236,25 @@ \fi \RequirePackage{anyfontsize} +\ifdefstring{\ELEGANT@math}{newtx}{ + \RequirePackage{newtxmath} + \let\Bbbk\relax + \RequirePackage{esint} + %%% 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} + + \DeclareSymbolFont{CMlargesymbols}{OMX}{cmex}{m}{n} + \let\sumop\relax\let\prodop\relax + \DeclareMathSymbol{\sumop}{\mathop}{CMlargesymbols}{"50} + \DeclareMathSymbol{\prodop}{\mathop}{CMlargesymbols}{"51} +}{\relax} + % ----- Handle Colors ----- %% 章节以及页脚图形 @@ -330,7 +383,7 @@ \RequirePackage[ - backend=biber, + backend=\ELEGANT@bibend, citestyle=\ELEGANT@citestyle, bibstyle=\ELEGANT@bibstyle]{biblatex} \defbibheading{elegantbook}[\ebibname]{#1} @@ -801,7 +854,6 @@ - %%define the note and proof environment \RequirePackage{pifont,manfnt,bbding} \RequirePackage[many]{tcolorbox} @@ -855,37 +907,37 @@ \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=chapter]{definition}{ o t\label g }{ + \DeclareTColorBox[auto counter,number within=\ELEGANT@thmcnt]{definition}{ o t\label g }{ common,defstyle, IfValueTF={#1}{title={\definitionname~\thetcbcounter\ (#1)}}{title=\definitionname~\thetcbcounter}, IfBooleanTF={#2}{label=#3}{}} % \newtcbtheorem[auto counter,number within=chapter]{theorem}{\theoremname}{thmstyle}{thm} - \DeclareTColorBox[auto counter,number within=chapter]{theorem}{ o t\label g }{ + \DeclareTColorBox[auto counter,number within=\ELEGANT@thmcnt]{theorem}{ o t\label g }{ common,thmstyle, IfValueTF={#1}{title={\theoremname~\thetcbcounter\ (#1)}}{title=\theoremname~\thetcbcounter}, IfBooleanTF={#2}{label=#3}{}} % \newtcbtheorem[auto counter,number within=chapter]{postulate}{\postulatename}{thmstyle}{pos} - \DeclareTColorBox[auto counter,number within=chapter]{postulate}{ o t\label g }{ + \DeclareTColorBox[auto counter,number within=\ELEGANT@thmcnt]{postulate}{ o t\label g }{ common,thmstyle, IfValueTF={#1}{title={\postulatename~\thetcbcounter\ (#1)}}{title=\postulatename~\thetcbcounter}, IfBooleanTF={#2}{label=#3}{}} % \newtcbtheorem[auto counter,number within=chapter]{axiom}{\axiomname}{thmstyle}{axi} - \DeclareTColorBox[auto counter,number within=chapter]{axiom}{ o t\label g }{ + \DeclareTColorBox[auto counter,number within=\ELEGANT@thmcnt]{axiom}{ o t\label g }{ common,thmstyle, IfValueTF={#1}{title={\axiomname~\thetcbcounter\ (#1)}}{title=\axiomname~\thetcbcounter}, IfBooleanTF={#2}{label=#3}{}} % \newtcbtheorem[auto counter,number within=chapter]{corollary}{\corollaryname}{thmstyle}{cor} - \DeclareTColorBox[auto counter,number within=chapter]{corollary}{ o t\label g }{ + \DeclareTColorBox[auto counter,number within=\ELEGANT@thmcnt]{corollary}{ o t\label g }{ common,thmstyle, IfValueTF={#1}{title={\corollaryname~\thetcbcounter\ (#1)}}{title=\corollaryname~\thetcbcounter}, IfBooleanTF={#2}{label=#3}{}} % \newtcbtheorem[auto counter,number within=chapter]{lemma}{\lemmaname}{thmstyle}{lem} - \DeclareTColorBox[auto counter,number within=chapter]{lemma}{ o t\label g }{ + \DeclareTColorBox[auto counter,number within=\ELEGANT@thmcnt]{lemma}{ o t\label g }{ common,thmstyle, IfValueTF={#1}{title={\lemmaname~\thetcbcounter\ (#1)}}{title=\lemmaname~\thetcbcounter}, IfBooleanTF={#2}{label=#3}{}} % \newtcbtheorem[auto counter,number within=chapter]{proposition}{\propositionname}{propstyle}{pro} - \DeclareTColorBox[auto counter,number within=chapter]{proposition}{ o t\label g }{ + \DeclareTColorBox[auto counter,number within=\ELEGANT@thmcnt]{proposition}{ o t\label g }{ common,propstyle, IfValueTF={#1}{title={\propositionname~\thetcbcounter\ (#1)}}{title=\propositionname~\thetcbcounter}, IfBooleanTF={#2}{label=#3}{}}}{\relax} @@ -908,17 +960,17 @@ \theoremstyle{defstyle} % definition style - \newtheorem{definition}{\definitionname}[chapter] + \newtheorem{definition}{\definitionname}[\ELEGANT@thmcnt] \theoremstyle{thmstyle} %theorem style - \newtheorem{theorem}{\theoremname}[chapter] - \newtheorem{lemma}{\lemmaname}[chapter] - \newtheorem{corollary}{\corollaryname}[chapter] - \newtheorem{postulate}{\postulatename}[chapter] - \newtheorem{axiom}{\axiomname}[chapter] + \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}[chapter] + \newtheorem{proposition}{\propositionname}[\ELEGANT@thmcnt] }{\relax} % main(green-def): example exercise problem solution @@ -1003,6 +1055,7 @@ \RequirePackage{adforn} \newenvironment{problemset}[1][\xchaptertitle~\exercisename]{ + \vspace*{10pt} \begin{center} \phantomsection\addcontentsline{toc}{section}{\texorpdfstring{\xchaptertitle~\exercisename}{\exercisename}} % \markboth{#1}{\rightmark} @@ -1231,4 +1284,7 @@ \setlength{\cftchapnumwidth}{\widthof{\textbf{Appendix~999}}} }% } -} \ No newline at end of file +} + +% restore the tt default family to lmodern tt family +\renewcommand\ttdefault{lmtt} \ No newline at end of file