update to 0.08

This commit is contained in:
EthanDeng
2019-10-10 17:12:38 +08:00
parent 1554b81e48
commit fe1d54a1b1
4 changed files with 93 additions and 71 deletions

2
.gitignore vendored
View File

@@ -11,6 +11,8 @@
*.cb *.cb
*.cb2 *.cb2
.*.lb .*.lb
elegantpaper-cn.pdf
elegantpaper-en.pdf
## Intermediate documents: ## Intermediate documents:
*.dvi *.dvi

Binary file not shown.

View File

@@ -1,18 +1,16 @@
%!TEX program = xelatex %!TEX program = xelatex
% 完整编译方法 1 pdflatex -> bibtex -> pdflatex -> pdflatex % 完整编译方法 1: pdflatex -> bibtex -> pdflatex -> pdflatex
% 完整编译方法 2: xelatex -> bibtex -> xelatex -> xelatex % 完整编译方法 2: xelatex -> bibtex -> xelatex -> xelatex
\documentclass[lang=cn,11pt,numbers]{elegantpaper} \documentclass[lang=cn,11pt,numbers, a4paper]{elegantpaper}
\title{ElegantPaper: 一个优美的 \LaTeX{} 工作论文模板} \title{ElegantPaper: 一个优美的 \LaTeX{} 工作论文模板}
\author{\href{https://ddswhu.me/}{邓东升}} \author{Ethan DENG \\ Fudan University
\and Dongsheng DENG \\ PA Technology}
\institute{\href{https://elegantlatex.org/}{Elegant\LaTeX{} 项目组}} \institute{\href{https://elegantlatex.org/}{Elegant\LaTeX{} 项目组}}
% 不需要版本信息,直接注释即可 \version{0.08}
\version{0.07} \date{\zhtoday}
% 不需要时间信息的话,需要把 \today 删除。
\date{\today}
\begin{document} \begin{document}
@@ -26,25 +24,33 @@
\section{模板介绍} \section{模板介绍}
此模板基于 \LaTeX{} 的标准文类 article设计也即意味着你可以把 article 文类的选项传递给本模板,比如 \lstinline{a4paper, 10pt} 等等(推荐使用 \lstinline{11pt})。本模板支持 \lstinline{PDFLaTeX}\lstinline{XeLaTeX}\footnote{中文字体均使用 \lstinline{ctex} 包设置。} 两种编译方式 此模板基于 \LaTeX{} 的标准文类 article 设计,也即意味着你可以把 article 文类的选项传递给本模板,比如 \lstinline{a4paper, 11pt} 等等。
\begin{lstlisting}
\documentclass[a4paper,11pt]{elegantpaper}
\end{lstlisting}
数学字体的效果如下: 本模板支持 \hologo{pdfLaTeX}\hologo{XeLaTeX} 编译。
\begin{equation}
(a+3b)^{n} = \sum_{k=0}^{n} C_{n}^{k} a^{n-k} (3b)^k\label{eq:binom}
\end{equation}
\subsection{全局选项} \subsection{全局选项}
我在这个模板定义了一个语言选项 \lstinline{lang},可以选择英文模式 \lstinline{lang=en}(默认)或者中文模式 \lstinline{lang=cn}。当选择中文模式时,图表的标题引导词以及参考文献,定理引导词等信息会变成中文。你可以通过下面两种方式来选择语言模式: 模板定义了一个语言选项 \lstinline{lang},可以选择英文模式 \lstinline{lang=en}(默认)或者中文模式 \lstinline{lang=cn}。当选择中文模式时,图表的标题引导词以及参考文献,定理引导词等信息会变成中文。你可以通过下面两种方式来选择语言模式:
\begin{lstlisting} \begin{lstlisting}
\documentclass[lang=cn]{elegantpaper} % or \documentclass[lang=cn]{elegantpaper} % or
\documentclass{cn}{elegantpaper} \documentclass{cn}{elegantpaper}
\end{lstlisting} \end{lstlisting}
\textbf{注意:} 英文模式下,由于没有添加中文宏包,无法输入中文。如果需要输入中文,可以通过在导言区引入中文宏包 \lstinline{ctex} 或者加入 \lstinline{xeCJK} 宏包后自行设置字体。
\begin{lstlisting}
\usepackage[UTF8,scheme=plain]{ctex}
\end{lstlisting}
\subsection{英文与数学字体}
本模板使用 \lstinline{newtxtext}\lstinline{newtxmath} 分别设置全文的英文文本字体和数学字体。
\subsection{自定义命令} \subsection{自定义命令}
此模板中,并没有修改任何默认的命令或者环境,所以,你可以在此模板使用原来的命令和环境。另外,我自定义了 4 个命令: 此模板并没有修改任何默认的 \LaTeX{} 命令或者环境。另外,我自定义了 4 个命令:
\begin{enumerate} \begin{enumerate}
\item \lstinline{\email}:创建邮箱地址的链接; \item \lstinline{\email}:创建邮箱地址的链接,比如 \email{ddswhu@outlook.com}
\item \lstinline{\figref}:用法和 \lstinline{\ref} 类似,但是会在插图的标题前添加 <\textbf{图 n}> \item \lstinline{\figref}:用法和 \lstinline{\ref} 类似,但是会在插图的标题前添加 <\textbf{图 n}>
\item \lstinline{\tabref}:用法和 \lstinline{\ref} 类似,但是会在表格的标题前添加 <\textbf{表 n}> \item \lstinline{\tabref}:用法和 \lstinline{\ref} 类似,但是会在表格的标题前添加 <\textbf{表 n}>
\item \lstinline{\keywords}:为摘要环境添加关键词。 \item \lstinline{\keywords}:为摘要环境添加关键词。
@@ -135,23 +141,47 @@
\subsection{参考文献} \subsection{参考文献}
此模板使用 Bib\TeX{} 来生成参考文献默认使用的文献样式bib style\lstinline{GB/T 7714-2015}\footnote{通过调用 \href{https://ctan.org/pkg/gbt7714}{\lstinline{gbt7714}} 宏包}。参考文献示例:~\cite{en3} 使用了中国一个大型的 P2P 平台(人人贷)的数据来检验男性投资者和女性投资者在投资表现上是否有显著差异。 此模板使用 \hologo{BibTeX} 来生成参考文献默认使用的文献样式bib style\lstinline{GB/T 7714-2015}\footnote{通过调用 \href{https://ctan.org/pkg/gbt7714}{\lstinline{gbt7714}} 宏包}。参考文献示例:~\cite{en3} 使用了中国一个大型的 P2P 平台(人人贷)的数据来检验男性投资者和女性投资者在投资表现上是否有显著差异。
你可以在谷歌学术MendeleyEndnote 中获得文献条目bib item然后把它们添加到 \lstinline{wpref.bib} 中。在文中引用的时候引用它们的键值bib key即可。注意需要在编译的过程中添加 Bib\TeX{} 编译。如果你想在参考文献中添加未引用的文献(部分或者全部),可以使用 你可以在谷歌学术MendeleyEndnote 中获得文献条目bib item然后把它们添加到 \lstinline{wpref.bib} 中。在文中引用的时候引用它们的键值bib key即可。注意需要在编译的过程中添加 \hologo{BibTeX} 编译。
本模板还添加了 \lstinline{cite=numbers}\lstinline{cite=super}\lstinline{cite=authoryear} 三个参考文献选项,用于设置参考文献格式的设置,默认为 \lstinline{super}。理工科类一般使用数字形式 \lstinline{numbers} 或者上标形式 \lstinline{super},而文科类多使用作者--年份 \lstinline{authoryear} 比较多。如果需要改为 \lstinline{cite=numbers} 或者 \lstinline{authoryear} ,可以使用
\begin{lstlisting} \begin{lstlisting}
\nocite{EINAV2010, Havrylchyk2018} % add the two reference. \documentclass[cite=numbers]{elegantpaper} % numbers style ref style
\nocite{*} % add all the reference in the bib file. \documentclass[numbers]{elegantpaper}
\documentclass[cite=authoryear]{elegantpaper} % author-year ref style
\documentclass[authoryear]{elegantpaper}
\end{lstlisting} \end{lstlisting}
\section{示例} \section{常见问题 FAQ}
在这部分,我提供一个示例文档:
\begin{enumerate}[label=\arabic*).]
\item \textit{如何删除版本信息?}\\
导言区不写 \lstinline|\version{x.xx}| 即可。
\item \textit{如何删除日期?}\\
需要注意的是,与版本 \lstinline{\version} 不同的是,导言区不写或注释 \lstinline{\date} 的话,仍然会打印出当日日期,原因是 \lstinline{\date} 有默认参数。如果不需要日期的话,日期可以留空即可,也即 \lstinline|\date{}|。
\item \textit{如何获得中文日期?}\\
为了获得中文日期,必须在中文模式下\footnote{英文模式下,由于未加载中文宏包,无法输入中文。},使用 \lstinline|\date{\zhdate{2019/10/10}}|,如果需要当天的汉化日期,可以使用 \lstinline|\date{\zhtoday}|,这两个命令都来源于 \href{https://ctan.org/pkg/zhnumber}{\lstinline{zhnumber}} 宏包。
\item \textit{如何添加多个作者?}\\
\lstinline{\author} 里面使用 \lstinline{\and},作者单位可以用 \lstinline{\\} 换行。
\begin{lstlisting} \begin{lstlisting}
\documentclass[lang=cn]{elegantpaper} \author{Author A \\ Org. A \and Author B \\ Org. B }
\end{lstlisting}
\item \textit{如何添加中英文摘要?}\\
请参考 \href{https://github.com/ElegantLaTeX/ElegantPaper/issues/5}{Github::ElegantPaper/issues/5}
\end{enumerate}
\section{示例}
这是一个示例文档:
\begin{lstlisting}
\documentclass[lang=cn,a4paper,11pt]{elegantpaper}
% title information % title information
\title{A Working Paper Example} \title{Working Paper Example}
\author{ddswhu} \author{Author Name}
\institute{Elegant\LaTeX{} Group} \institute{Elegant\LaTeX{} Group}
\version{1.00} \version{1.00}
\date{\today} \date{\today}
@@ -170,9 +200,8 @@ The content of introduction section.
\section{Conclusion} \section{Conclusion}
The content of conclusion section. The content of conclusion section.
% include the noncited reference
\nocite{ref1, ref2}
\bibliography{wpref} \bibliography{wpref}
\end{document} \end{document}
\end{lstlisting} \end{lstlisting}

View File

@@ -4,7 +4,7 @@
% Lastest Version: https://github.com/ElegantLaTeX/ElegantPaper % Lastest Version: https://github.com/ElegantLaTeX/ElegantPaper
% --- Class structure: identification part % --- Class structure: identification part
\ProvidesClass{elegantpaper}[2019/04/01 v0.07 ElegantLaTeX Paper class] \ProvidesClass{elegantpaper}[2019/10/10 v0.08 ElegantLaTeX Paper class]
\NeedsTeXFormat{LaTeX2e} \NeedsTeXFormat{LaTeX2e}
\RequirePackage{kvoptions} \RequirePackage{kvoptions}
@@ -109,9 +109,23 @@
\RequirePackage[T1]{fontenc} \RequirePackage[T1]{fontenc}
\AtEndOfClass{\RequirePackage{microtype}} \AtEndOfClass{\RequirePackage{microtype}}
\fi \fi
\RequirePackage{hologo}
\RequirePackage{newtxtext} \RequirePackage{newtxtext}
\RequirePackage{newtxmath} \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}{ \ifdefstring{\ELEGANT@lang}{cn}{
\theoremstyle{plain}% default \theoremstyle{plain}% default
@@ -135,7 +149,7 @@
\newcommand\versiontext{}% \newcommand\versiontext{}%
\newcommand\updatetext{}% \newcommand\updatetext{}%
\renewcommand\abstractname{\hspace{2em}} \renewcommand\abstractname{\hspace{2em}}
\setlength{\parindent}{2em} \setlength\parindent{2\ccwd}
\renewcommand{\abstracttextfont}{\small\sffamily\kaishu\noindent\ignorespaces} \renewcommand{\abstracttextfont}{\small\sffamily\kaishu\noindent\ignorespaces}
\newcommand{\keywords}[1]{\vskip2ex\par\noindent\normalfont{\bfseries : } #1} \newcommand{\keywords}[1]{\vskip2ex\par\noindent\normalfont{\bfseries : } #1}
\newcommand\figref[1]{{\bfseries ~\ref{#1}}} \newcommand\figref[1]{{\bfseries ~\ref{#1}}}
@@ -159,6 +173,7 @@
\renewcommand*{\proofname}{\normalfont\bfseries Proof}% \renewcommand*{\proofname}{\normalfont\bfseries Proof}%
\newcommand\versiontext{\itshape Version: }% \newcommand\versiontext{\itshape Version: }%
\newcommand\updatetext{\itshape Date: }% \newcommand\updatetext{\itshape Date: }%
\setlength\parindent{2em}
\renewcommand{\abstracttextfont}{\sffamily\small\noindent\ignorespaces} \renewcommand{\abstracttextfont}{\sffamily\small\noindent\ignorespaces}
\newcommand{\keywords}[1]{\vskip2ex\par\noindent\normalfont{\bfseries Keywords: } #1} \newcommand{\keywords}[1]{\vskip2ex\par\noindent\normalfont{\bfseries Keywords: } #1}
\newcommand\figref[1]{{\bfseries Figure~\ref{#1}}} \newcommand\figref[1]{{\bfseries Figure~\ref{#1}}}
@@ -233,10 +248,10 @@
{\large {\large
\lineskip .5em% \lineskip .5em%
\begin{tabular}[t]{c}% \begin{tabular}[t]{c}%
\@author\\ \@author\\[1ex]
\the\institute \end{tabular}\par}
\end{tabular}\par}% \the\institute%
\vskip 1em% \vskip 0.5ex%
\IfEmpty\version \IfEmpty\version
\else \else
{\small\normalfont\ifdefstring{\ELEGANT@lang}{en}{\itshape}{\kaishu}\versiontext\the\version} {\small\normalfont\ifdefstring{\ELEGANT@lang}{en}{\itshape}{\kaishu}\versiontext\the\version}
@@ -251,32 +266,6 @@
} }
\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} \renewcommand{\ttdefault}{cmtt}
\lstdefinestyle{mystyle}{ \lstdefinestyle{mystyle}{
@@ -287,18 +276,20 @@
\lstset{basicstyle=\scriptsize\ttfamily,style=mystyle} \lstset{basicstyle=\scriptsize\ttfamily,style=mystyle}
\definecolor{lightgrey}{rgb}{0.9,0.9,0.9} \definecolor{lightgrey}{rgb}{0.95,0.95,0.95}
\definecolor{commentcolor}{RGB}{0,100,0}
\definecolor{frenchplum}{RGB}{190,20,83} \definecolor{frenchplum}{RGB}{190,20,83}
\lstset{language=[LaTeX]TeX, \lstset{language=[LaTeX]TeX,
texcsstyle=*\color{winered}, texcsstyle=*\color{winered},
numbers=none, numbers=none,
breaklines=true, breaklines=true,
keywordstyle=\color{winered}, keywordstyle=\color{winered},
commentstyle=\color{gray}, frame=tlbr,framesep=4pt,framerule=0pt,
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}, 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},
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}, morekeywords={DeclareSymbolFont,SetSymbolFont,toprule,midrule,bottomrule,institute,version,includegraphics,setmainfont,setsansfont,setmonofont ,setCJKmainfont,setCJKsansfont,setCJKmonofont,RequirePackage,figref,tabref,email,maketitle,keywords,zhdate,zhtoday},
frame=none, % frame=none,
tabsize=2, tabsize=2,
backgroundcolor=\color{lightgrey} backgroundcolor=\color{lightgrey}
} }