diff --git a/.gitignore b/.gitignore index e6598ba..f8edbcb 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,8 @@ *.cb *.cb2 .*.lb +elegantpaper-cn.pdf +elegantpaper-en.pdf ## Intermediate documents: *.dvi diff --git a/elegantpaper-cn.pdf b/elegantpaper-cn.pdf index ec71614..d938079 100644 Binary files a/elegantpaper-cn.pdf and b/elegantpaper-cn.pdf differ diff --git a/elegantpaper-cn.tex b/elegantpaper-cn.tex index 02a2fd4..5782849 100644 --- a/elegantpaper-cn.tex +++ b/elegantpaper-cn.tex @@ -1,18 +1,16 @@ %!TEX program = xelatex -% 完整编译方法 1 pdflatex -> bibtex -> pdflatex -> pdflatex +% 完整编译方法 1: pdflatex -> bibtex -> pdflatex -> pdflatex % 完整编译方法 2: xelatex -> bibtex -> xelatex -> xelatex -\documentclass[lang=cn,11pt,numbers]{elegantpaper} +\documentclass[lang=cn,11pt,numbers, a4paper]{elegantpaper} \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{} 项目组}} -% 不需要版本信息,直接注释即可 -\version{0.07} -% 不需要时间信息的话,需要把 \today 删除。 -\date{\today} - +\version{0.08} +\date{\zhtoday} \begin{document} @@ -26,28 +24,36 @@ \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} -数学字体的效果如下: -\begin{equation} -(a+3b)^{n} = \sum_{k=0}^{n} C_{n}^{k} a^{n-k} (3b)^k\label{eq:binom} -\end{equation} - +本模板支持 \hologo{pdfLaTeX} 和 \hologo{XeLaTeX} 编译。 + \subsection{全局选项} -我在这个模板中定义了一个语言选项 \lstinline{lang},可以选择英文模式 \lstinline{lang=en}(默认)或者中文模式 \lstinline{lang=cn}。当选择中文模式时,图表的标题引导词以及参考文献,定理引导词等信息会变成中文。你可以通过下面两种方式来选择语言模式: +此模板定义了一个语言选项 \lstinline{lang},可以选择英文模式 \lstinline{lang=en}(默认)或者中文模式 \lstinline{lang=cn}。当选择中文模式时,图表的标题引导词以及参考文献,定理引导词等信息会变成中文。你可以通过下面两种方式来选择语言模式: \begin{lstlisting} \documentclass[lang=cn]{elegantpaper} % or \documentclass{cn}{elegantpaper} \end{lstlisting} +\textbf{注意:} 英文模式下,由于没有添加中文宏包,无法输入中文。如果需要输入中文,可以通过在导言区引入中文宏包 \lstinline{ctex} 或者加入 \lstinline{xeCJK} 宏包后自行设置字体。 +\begin{lstlisting} +\usepackage[UTF8,scheme=plain]{ctex} +\end{lstlisting} + +\subsection{英文与数学字体} + +本模板使用 \lstinline{newtxtext} 和 \lstinline{newtxmath} 分别设置全文的英文文本字体和数学字体。 \subsection{自定义命令} -在此模板中,并没有修改任何默认的命令或者环境,所以,你可以在此模板使用原来的命令和环境。另外,我自定义了 4 个命令: +此模板并没有修改任何默认的 \LaTeX{} 命令或者环境。另外,我自定义了 4 个命令: \begin{enumerate} - \item \lstinline{\email}:创建邮箱地址的链接; - \item \lstinline{\figref}:用法和 \lstinline{\ref} 类似,但是会在插图的标题前添加 <\textbf{图 n}> ; - \item \lstinline{\tabref}:用法和 \lstinline{\ref} 类似,但是会在表格的标题前添加 <\textbf{表 n}>; - \item \lstinline{\keywords}:为摘要环境添加关键词。 + \item \lstinline{\email}:创建邮箱地址的链接,比如 \email{ddswhu@outlook.com}; + \item \lstinline{\figref}:用法和 \lstinline{\ref} 类似,但是会在插图的标题前添加 <\textbf{图 n}> ; + \item \lstinline{\tabref}:用法和 \lstinline{\ref} 类似,但是会在表格的标题前添加 <\textbf{表 n}>; + \item \lstinline{\keywords}:为摘要环境添加关键词。 \end{enumerate} \subsection{列表环境} @@ -135,23 +141,47 @@ \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 平台(人人贷)的数据来检验男性投资者和女性投资者在投资表现上是否有显著差异。 -你可以在谷歌学术,Mendeley,Endnote 中获得文献条目(bib item),然后把它们添加到 \lstinline{wpref.bib} 中。在文中引用的时候,引用它们的键值(bib key)即可。注意需要在编译的过程中添加 Bib\TeX{} 编译。如果你想在参考文献中添加未引用的文献(部分或者全部),可以使用 +你可以在谷歌学术,Mendeley,Endnote 中获得文献条目(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} -\nocite{EINAV2010, Havrylchyk2018} % add the two reference. -\nocite{*} % add all the reference in the bib file. +\documentclass[cite=numbers]{elegantpaper} % numbers style ref style +\documentclass[numbers]{elegantpaper} + +\documentclass[cite=authoryear]{elegantpaper} % author-year ref style +\documentclass[authoryear]{elegantpaper} \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} -\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{A Working Paper Example} -\author{ddswhu} +\title{Working Paper Example} +\author{Author Name} \institute{Elegant\LaTeX{} Group} + \version{1.00} \date{\today} @@ -170,9 +200,8 @@ The content of introduction section. \section{Conclusion} The content of conclusion section. -% include the noncited reference -\nocite{ref1, ref2} \bibliography{wpref} + \end{document} \end{lstlisting} diff --git a/elegantpaper.cls b/elegantpaper.cls index 38bd5eb..cc93fde 100644 --- a/elegantpaper.cls +++ b/elegantpaper.cls @@ -4,7 +4,7 @@ % 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/10 v0.08 ElegantLaTeX Paper class] \NeedsTeXFormat{LaTeX2e} \RequirePackage{kvoptions} @@ -109,9 +109,23 @@ \RequirePackage[T1]{fontenc} \AtEndOfClass{\RequirePackage{microtype}} \fi +\RequirePackage{hologo} \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 @@ -135,7 +149,7 @@ \newcommand\versiontext{版本:}% \newcommand\updatetext{日期:}% \renewcommand\abstractname{摘\hspace{2em}要} - \setlength{\parindent}{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}}} @@ -159,6 +173,7 @@ \renewcommand*{\proofname}{\normalfont\bfseries Proof}% \newcommand\versiontext{\itshape Version: }% \newcommand\updatetext{\itshape Date: }% + \setlength\parindent{2em} \renewcommand{\abstracttextfont}{\sffamily\small\noindent\ignorespaces} \newcommand{\keywords}[1]{\vskip2ex\par\noindent\normalfont{\bfseries Keywords: } #1} \newcommand\figref[1]{{\bfseries Figure~\ref{#1}}} @@ -233,10 +248,10 @@ {\large \lineskip .5em% \begin{tabular}[t]{c}% - \@author\\ - \the\institute - \end{tabular}\par}% -\vskip 1em% + \@author\\[1ex] + \end{tabular}\par} + \the\institute% +\vskip 0.5ex% \IfEmpty\version \else {\small\normalfont\ifdefstring{\ELEGANT@lang}{en}{\itshape}{\kaishu}\versiontext\the\version} @@ -251,54 +266,30 @@ } - - -\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 + basicstyle=% + \ttfamily + \lst@ifdisplaystyle\footnotesize\fi } \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} \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}, 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}, + % frame=none, tabsize=2, backgroundcolor=\color{lightgrey} }