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.cls237
1 files changed, 128 insertions, 109 deletions
diff --git a/macros/latex/contrib/elegantpaper/elegantpaper.cls b/macros/latex/contrib/elegantpaper/elegantpaper.cls
index ec8b4921b6..65c9ea5101 100644
--- a/macros/latex/contrib/elegantpaper/elegantpaper.cls
+++ b/macros/latex/contrib/elegantpaper/elegantpaper.cls
@@ -1,14 +1,12 @@
-% Current Version: 0.07
% Author: Dongsheng Deng
% Homepage: https://ddswhu.me/
% Email: elegantlatex2e@gmail.com
% Lastest Version: https://github.com/ElegantLaTeX/ElegantPaper
% --- Class structure: identification part
-\ProvidesClass{elegantpaper}[2019/04/01 v0.07 ElegantLaTeX Paper class]
+\ProvidesClass{elegantpaper}[2019/10/17 v0.08 ElegantLaTeX Paper class]
\NeedsTeXFormat{LaTeX2e}
-
\RequirePackage{kvoptions}
\RequirePackage{ifthen}
\RequirePackage{ifxetex}
@@ -22,30 +20,32 @@
\DeclareVoidOption{cn}{\ekv{lang = cn}}
\DeclareVoidOption{en}{\ekv{lang = en}}
-% \PassOptionsToClass{11pt}{article}
+\DeclareStringOption[numbers]{cite}
+\DeclareVoidOption{numbers}{\ekv{cite=numbers}}
+\DeclareVoidOption{authoryear}{\ekv{cite=authoryear}}
+\DeclareVoidOption{super}{\ekv{cite=super}}
-\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
-\ProcessOptions\relax
+\DeclareDefaultOption{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessKeyvalOptions*\relax
\LoadClass{article}
\RequirePackage{amsthm}
-\RequirePackage{amsmath,amssymb}
-
-\linespread{1.35}
-
-
-% indentation, table and figure package
+\RequirePackage{amsmath}
+\RequirePackage{amssymb}
\RequirePackage{indentfirst}
\RequirePackage{booktabs}
\RequirePackage{multicol}
+\RequirePackage{multirow}
+\RequirePackage{linegoal}
\RequirePackage{xcolor}
\RequirePackage{graphicx}
\RequirePackage{fancyvrb}
\RequirePackage{abstract}
+\RequirePackage{hologo}
+\linespread{1.35}
\graphicspath{{image/}{figure/}{fig/}{img/}}
% caption settings
@@ -57,16 +57,20 @@
\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}
\definecolor{winered}{rgb}{0.5,0,0}
-% bib-settings
-\RequirePackage{natbib}
-\setlength{\bibsep}{0.0pt}
-\def\bibfont{\footnotesize}
+\definecolor{lightgrey}{rgb}{0.95,0.95,0.95}
+\definecolor{commentcolor}{RGB}{0,100,0}
+\definecolor{frenchplum}{RGB}{190,20,83}
-% settings for the geometry
+% settings for the hyperref and geometry
\RequirePackage{hyperref}
\hypersetup{
pdfborder={0 0 0},
@@ -77,70 +81,113 @@
citecolor={winered},
linktoc=all,
}
-\RequirePackage[left=1in, right=1in, top=1in, bottom=1in]{geometry}
+\RequirePackage[left=1in, right=1in, top=1in, bottom=1in,headheight=0pt,headsep=0pt]{geometry}
+\setlength{\headsep}{5pt}
% add the \email cmd
\newcommand\email[1]{\href{mailto:#1}{\nolinkurl{#1}}}
+% font settings
\PassOptionsToPackage{no-math}{fontspec}
-\RequirePackage[UTF8, scheme=plain]{ctex}
-\RequirePackage[T1]{fontenc}
+
+\ifdefstring{\ELEGANT@lang}{cn}{%
+ \RequirePackage[UTF8, scheme=plain]{ctex}
+}
+
+\ifxetex
+ \RequirePackage{fontenc}
+\else
+ \RequirePackage[T1]{fontenc}
+ \AtEndOfClass{%
+ \RequirePackage{microtype}}
+\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}
+
+\DeclareSymbolFont{CMlargesymbols}{OMX}{cmex}{m}{n}
+\let\sumop\relax\let\prodop\relax
+\DeclareMathSymbol{\sumop}{\mathop}{CMlargesymbols}{"50}
+\DeclareMathSymbol{\prodop}{\mathop}{CMlargesymbols}{"51}
\ifdefstring{\ELEGANT@lang}{cn}{
- \theoremstyle{plain}% default
- \newtheorem{theorem}{定理}[section] %
- \newtheorem{lemma}[theorem]{引理} %
- \newtheorem{proposition}[theorem]{性质} %
- \newtheorem*{corollary}{推论} %
- \theoremstyle{definition} %
- \newtheorem{definition}{定义}[section] %
- \newtheorem{conjecture}{猜想}[section] %
- \newtheorem{example}{例}[section] %
- \theoremstyle{remark} %
- \newtheorem*{remark}{\normalfont\bfseries 评论} %
- \newtheorem*{note}{\normalfont\bfseries 注} %
- \newtheorem{case}{\normalfont\bfseries 案例} %
- \renewcommand*{\proofname}{\normalfont\bfseries 证明} %
- \renewcommand\contentsname{目录}
- \renewcommand\refname{参考文献} %
- \renewcommand\figurename{图} %
- \renewcommand\tablename{表}%
- \newcommand\versiontext{\itshape 版本:}%
- \newcommand\updatetext{\itshape 更新:}%
- \renewcommand\abstractname{摘\hspace{2em}要}
- \setlength{\parindent}{2em}
- \renewcommand{\abstracttextfont}{\small\sffamily\kaishu}
- \newcommand{\keywords}[1]{\vskip2ex\par\noindent\normalfont{\bfseries 关键词: } #1}
- \newcommand\figref[1]{{\bfseries 图~\ref{#1}}}
- \newcommand\tabref[1]{{\bfseries 表~\ref{#1}}}
+ \theoremstyle{plain}% default
+ \newtheorem{theorem}{定理}[section] %
+ \newtheorem{lemma}[theorem]{引理} %
+ \newtheorem{proposition}[theorem]{性质} %
+ \newtheorem*{corollary}{推论} %
+ \theoremstyle{definition} %
+ \newtheorem{definition}{定义}[section] %
+ \newtheorem{conjecture}{猜想}[section] %
+ \newtheorem{example}{例}[section] %
+ \theoremstyle{remark} %
+ \newtheorem*{remark}{\normalfont\bfseries 评论} %
+ \newtheorem*{note}{\normalfont\bfseries 注} %
+ \newtheorem{case}{\normalfont\bfseries 案例} %
+ \renewcommand*{\proofname}{\normalfont\bfseries 证明} %
+ \renewcommand\contentsname{目录}
+ \renewcommand\refname{参考文献} %
+ \renewcommand\figurename{图} %
+ \renewcommand\tablename{表}%
+ \newcommand\versiontext{版本:}%
+ \newcommand\updatetext{日期:}%
+ \renewcommand\abstractname{摘\hspace{2em}要}
+ \setlength\parindent{2\ccwd}
+ \renewcommand{\abstracttextfont}{\small\sffamily\kaishu\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}
+
\ifdefstring{\ELEGANT@lang}{en}{
\theoremstyle{plain}% default
- \newtheorem{theorem}{Theorem}[section] %
- \newtheorem{lemma}[theorem]{Lemma} %
- \newtheorem{proposition}[theorem]{Proposition} %
- \newtheorem*{corollary}{Corollary} %
- \theoremstyle{definition} %
- \newtheorem{definition}{Definition}[section] %
- \newtheorem{conjecture}{Conjecture}[section] %
- \newtheorem{example}{Example}[section] %
- \theoremstyle{remark} %
- \newtheorem*{remark}{Remark} %
- \newtheorem*{note}{Note} %
- \newtheorem{case}{Case} %
- \renewcommand*{\proofname}{\normalfont\bfseries Proof}%
- \newcommand\versiontext{\itshape Version: }%
- \newcommand\updatetext{\itshape Update: }%
- \renewcommand{\abstracttextfont}{\sffamily\small\kaishu}
- \newcommand{\keywords}[1]{\vskip2ex\par\noindent\normalfont{\bfseries Keywords: } #1}
- \newcommand\figref[1]{{\bfseries Figure~\ref{#1}}}
- \newcommand\tabref[1]{{\bfseries Table~\ref{#1}}}
+ \newtheorem{theorem}{Theorem}[section] %
+ \newtheorem{lemma}[theorem]{Lemma} %
+ \newtheorem{proposition}[theorem]{Proposition} %
+ \newtheorem*{corollary}{Corollary} %
+ \theoremstyle{definition} %
+ \newtheorem{definition}{Definition}[section] %
+ \newtheorem{conjecture}{Conjecture}[section] %
+ \newtheorem{example}{Example}[section] %
+ \theoremstyle{remark} %
+ \newtheorem*{remark}{Remark} %
+ \newtheorem*{note}{Note} %
+ \newtheorem{case}{Case} %
+ \renewcommand*{\proofname}{\normalfont\bfseries Proof}%
+ \newcommand\versiontext{\itshape Version: }%
+ \newcommand\updatetext{\itshape Date: }%
+ \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\figref[1]{{\bfseries Figure~\ref{#1}}}
+ \newcommand\tabref[1]{{\bfseries Table~\ref{#1}}}
+ \bibliographystyle{aer}
}{\relax}
\AtBeginEnvironment{verbatim}{\microtypesetup{activate=false}}
+\BeforeBeginEnvironment{tabular}{\small}
+\AfterEndEnvironment{tabular}{}
+
+\AtBeginDocument{
+ \setlength{\abovedisplayskip}{3pt}
+ \setlength{\belowdisplayskip}{3pt}
+ \RequirePackage[flushmargin]{footmisc}
+ \setlength{\footnotesep}{12pt}
+}
\def\IfEmpty#1{%
\edef\1{\the#1}
@@ -148,13 +195,13 @@
}
\newtoks\version
\newtoks\institute
-\def \ifempty#1{\def\temp{#1} \ifx\temp\empty }
+
\renewcommand\maketitle{\par
\begingroup
\renewcommand\thefootnote{\@fnsymbol\c@footnote}%
\def\@makefnmark{\rlap{\@textsuperscript{\normalfont\@thefnmark}}}%
\long\def\@makefntext##1{\parindent 1em\noindent
- \hb@xt@1.8em{%
+ \hb@xt@0.1em{%
\hss\@textsuperscript{\normalfont\@thefnmark}}##1}%
\if@twocolumn
\ifnum \col@number=\@ne
@@ -195,72 +242,44 @@
{\large
\lineskip .5em%
\begin{tabular}[t]{c}%
- \@author\\
- \the\institute
- \end{tabular}\par}%
-\vskip 1.5em%
+ \@author\\[1ex]
+ \end{tabular}\par}
+ \the\institute%
+\vskip 0.5ex%
\IfEmpty\version
\else
-{\small \normalfont\kaishu \versiontext \itshape\the\version}
+{\small\normalfont\ifdefstring{\ELEGANT@lang}{en}{\itshape}{\kaishu}\versiontext\the\version}
\fi
\ifx\@date\empty
\else
\vskip 0.1em%
- {\small\normalfont\kaishu \updatetext \itshape \@date}%
+ {\small\normalfont\ifdefstring{\ELEGANT@lang}{en}{\itshape}{\kaishu}\updatetext\@date}%
\fi
\end{center}%
\par
}
-
-
-\DeclareSymbolFont{CMletters} {OML}{cmm} {m}{it}%
-\DeclareSymbolFont{CMsymbols} {OMS}{cmsy}{m}{n}%
-\DeclareSymbolFont{CMlargesymbols}{OMX}{cmex}{m}{n}%
-
-% \let\sum\relax
-% \DeclareMathSymbol{\sum}{\mathop}{CMlargesymbols}{"50}%
-% \let\int\relax
-% \DeclareMathSymbol{\int}{\mathop}{CMlargesymbols}{"5A}%
-
-\let\intop\relax\let\sumop\relax\let\ointop\relax\let\prodop\relax
-\DeclareMathSymbol{\sumop}{\mathop}{CMlargesymbols}{"50}
-\DeclareMathSymbol{\intop}{\mathop}{CMlargesymbols}{"52}
-\DeclareMathSymbol{\ointop}{\mathop}{CMlargesymbols}{"49}
-\DeclareMathSymbol{\prodop}{\mathop}{CMlargesymbols}{"59}
-
-% \let\partial\relax
-% \DeclareMathSymbol{\partial}{\mathord}{CMletters}{"40}%
-% \let\in\relax
-%\DeclareMathSymbol{\in}{\mathrel}{CMsymbols}{"32}%
-% \let\pi\relax
-% \DeclareMathSymbol{\pi}{\mathord}{CMletters}{"19}
-
-
-
-\RequirePackage{listings}
+\RequirePackage{listings}
\renewcommand{\ttdefault}{cmtt}
-\lstdefinestyle{mystyle}{
+
+\lstdefinestyle{estyle}{
basicstyle=%
\ttfamily
\lst@ifdisplaystyle\footnotesize\fi
}
+\lstset{basicstyle=\scriptsize\ttfamily,style=estyle}
-\lstset{basicstyle=\scriptsize\ttfamily,style=mystyle}
-
-\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},
+ frame=tlbr,framesep=4pt,framerule=0pt,
+ commentstyle=\color{commentcolor},
+ 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,cite,gbt7714,lang},
emphstyle={\color{frenchplum}},
- morekeywords={DeclareSymbolFont,SetSymbolFont,toprule,midrule,bottomrule,institute,version,includegraphics,setmainfont,setsansfont,setmonofont ,setCJKmainfont,setCJKsansfont,setCJKmonofont,RequirePackage,figref,tabref,email,maketitle,keywords},
- frame=none,
+ morekeywords={DeclareSymbolFont,SetSymbolFont,toprule,midrule,bottomrule,institute,version,includegraphics,setmainfont,setsansfont,setmonofont ,setCJKmainfont,setCJKsansfont,setCJKmonofont,RequirePackage,figref,tabref,email,maketitle,keywords,zhdate,zhtoday},
tabsize=2,
backgroundcolor=\color{lightgrey}
}