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.cls1068
1 files changed, 580 insertions, 488 deletions
diff --git a/macros/latex/contrib/elegantbook/elegantbook.cls b/macros/latex/contrib/elegantbook/elegantbook.cls
index 6441e3d2d3..dcb747a8af 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-2019 ElegantLaTeX (elegantlatex2e@gmail.com)
+%% Copyright 2013-2020 ElegantLaTeX (elegantlatex2e@gmail.com)
%%
%% This work may be distributed and/or modified freely
%% available at https://github.com/ElegantLaTeX/ElegantBook
@@ -8,7 +8,7 @@
%%%%%%%%%%%%%%%%%%%%%
% % !Mode:: "TeX:UTF-8"
\NeedsTeXFormat{LaTeX2e}
-\ProvidesClass{elegantbook}[2019/08/18 v3.09 ElegantBook document class]
+\ProvidesClass{elegantbook}[2020/02/10 v3.10 ElegantBook document class]
\RequirePackage{kvoptions}
\RequirePackage{etoolbox}
@@ -22,10 +22,10 @@
\DeclareStringOption[fancy]{mode}
\DeclareStringOption[show]{base}
\DeclareStringOption[normal]{device}
-\DeclareStringOption[numbers]{cite}
-\DeclareStringOption[newtxmath]{math}
+\DeclareStringOption[cm]{math}
\DeclareStringOption[marginfalse]{marginpar}
\DeclareStringOption[onecol]{toc}
+\DeclareStringOption{scheme}
% ----- backward compatibility
\DeclareVoidOption{green}{\ekv{color=green}}
\DeclareVoidOption{cyan}{\ekv{color=cyan}}
@@ -33,6 +33,13 @@
\DeclareVoidOption{gray}{\ekv{color=gray}}
\DeclareVoidOption{black}{\ekv{color=black}}
\DeclareVoidOption{nocolor}{\ekv{color=none}}
+\DeclareStringOption[ctexfont]{chinesefont}
+
+\DeclareVoidOption{chinese}{\ekv{scheme=chinese}}
+
+\DeclareVoidOption{ctexfont}{\ekv{chinesefont=ctexfont}}
+\DeclareVoidOption{founder}{\ekv{chinesefont=founder}}
+\DeclareVoidOption{nofont}{\ekv{chinesefont=nofont}}
\DeclareVoidOption{en}{\ekv{lang=en}}
\DeclareVoidOption{cn}{\ekv{lang=cn}}
@@ -49,11 +56,16 @@
\DeclareVoidOption{normal}{\ekv{device=normal}}
\DeclareVoidOption{pad}{\ekv{device=pad}}
+\DeclareStringOption[numbers]{cite}
\DeclareVoidOption{numbers}{\ekv{cite=numbers}}
\DeclareVoidOption{authoryear}{\ekv{cite=authoryear}}
+\DeclareVoidOption{super}{\ekv{cite=super}}
+
+\DeclareStringOption[apalike]{bibstyle}
-\DeclareVoidOption{newtxmath}{\ekv{math=newtx}}
+\DeclareVoidOption{newtx}{\ekv{math=newtx}}
\DeclareVoidOption{mtpro2}{\ekv{math=mtpro2}}
+\DeclareVoidOption{cm}{\ekv{math=cm}}
\DeclareVoidOption{margintrue}{\ekv{marginpar=margintrue}}
\DeclareVoidOption{marginfalse}{\ekv{marginpar=marginfalse}}
@@ -74,44 +86,104 @@
\ProcessKeyvalOptions*\relax
% \ProcessOptions*\relax
-\LoadClass[a4paper,oneside,openany]{book}
+\LoadClass[a4paper,oneside]{book}
-\RequirePackage{indentfirst,comment}
-\setlength\parindent{2em}
+%% device settings
+\RequirePackage{geometry}
+\ifdefstring{\ELEGANT@device}{normal}{
+ \geometry{
+ a4paper,
+ top=25.4mm, bottom=25.4mm,
+ headheight=2.17cm,
+ headsep=4mm,
+ footskip=12mm
+ }
+ \ifdefstring{\ELEGANT@marginpar}{margintrue}{
+ \geometry{
+ marginparwidth=5cm, marginparsep=5mm,
+ left=2cm,right=7cm}}{\relax}}{
+ \relax}
+\ifdefstring{\ELEGANT@device}{pad}{
+\geometry{
+ paperwidth=7.5in,
+ paperheight=10in,
+ margin=16mm,
+ headheight=2.17cm,
+ footskip=4mm
+}}{\relax}
+
+\RequirePackage{indentfirst,comment}
% fontsetting
\ifdefstring{\ELEGANT@math}{mtpro2}{
-\let\Bbbk\relax
-\RequirePackage[lite]{mtpro2}
+ \let\Bbbk\relax
+ \RequirePackage[lite]{mtpro2}
}{\relax}
+\setcounter{tocdepth}{1}
\PassOptionsToPackage{no-math}{fontspec}
+\RequirePackage{iftex}
\ifdefstring{\ELEGANT@lang}{cn}{
-\RequirePackage[UTF8, scheme=plain]{ctex}
-}
-
-\RequirePackage{ifxetex}
-
-
+ \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
+ \AfterEndPreamble{
+ % \renewcommand{\itshape}{\kaishu}
+ \setlength\parindent{2\ccwd}}}{\relax}
+
+\ifcsname kaishu\endcsname
+ \newcommand{\citshape}{\kaishu}
+\else
+ \newcommand{\citshape}{\itshape}
+\fi
+
+\ifcsname fangsong\endcsname
+ \newcommand{\cfs}{\fangsong}
+\else
+ \newcommand{\cfs}{\normalfont}
+\fi
\RequirePackage{newtxtext}
\RequirePackage{anyfontsize}
-\ifdefstring{\ELEGANT@math}{newtxmath}{
-\RequirePackage{newtxmath}
-\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}
+\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 -----
@@ -119,61 +191,61 @@
\RequirePackage{xcolor}
\ifdefstring{\ELEGANT@color}{green}{
- \definecolor{structurecolor}{RGB}{0,120,2}%
- \definecolor{main}{RGB}{0,120,2}%
- \definecolor{second}{RGB}{230,90,7}%
- \definecolor{third}{RGB}{0,160,152}%
+ \definecolor{structurecolor}{RGB}{0,120,2}%
+ \definecolor{main}{RGB}{0,120,2}%
+ \definecolor{second}{RGB}{230,90,7}%
+ \definecolor{third}{RGB}{0,160,152}%
}{\relax}
\ifdefstring{\ELEGANT@color}{cyan}{
- \definecolor{structurecolor}{RGB}{31,186,190}%
- \definecolor{main}{RGB}{59,180,5}%
- \definecolor{second}{RGB}{175,153,8}%
- \definecolor{third}{RGB}{244,105,102}%
+ \definecolor{structurecolor}{RGB}{31,186,190}%
+ \definecolor{main}{RGB}{59,180,5}%
+ \definecolor{second}{RGB}{175,153,8}%
+ \definecolor{third}{RGB}{244,105,102}%
}{\relax}
\ifdefstring{\ELEGANT@color}{blue}{
- \definecolor{structurecolor}{RGB}{60,113,183}
- \definecolor{main}{RGB}{0,166,82}%
- \definecolor{second}{RGB}{255,134,24}%
- \definecolor{third}{RGB}{0,174,247}%
+ \definecolor{structurecolor}{RGB}{60,113,183}
+ \definecolor{main}{RGB}{0,166,82}%
+ \definecolor{second}{RGB}{255,134,24}%
+ \definecolor{third}{RGB}{0,174,247}%
}{\relax}
\ifdefstring{\ELEGANT@color}{gray}{
- \definecolor{structurecolor}{RGB}{150,150,150}
- \definecolor{main}{RGB}{150,150,150}%
- \definecolor{second}{RGB}{150,150,150}%
- \definecolor{third}{RGB}{150,150,150}%
+ \definecolor{structurecolor}{RGB}{150,150,150}
+ \definecolor{main}{RGB}{150,150,150}%
+ \definecolor{second}{RGB}{150,150,150}%
+ \definecolor{third}{RGB}{150,150,150}%
}{\relax}
\ifdefstring{\ELEGANT@color}{black}{
- \definecolor{structurecolor}{RGB}{0,0,0}
- \definecolor{main}{RGB}{0,0,0}%
- \definecolor{second}{RGB}{0,0,0}%
- \definecolor{third}{RGB}{0,0,0}%
+ \definecolor{structurecolor}{RGB}{0,0,0}
+ \definecolor{main}{RGB}{0,0,0}%
+ \definecolor{second}{RGB}{0,0,0}%
+ \definecolor{third}{RGB}{0,0,0}%
}{\relax}
%green color
- \definecolor{structure1}{RGB}{0,120,2}%
- \definecolor{main1}{RGB}{0,120,2}%
- \definecolor{second1}{RGB}{230,90,7}%
- \definecolor{third1}{RGB}{0,160,152}%
+\definecolor{structure1}{RGB}{0,120,2}%
+\definecolor{main1}{RGB}{0,120,2}%
+\definecolor{second1}{RGB}{230,90,7}%
+\definecolor{third1}{RGB}{0,160,152}%
%cyan color
- \definecolor{structure2}{RGB}{31,186,190}%
- \definecolor{main2}{RGB}{59,180,5}%
- \definecolor{second2}{RGB}{175,153,8}%
- \definecolor{third2}{RGB}{244,105,102}%
+\definecolor{structure2}{RGB}{31,186,190}%
+\definecolor{main2}{RGB}{59,180,5}%
+\definecolor{second2}{RGB}{175,153,8}%
+\definecolor{third2}{RGB}{244,105,102}%
%blue color
- \definecolor{structure3}{RGB}{60,113,183}
- \definecolor{main3}{RGB}{0,166,82}%
- \definecolor{second3}{RGB}{255,134,24}%
- \definecolor{third3}{RGB}{0,174,247}%
+\definecolor{structure3}{RGB}{60,113,183}
+\definecolor{main3}{RGB}{0,166,82}%
+\definecolor{second3}{RGB}{255,134,24}%
+\definecolor{third3}{RGB}{0,174,247}%
% gray color
- \definecolor{structure4}{RGB}{150,150,150}
- \definecolor{main4}{RGB}{150,150,150}%
- \definecolor{second4}{RGB}{150,150,150}%
- \definecolor{third4}{RGB}{150,150,150}%
+\definecolor{structure4}{RGB}{150,150,150}
+\definecolor{main4}{RGB}{150,150,150}%
+\definecolor{second4}{RGB}{150,150,150}%
+\definecolor{third4}{RGB}{150,150,150}%
% black color
- \definecolor{structure5}{RGB}{0,0,0}
- \definecolor{main5}{RGB}{0,0,0}%
- \definecolor{second5}{RGB}{0,0,0}%
- \definecolor{third5}{RGB}{0,0,0}%
+\definecolor{structure5}{RGB}{0,0,0}
+\definecolor{main5}{RGB}{0,0,0}%
+\definecolor{second5}{RGB}{0,0,0}%
+\definecolor{third5}{RGB}{0,0,0}%
% corlor definition
\definecolor{winered}{rgb}{0.5,0,0}
@@ -181,51 +253,60 @@
\newcommand{\base}[2]{%
- \nointerlineskip \vspace{0.1\baselineskip}\hspace{\fill}
- {\color{#1}
- \resizebox{0.3\linewidth}{1.5ex}
- {{%
- {\begin{tikzpicture}
- \node (C) at (0,0) {};
- \node (D) at (4,0) {};
- \path (C) to [ornament=#2] (D);
- \end{tikzpicture}}}}}%
- \hspace{\fill}
- \par\nointerlineskip \vspace{0.1\baselineskip}
+ \nointerlineskip \vspace{0.1\baselineskip}\hspace{\fill}
+ {\color{#1}
+ \resizebox{0.3\linewidth}{1.5ex}
+ {{%
+ {\begin{tikzpicture}
+ \node (C) at (0,0) {};
+ \node (D) at (4,0) {};
+ \path (C) to [ornament=#2] (D);
+ \end{tikzpicture}}}}}%
+ \hspace{\fill}
+ \par\nointerlineskip \vspace{0.1\baselineskip}
}
% ----- Title Style -----
\ifdefstring{\ELEGANT@titlestyle}{hang}{\def\style{hang}}{\relax}
\ifdefstring{\ELEGANT@titlestyle}{display}{\def\style{display}}{\relax}
+% reference:
+% https://tex.stackexchange.com/questions/58506/how-to-make-a-new-command-similar-to-author
+% https://pastebin.com/C8W4axzV
+\newcommand\email[1]{\href{mailto:#1}{\nolinkurl{#1}}}
-\newtoks\email
-\newtoks\version
-\newtoks\institute
-\newtoks\subtitle
+\global\let\@title\@empty
+\global\let\@author\@empty
+\global\let\@date\@empty
+\newcommand{\subtitle}[1]{\gdef\@subtitle{#1}}
+\newcommand{\institute}[1]{\gdef\@institute{#1}}
+\newcommand{\version}[1]{\gdef\@version{#1}}
+\newcommand{\extrainfo}[1]{\gdef\@extrainfo{#1}}
-\RequirePackage[sort&compress]{natbib}
-\setlength{\bibsep}{0.0pt}
-\def\bibfont{\footnotesize}
+\RequirePackage{mwe}
+\newcommand{\logo}[1]{\gdef\@logo{#1}}
+\newcommand{\cover}[1]{\gdef\@cover{#1}}
+\newcommand{\question}[1]{{\par\citshape #1}\\[0.2ex]}
+\RequirePackage[\ELEGANT@cite,sort&compress]{natbib}
+\setlength{\bibsep}{0.0pt}
+\def\bibfont{\footnotesize}
\RequirePackage{enumerate}
% list/itemize/enumerate setting
\RequirePackage[shortlabels,inline]{enumitem}
\setlist{nolistsep}
-% caption settings
\RequirePackage[font=small,labelfont={bf,color=structurecolor}]{caption}
\captionsetup[table]{skip=3pt}
\captionsetup[figure]{skip=3pt}
\AtBeginDocument{
-\setlength{\abovedisplayskip}{3pt}
-\setlength{\belowdisplayskip}{3pt}
-\setcounter{tocdepth}{1}
-\RequirePackage[flushmargin]{footmisc}
-\setlength{\footnotesep}{12pt}
+ \setlength{\abovedisplayskip}{3pt}
+ \setlength{\belowdisplayskip}{3pt}
+ \RequirePackage[flushmargin,stable]{footmisc}
+ \setlength{\footnotesep}{12pt}
}
\ifdefstring{\ELEGANT@toc}{twocol}{
@@ -244,6 +325,7 @@
\RequirePackage{graphicx}
%\RequirePackage{enumerate}
\RequirePackage{amsmath,mathrsfs,amsfonts,amssymb}
+
\RequirePackage{booktabs}
\RequirePackage{multicol,multirow}
\RequirePackage{xcolor}
@@ -252,46 +334,98 @@
%%中文结构名字
\ifdefstring{\ELEGANT@lang}{cn}{
- \renewcommand{\contentsname}{目\hspace{2em}录}
- \renewcommand{\figurename}{图}
- \renewcommand{\tablename}{表}
- \renewcommand{\partname}{\color{structurecolor}}
- \renewcommand{\thepart}{第\zhnumber{\arabic{part}}部分}
- \renewcommand{\listfigurename}{插图目录}
- \renewcommand{\listtablename}{表格目录}
- \renewcommand{\bibname}{参考文献}
- \renewcommand{\appendixname}{附录}
- \renewcommand{\indexname}{索\hspace{2em}引}
- \newcommand\figref[1]{\textbf{图}~\ref{#1}}
- \newcommand\tabref[1]{\textbf{表}~\ref{#1}}
- \renewcommand{\chaptername}{第 \thechapter\,章}
- \ifdefstring{\ELEGANT@cite}{authoryear}{
- \RequirePackage[authoryear]{gbt7714}
- }{\relax}
- \ifdefstring{\ELEGANT@cite}{numbers}{
- \RequirePackage[numbers]{gbt7714}
- }{\relax}
- \ifdefstring{\ELEGANT@cite}{super}{
- \RequirePackage[super]{gbt7714}
- }{\relax}
+ \renewcommand{\contentsname}{目录}
+ \renewcommand{\figurename}{图}
+ \renewcommand{\tablename}{表}
+ \renewcommand{\partname}{\color{structurecolor}}
+ \renewcommand{\thepart}{第\zhnumber{\arabic{part}}部分}
+ \renewcommand{\listfigurename}{插图目录}
+ \renewcommand{\listtablename}{表格目录}
+ \renewcommand{\bibname}{参考文献}
+ \renewcommand{\appendixname}{附录~\thechapter}
+ \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}{\textit{作者:}}
+ \newcommand{\institutename}{\textit{组织:}}
+ \newcommand{\datename}{\textit{时间:}}
+ \newcommand{\versionname}{\textit{版本:}}
+ \RequirePackage[\ELEGANT@cite]{gbt7714}
+ \newcommand{\notename}{笔记}
+ \renewcommand*{\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{\textit{#1}:\textit{#2}}}
+ \newcommand{\updatename}{更新:}
+ \newcommand{\historyname}{版本更新历史}
}{\relax}
\ifdefstring{\ELEGANT@lang}{en}{
-\newcommand\figref[1]{\textbf{Figure}~\ref{#1}}
-\newcommand\tabref[1]{\textbf{Table}~\ref{#1}}
-\renewcommand{\chaptername}{Chapter \thechapter}
-\bibliographystyle{aer}
+ \setlength\parindent{2em}
+ \newcommand\figref[1]{\textbf{Figure}~\ref{#1}}
+ \newcommand\tabref[1]{\textbf{Table}~\ref{#1}}
+ \renewcommand{\chaptername}{Chapter \thechapter}
+ \newcommand{\authorname}{\textbf{Author: }}
+ \newcommand{\institutename}{\textbf{Institute: }}
+ \newcommand{\datename}{\textbf{Date: }}
+ \newcommand{\versionname}{\textbf{Version: }}
+ \bibliographystyle{\ELEGANT@bibstyle}
+ \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}
+ \newcommand{\problemsetname}{Exercise}
+ \newcommand\bioinfo[2]{\gdef\@bioinfo{\textbf{#1}: #2}}
+ \newcommand{\updatename}{Updates:}
+ \newcommand{\historyname}{Version History}
}{\relax}
\RequirePackage{xpatch}
-\xpatchcmd{\part}{\thispagestyle{plain}}
- {\thispagestyle{plain}}{}{}
-\xpatchcmd{\@endpart}{\vfil\newpage}{\vfil\newpage
- }{}{}
+\xpatchcmd{\part}{
+ \thispagestyle{plain}}{
+ \thispagestyle{plain}}{}{}
+\xpatchcmd{\@endpart}{
+ \vfil\newpage}{
+ \vfil\newpage}{}{}
+
\graphicspath{{./figure/}{./figures/}{./image/}{./images/}{./graphics/}{./graphic/}{./pictures/}{./picture/}}
-\RequirePackage{tikz}
+\usepackage{pgfornament} %% load tikz without tikz
\usetikzlibrary{backgrounds,calc,shadows}
-\usepackage[object=vectorian]{pgfornament} %%
+\newcommand*\circled[1]{\tikz[baseline=(char.base)]{
+ \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);}
\newcommand*{\eitemii}{\tikz \draw [baseline, fill=structurecolor,draw=none,circular drop shadow] circle (2pt);}
@@ -305,212 +439,168 @@
\setlist[itemize,3]{label={\eitemiii}}
-%% device settings
-
-\RequirePackage{geometry}
-\ifdefstring{\ELEGANT@device}{normal}{
-\geometry{
- a4paper,
- top=25.4mm, bottom=25.4mm,
- headheight=2.17cm,
- headsep=4mm,
- footskip=12mm
-}
-\ifdefstring{\ELEGANT@marginpar}{margintrue}{
-\geometry{
- marginparwidth=5cm, marginparsep=5mm,
- left=2cm,right=7cm,
-}
-}{\relax}
-}{\relax}
-
-\ifdefstring{\ELEGANT@device}{pad}{
-\geometry{
- paperwidth=7.5in,
- paperheight=10in,
- margin=16mm,
- headheight=2.17cm,
- footskip=4mm
-}}{\relax}
-
\RequirePackage{hyperref}
\hypersetup{
- breaklinks,
- unicode,
- linktoc=all,
- bookmarksnumbered=true,
- bookmarksopen=true,
- pdfkeywords={ElegantBook},
- colorlinks,
- linkcolor=winered,
- citecolor=winered,
- urlcolor = winered,
- plainpages=false,
- pdfstartview=FitH,
- pdfborder={0 0 0},
- linktocpage
+ breaklinks,
+ unicode,
+ linktoc=all,
+ bookmarksnumbered=true,
+ bookmarksopen=true,
+ pdfkeywords={ElegantBook},
+ colorlinks,
+ linkcolor=winered,
+ citecolor=winered,
+ urlcolor=winered,
+ plainpages=false,
+ pdfstartview=FitH,
+ pdfborder={0 0 0},
+ linktocpage
}
-\let\email\relax
-\newcommand\email[1]{\href{mailto:#1}{\nolinkurl{#1}}}
%% 章节设置
\RequirePackage[center,pagestyles]{titlesec}
\RequirePackage{apptools}
-\RequirePackage[toc,page]{appendix}
+\RequirePackage[toc,page,title,titletoc]{appendix}
\setcounter{secnumdepth}{5}
\titleformat{\chapter}[\style]{\bfseries}
{\filcenter\LARGE\enspace\bfseries{\color{structurecolor}\IfAppendix{\appendixname}{\chaptername}\enspace}}{1pt}{\bfseries\color{structurecolor}\LARGE\filcenter}[\ifdefstring{\ELEGANT@base}{hide}{}{\filcenter\base{structurecolor}{88}}]
-\titleformat{\section}[hang]{\bfseries}
-{\hspace{-2.45em}\Large\bfseries{\color{structurecolor}\thesection}\enspace}{1pt}{\color{structurecolor}\Large\bfseries\filright}
-
-\titleformat{\subsection}[hang]{\bfseries}
-{\hspace{-2.45em}\large\bfseries\color{structurecolor}\thesubsection\enspace}{1pt}{\color{structurecolor}\large\bfseries\filright}
-
-\titleformat{\subsubsection}[hang]{\bfseries}
-{\hspace{-2.45em}\large\bfseries\color{structurecolor}\thesubsubsection\enspace}{1pt}{\color{structurecolor}\large\bfseries\filright}
+\titleformat{\section}[hang]{\bfseries}{
+ \Large\bfseries{\color{structurecolor}\thesection}\enspace}{1pt}{%
+ \color{structurecolor}\Large\bfseries\filright}
+\titleformat{\subsection}[hang]{\bfseries}{
+ \large\bfseries\color{structurecolor}\thesubsection\enspace}{1pt}{%
+ \color{structurecolor}\large\bfseries\filright}
+\titleformat{\subsubsection}[hang]{\bfseries}{
+ \large\bfseries\color{structurecolor}\thesubsubsection\enspace}{1pt}{%
+ \color{structurecolor}\large\bfseries\filright}
\titlespacing{\chapter}{0pt}{-20pt}{1.3\baselineskip}
%\titlespacing{\subsection}{0pt}{0.5\baselineskip}{-\baselineskip}
-
-
%%define the note and proof environment
\RequirePackage{pifont,manfnt,bbding}
-
\RequirePackage[many]{tcolorbox}
+
+% \newlength{\normalparindent}
+% \setlength{\normalparindent}{\parindent}
\ifdefstring{\ELEGANT@mode}{fancy}{
-\tcbset{
+ \tcbset{
common/.style={
- fontupper=\ifdefstring{\ELEGANT@lang}{en}{\itshape}{\upshape\kaishu},
- lower separated=false,
- 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={.},},
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$}}; }
- },
+ 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}{
- \ifdefstring{\ELEGANT@lang}{en}{Definition}{定义}
-}{defstyle}{def}
-
-\newtcbtheorem[auto counter,number within=chapter]{theorem}{
- \ifdefstring{\ELEGANT@lang}{en}{Theorem}{定理}
-}{thmstyle}{thm}
-
-\newtcbtheorem[auto counter,number within=chapter]{proposition}{
- \ifdefstring{\ELEGANT@lang}{en}{Proposition}{命题}
-}{propstyle}{pro}
-
-\newtcbtheorem[auto counter,number within=chapter]{corollary}{
- \ifdefstring{\ELEGANT@lang}{en}{Corollary}{推论}
-}{thmstyle}{cor}
-
-\newtcbtheorem[auto counter,number within=chapter]{lemma}{
- \ifdefstring{\ELEGANT@lang}{en}{Lemma}{引理}
-}{thmstyle}{lem}
-
+ 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}
+ \newtcbtheorem[auto counter,number within=chapter]{theorem}{\theoremname}{thmstyle}{thm}
+ \newtcbtheorem[auto counter,number within=chapter]{postulate}{\postulatename}{thmstyle}{pos}
+ \newtcbtheorem[auto counter,number within=chapter]{axiom}{\axiomname}{thmstyle}{axi}
+ \newtcbtheorem[auto counter,number within=chapter]{proposition}{\propositionname}{propstyle}{pro}
+ \newtcbtheorem[auto counter,number within=chapter]{corollary}{\corollaryname}{thmstyle}{cor}
+ \newtcbtheorem[auto counter,number within=chapter]{lemma}{\lemmaname}{thmstyle}{lem}
}{\relax}
\ifdefstring{\ELEGANT@mode}{simple}{
-\let\openbox\relax
-\RequirePackage{amsthm}
-\let\proof\relax
-\let\endproof\relax
-% declare a new theorem style
-\newtheoremstyle{edefstyle}%
-{3pt}% Space above
-{3pt}% Space below
-{\ifdefstring{\ELEGANT@lang}{en}{\itshape}{\upshape\kaishu}}% Body font
-{}% Indent amount
-{\bfseries\color{main}}% Theorem head font
-{}% Punctuation after theorem head
-{0.5em}% Space after theorem head
-{\thmname{#1} \thmnumber{#2} \thmnote{(#3)}}% Theorem head spec (can be left empty, meaning ‘normal’)
-% -------------------------------------------------%
-\newtheoremstyle{ethmstyle}%
-{3pt}% Space above
-{3pt}% Space below
-{\ifdefstring{\ELEGANT@lang}{en}{\itshape}{\upshape\kaishu}}% Body font
-{}% Indent amount
-{\bfseries\color{second}}% Theorem head font
-{}% Punctuation after theorem head
-{.5em}% Space after theorem head
-{\thmname{#1} \thmnumber{#2} \thmnote{(#3)}}% Theorem head spec (can be left empty, meaning ‘normal’)
-% -------------------------------------------------%
-\newtheoremstyle{eprostyle}%
-{3pt}% Space above
-{3pt}% Space below
-{\ifdefstring{\ELEGANT@lang}{en}{\itshape}{\upshape\kaishu}}% Body font
-{}% Indent amount
-{\bfseries\color{third}}% Theorem head font
-{}% Punctuation after theorem head
-{.5em}% Space after theorem head
-{\thmname{#1} \thmnumber{#2} \thmnote{(#3)}}% Theorem head spec (can be left empty, meaning ‘normal’)
-
-\theoremstyle{edefstyle}
-\newtheorem{edefinition}{\ifdefstring{\ELEGANT@lang}{en}{Definition}{定义}}[chapter]
-
-\theoremstyle{ethmstyle}
-\newtheorem{etheorem}{\ifdefstring{\ELEGANT@lang}{en}{Theorem}{定理}}[chapter]
-\newtheorem{elemma}{\ifdefstring{\ELEGANT@lang}{en}{Lemma}{引理}}[chapter]
-\newtheorem{ecorollary}{\ifdefstring{\ELEGANT@lang}{en}{Corollary}{推论}}[chapter]
-
-\theoremstyle{eprostyle}
-\newtheorem{eproposition}{\ifdefstring{\ELEGANT@lang}{en}{Proposition}{命题}}[chapter]
-
-\newenvironment{theorem}[2]
- {\ifstrempty{#1}{\etheorem}{\etheorem[#1]}\ifstrempty{#2}{}{\label{thm:#2}}}
- {\endetheorem}
-
-\newenvironment{definition}[2]
- {\ifstrempty{#1}{\edefinition}{\edefinition[#1]}\ifstrempty{#2}{}{\label{def:#2}}}
- {\endedefinition}
-
-\newenvironment{lemma}[2]
- {\ifstrempty{#1}{\elemma}{\elemma[#1]}\ifstrempty{#2}{}{\label{lem:#2}}}
- {\endelemma}
-
-\newenvironment{corollary}[2]
- {\ifstrempty{#1}{\ecorollary}{\ecorollary[#1]}\ifstrempty{#2}{}{\label{cor:#2}}}
- {\endecorollary}
-
-\newenvironment{proposition}[2]
- {\ifstrempty{#1}{\eproposition}{\eproposition[#1]}\ifstrempty{#2}{}{\label{pro:#2}}}
- {\endeproposition}
+ \let\openbox\relax
+ \RequirePackage{amsthm}
+ \let\proof\relax
+ % \let\proofname\relax
+ \let\endproof\relax
+
+ % declare a new theorem style
+ \newtheoremstyle{edefstyle}{3pt}{3pt}{\citshape}{-3pt}{
+ \bfseries\color{main}}{}{0.5em}{\thmname{#1} \thmnumber{#2} \thmnote{(#3)}}
+ \newtheoremstyle{ethmstyle}{3pt}{3pt}{\citshape}{-3pt}{
+ \bfseries\color{second}}{}{0.5em}{\thmname{#1} \thmnumber{#2} \thmnote{(#3)}}
+ \newtheoremstyle{eprostyle}{3pt}{3pt}{\citshape}{-3pt}{
+ \bfseries\color{third}}{}{0.5em}{\thmname{#1} \thmnumber{#2} \thmnote{(#3)}}
+
+
+ \theoremstyle{edefstyle} % definition style
+
+ \newtheorem{edefinition}{\definitionname}[chapter]
+ \newenvironment{definition}[2]{
+ \ifstrempty{#1}{\edefinition}{\edefinition[#1]}\ifstrempty{#2}{}{\label{def:#2}}}{
+ \endedefinition}
+
+
+ \theoremstyle{ethmstyle} %theorem style
+
+ \newtheorem{etheorem}{\theoremname}[chapter]
+ \newenvironment{theorem}[2]{
+ \ignorespaces\ifstrempty{#1}{\etheorem}{\etheorem[#1]}\ifstrempty{#2}{}{\label{thm:#2}}}{
+ \endetheorem}
+
+ \newtheorem{elemma}{\lemmaname}[chapter]
+ \newenvironment{lemma}[2]{
+ \ignorespaces\ifstrempty{#1}{\elemma}{\elemma[#1]}\ifstrempty{#2}{}{\label{lem:#2}}}{
+ \endelemma}
+
+ \newtheorem{ecorollary}{\corollaryname}[chapter]
+ \newenvironment{corollary}[2]{
+ \ignorespaces\ifstrempty{#1}{\ecorollary}{\ecorollary[#1]}\ifstrempty{#2}{}{\label{cor:#2}}}{
+ \endecorollary}
+
+ \newtheorem{epostulate}{\postulatename}[chapter]
+ \newenvironment{postulate}[2]{
+ \ifstrempty{#1}{\epostulate}{\epostulate[#1]}\ifstrempty{#2}{}{\label{pos:#2}}}{
+ \endepostulate}
+
+ \newtheorem{eaxiom}{\axiomname}[chapter]
+ \newenvironment{axiom}[2]{
+ \ifstrempty{#1}{\eaxiom}{\eaxiom[#1]}\ifstrempty{#2}{}{\label{axi:#2}}}{
+ \endaxiom}
+
+ \theoremstyle{eprostyle}
+ \newtheorem{eproposition}{\propositionname}[chapter]
+ \newenvironment{proposition}[2]{
+ \ifstrempty{#1}{\eproposition}{\eproposition[#1]}\ifstrempty{#2}{}{\label{pro:#2}}}{
+ \endeproposition}
}{\relax}
% main(green-def): example exercise problem solution
@@ -522,145 +612,122 @@
\setcounter{exam}{0}
\renewcommand{\theexam}{\thechapter.\arabic{exam}}
\newenvironment{example}[1][]{
- \refstepcounter{exam}\par\noindent\textbf{\color{main}{%
- \ifdefstring{\ELEGANT@lang}{en}{Example}{例}
- }\theexam #1 \,}\rmfamily %
- }{
- \par\medskip\ignorespacesafterend %
- }
+ \refstepcounter{exam}
+ \par\noindent\textbf{\color{main}{\examplename}\theexam #1 }\rmfamily}{
+ \par\ignorespacesafterend}
%% Exercise with counter
\newcounter{exer}[chapter]
\setcounter{exer}{0}
\renewcommand{\theexer}{\thechapter.\arabic{exer}}
\newenvironment{exercise}[1][]{
- \refstepcounter{exer}\par\noindent\makebox[-3pt][r]{\scriptsize\color{red!90}\HandPencilLeft\quad}\textbf{\color{main}{%
- \ifdefstring{\ELEGANT@lang}{en}{Exercise}{练习}
- }\theexer #1 \,}\rmfamily %
- }{
- \par\medskip\ignorespacesafterend %
- }
+ \refstepcounter{exer}
+ \par\noindent\makebox[-3pt][r]{
+ \scriptsize\color{red!90}\HandPencilLeft\quad}
+ \textbf{\color{main}{\exercisename}\theexer #1 }\rmfamily}{
+ \par\ignorespacesafterend}
-%% Exercise with counter
+%% Problem with counter
\newcounter{prob}[chapter]
\setcounter{prob}{0}
\renewcommand{\theprob}{\thechapter.\arabic{prob}}
\newenvironment{problem}[1][]{
- \refstepcounter{prob}\par\noindent\textbf{\color{main}{%
- \ifdefstring{\ELEGANT@lang}{en}{Problem}{例题}
- }\theprob #1 \,}\rmfamily %
- }{
- \par\medskip\ignorespacesafterend %
- }
-
-
-
-\newenvironment{note}{\par\noindent{\makebox[0pt][r]{\scriptsize\color{red!90}\textdbend\quad}\textbf{\color{second}%
- \ifdefstring{\ELEGANT@lang}{en}{Note}{注意}\,
-}}\ifdefstring{\ELEGANT@lang}{en}{\itshape}{\kaishu}}{\par}
-
-\newenvironment{proof}{\par\noindent\textbf{\color{second}%
- \ifdefstring{\ELEGANT@lang}{en}{Proof}{证明}\;
-}\color{black!90}\small}{
-%\hfill$\Box$\quad
-\par}
-\newenvironment{remark}{\noindent\textbf{\color{second}%
- \ifdefstring{\ELEGANT@lang}{en}{Remark}{注}\,
-}}{\par}
-\newenvironment{assumption}{\par\noindent\textbf{\color{third}%
- \ifdefstring{\ELEGANT@lang}{en}{Assumption}{假设}\,
-}}{\par}
-\newenvironment{conclusion}{\par\noindent\textbf{\color{third}%
- \ifdefstring{\ELEGANT@lang}{en}{Conclusion}{结论}\,
-}}{\par}
-\newenvironment{solution}{\par\noindent\textbf{\color{main}%
- \ifdefstring{\ELEGANT@lang}{en}{Solution}{解}\;
-}\ifdefstring{\ELEGANT@lang}{en}{\itshape}{\kaishu}}{\vskip2ex\par}
-\newenvironment{property}{\par\noindent\textbf{\color{third}%
- \ifdefstring{\ELEGANT@lang}{en}{Property}{性质}\;
-}}{\par}
-\newenvironment{custom}[1]{\par\noindent\textbf{\color{third}
- \ifdefstring{\ELEGANT@lang}{en}{#1}{#1}\,
-}}{\par}
+ \refstepcounter{prob}
+ \par\noindent\textbf{\color{main}{\problemname}\theprob #1 }\rmfamily}{
+ \par\ignorespacesafterend}
+
+\newenvironment{note}{
+ \par\noindent\makebox[-3pt][r]{
+ \scriptsize\color{red!90}\textdbend\quad}
+ \textbf{\color{second}\notename} \citshape}{\par}
+
+\newenvironment{proof}{
+ \par\noindent\textbf{\color{second}\proofname\;}
+ \color{black!90}\cfs}{
+ % \hfill$\Box$\quad
+ \par}
+
+\newenvironment{solution}{\par\noindent\textbf{\color{main}\solutionname} \citshape}{\par}
+\newenvironment{remark}{\noindent\textbf{\color{second}\remarkname}}{\par}
+\newenvironment{assumption}{\par\noindent\textbf{\color{third}\assumptionname} \citshape}{\par}
+\newenvironment{conclusion}{\par\noindent\textbf{\color{third}\conclusionname} \citshape}{\par}
+\newenvironment{property}{\par\noindent\textbf{\color{third}\propertyname} \citshape}{\par}
+\newenvironment{custom}[1]{\par\noindent\textbf{\color{third} #1} \citshape}{\par}
\RequirePackage{multicol}
\tcbset{
- introduction/.style={
- enhanced,
- breakable,
- colback=structurecolor!10,
- colframe=structurecolor,
- fonttitle=\bfseries,
- colbacktitle=structurecolor,
- fontupper=\ifdefstring{\ELEGANT@lang}{en}{\sffamily}{\kaishu},
- 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
- },
+ 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
+ },
}
-\newenvironment{introduction}[1][\ifdefstring{\ELEGANT@lang}{en}{Introduction}{内容提要}]{
-\begin{tcolorbox}[introduction,title={#1}]
-\begin{multicols}{2}
-\begin{itemize}[label=\textcolor{structurecolor}{\scriptsize\SquareShadowBottomRight}]
-}{%
-\end{itemize}
-\end{multicols}
-\end{tcolorbox}}
+\newenvironment{introduction}[1][\introductionname]{
+ \begin{tcolorbox}[introductionsty,title={#1}]
+ \begin{multicols}{2}
+ \begin{itemize}[label=\textcolor{structurecolor}{\upshape\scriptsize\SquareShadowBottomRight}]}{
+ \end{itemize}
+ \end{multicols}
+ \end{tcolorbox}}
\RequirePackage{adforn}
-\newenvironment{problemset}[1][\ifdefstring{\ELEGANT@lang}{en}{\textbf{\chaptername\, Exercise}}{\textbf{\chaptername\, 习题}}]{
-\begin{center}
-\ifdefstring{\ELEGANT@lang}{en}{\addcontentsline{toc}{section}{\texorpdfstring{\chaptername\,}{Chapter} Exercise} }{\addcontentsline{toc}{section}{\texorpdfstring{\chaptername\,}{章节}习题}}
-\textcolor{structurecolor}{\Large\bfseries\adftripleflourishleft~#1~\adftripleflourishright}
-\end{center}
-\begin{enumerate}[label=\textcolor{structurecolor}{\arabic*.}]}{%
-\end{enumerate}}
+\newenvironment{problemset}[1][\chaptername~\problemsetname]{
+ \begin{center}
+ \phantomsection\addcontentsline{toc}{section}{\texorpdfstring{\chaptername\;\problemsetname}{\problemsetname}}
+ \textcolor{structurecolor}{\Large\bfseries\adftripleflourishleft~#1~\adftripleflourishright}
+ \end{center}
+ \begin{enumerate}}{
+ \end{enumerate}}
\def\relsec{\endgroup start}
\def\endrelsec{end\begingroup\def \@currenvir {relsec}}
\ifdefstring{\ELEGANT@result}{noanswer}{
- \AtBeginDocument{
- \excludecomment{solution}
- \excludecomment{proof}
- \excludecomment{inline}
- }
+ \AtBeginDocument{
+ \excludecomment{solution}
+ \excludecomment{proof}
+ \excludecomment{inline}
+ }
}{\relax}
%页眉页脚
\RequirePackage{fancyhdr}
-\RequirePackage{lastpage}
\fancyhf{}
-
\ifdefstring{\ELEGANT@base}{hide}{
- \if@twoside
- \fancyhead[ER,OR]{\color{structurecolor}\ifdefstring{\ELEGANT@lang}{en}{\itshape}{\kaishu}\rightmark}
- \fancyhead[El,OL]{\color{structurecolor}\ifdefstring{\ELEGANT@lang}{en}{\itshape}{\kaishu}\leftmark}
- \else
- \fancyhead[L]{\color{structurecolor}\ifdefstring{\ELEGANT@lang}{en}{\itshape}{\kaishu}\leftmark}
- \fancyhead[R]{\color{structurecolor}\ifdefstring{\ELEGANT@lang}{en}{\itshape}{\kaishu}\rightmark}
- \fancyfoot[c]{\color{structurecolor}\ifdefstring{\ELEGANT@lang}{en}{\itshape}{\kaishu}--\;\thepage/\pageref*{LastPage}\;--}
- \fi
+ \fancyfoot[c]{\color{structurecolor}\scriptsize\thepage}
+ \if@twoside
+ \fancyhead[ER]{\color{structurecolor}\citshape\leftmark}
+ \fancyhead[OL]{\color{structurecolor}\citshape\rightmark}
+ \else
+ \fancyhead[R]{\color{structurecolor}\citshape\rightmark}
+ \fi
}{\relax}
\ifdefstring{\ELEGANT@base}{show}{
- \fancyfoot[c]{\catcode`\$=3\relax\base{structurecolor}{88}}
- \if@twoside
- \fancyhead[ER,OL]{\color{structurecolor}\ifdefstring{\ELEGANT@lang}{en}{\itshape}{\kaishu}--\;\thepage/\pageref*{LastPage}\;--}
- \fancyhead[EL]{\color{structurecolor}\ifdefstring{\ELEGANT@lang}{en}{\itshape}{\kaishu}\leftmark}
- \fancyhead[OR]{\color{structurecolor}\ifdefstring{\ELEGANT@lang}{en}{\itshape}{\kaishu}\rightmark}
- \else
- \fancyhead[R]{\color{structurecolor}\ifdefstring{\ELEGANT@lang}{en}{\itshape}{\kaishu}--\;\thepage/\pageref*{LastPage}\;--}
- \fancyhead[L]{\color{structurecolor}\ifdefstring{\ELEGANT@lang}{en}{\itshape}{\kaishu}\leftmark}
- \fi
+ \fancyfoot[c]{\catcode`\$=3\relax\base{structurecolor}{88}}
+ \if@twoside
+ \fancyhead[EL,OR]{\color{structurecolor}--\;\thepage\;--}
+ \fancyhead[ER]{\color{structurecolor}\citshape\leftmark}
+ \fancyhead[OL]{\color{structurecolor}\citshape\rightmark}
+ \else
+ \fancyhead[R]{\color{structurecolor}--\;\thepage\;--}
+ \fancyhead[L]{\color{structurecolor}\citshape\rightmark}
+ \fi
}{\relax}
@@ -672,83 +739,81 @@
\renewcommand{\sectionmark}[1]{\markright{\thesection\, #1}{} }
\renewcommand{\chaptermark}[1]{\markboth{\chaptername \, #1\,}{}}
-%%封面
-\newcommand*{\extrainfo}[1]{\def\@extrainfo{#1}}
-
-\def\IfEmpty#1{%
- \edef\1{\the#1}
- \ifx\1\empty
-}
-\def \ifempty#1{\def\temp{#1} \ifx\temp\empty }
-
-\newcommand*{\logo}[1]{
- \def\@logo{\includegraphics[width=4.2cm]{#1}
- }
-}
-\ifdefstring{\ELEGANT@device}{normal}{
-\newcommand*{\cover}[1]{
- \def\@cover{\includegraphics[width=\linewidth]{#1}
- }
-}}{\relax}
-
-\ifdefstring{\ELEGANT@device}{pad}{
-\newcommand*{\cover}[1]{
- \def\@cover{\includegraphics[trim=0 26bp 0 26bp,clip=true, width=\linewidth]{#1}
- }
-}}{\relax}
-
\renewcommand{\baselinestretch}{1.35}
\renewcommand*{\maketitle}{%
\hypersetup{pageanchor=false}
+\pagenumbering{Alph}
\begin{titlepage}
- \newgeometry{margin = 0in}
- \parindent=0pt
- \@cover
- \setlength{\fboxsep}{0pt}
- \colorbox{second}{\makebox[\linewidth][c]{\shortstack[c]{\vspace{0.5in}}}}
- \vfill
- \vskip-2ex
- \hspace{2em}
- \parbox{0.8\textwidth}{
- \bfseries\Huge \@title\par
- }
- \vfill
- \vspace{-1.0cm}
- \setstretch{2.5}
- \hspace{2.5em}
- \begin{minipage}[c]{0.67\linewidth}
- {\color{darkgray}\bfseries\Large \the\subtitle\\[2ex]}
- \color{gray}\normalsize
- {\renewcommand{\arraystretch}{0.618}
- \begin{tabular}{l}
- \ifdefstring{\ELEGANT@lang}{en}{\textbf{Author:}}{\kaishu 作者:} \@author \\
- \ifdefstring{\ELEGANT@lang}{en}{\textbf{Institute:}}{\kaishu 组织:} \the\institute\\
- \ifdefstring{\ELEGANT@lang}{en}{\textbf{Date:}}{\kaishu 时间:} \@date\\
- \ifdefstring{\ELEGANT@lang}{en}{\textbf{Version:}}{\kaishu 版本:} \the\version\\
- \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)$) {\@logo};
- \end{pgfonlayer}
- \end{tikzpicture}
- \end{minipage}
- \vfill
- \begin{center}
- \setstretch{1.3}
- \parbox[t]{0.7\textwidth}{\centering \itshape \@extrainfo}
- \end{center}
- \vfill
+ \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{second}{\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\@author\\ \fi
+ \ifcsname @institute\endcsname \institutename \@institute\\ \fi
+ % \ifcsname @date\endcsname \@date\\\fi
+ \ifx\@date\empty\else\datename\@date \\ \fi
+ \ifcsname @version\endcsname \versionname \@version\\ \fi
+ \ifcsname @bioinfo\endcsname \@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 \itshape
+ \ifcsname @extrainfo\endcsname\@extrainfo\fi}
+ \end{center}
+ \vfill
\end{titlepage}
\restoregeometry
-\thispagestyle{empty}
-}
+\thispagestyle{empty}}
-\RequirePackage{listings}
+\RequirePackage{listings}
\renewcommand{\ttdefault}{cmtt}
\lstdefinestyle{mystyle}{
basicstyle=%
@@ -761,21 +826,48 @@
\definecolor{lightgrey}{rgb}{0.9,0.9,0.9}
\definecolor{frenchplum}{RGB}{190,20,83}
\lstset{language=[LaTeX]TeX,
- texcsstyle=*\color{winered},
- numbers=none,
- breaklines=true,
- keywordstyle=\color{winered},
- commentstyle=\color{gray},
- emph={elegantpaper,fontenc,fontspec,xeCJK,FiraMono,xunicode,newtxmath,figure,fig,image,img,table,itemize,enumerate,newtxtext,newtxtt,ctex,microtype,description,times,newtx,booktabs,tabular,PDFLaTeX,XeLaTeX,type1cm,BibTeX,device,color,mode,lang,amsthm,tcolorbox,titlestyle,cite,marginnote,ctex,listings,base},
- 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,tableofcontents,elegantpar,heiti,kaishu,lstset,pagecolor,zhnumber,marginpar,part,equote,marginnote},
- frame=single,
- tabsize=2,
- rulecolor=\color{structurecolor},
- framerule=0.2pt,
- columns=flexible,
- % backgroundcolor=\color{lightgrey}
+ texcsstyle=*\color{winered},
+ numbers=none,
+ mathescape,
+ breaklines=true,
+ keywordstyle=\color{winered},
+ commentstyle=\color{gray},
+ emph={elegantpaper,fontenc,fontspec,xeCJK,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,gbt7714,natbib},
+ 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,
+ tabsize=2,
+ rulecolor=\color{structurecolor},
+ framerule=0.2pt,
+ columns=flexible,
+ % backgroundcolor=\color{lightgrey}
}
+
\newcommand\bmmax{0}
\RequirePackage{bm}
+% add the list of change history
+\newcommand{\dateinfoline}[2]{
+ \noindent\makebox[0pt][r]{%
+ \makebox[-5em][r]{%
+ \textbf{\textcolor{structurecolor}{#1}}}\quad}%
+ {\citshape\updatename\ignorespaces#2}}
+
+\newcommand{\datechange}[2]{%
+ \noindent{\makebox[\textwidth][r]{\color{structurecolor}\rule{1.15\textwidth}{.4pt}}}
+ \dateinfoline{#1}{#2}
+ \addcontentsline{dates}{section}{#1 -- #2}}
+
+\newcommand{\listofchanges}{%
+ \begingroup
+ \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
+
+\newenvironment{change}{
+ \begin{enumerate}[label=\small\protect\circled{\arabic*}]}{
+ \end{enumerate}} \ No newline at end of file