summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/elegantpaper/elegantpaper.cls
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/elegantpaper/elegantpaper.cls
Initial commit
Diffstat (limited to 'macros/latex/contrib/elegantpaper/elegantpaper.cls')
-rw-r--r--macros/latex/contrib/elegantpaper/elegantpaper.cls270
1 files changed, 270 insertions, 0 deletions
diff --git a/macros/latex/contrib/elegantpaper/elegantpaper.cls b/macros/latex/contrib/elegantpaper/elegantpaper.cls
new file mode 100644
index 0000000000..ec8b4921b6
--- /dev/null
+++ b/macros/latex/contrib/elegantpaper/elegantpaper.cls
@@ -0,0 +1,270 @@
+% 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]
+\NeedsTeXFormat{LaTeX2e}
+
+
+\RequirePackage{kvoptions}
+\RequirePackage{ifthen}
+\RequirePackage{ifxetex}
+\RequirePackage{etoolbox}
+\RequirePackage{calc}
+
+\SetupKeyvalOptions{family=ELEGANT, prefix=ELEGANT@, setkeys=\kvsetkeys}
+\newcommand{\ekv}[1]{\kvsetkeys{ELEGANT}{#1}}
+
+\DeclareStringOption[en]{lang}
+\DeclareVoidOption{cn}{\ekv{lang = cn}}
+\DeclareVoidOption{en}{\ekv{lang = en}}
+
+% \PassOptionsToClass{11pt}{article}
+
+\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
+\ProcessOptions\relax
+\ProcessKeyvalOptions*\relax
+\LoadClass{article}
+
+
+
+\RequirePackage{amsthm}
+\RequirePackage{amsmath,amssymb}
+
+\linespread{1.35}
+
+
+% indentation, table and figure package
+\RequirePackage{indentfirst}
+\RequirePackage{booktabs}
+\RequirePackage{multicol}
+\RequirePackage{xcolor}
+\RequirePackage{graphicx}
+\RequirePackage{fancyvrb}
+\RequirePackage{abstract}
+
+\graphicspath{{image/}{figure/}{fig/}{img/}}
+
+% caption settings
+\RequirePackage[font=small,labelfont={bf}]{caption}
+\captionsetup[table]{skip=3pt}
+\captionsetup[figure]{skip=3pt}
+
+% list/itemize/enumerate setting
+\RequirePackage[shortlabels,inline]{enumitem}
+\setlist{nolistsep}
+
+% define the hyperref color
+\RequirePackage{xcolor}
+\definecolor{winered}{rgb}{0.5,0,0}
+
+% bib-settings
+\RequirePackage{natbib}
+\setlength{\bibsep}{0.0pt}
+\def\bibfont{\footnotesize}
+
+% settings for the 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]{geometry}
+
+% add the \email cmd
+\newcommand\email[1]{\href{mailto:#1}{\nolinkurl{#1}}}
+
+\PassOptionsToPackage{no-math}{fontspec}
+\RequirePackage[UTF8, scheme=plain]{ctex}
+\RequirePackage[T1]{fontenc}
+\RequirePackage{newtxtext}
+\RequirePackage{newtxmath}
+
+
+\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}}}
+}{\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}}}
+}{\relax}
+
+\AtBeginEnvironment{verbatim}{\microtypesetup{activate=false}}
+
+\def\IfEmpty#1{%
+ \edef\1{\the#1}
+ \ifx\1\empty
+}
+\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{%
+ \hss\@textsuperscript{\normalfont\@thefnmark}}##1}%
+ \if@twocolumn
+ \ifnum \col@number=\@ne
+ \@maketitle
+ \else
+ \twocolumn[\@maketitle]%
+ \fi
+ \else
+ \newpage
+ \global\@topnum\z@ % Prevents figures from going at top of page.
+ \@maketitle
+ \fi
+ \thispagestyle{plain}\@thanks
+ \endgroup
+ \setcounter{footnote}{0}%
+ \global\let\thanks\relax
+ \global\let\maketitle\relax
+ \global\let\@maketitle\relax
+ \global\let\@thanks\@empty
+ \global\let\@author\@empty
+ \global\let\@ELEGANT@version\@empty
+ \global\let\@date\@empty
+ \global\let\@title\@empty
+ \global\let\title\relax
+ \global\let\author\relax
+ \global\let\date\relax
+ \global\let\and\relax
+ \global\let\ELEGANT@version\relax
+}
+\def\@maketitle{%
+ \newpage
+ \null
+ \vskip 2em%
+ \begin{center}%
+ \let \footnote \thanks
+ {\LARGE\bfseries \@title \par}%
+ \vskip 1.5em%
+ {\large
+ \lineskip .5em%
+ \begin{tabular}[t]{c}%
+ \@author\\
+ \the\institute
+ \end{tabular}\par}%
+\vskip 1.5em%
+\IfEmpty\version
+\else
+{\small \normalfont\kaishu \versiontext \itshape\the\version}
+\fi
+\ifx\@date\empty
+\else
+\vskip 0.1em%
+ {\small\normalfont\kaishu \updatetext \itshape \@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}
+\renewcommand{\ttdefault}{cmtt}
+\lstdefinestyle{mystyle}{
+ basicstyle=%
+ \ttfamily
+ \lst@ifdisplaystyle\footnotesize\fi
+}
+
+\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},
+ 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,
+ tabsize=2,
+ backgroundcolor=\color{lightgrey}
+}
+
+
+
+