summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/elegantnote/elegantnote.cls
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-04-13 03:03:00 +0000
committerNorbert Preining <norbert@preining.info>2020-04-13 03:03:00 +0000
commitc98e9ebef816f09dc54c52a01df4f978e1b210fc (patch)
tree0073017824e78ee91d2356f76d2b2944437da5d9 /macros/latex/contrib/elegantnote/elegantnote.cls
parentffcfe2bb60911db71a31e4c12541eae3e9df29f3 (diff)
CTAN sync 202004130303
Diffstat (limited to 'macros/latex/contrib/elegantnote/elegantnote.cls')
-rw-r--r--macros/latex/contrib/elegantnote/elegantnote.cls203
1 files changed, 121 insertions, 82 deletions
diff --git a/macros/latex/contrib/elegantnote/elegantnote.cls b/macros/latex/contrib/elegantnote/elegantnote.cls
index 549745689e..fac84ea40d 100644
--- a/macros/latex/contrib/elegantnote/elegantnote.cls
+++ b/macros/latex/contrib/elegantnote/elegantnote.cls
@@ -4,57 +4,60 @@
% Lastest Version: https://github.com/ElegantLaTeX/ElegantNote
% --- Class structure: identification part
-\ProvidesClass{elegantnote}[2018/12/09 ElegantNote v2.20 class]
+\ProvidesClass{elegantnote}[2020/04/12 ElegantNote v2.30 class]
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{kvoptions}
-\RequirePackage{ifthen}
-\RequirePackage{ifxetex}
\RequirePackage{etoolbox}
\RequirePackage{calc}
-\SetupKeyvalOptions{
- family=ELEGANT,
- prefix=ELEGANT@,
- setkeys=\kvsetkeys}
-
+\SetupKeyvalOptions{family=ELEGANT,prefix=ELEGANT@,setkeys=\kvsetkeys}
\newcommand{\ekv}[1]{\kvsetkeys{ELEGANT}{#1}}
-% ----- Colors -----
\DeclareStringOption[blue]{color}
-\DeclareStringOption[pad]{device}
-\DeclareStringOption[cn]{lang}
-\DeclareStringOption{mode}
-% ----- backward compatibility
\DeclareVoidOption{green}{\ekv{color=green}}
\DeclareVoidOption{cyan}{\ekv{color=cyan}}
\DeclareVoidOption{blue}{\ekv{color=blue}}
\DeclareVoidOption{sakura}{\ekv{color=sakura}}
\DeclareVoidOption{black}{\ekv{color=black}}
-
+\DeclareStringOption[pad]{device}
\DeclareVoidOption{pc}{\ekv{device=pc}}
\DeclareVoidOption{pad}{\ekv{device=pad}}
\DeclareVoidOption{kindle}{\ekv{device=kindle}}
\DeclareVoidOption{normal}{\ekv{device=normal}}
\DeclareVoidOption{screen}{\ekv{device=screen}}
+\DeclareStringOption[cn]{lang}
\DeclareVoidOption{cn}{\ekv{lang=cn}}
\DeclareVoidOption{en}{\ekv{lang=en}}
+\DeclareStringOption{mode}
\DeclareVoidOption{geye}{\ekv{mode=geye}}
\DeclareVoidOption{hazy}{\ekv{mode=hazy}}
+\DeclareStringOption[ctexfont]{chinesefont}
+\DeclareVoidOption{ctexfont}{\ekv{chinesefont=ctexfont}}
+\DeclareVoidOption{founder}{\ekv{chinesefont=founder}}
+\DeclareVoidOption{nofont}{\ekv{chinesefont=nofont}}
+
\DeclareStringOption[numbers]{cite}
\DeclareVoidOption{numbers}{\ekv{cite=numbers}}
\DeclareVoidOption{authoryear}{\ekv{cite=authoryear}}
\DeclareVoidOption{super}{\ekv{cite=super}}
+\DeclareStringOption[apalike]{bibstyle}
+
\DeclareStringOption[11pt]{fontsize}
\DeclareVoidOption{10pt}{\ekv{fontsize=10pt}}
\DeclareVoidOption{11pt}{\ekv{fontsize=11pt}}
\DeclareVoidOption{12pt}{\ekv{fontsize=12pt}}
+\DeclareStringOption[cm]{math}
+\DeclareVoidOption{newtx}{\ekv{math=newtx}}
+\DeclareVoidOption{mtpro2}{\ekv{math=mtpro2}}
+\DeclareVoidOption{cm}{\ekv{math=cm}}
+
\DeclareDefaultOption{
\PassOptionsToClass{\CurrentOption}{article}
}
@@ -62,35 +65,79 @@
\LoadClass{article}
-
-\RequirePackage{amsmath,amsthm}
\PassOptionsToPackage{no-math}{fontspec}
+\RequirePackage{amsmath,amsthm}
+
+\RequirePackage{iftex}
+
\ifdefstring{\ELEGANT@lang}{cn}{%
- \RequirePackage[
- UTF8,
- scheme=plain,
- punct=kaiming]{ctex}
+\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}
-% newtxtext and newtxmath pkg
-\RequirePackage{newtxtext}
-\RequirePackage{newtxmath}
-\RequirePackage{esint}
+\ifcsname kaishu\endcsname
+ \newcommand{\citshape}{\kaishu}
+\else
+ \newcommand{\citshape}{\itshape}
+\fi
+\ifcsname kaishu\endcsname
+ \newcommand{\cnormal}{\kaishu}
+\else
+ \newcommand{\cnormal}{\normalfont}
+\fi
+\ifcsname fangsong\endcsname
+ \newcommand{\cfs}{\fangsong}
+\else
+ \newcommand{\cfs}{\normalfont}
+\fi
-%%% 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}
+\RequirePackage{newtxtext}
+\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}
-\DeclareSymbolFont{CMlargesymbols}{OMX}{cmex}{m}{n}
-\let\sumop\relax\let\prodop\relax
-\DeclareMathSymbol{\sumop}{\mathop}{CMlargesymbols}{"50}
-\DeclareMathSymbol{\prodop}{\mathop}{CMlargesymbols}{"51}
\RequirePackage{indentfirst}
\RequirePackage{anyfontsize}
@@ -148,29 +195,19 @@
}
\let\openbox\relax
-\newtheoremstyle{plain}{3pt}{3pt}{%
- \ifdefstring{\ELEGANT@lang}{en}{%
- \itshape}{%
- \kaishu}}{}{%
+\newtheoremstyle{plain}{\topsep}{\topsep}{\citshape}{}{%
\color{ecolor}\bfseries}{}{%
0.5em}{%
\thmname{#1}\thmnumber{ #2}\thmnote{ (#3)}}
-\newtheoremstyle{definition}{3pt}{3pt}{%
- \ifdefstring{\ELEGANT@lang}{en}{%
- \itshape}{%
- \kaishu}}{}{%
+\newtheoremstyle{definition}{\topsep}{\topsep}{\citshape}{}{%
\color{ecolor}\bfseries}{}{%
0.5em}{}
-\newtheoremstyle{remark}{3pt}{3pt}{
- \ifdefstring{\ELEGANT@lang}{en}{
- \itshape}{
- \kaishu}}{}{
+\newtheoremstyle{remark}{\topsep}{\topsep}{\cnormal}{}{
\color{ecolor}\bfseries}{}{
0.5em}{}
-
% caption settings
\RequirePackage{caption}
\captionsetup{
@@ -182,26 +219,6 @@
\RequirePackage[shortlabels,inline]{enumitem}
\setlist{nolistsep}
-
-\RequirePackage[sort&compress]{natbib}
-\setlength{\bibsep}{0.0pt}
-\def\bibfont{\footnotesize}
-
-
-% headings
-\RequirePackage{fancyhdr}
-\fancyhf{}
-\pagestyle{fancy}
-\rfoot{\footnotesize\textcolor{gray}{\thepage}}
-\renewcommand{\headrulewidth}{0pt}
-\renewcommand{\footrulewidth}{0pt}
-
-\fancypagestyle{plain}{%
- \renewcommand{\headrulewidth}{0pt}%
- \fancyhf{}%
- \fancyfoot[R]{
- \footnotesize \textcolor{gray}{\thepage}}}
-
\RequirePackage[flushmargin,stable]{footmisc}
\setlength{\footnotesep}{12pt}
@@ -230,7 +247,6 @@
\definecolor{ecyan}{RGB}{0,175,152}
\definecolor{eblue}{RGB}{20,50,104}
\definecolor{sakura}{RGB}{255,183,197}
-% \definecolor{black}{RGB}{255,183,197}
%% device settings
%% default=pad
@@ -279,12 +295,28 @@
footskip=0.6cm}}{%
\relax}
+% headings
+\RequirePackage{fancyhdr}
+\renewcommand{\headrulewidth}{0pt}
+\renewcommand{\footrulewidth}{0pt}
+
+\fancypagestyle{fancy-note}{
+ \fancyhf{} % clear header/footer settings
+ \fancyfoot[C]{\footnotesize\textcolor{gray}{\thepage}}
+}
+
+\fancypagestyle{plain}{%
+ \fancyhf{}
+ \fancyfoot[R]{\footnotesize\textcolor{gray}{\thepage}}}
+
+\pagestyle{fancy-note}
+
\ifdefstring{\ELEGANT@lang}{cn}{%
\theoremstyle{plain}% default
\newtheorem{theorem}{定理}[section] %
\newtheorem{lemma}[theorem]{引理} %
- \newtheorem{proposition}[theorem]{性质} %
+ \newtheorem{proposition}[theorem]{命题} %
\newtheorem*{corollary}{推论} %
\theoremstyle{definition} %
\newtheorem{definition}{定义}[section] %
@@ -304,8 +336,13 @@
\setlength{\parindent}{2em}
\newcommand{\keywords}[1]{%
\vskip2ex\par\noindent\normalfont{\bfseries 关键词: } #1}
- \RequirePackage[\ELEGANT@cite]{gbt7714}}{%
- \relax}
+ \RequirePackage{gbt7714}
+ \ifdefstring{\ELEGANT@cite}{authoryear}{
+ \bibliographystyle{gbt7714-author-year}}{
+ \bibliographystyle{gbt7714-numerical}}
+ \ifdefstring{\ELEGANT@cite}{numbers}{
+ \citestyle{numbers}}{\relax}
+ }{\relax}
\ifdefstring{\ELEGANT@lang}{en}{
\theoremstyle{plain}% default
@@ -325,9 +362,12 @@
\normalfont\bfseries\color{ecolor} Proof}
\newcommand\versiontext{Version: }%
\newcommand\updatetext{Update: }%
- \bibliographystyle{aer}}{%
+ \RequirePackage[\ELEGANT@cite,sort&compress]{natbib}
+ \bibliographystyle{\ELEGANT@bibstyle}}{%
\relax}
+\setlength{\bibsep}{0.0pt}
+\def\bibfont{\footnotesize}
\def\IfEmpty#1{%
\edef\1{\the#1}
@@ -392,17 +432,11 @@
\IfEmpty\version
\else
- {\normalfont\ifdefstring{\ELEGANT@lang}{en}{
- \itshape}{%
- \kaishu}
- \versiontext\the\version \\}
+ {\normalfont\citshape\versiontext\the\version \\}
\fi
\ifx\@date\empty
\else
- {\normalfont\ifdefstring{\ELEGANT@lang}{en}{
- \itshape}{%
- \kaishu}
- \updatetext\@date}%
+ {\normalfont\citshape\updatetext\@date}%
\fi
\end{center}%
\par}
@@ -434,7 +468,7 @@
\lstdefinestyle{estyle}{
basicstyle=%
\ttfamily
- \lst@ifdisplaystyle\footnotesize\fi}
+ \lst@ifdisplaystyle\small\fi}
% \lstset{
% basicstyle=\scriptsize\ttfamily,
@@ -481,11 +515,16 @@
device,
color,
mode,
+ chinesefont,
+ cite,
+ bibstyle,
+ math,
lang,
amsthm},
emphstyle={\color{frenchplum}},
morekeywords={%
DeclareSymbolFont,
+ setCJKfamilyfont,
SetSymbolFont,
toprule,
midrule,