summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/elegantbook/elegantbook.cls
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/elegantbook/elegantbook.cls')
-rw-r--r--macros/latex/contrib/elegantbook/elegantbook.cls310
1 files changed, 237 insertions, 73 deletions
diff --git a/macros/latex/contrib/elegantbook/elegantbook.cls b/macros/latex/contrib/elegantbook/elegantbook.cls
index ae05a7c3a5..0966c3fc12 100644
--- a/macros/latex/contrib/elegantbook/elegantbook.cls
+++ b/macros/latex/contrib/elegantbook/elegantbook.cls
@@ -1,6 +1,6 @@
%%%%%%%%%%%%%%%%%%%%%%
%% start of file `elegantbook.cls'.
-%% Copyright 2013-2021 ElegantLaTeX (elegantlatex2e@gmail.com)
+%% Copyright 2013-2022 ElegantLaTeX (elegantlatex2e@gmail.com)
%%
%% This work may be distributed and/or modified freely
%% available at https://github.com/ElegantLaTeX/ElegantBook
@@ -8,8 +8,10 @@
%%%%%%%%%%%%%%%%%%%%%
% % !Mode:: "TeX:UTF-8"
\NeedsTeXFormat{LaTeX2e}
-\ProvidesClass{elegantbook}[2021/05/02 v4.1 ElegantBook document class]
+\ProvidesClass{elegantbook}[2022/04/09 v4.3 ElegantBook document class]
+
+%%%
\RequirePackage{kvoptions}
\RequirePackage{etoolbox}
\SetupKeyvalOptions{family=ELEGANT, prefix=ELEGANT@, setkeys=\kvsetkeys}
@@ -25,6 +27,7 @@
\DeclareStringOption[marginfalse]{marginpar}
\DeclareStringOption[onecol]{toc}
\DeclareStringOption{scheme}
+
% ----- backward compatibility
\DeclareVoidOption{green}{\ekv{color=green}}
\DeclareVoidOption{cyan}{\ekv{color=cyan}}
@@ -32,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}}
@@ -43,6 +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}}
@@ -56,7 +66,6 @@
\DeclareStringOption[numeric-comp]{citestyle}
\DeclareStringOption[numeric]{bibstyle}
-
\DeclareVoidOption{newtx}{\ekv{math=newtx}}
\DeclareVoidOption{mtpro2}{\ekv{math=mtpro2}}
\DeclareVoidOption{cm}{\ekv{math=cm}}
@@ -68,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}}}
@@ -133,6 +150,7 @@
footskip=4mm
}}{\relax}
+
\RequirePackage{indentfirst,comment}
% fontsetting
\ifdefstring{\ELEGANT@math}{mtpro2}{
@@ -144,34 +162,53 @@
\renewcommand{\baselinestretch}{1.2}
\PassOptionsToPackage{no-math}{fontspec}
+\PassOptionsToPackage{quiet}{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}
+
+\ifXeTeX
+ \RequirePackage[no-math]{fontspec}
+ \setmainfont{texgyretermes}[
+ UprightFont = *-regular ,
+ BoldFont = *-bold ,
+ ItalicFont = *-italic ,
+ BoldItalicFont = *-bolditalic ,
+ Extension = .otf ,
+ Scale = 1.0]
- \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
+ \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}
@@ -199,7 +236,6 @@
\newcommand{\cfs}{\normalfont}
\fi
-\RequirePackage{newtxtext}
\RequirePackage{anyfontsize}
\ifdefstring{\ELEGANT@math}{newtx}{
\RequirePackage{newtxmath}
@@ -220,6 +256,7 @@
\DeclareMathSymbol{\prodop}{\mathop}{CMlargesymbols}{"51}
}{\relax}
+
% ----- Handle Colors -----
%% 章节以及页脚图形
@@ -340,16 +377,17 @@
\RequirePackage{makecell,lipsum,hologo}
%%中文结构名字
-\RequirePackage[
- backend=biber,
- citestyle=\ELEGANT@citestyle,
- bibstyle=\ELEGANT@bibstyle]{biblatex}
-
-
%% 章节设置
+\RequirePackage[center,pagestyles]{titlesec}
+\RequirePackage[title,titletoc,header]{appendix}
-\RequirePackage{appendix}
+
+\RequirePackage[
+ backend=\ELEGANT@bibend,
+ citestyle=\ELEGANT@citestyle,
+ bibstyle=\ELEGANT@bibstyle]{biblatex}
+\defbibheading{elegantbook}[\ebibname]{#1}
\ifdefstring{\ELEGANT@lang}{cn}{
\renewcommand{\baselinestretch}{1.3}
@@ -361,13 +399,12 @@
\renewcommand{\listfigurename}{插图目录}
\renewcommand{\listtablename}{表格目录}
\renewcommand{\bibname}{参考文献}
+ \newcommand{\ebibname}{参考文献}
\renewcommand{\appendixname}{附录}
+ \renewcommand{\appendixtocname}{附录}
\renewcommand{\indexname}{索\hspace{2em}引}
\newcommand\figref[1]{\textbf{图}~\ref{#1}}
\newcommand\tabref[1]{\textbf{表}~\ref{#1}}
- \ifdefstring{\ELEGANT@scheme}{chinese}{
- \renewcommand{\chaptername}{第\zhnumber{\arabic{chapter}}章}}{
- \renewcommand{\chaptername}{第 \thechapter{} 章}}
\newcommand{\authorname}{\citshape 作者:}
\newcommand{\institutename}{\citshape 组织:}
\newcommand{\datename}{\citshape 时间:}
@@ -394,12 +431,16 @@
\newcommand\bioinfo[2]{\gdef\@bioinfo{{\citshape #1}:#2}}
\newcommand{\updatename}{更新:}
\newcommand{\historyname}{版本更新历史}
- }{\relax}
+ \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 \thechapter}
+ \renewcommand{\chaptername}{Chapter}
\renewcommand{\partname}{\color{structurecolor} Part}
\newcommand{\authorname}{\textbf{Author: }}
\newcommand{\institutename}{\textbf{Institute: }}
@@ -424,6 +465,7 @@
\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:}
@@ -437,7 +479,7 @@
\setlength\parindent{2em}
\newcommand\figref[1]{\textbf{Figura}~\ref{#1}}
\newcommand\tabref[1]{\textbf{Tabella}~\ref{#1}}
- \renewcommand{\chaptername}{Chapter \thechapter}
+ \renewcommand{\chaptername}{Chapter}
\newcommand{\authorname}{\textbf{Autore: }}
\newcommand{\institutename}{\textbf{Istituto: }}
\newcommand{\datename}{\textbf{Data: }}
@@ -462,6 +504,7 @@
\newcommand{\introductionname}{Introduzione}
\newcommand\bioinfo[2]{\gdef\@bioinfo{\textbf{#1}: #2}}
\newcommand{\updatename}{Aggiornamenti:}
+ \newcommand{\ebibname}{Bibliografia}
\newcommand{\historyname}{Cronologia delle versioni}
}{\relax}
@@ -472,7 +515,7 @@
\setlength\parindent{2em}
\renewcommand\figref[1]{\textbf{Figure}\ref{#1}}
\renewcommand\tabref[1]{\textbf{Tableau}\ref{#1}}
- \renewcommand{\chaptername}{Chapitre \thechapter}
+ \renewcommand{\chaptername}{Chapitre}
\renewcommand{\authorname}{\textbf{Auteur: }}
\renewcommand{\institutename}{\textbf{Institut: }}
\renewcommand{\datename}{\textbf{Date: }}
@@ -497,6 +540,7 @@
\renewcommand{\introductionname}{Introduction}
\renewcommand{\problemsetname}{Exercice}
\renewcommand{\updatename}{Mises à jour:}
+ \newcommand{\ebibname}{Bibliographie}
\renewcommand{\historyname}{Historique des versions}
}{\relax}
@@ -506,7 +550,7 @@
\setlength\parindent{2em}
\newcommand\figref[1]{\textbf{Figuur}~\ref{#1}}
\newcommand\tabref[1]{\textbf{Tabel}~\ref{#1}}
- \renewcommand{\chaptername}{Hoofdstuk \arabic{chapter}}
+ \renewcommand{\chaptername}{Hoofdstuk}
\newcommand{\authorname}{\textbf{Auteur: }}
\newcommand{\institutename}{\textbf{Instituut: }}
\newcommand{\datename}{\textbf{Datum: }}
@@ -532,6 +576,7 @@
\newcommand{\problemsetname}{Probleemcomplex}
\newcommand\bioinfo[2]{\gdef\@bioinfo{\textbf{#1}: #2}}
\newcommand{\updatename}{Update:}
+ \newcommand{\ebibname}{Bibliographie}
\newcommand{\historyname}{Versie Geschiedenis}
}{\relax}
@@ -541,7 +586,7 @@
\setlength\parindent{2em}
\newcommand\figref[1]{\ref{#1}~\textbf{Ábra}}
\newcommand\tabref[1]{\ref{#1}~\textbf{Táblázat}}
- \renewcommand{\chaptername}{\thechapter ~ fejezet}
+ \renewcommand{\chaptername}{Fejezet}
\newcommand{\authorname}{\textbf{Szerző: }}
\newcommand{\institutename}{\textbf{Intézmény: }}
\newcommand{\datename}{\textbf{Dátum: }}
@@ -567,6 +612,7 @@
\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}
@@ -580,7 +626,7 @@
\renewcommand{\listtablename}{Tabellenverzeichnis}
\renewcommand{\bibname}{Bibliographie}
\renewcommand{\appendixname}{Anhang}
- \renewcommand{\chaptername}{Kapitel \thechapter}
+ \renewcommand{\chaptername}{Kapitel}
\newcommand{\authorname}{\textbf{Autor: }}
\newcommand{\institutename}{\textbf{Institut: }}
\newcommand{\datename}{\textbf{Datum: }}
@@ -606,6 +652,7 @@
\newcommand{\introductionname}{Einleitung}
\newcommand\bioinfo[2]{\gdef\@bioinfo{\textbf{#1}: #2}}
\newcommand{\updatename}{Updates:}
+ \renewcommand{\ebibname}{Bibliographie}
\newcommand{\historyname}{Version der Geschichte}
}{\relax}
@@ -614,7 +661,7 @@
\setlength\parindent{2em}
\newcommand\figref[1]{\textbf{Figura}~\ref{#1}}
\newcommand\tabref[1]{\textbf{Tabla}~\ref{#1}}
- \renewcommand{\spanishchaptername}{Capítulo \thechapter}
+ \renewcommand{\spanishchaptername}{Capítulo}
\newcommand{\authorname}{\textbf{Autor: }}
\newcommand{\institutename}{\textbf{Instituto: }}
\newcommand{\datename}{\textbf{Fecha: }}
@@ -640,6 +687,7 @@
\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}
@@ -650,7 +698,7 @@
\setlength\parindent{2em}
\newcommand\figref[1]{\textbf{Зураг}\ref{#1}}
\newcommand\tabref[1]{\textbf{Хүснэгт}\ref{#1}}
- \renewcommand{\chaptername}{Бүлэг \thechapter}
+ \renewcommand{\chaptername}{Бүлэг}
\newcommand{\authorname}{\textbf{Зохиогч: }}
\newcommand{\institutename}{\textbf{Сургууль: }}
\newcommand{\datename}{\textbf{Огноо: }}
@@ -676,9 +724,89 @@
\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}{バージョン更新履歴}
+}{\relax}
+
+
\graphicspath{{./figure/}{./figures/}{./image/}{./images/}{./graphics/}{./graphic/}{./pictures/}{./picture/}}
\RequirePackage{tikz} %% load tikz without tikz
@@ -698,12 +826,19 @@
\setlist[itemize,2]{label={\eitemii}}
\setlist[itemize,3]{label={\eitemiii}}
-
-\RequirePackage[center,pagestyles]{titlesec}
\RequirePackage{apptools}
+
+% appendix chapter:
+
+\ifdefstring{\ELEGANT@lang}{cn}{
+ \ifdefstring{\ELEGANT@scheme}{chinese}{
+ \newcommand{\xchaptertitle}{第\zhnumber{\arabic{chapter}}章} }{
+ \newcommand{\xchaptertitle}{第 \thechapter{} 章}} }{
+ \newcommand{\xchaptertitle}{\chaptername~\thechapter~}}
+
\setcounter{secnumdepth}{5}
\titleformat{\chapter}[\style]{\bfseries}{
- \filcenter\LARGE\enspace\bfseries{\color{structurecolor} \IfAppendix{\appendixname\;\thechapter}{\chaptername}\;}}{1pt}{
+ \filcenter\LARGE\enspace\bfseries{\color{structurecolor} \IfAppendix{\appendixname\;\thechapter\;}{\xchaptertitle\;}}}{1pt}{
\LARGE\bfseries\color{structurecolor}\filcenter}[]
\titleformat{\section}[hang]{\bfseries}{
\Large\bfseries{\color{structurecolor}\thesection}\enspace}{1pt}{%
@@ -720,7 +855,6 @@
-
%%define the note and proof environment
\RequirePackage{pifont,manfnt,bbding}
\RequirePackage[many]{tcolorbox}
@@ -774,37 +908,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}
@@ -827,17 +961,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
@@ -921,9 +1055,10 @@
\RequirePackage{adforn}
-\newenvironment{problemset}[1][\chaptername~\;\exercisename]{
+\newenvironment{problemset}[1][\xchaptertitle~\exercisename]{
+ \vspace*{10pt}
\begin{center}
- \phantomsection\addcontentsline{toc}{section}{\texorpdfstring{\chaptername\;\exercisename}{\exercisename}}
+ \phantomsection\addcontentsline{toc}{section}{\texorpdfstring{\xchaptertitle~\exercisename}{\exercisename}}
% \markboth{#1}{\rightmark}
\markright{#1}
\textcolor{structurecolor}{\Large\bfseries\adftripleflourishleft~#1~\adftripleflourishright}
@@ -948,7 +1083,7 @@
\fancyhf{}
-\fancyfoot[c]{\color{structurecolor}\scriptsize\thepage}
+\fancyfoot[c]{\color{structurecolor}\small\thepage}
\if@twoside
\fancyhead[EL]{\color{structurecolor}\cnormal\leftmark}
\fancyhead[OR]{\color{structurecolor}\cnormal\rightmark}
@@ -962,8 +1097,7 @@
% \renewcommand{\headrule}{}
\fancypagestyle{plain}{\renewcommand{\headrulewidth}{0pt}\fancyhf{}\renewcommand{\headrule}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\, #1}{}}
-\renewcommand{\chaptermark}[1]{\markboth{\chaptername\, #1}{}}
-
+\renewcommand{\chaptermark}[1]{\markboth{\xchaptertitle\, #1}{}}
\renewcommand*{\maketitle}{%
@@ -1058,7 +1192,7 @@
breaklines=true,
keywordstyle=\color{winered},
commentstyle=\color{gray},
- emph={elegantpaper,fontenc,fontspec,xeCJK,citestyle,FiraMono,xunicode,newtxmath,figure,fig,image,img,table,itemize,enumerate,newtxtext,newtxtt,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},
+ 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,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,
@@ -1125,3 +1259,33 @@
\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
+\usepackage{calc}
+\usepackage[titles]{tocloft}
+\ifdefstring{\ELEGANT@lang}{cn}{
+ \renewcommand{\cftchappresnum}{\beforechap\space}
+ \renewcommand{\cftchapaftersnum}{\space\afterchap}
+ \setlength{\cftchapnumwidth}{\widthof{\textbf{附录~999}}}
+ \g@addto@macro\appendix{%
+ \addtocontents{toc}{%
+ \protect\renewcommand{\protect\cftchappresnum}{\appendixname\space}%
+ \protect\renewcommand{\protect\cftchapaftersnum}{}%
+ }%
+ }
+}{
+ \renewcommand{\cftchappresnum}{\chaptername\space}
+ \renewcommand{\cftchapaftersnum}{\space}
+ \setlength{\cftchapnumwidth}{\widthof{\textbf{Appendix~9}}}
+ \g@addto@macro\appendix{%
+ \addtocontents{toc}{%
+ \protect\renewcommand{\protect\cftchappresnum}{\appendixname\space}%
+ \protect\renewcommand{\protect\cftchapaftersnum}{}%
+ \setlength{\cftchapnumwidth}{\widthof{\textbf{Appendix~999}}}
+ }%
+ }
+}
+
+% restore the tt default family to lmodern tt family
+\renewcommand\ttdefault{lmtt} \ No newline at end of file