summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/elegantpaper/elegantpaper.cls
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/elegantpaper/elegantpaper.cls')
-rw-r--r--macros/latex/contrib/elegantpaper/elegantpaper.cls182
1 files changed, 120 insertions, 62 deletions
diff --git a/macros/latex/contrib/elegantpaper/elegantpaper.cls b/macros/latex/contrib/elegantpaper/elegantpaper.cls
index 65c9ea5101..51ad2b046f 100644
--- a/macros/latex/contrib/elegantpaper/elegantpaper.cls
+++ b/macros/latex/contrib/elegantpaper/elegantpaper.cls
@@ -4,12 +4,10 @@
% Lastest Version: https://github.com/ElegantLaTeX/ElegantPaper
% --- Class structure: identification part
-\ProvidesClass{elegantpaper}[2019/10/17 v0.08 ElegantLaTeX Paper class]
+\ProvidesClass{elegantpaper}[2020/04/12 v0.09 ElegantLaTeX Paper class]
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{kvoptions}
-\RequirePackage{ifthen}
-\RequirePackage{ifxetex}
\RequirePackage{etoolbox}
\RequirePackage{calc}
@@ -17,19 +15,50 @@
\newcommand{\ekv}[1]{\kvsetkeys{ELEGANT}{#1}}
\DeclareStringOption[en]{lang}
-\DeclareVoidOption{cn}{\ekv{lang = cn}}
-\DeclareVoidOption{en}{\ekv{lang = en}}
+\DeclareVoidOption{cn}{\ekv{lang=cn}}
+\DeclareVoidOption{en}{\ekv{lang=en}}
+
+\DeclareStringOption[cm]{math}
\DeclareStringOption[numbers]{cite}
\DeclareVoidOption{numbers}{\ekv{cite=numbers}}
\DeclareVoidOption{authoryear}{\ekv{cite=authoryear}}
\DeclareVoidOption{super}{\ekv{cite=super}}
+\DeclareStringOption[apalike]{bibstyle}
+
+\DeclareStringOption[ctexfont]{chinesefont}
+\DeclareVoidOption{ctexfont}{\ekv{chinesefont=ctexfont}}
+\DeclareVoidOption{founder}{\ekv{chinesefont=founder}}
+\DeclareVoidOption{nofont}{\ekv{chinesefont=nofont}}
+
+\DeclareVoidOption{newtx}{\ekv{math=newtx}}
+\DeclareVoidOption{mtpro2}{\ekv{math=mtpro2}}
+\DeclareVoidOption{cm}{\ekv{math=cm}}
+
\DeclareDefaultOption{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessKeyvalOptions*\relax
\LoadClass{article}
-
+\RequirePackage{hyperref}
+\hypersetup{
+ pdfborder={0 0 0},
+ colorlinks=true,
+ linkcolor={winered},
+ urlcolor={winered},
+ filecolor={winered},
+ citecolor={winered},
+ linktoc=all,
+}
+% settings for the hyperref and geometry
+\RequirePackage[
+ left=1in,
+ right=1in,
+ top=1in,
+ bottom=1in,
+ headheight=0pt,
+ headsep=0pt]{geometry}
+\setlength{\headsep}{5pt}
\RequirePackage{amsthm}
\RequirePackage{amsmath}
@@ -38,7 +67,7 @@
\RequirePackage{booktabs}
\RequirePackage{multicol}
\RequirePackage{multirow}
-\RequirePackage{linegoal}
+% \RequirePackage{linegoal}
\RequirePackage{xcolor}
\RequirePackage{graphicx}
\RequirePackage{fancyvrb}
@@ -49,7 +78,7 @@
\graphicspath{{image/}{figure/}{fig/}{img/}}
% caption settings
-\RequirePackage[font=small,labelfont={bf}]{caption}
+\RequirePackage[font=small,labelfont={bf}]{caption}
\captionsetup[table]{skip=3pt}
\captionsetup[figure]{skip=3pt}
@@ -57,10 +86,6 @@
\RequirePackage[shortlabels,inline]{enumitem}
\setlist{nolistsep}
-\RequirePackage[\ELEGANT@cite,sort&compress]{natbib}
-% \PassOptionsToPackage{\ELEGANT@cite}{natbib}
-\setlength{\bibsep}{0.0pt}
-\def\bibfont{\footnotesize}
% define the hyperref color
\RequirePackage{xcolor}
@@ -70,62 +95,86 @@
\definecolor{commentcolor}{RGB}{0,100,0}
\definecolor{frenchplum}{RGB}{190,20,83}
-% settings for the hyperref and geometry
-\RequirePackage{hyperref}
-\hypersetup{
- pdfborder={0 0 0},
- colorlinks=true,
- linkcolor={winered},
- urlcolor={winered},
- filecolor={winered},
- citecolor={winered},
- linktoc=all,
-}
-\RequirePackage[left=1in, right=1in, top=1in, bottom=1in,headheight=0pt,headsep=0pt]{geometry}
-\setlength{\headsep}{5pt}
-% add the \email cmd
+% add the email cmd
\newcommand\email[1]{\href{mailto:#1}{\nolinkurl{#1}}}
% font settings
-\PassOptionsToPackage{no-math}{fontspec}
-\ifdefstring{\ELEGANT@lang}{cn}{%
- \RequirePackage[UTF8, scheme=plain]{ctex}
-}
+\PassOptionsToPackage{no-math}{fontspec}
+\ifdefstring{\ELEGANT@lang}{cn}{
+ \ifXeTeX
+ \ifdefstring{\ELEGANT@chinesefont}{founder}{
+ \RequirePackage[UTF8,scheme=plain,fontset=none]{ctex}
+ \setCJKmainfont[BoldFont={FZHei-B01},ItalicFont={FZKai-Z03}]{FZShuSong-Z01}
+ \setCJKsansfont[BoldFont={FZHei-B01},ItalicFont={FZHei-B01}]{FZHei-B01}
+ \setCJKmonofont[BoldFont={FZHei-B01},ItalicFont={FZHei-B01}]{FZFangSong-Z02}
+ \setCJKfamilyfont{zhsong}{FZShuSong-Z01}
+ \setCJKfamilyfont{zhhei}{FZHei-B01}
+ \setCJKfamilyfont{zhkai}{FZKai-Z03}
+ \setCJKfamilyfont{zhfs}{FZFangSong-Z02}
+ \newcommand*{\songti}{\CJKfamily{zhsong}}
+ \newcommand*{\heiti}{\CJKfamily{zhhei}}
+ \newcommand*{\kaishu}{\CJKfamily{zhkai}}
+ \newcommand*{\fangsong}{\CJKfamily{zhfs}}}{\relax}
+
+ \ifdefstring{\ELEGANT@chinesefont}{nofont}{
+ \RequirePackage[UTF8,scheme=plain,fontset=none]{ctex}}{\relax}
+
+ \ifdefstring{\ELEGANT@chinesefont}{ctexfont}{
+ \RequirePackage[UTF8,scheme=plain]{ctex}}{\relax}
+ \else
+ \ifdefstring{\ELEGANT@chinesefont}{ctexfont}{
+ \RequirePackage[UTF8,scheme=plain]{ctex}}{\relax}
+ \fi
+ \AfterEndPreamble{
+ % \renewcommand{\itshape}{\kaishu}
+ \setlength\parindent{2\ccwd}}}{\relax}
+
+\ifcsname kaishu\endcsname
+ \newcommand{\citshape}{\kaishu}
+\else
+ \newcommand{\citshape}{\itshape}
+\fi
+\ifcsname kaishu\endcsname
+ \newcommand{\cnormal}{\kaishu}
+\else
+ \newcommand{\cnormal}{\normalfont}
+\fi
-\ifxetex
- \RequirePackage{fontenc}
+\ifcsname fangsong\endcsname
+ \newcommand{\cfs}{\fangsong}
\else
- \RequirePackage[T1]{fontenc}
- \AtEndOfClass{%
- \RequirePackage{microtype}}
+ \newcommand{\cfs}{\normalfont}
\fi
-% newtxtext and newtxmath pkg
\RequirePackage{newtxtext}
-\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}
+\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{appendix}
\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] %
@@ -144,13 +193,19 @@
\newcommand\updatetext{日期:}%
\renewcommand\abstractname{摘\hspace{2em}要}
\setlength\parindent{2\ccwd}
- \renewcommand{\abstracttextfont}{\small\sffamily\kaishu\noindent\ignorespaces}
+ \renewcommand{\abstracttextfont}{\small\citshape\noindent\ignorespaces}
% 新定义命令
\newcommand{\keywords}[1]{\vskip2ex\par\noindent\normalfont{\bfseries 关键词: } #1}
\newcommand\figref[1]{{\bfseries 图~\ref{#1}}}
\newcommand\tabref[1]{{\bfseries 表~\ref{#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}
+ \renewcommand{\appendixtocname}{附录}
+ \renewcommand{\appendixpagename}{附录}}{\relax}
\ifdefstring{\ELEGANT@lang}{en}{
\theoremstyle{plain}% default
@@ -172,11 +227,14 @@
\setlength\parindent{2em}
\renewcommand{\abstracttextfont}{\sffamily\small\noindent\ignorespaces}
% newcommands defined in this template.
- \newcommand{\keywords}[1]{\vskip2ex\par\noindent\normalfont{\bfseries Keywords: } #1}
+ \newcommand{\keywords}[1]{\vskip 2ex\par\noindent\normalfont{\bfseries Keywords: } #1}
\newcommand\figref[1]{{\bfseries Figure~\ref{#1}}}
\newcommand\tabref[1]{{\bfseries Table~\ref{#1}}}
- \bibliographystyle{aer}
-}{\relax}
+ \RequirePackage[\ELEGANT@cite,sort&compress]{natbib}
+ \bibliographystyle{\ELEGANT@bibstyle}}{\relax}
+
+\setlength{\bibsep}{0.0pt}
+\def\bibfont{\footnotesize}
\AtBeginEnvironment{verbatim}{\microtypesetup{activate=false}}
\BeforeBeginEnvironment{tabular}{\small}
@@ -186,8 +244,7 @@
\setlength{\abovedisplayskip}{3pt}
\setlength{\belowdisplayskip}{3pt}
\RequirePackage[flushmargin]{footmisc}
- \setlength{\footnotesep}{12pt}
-}
+ \setlength{\footnotesep}{12pt}}
\def\IfEmpty#1{%
\edef\1{\the#1}
@@ -248,12 +305,12 @@
\vskip 0.5ex%
\IfEmpty\version
\else
-{\small\normalfont\ifdefstring{\ELEGANT@lang}{en}{\itshape}{\kaishu}\versiontext\the\version}
+{\small\normalfont\citshape\versiontext\the\version}
\fi
\ifx\@date\empty
\else
\vskip 0.1em%
- {\small\normalfont\ifdefstring{\ELEGANT@lang}{en}{\itshape}{\kaishu}\updatetext\@date}%
+ {\small\normalfont\citshape\updatetext\@date}%
\fi
\end{center}%
\par
@@ -287,3 +344,4 @@
+