mirror of
https://github.com/ElegantLaTeX/ElegantBook.git
synced 2026-01-26 12:24:36 +08:00
version 3.08
This commit is contained in:
111
elegantbook.cls
111
elegantbook.cls
@@ -8,7 +8,7 @@
|
|||||||
%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%
|
||||||
% % !Mode:: "TeX:UTF-8"
|
% % !Mode:: "TeX:UTF-8"
|
||||||
\NeedsTeXFormat{LaTeX2e}
|
\NeedsTeXFormat{LaTeX2e}
|
||||||
\ProvidesClass{elegantbook}[2019/04/25 v3.07 ElegantBook document class]
|
\ProvidesClass{elegantbook}[2019/05/26 v3.08 ElegantBook document class]
|
||||||
|
|
||||||
\RequirePackage{kvoptions}
|
\RequirePackage{kvoptions}
|
||||||
\RequirePackage{etoolbox}
|
\RequirePackage{etoolbox}
|
||||||
@@ -22,7 +22,9 @@
|
|||||||
\DeclareStringOption[fancy]{mode}
|
\DeclareStringOption[fancy]{mode}
|
||||||
\DeclareStringOption[show]{base}
|
\DeclareStringOption[show]{base}
|
||||||
\DeclareStringOption[normal]{device}
|
\DeclareStringOption[normal]{device}
|
||||||
|
\DeclareStringOption[numbers]{cite}
|
||||||
|
\DeclareStringOption[newtxmath]{math}
|
||||||
|
\DeclareStringOption[marginfalse]{marginpar}
|
||||||
% ----- backward compatibility
|
% ----- backward compatibility
|
||||||
\DeclareVoidOption{green}{\ekv{color=green}}
|
\DeclareVoidOption{green}{\ekv{color=green}}
|
||||||
\DeclareVoidOption{cyan}{\ekv{color=cyan}}
|
\DeclareVoidOption{cyan}{\ekv{color=cyan}}
|
||||||
@@ -45,6 +47,15 @@
|
|||||||
|
|
||||||
\DeclareVoidOption{normal}{\ekv{device=normal}}
|
\DeclareVoidOption{normal}{\ekv{device=normal}}
|
||||||
\DeclareVoidOption{pad}{\ekv{device=pad}}
|
\DeclareVoidOption{pad}{\ekv{device=pad}}
|
||||||
|
|
||||||
|
\DeclareVoidOption{numbers}{\ekv{cite=numbers}}
|
||||||
|
\DeclareVoidOption{authoryear}{\ekv{cite=authoryear}}
|
||||||
|
|
||||||
|
\DeclareVoidOption{newtxmath}{\ekv{math=newtx}}
|
||||||
|
\DeclareVoidOption{mtpro2}{\ekv{math=mtpro2}}
|
||||||
|
|
||||||
|
\DeclareVoidOption{margintrue}{\ekv{marginpar=margintrue}}
|
||||||
|
\DeclareVoidOption{marginfalse}{\ekv{marginpar=marginfalse}}
|
||||||
% ----- Math option -----
|
% ----- Math option -----
|
||||||
\newcommand\mailto[1]{\href{mailto:#1}{\nolinkurl{#1}}}
|
\newcommand\mailto[1]{\href{mailto:#1}{\nolinkurl{#1}}}
|
||||||
|
|
||||||
@@ -64,6 +75,11 @@
|
|||||||
\setlength\parindent{2em}
|
\setlength\parindent{2em}
|
||||||
|
|
||||||
% fontsetting
|
% fontsetting
|
||||||
|
\ifdefstring{\ELEGANT@math}{mtpro2}{
|
||||||
|
\let\Bbbk\relax
|
||||||
|
\RequirePackage[lite]{mtpro2}
|
||||||
|
}{\relax}
|
||||||
|
|
||||||
|
|
||||||
\PassOptionsToPackage{no-math}{fontspec}
|
\PassOptionsToPackage{no-math}{fontspec}
|
||||||
\ifdefstring{\ELEGANT@lang}{cn}{
|
\ifdefstring{\ELEGANT@lang}{cn}{
|
||||||
@@ -78,11 +94,13 @@
|
|||||||
\RequirePackage[T1]{fontenc}
|
\RequirePackage[T1]{fontenc}
|
||||||
\fi
|
\fi
|
||||||
|
|
||||||
|
|
||||||
\RequirePackage{newtxtext}
|
\RequirePackage{newtxtext}
|
||||||
|
\ifdefstring{\ELEGANT@math}{newtxmath}{
|
||||||
\RequirePackage{newtxmath}
|
\RequirePackage{newtxmath}
|
||||||
% \let\Bbbk\relax
|
}{\relax}
|
||||||
% \usepackage[lite]{mtpro2}
|
|
||||||
%
|
|
||||||
|
|
||||||
% font setting for text and math
|
% font setting for text and math
|
||||||
% \RequirePackage[T1]{fontenc}
|
% \RequirePackage[T1]{fontenc}
|
||||||
@@ -90,30 +108,26 @@
|
|||||||
% \RequirePackage{newtxmath}
|
% \RequirePackage{newtxmath}
|
||||||
% \RequirePackage[scale=0.85]{newtxtt}
|
% \RequirePackage[scale=0.85]{newtxtt}
|
||||||
\RequirePackage{anyfontsize}
|
\RequirePackage{anyfontsize}
|
||||||
|
\ifdefstring{\ELEGANT@math}{newtxmath}{
|
||||||
\DeclareSymbolFont{CMletters} {OML}{cmm} {m}{it}%
|
\DeclareSymbolFont{CMletters} {OML}{cmm} {m}{it}%
|
||||||
\DeclareSymbolFont{CMsymbols} {OMS}{cmsy}{m}{n}%
|
\DeclareSymbolFont{CMsymbols} {OMS}{cmsy}{m}{n}%
|
||||||
\DeclareSymbolFont{CMlargesymbols}{OMX}{cmex}{m}{n}%
|
\DeclareSymbolFont{CMlargesymbols}{OMX}{cmex}{m}{n}%
|
||||||
|
|
||||||
% \let\sum\relax
|
% \let\sum\relax
|
||||||
% \DeclareMathSymbol{\sum}{\mathop}{CMlargesymbols}{"50}%
|
% \DeclareMathSymbol{\sum}{\mathop}{CMlargesymbols}{"50}%
|
||||||
% \let\int\relax
|
% \let\int\relax
|
||||||
% \DeclareMathSymbol{\int}{\mathop}{CMlargesymbols}{"5A}%
|
% \DeclareMathSymbol{\int}{\mathop}{CMlargesymbols}{"5A}%
|
||||||
|
|
||||||
\let\intop\relax\let\sumop\relax\let\ointop\relax\let\prodop\relax
|
\let\intop\relax\let\sumop\relax\let\ointop\relax\let\prodop\relax
|
||||||
|
|
||||||
\DeclareMathSymbol{\sumop}{\mathop}{CMlargesymbols}{"50}
|
\DeclareMathSymbol{\sumop}{\mathop}{CMlargesymbols}{"50}
|
||||||
\DeclareMathSymbol{\intop}{\mathop}{CMlargesymbols}{"52}
|
\DeclareMathSymbol{\intop}{\mathop}{CMlargesymbols}{"52}
|
||||||
\DeclareMathSymbol{\ointop}{\mathop}{CMlargesymbols}{"48}
|
\DeclareMathSymbol{\ointop}{\mathop}{CMlargesymbols}{"48}
|
||||||
\DeclareMathSymbol{\prodop}{\mathop}{CMlargesymbols}{"51}
|
\DeclareMathSymbol{\prodop}{\mathop}{CMlargesymbols}{"51}
|
||||||
|
|
||||||
% \let\partial\relax
|
% \let\partial\relax
|
||||||
% \DeclareMathSymbol{\partial}{\mathord}{CMletters}{"40}%
|
% \DeclareMathSymbol{\partial}{\mathord}{CMletters}{"40}%
|
||||||
% \let\in\relax
|
% \let\in\relax
|
||||||
%\DeclareMathSymbol{\in}{\mathrel}{CMsymbols}{"32}%
|
%\DeclareMathSymbol{\in}{\mathrel}{CMsymbols}{"32}%
|
||||||
% \let\pi\relax
|
% \let\pi\relax
|
||||||
% \DeclareMathSymbol{\pi}{\mathord}{CMletters}{"19}
|
% \DeclareMathSymbol{\pi}{\mathord}{CMletters}{"19}
|
||||||
|
}{\relax}
|
||||||
|
|
||||||
% ----- Handle Colors -----
|
% ----- Handle Colors -----
|
||||||
%% 章节以及页脚图形
|
%% 章节以及页脚图形
|
||||||
@@ -138,7 +152,7 @@
|
|||||||
\definecolor{third}{RGB}{0,174,247}%
|
\definecolor{third}{RGB}{0,174,247}%
|
||||||
}{\relax}
|
}{\relax}
|
||||||
\ifdefstring{\ELEGANT@color}{gray}{
|
\ifdefstring{\ELEGANT@color}{gray}{
|
||||||
\definecolor{structurecolor}{RGB}{0,0,0}
|
\definecolor{structurecolor}{RGB}{150,150,150}
|
||||||
\definecolor{main}{RGB}{150,150,150}%
|
\definecolor{main}{RGB}{150,150,150}%
|
||||||
\definecolor{second}{RGB}{150,150,150}%
|
\definecolor{second}{RGB}{150,150,150}%
|
||||||
\definecolor{third}{RGB}{150,150,150}%
|
\definecolor{third}{RGB}{150,150,150}%
|
||||||
@@ -166,7 +180,7 @@
|
|||||||
\definecolor{second3}{RGB}{255,134,24}%
|
\definecolor{second3}{RGB}{255,134,24}%
|
||||||
\definecolor{third3}{RGB}{0,174,247}%
|
\definecolor{third3}{RGB}{0,174,247}%
|
||||||
% gray color
|
% gray color
|
||||||
\definecolor{structure4}{RGB}{0,0,0}
|
\definecolor{structure4}{RGB}{150,150,150}
|
||||||
\definecolor{main4}{RGB}{150,150,150}%
|
\definecolor{main4}{RGB}{150,150,150}%
|
||||||
\definecolor{second4}{RGB}{150,150,150}%
|
\definecolor{second4}{RGB}{150,150,150}%
|
||||||
\definecolor{third4}{RGB}{150,150,150}%
|
\definecolor{third4}{RGB}{150,150,150}%
|
||||||
@@ -205,7 +219,7 @@
|
|||||||
\newtoks\institute
|
\newtoks\institute
|
||||||
\newtoks\subtitle
|
\newtoks\subtitle
|
||||||
|
|
||||||
\RequirePackage{natbib}
|
\RequirePackage[sort&compress]{natbib}
|
||||||
\setlength{\bibsep}{0.0pt}
|
\setlength{\bibsep}{0.0pt}
|
||||||
\def\bibfont{\footnotesize}
|
\def\bibfont{\footnotesize}
|
||||||
|
|
||||||
@@ -221,8 +235,13 @@
|
|||||||
\captionsetup[table]{skip=3pt}
|
\captionsetup[table]{skip=3pt}
|
||||||
\captionsetup[figure]{skip=3pt}
|
\captionsetup[figure]{skip=3pt}
|
||||||
|
|
||||||
|
\AtBeginDocument{
|
||||||
|
\setlength{\abovedisplayskip}{3pt}
|
||||||
|
\setlength{\belowdisplayskip}{3pt}
|
||||||
|
}
|
||||||
%% 常用宏包
|
%% 常用宏包
|
||||||
\linespread{1.3}
|
\linespread{1.3}
|
||||||
|
|
||||||
\RequirePackage{graphicx}
|
\RequirePackage{graphicx}
|
||||||
%\RequirePackage{enumerate}
|
%\RequirePackage{enumerate}
|
||||||
\RequirePackage{amsmath,mathrsfs,amsfonts,amssymb}
|
\RequirePackage{amsmath,mathrsfs,amsfonts,amssymb}
|
||||||
@@ -230,8 +249,8 @@
|
|||||||
\RequirePackage{multicol}
|
\RequirePackage{multicol}
|
||||||
\RequirePackage{xcolor}
|
\RequirePackage{xcolor}
|
||||||
\RequirePackage{fancyvrb}
|
\RequirePackage{fancyvrb}
|
||||||
\RequirePackage{makecell,lipsum,hologo,setspace}
|
\RequirePackage{makecell,lipsum,hologo}
|
||||||
|
\usepackage{setspace}
|
||||||
|
|
||||||
%%中文结构名字
|
%%中文结构名字
|
||||||
\ifdefstring{\ELEGANT@lang}{cn}{
|
\ifdefstring{\ELEGANT@lang}{cn}{
|
||||||
@@ -248,7 +267,10 @@
|
|||||||
\newcommand\figref[1]{\textbf{图}~\ref{#1}}
|
\newcommand\figref[1]{\textbf{图}~\ref{#1}}
|
||||||
\newcommand\tabref[1]{\textbf{表}~\ref{#1}}
|
\newcommand\tabref[1]{\textbf{表}~\ref{#1}}
|
||||||
\renewcommand{\chaptername}{第 \thechapter\;章}
|
\renewcommand{\chaptername}{第 \thechapter\;章}
|
||||||
\RequirePackage[authoryear]{gbt7714}
|
\ifdefstring{\ELEGANT@cite}{authoryear}{
|
||||||
|
\RequirePackage[authoryear]{gbt7714}}{\relax}
|
||||||
|
\ifdefstring{\ELEGANT@cite}{numbers}{
|
||||||
|
\RequirePackage[numbers]{gbt7714}}{\relax}
|
||||||
% \bibliographystyle{aer}
|
% \bibliographystyle{aer}
|
||||||
}{\relax}
|
}{\relax}
|
||||||
\ifdefstring{\ELEGANT@lang}{en}{
|
\ifdefstring{\ELEGANT@lang}{en}{
|
||||||
@@ -284,7 +306,7 @@
|
|||||||
%% device settings
|
%% device settings
|
||||||
|
|
||||||
\RequirePackage{geometry}
|
\RequirePackage{geometry}
|
||||||
|
\RequirePackage{marginnote}
|
||||||
\ifdefstring{\ELEGANT@device}{normal}{
|
\ifdefstring{\ELEGANT@device}{normal}{
|
||||||
\geometry{
|
\geometry{
|
||||||
a4paper,
|
a4paper,
|
||||||
@@ -292,7 +314,14 @@
|
|||||||
headheight=2.17cm,
|
headheight=2.17cm,
|
||||||
headsep=4mm,
|
headsep=4mm,
|
||||||
footskip=12mm
|
footskip=12mm
|
||||||
}}{\relax}
|
}
|
||||||
|
\ifdefstring{\ELEGANT@marginpar}{margintrue}{
|
||||||
|
\geometry{
|
||||||
|
marginparwidth=6cm, marginparsep=5mm,
|
||||||
|
left=1.5cm,right=7.5cm,
|
||||||
|
}
|
||||||
|
}{\relax}
|
||||||
|
}{\relax}
|
||||||
|
|
||||||
\ifdefstring{\ELEGANT@device}{pad}{
|
\ifdefstring{\ELEGANT@device}{pad}{
|
||||||
\geometry{
|
\geometry{
|
||||||
@@ -545,7 +574,7 @@
|
|||||||
}}{\par}
|
}}{\par}
|
||||||
\newenvironment{solution}{\par\noindent\textbf{\color{main}
|
\newenvironment{solution}{\par\noindent\textbf{\color{main}
|
||||||
\ifdefstring{\ELEGANT@lang}{en}{Solution}{解}
|
\ifdefstring{\ELEGANT@lang}{en}{Solution}{解}
|
||||||
}}{\par}
|
}\ifdefstring{\ELEGANT@lang}{en}{\itshape}{\kaishu}}{\vskip2ex\par}
|
||||||
\newenvironment{property}{\par\noindent\textbf{\color{third}
|
\newenvironment{property}{\par\noindent\textbf{\color{third}
|
||||||
\ifdefstring{\ELEGANT@lang}{en}{Property}{性质}
|
\ifdefstring{\ELEGANT@lang}{en}{Property}{性质}
|
||||||
}}{\par}
|
}}{\par}
|
||||||
@@ -582,6 +611,13 @@
|
|||||||
\end{multicols}
|
\end{multicols}
|
||||||
\end{tcolorbox}}
|
\end{tcolorbox}}
|
||||||
|
|
||||||
|
\RequirePackage{adforn}
|
||||||
|
\newenvironment{problemset}[1][\ifdefstring{\ELEGANT@lang}{en}{\textbf{\chaptername\; Exercise}}{\textbf{\chaptername\; 习题}}]{
|
||||||
|
\begin{center}
|
||||||
|
\textcolor{structurecolor}{\Large\bfseries\adftripleflourishleft~#1~\adftripleflourishright}
|
||||||
|
\end{center}
|
||||||
|
\begin{enumerate}[label=\textcolor{structurecolor}{\arabic*.}]}{%
|
||||||
|
\end{enumerate}}
|
||||||
|
|
||||||
\ifdefstring{\ELEGANT@result}{noanswer}{
|
\ifdefstring{\ELEGANT@result}{noanswer}{
|
||||||
\AtBeginDocument{
|
\AtBeginDocument{
|
||||||
@@ -616,7 +652,7 @@
|
|||||||
\renewcommand{\chaptermark}[1]{\markboth{\chaptername \; #1\;}{}}
|
\renewcommand{\chaptermark}[1]{\markboth{\chaptername \; #1\;}{}}
|
||||||
|
|
||||||
%%封面
|
%%封面
|
||||||
\newcommand*{\equote}[1]{\def\@equote{#1}}
|
\newcommand*{\extrainfo}[1]{\def\@extrainfo{#1}}
|
||||||
|
|
||||||
\def\IfEmpty#1{%
|
\def\IfEmpty#1{%
|
||||||
\edef\1{\the#1}
|
\edef\1{\the#1}
|
||||||
@@ -679,7 +715,10 @@
|
|||||||
\end{tikzpicture}
|
\end{tikzpicture}
|
||||||
\end{minipage}
|
\end{minipage}
|
||||||
\vfill
|
\vfill
|
||||||
\centerline{\itshape \@equote}
|
\begin{center}
|
||||||
|
\setstretch{1.3}
|
||||||
|
\parbox[t]{0.7\textwidth}{\centering \itshape \@extrainfo}
|
||||||
|
\end{center}
|
||||||
\vfill
|
\vfill
|
||||||
\end{titlepage}
|
\end{titlepage}
|
||||||
\restoregeometry
|
\restoregeometry
|
||||||
@@ -709,7 +748,7 @@
|
|||||||
commentstyle=\color{gray},
|
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},
|
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},
|
||||||
emphstyle={\color{frenchplum}},
|
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,equote,logo,cover,subtitle,appendix,chapter,hypersetup,mainmatter,tableofcontents},
|
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},
|
||||||
frame=single,
|
frame=single,
|
||||||
tabsize=2,
|
tabsize=2,
|
||||||
rulecolor=\color{structurecolor},
|
rulecolor=\color{structurecolor},
|
||||||
@@ -717,3 +756,29 @@
|
|||||||
columns=flexible,
|
columns=flexible,
|
||||||
% backgroundcolor=\color{lightgrey}
|
% backgroundcolor=\color{lightgrey}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
\definecolor{tcolor}{RGB}{255,127, 0} % default: 0,124,53
|
||||||
|
\definecolor{lcolor}{RGB}{255,178,102} % default: 153,255,153
|
||||||
|
\definecolor{pcolor}{RGB}{251,204,231} % default: 216,255,216
|
||||||
|
|
||||||
|
\RequirePackage{bm}
|
||||||
|
\newif\ifstartedinmathmode
|
||||||
|
\newcommand{\elegantpar}[2]{%
|
||||||
|
\relax\ifmmode\startedinmathmodetrue\else\startedinmathmodefalse\fi
|
||||||
|
{\color{second}\ifstartedinmathmode \ensuremath{\bm\langle #1 \bm\rangle}\else $\bm\langle$#1$\bm\rangle$\fi}%
|
||||||
|
\begin{tikzpicture}[remember picture, baseline=-0.75ex]%
|
||||||
|
\node[coordinate] (inText) {};%
|
||||||
|
\end{tikzpicture}%
|
||||||
|
\marginnote{%
|
||||||
|
\renewcommand{\baselinestretch}{1.0}%
|
||||||
|
\begin{tikzpicture}[remember picture]%
|
||||||
|
\draw node[fill= third!20, rounded corners,text width=\marginparwidth] (inNote){\footnotesize #2};%
|
||||||
|
\end{tikzpicture}%
|
||||||
|
}%
|
||||||
|
\begin{tikzpicture}[remember picture, overlay]%
|
||||||
|
\draw[draw = second]
|
||||||
|
([yshift=-0.55em] inText)
|
||||||
|
-| ([xshift=-0.55em] inNote.west)
|
||||||
|
-| (inNote.west);%
|
||||||
|
\end{tikzpicture}%
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user