diff --git a/makeclearfig.bat b/delete-temp-files.bat similarity index 93% rename from makeclearfig.bat rename to delete-temp-files.bat index 33f3659..f6da4ee 100644 --- a/makeclearfig.bat +++ b/delete-temp-files.bat @@ -1,5 +1,5 @@ @echo off -del /q *.aux *.bbl *.blg *.log *.out *.toc *.bcf *.xml *.synctex *.nlo *.nls *.bak *.ind *.idx *.ilg *.lof *.lot *.ent-x *.tmp *.ltx *.los *.lol *.loc *.listing *.gz *.userbak *.nav *.snm *.vrb +del /q *.aux *.bbl *.blg *.log *.out *.toc *.bcf *.xml *.synctex *.nlo *.nls *.bak *.ind *.idx *.ilg *.lof *.lot *.ent-x *.tmp *.ltx *.los *.lol *.loc *.listing *.gz *.userbak *.nav *.snm *.vrb *.synctex(busy) del /q *.nav *.snm *.vrb *.fls *.xdv *.fdb_latexmk \ No newline at end of file diff --git a/elegantpaper-cn.pdf b/elegantpaper-cn.pdf index 9a90d63..5a3d6e2 100644 Binary files a/elegantpaper-cn.pdf and b/elegantpaper-cn.pdf differ diff --git a/elegantpaper-cn.tex b/elegantpaper-cn.tex index b028858..659f9cd 100644 --- a/elegantpaper-cn.tex +++ b/elegantpaper-cn.tex @@ -4,7 +4,7 @@ \documentclass[lang=cn,11pt]{elegantpaper} \title{ElegantPaper: 一个优美的 \LaTeX{} 工作论文模板} -\author{\href{https://ddswhu.me/}{邓 东 升}} +\author{\href{https://ddswhu.me/}{邓东升}} \institute{\href{https://elegantlatex.org/}{Elegant\LaTeX{} 项目组}} @@ -14,15 +14,12 @@ \date{\today} -% 如果想修改参考文献样式,请把这行注释掉 -\usepackage[authoryear]{gbt7714} % 国标 - \begin{document} \maketitle \begin{abstract} -\noindent 本文为 \href{https://github.com/ElegantLaTeX/ElegantPaper/}{ElegantPaper} 的说明文档(中文)。此模板基于 \LaTeX{} 的 article 类,专为工作论文写作而设计。设计这个模板的初衷是让作者不用关心工作论文的格式,专心写作,从而有更加舒适,简便的写作体验。如果你有其他问题、建议或者报告 bug,可以在 \href{https://github.com/ElegantLaTeX/ElegantPaper/issues}{ElegantPaper/issues} 留言。如果你想了解更多由 Elegant\LaTeX{} 项目组设计的模板,请访问 \href{https://github.com/ElegantLaTeX/}{https://github.com/ElegantLaTeX/}。 +本文为 \href{https://github.com/ElegantLaTeX/ElegantPaper/}{ElegantPaper} 的说明文档(中文)。此模板基于 \LaTeX{} 的 article 类,专为工作论文写作而设计。设计这个模板的初衷是让作者不用关心工作论文的格式,专心写作,从而有更加舒适,简便的写作体验。如果你有其他问题、建议或者报告 bug,可以在 \href{https://github.com/ElegantLaTeX/ElegantPaper/issues}{ElegantPaper/issues} 留言。如果你想了解更多由 Elegant\LaTeX{} 项目组设计的模板,请访问 \href{https://github.com/ElegantLaTeX/}{https://github.com/ElegantLaTeX/}。 \keywords{Elegant\LaTeX{},工作论文,模板} \end{abstract} @@ -32,14 +29,12 @@ 此模板是基于 \LaTeX{} 的标准文类 article设计,也即意味着你可以把 article 文类的选项传递给本模板,比如 \lstinline{a4paper, 10pt} 等等(推荐使用 \lstinline{11pt})。本模板支持 \lstinline{PDFLaTeX} 和 \lstinline{XeLaTeX}\footnote{中文字体均使用 \lstinline{ctex} 包设置。} 两种编译方式。 数学字体的效果如下: - \begin{equation} (a+3b)^{n} = \sum_{k=0}^{n} C_{n}^{k} a^{n-k} (3b)^k\label{eq:binom} \end{equation} \subsection{全局选项} 我在这个模板中定义了一个语言选项 \lstinline{lang},可以选择英文模式 \lstinline{lang=en}(默认)或者中文模式 \lstinline{lang=cn}。当选择中文模式时,图表的标题引导词以及参考文献,定理引导词等信息会变成中文。你可以通过下面两种方式来选择语言模式: - \begin{lstlisting} \documentclass[lang=cn]{elegantpaper} % or \documentclass{cn}{elegantpaper} @@ -48,7 +43,6 @@ \subsection{自定义命令} 在此模板中,并没有修改任何默认的命令或者环境,所以,你可以在此模板使用原来的命令和环境。另外,我自定义了 4 个命令: - \begin{enumerate} \item \lstinline{\email}:创建邮箱地址的链接; \item \lstinline{\figref}:用法和 \lstinline{\ref} 类似,但是会在插图的标题前添加 <\textbf{图 n}> ; @@ -56,8 +50,6 @@ \item \lstinline{\keywords}:为摘要环境添加关键词。 \end{enumerate} - - \subsection{列表环境} 你可以使用列表环境(\lstinline{itemize}、\lstinline{enumerate}、\lstinline{description}),示例如下:\\[2ex] \begin{minipage}[c]{0.59\linewidth} @@ -78,12 +70,8 @@ \end{minipage} - - \subsection{插图} 插图的命令和以前一样,也是使用 \lstinline{figure} 环境。\figref{fig:scatter} 显示了插图的效果。你可以把你的图放到当前工作目录的如下子目录下 (\lstinline{./image/}, \lstinline{./img/}, \lstinline{./figure/}, \lstinline{./fig/})。 - - \begin{lstlisting} \begin{figure}[htbp] \centering @@ -98,8 +86,7 @@ \end{figure} \subsection{表格} -我强烈建议你使用 \lstinline{booktabs} 宏包,这个宏包有三个命令 \lstinline{\toprule}、\lstinline{\midrule} 和 \lstinline{\bottomrule} 能方便你制作三线表。\tabref{tab:reg} 是一个示例: - +建议使用 \lstinline{booktabs} 宏包制作表格,该宏包有三个命令 \lstinline{\toprule}、\lstinline{\midrule} 和 \lstinline[breaklines]{\bottomrule} 能方便你制作三线表。\tabref{tab:reg} 是一个示例: \begin{lstlisting} \begin{table}[htbp] \small @@ -151,27 +138,13 @@ 此模板使用了 Bib\TeX{} 来生成参考文献,默认使用的文献样式(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{} 编译。如果你想在参考文献中添加未引用的文献(部分或者全部),可以使用 - \begin{lstlisting} \nocite{EINAV2010, Havrylchyk2018} % add the two reference. \nocite{*} % add all the reference in the bib file. \end{lstlisting} -如果你想修改参考文献的样式(比如改为 \lstinline{aer}),你可以在导言区将下面代码注释掉。 -\begin{lstlisting} -\usepackage[authoryear]{gbt7714} -\end{lstlisting} - -并且文档末尾添加 - -\begin{lstlisting} -\bibliographystyle{aer} -\end{lstlisting} - \section{示例} 在这部分,我提供一个示例文档: - - \begin{lstlisting} \documentclass[lang=cn]{elegantpaper} @@ -199,15 +172,12 @@ The content of conclusion section. % include the noncited reference \nocite{ref1, ref2} -\bibliographystyle{aer} \bibliography{wpref} \end{document} \end{lstlisting} \nocite{*} -% 如果想修改参考文献样式(非国标),请把下行取消注释,并换成合适的样式(比如 unsrt,plain 样式)。 -%\bibliographystyle{aer} \bibliography{wpref} \end{document} diff --git a/elegantpaper-en.pdf b/elegantpaper-en.pdf index 66c1af4..6aee7ed 100644 Binary files a/elegantpaper-en.pdf and b/elegantpaper-en.pdf differ diff --git a/elegantpaper-en.tex b/elegantpaper-en.tex index 1909d32..8238def 100644 --- a/elegantpaper-en.tex +++ b/elegantpaper-en.tex @@ -1,6 +1,6 @@ %!TEX program = pdflatex % Full chain: pdflatex -> bibtex -> pdflatex -> pdflatex -\documentclass[11pt]{elegantpaper} +\documentclass[11pt,en]{elegantpaper} \title{ElegantPaper: An Elegant \LaTeX{} Template for Working Papers} \author{\href{https://ddswhu.me/}{Dongsheng Deng}} @@ -14,7 +14,7 @@ \maketitle \begin{abstract} -\noindent This paper illustrates the usage of the \href{https://github.com/ElegantLaTeX/ElegantPaper}{ElegantPaper} template, which is designed for writing a working paper. This template is based on the standard \LaTeX{} article class. The goal of this template is to make the writing process easier and more comfortable. You can get rid of all the worries about the format. Just enjoy it! If you have any questions, suggestions or bug reports, you can visit \href{https://github.com/ElegantLaTeX/ElegantPaper/issues}{ElegantPaper/issues}. Looking for other templates designed by Elegant\LaTeX{} Group? Please visit: \href{https://github.com/ElegantLaTeX}{https://github.com/ElegantLaTeX}.\par +This paper illustrates the usage of the \href{https://github.com/ElegantLaTeX/ElegantPaper}{ElegantPaper} template, which is designed for writing a working paper. This template is based on the standard \LaTeX{} article class. The goal of this template is to make the writing process easier and more comfortable. You can get rid of all the worries about the format. Just enjoy it! If you have any questions, suggestions or bug reports, you can visit \href{https://github.com/ElegantLaTeX/ElegantPaper/issues}{ElegantPaper/issues}. Looking for other templates designed by Elegant\LaTeX{} Group? Please visit: \href{https://github.com/ElegantLaTeX}{https://github.com/ElegantLaTeX}.\par \keywords{Elegant\LaTeX{}, Working Paper, Template} \end{abstract} @@ -30,7 +30,6 @@ The effect of math fonts is as follows: \subsection{Global Options} I defined one option named \lstinline{lang}, this option has two alternative values, \lstinline{lang=en} (default) or \lstinline{lang=cn}. \lstinline{lang=cn} will make the caption of figure/table, abstract name, refname etc. Chinese, while \lstinline{lang=en} will keep all these stuff English, as the default article class sets. You can use this option as - \begin{lstlisting} \documentclass[lang=en]{elegantpaper} \documentclass{en}{elegantpaper} % both ok @@ -67,8 +66,6 @@ You can use \lstinline{itemize}, \lstinline{enumerate}, or \lstinline{descriptio \subsection{Table} I strongly recommend you to use the \lstinline{booktabs} package in your paper. It adds three commands to make the table prettier, \lstinline{\toprule}, \lstinline{\midrule} and \lstinline{\bottomrule}. \tabref{tab:reg} is an example. - - \begin{lstlisting} \begin{table}[htbp] \small @@ -118,7 +115,6 @@ I strongly recommend you to use the \lstinline{booktabs} package in your paper. \subsection{Graphics} To include a graphic, you can use figure environment as usual. \figref{fig:scatter} shows the effect. You can put all your images in the sub directories (\lstinline{./image/}, \lstinline{./img/}, \lstinline{./figure/}, \lstinline{./fig/}) of your current working directory. - \begin{lstlisting} \begin{figure}[htbp] \centering @@ -133,24 +129,18 @@ To include a graphic, you can use figure environment as usual. \figref{fig:scatt \end{figure} \subsection{Bibliography} -This template used Bib\TeX{} to generate the bibliography, the default bibliography style is \lstinline{unsrt}. Let's take a glance at the citation effect, ~\cite{en3} used data from a major peer-to-peer lending marketplace in China to study whether female and male investors evaluate loan performance differently. +This template used Bib\TeX{} to generate the bibliography, the default bibliography style is \lstinline{aer}. Let's take a glance at the citation effect, ~\cite{en3} used data from a major peer-to-peer lending marketplace in China to study whether female and male investors evaluate loan performance differently. If you want to use Bib\TeX{}, you must create a file named \lstinline{wpref.bib}, and add bib items (from Google Scholar, Mendeley, EndNote, and etc.) to \lstinline{wpref.bib} file, and cite the bibkey in the \lstinline{tex} file. The Bib\TeX{} will automatically generate the bibliography for you for the reference you cited. If you want to add some noncited references or all of them to the bibliography, you can use - \begin{lstlisting} \nocite{EINAV2010, Havrylchyk2018} % add two noncited references \nocite{*} % list all the references of the bib file. \end{lstlisting} -If you want to change the bibliography style, you can replace \lstinline{aer} for the prefered style, for example, the \lstinline{unsrt} style. -\begin{lstlisting} -\bibliographystyle{unsrt} -\end{lstlisting} \section{A Minimal Example} In this section, we give a simple example using this template. - \begin{lstlisting} \documentclass[lang=en]{elegantpaper} @@ -178,16 +168,11 @@ The content of conclusion section. % include the noncited reference \nocite{ref1, ref2} -\bibliographystyle{aer} \bibliography{wpref} \end{document} \end{lstlisting} \nocite{en1,en2} - -% If you want change the bibliography style, replace aer with the prefered one. -\bibliographystyle{aer} - \bibliography{wpref} \end{document} diff --git a/elegantpaper.cls b/elegantpaper.cls index 7c25fa2..9efce9a 100644 --- a/elegantpaper.cls +++ b/elegantpaper.cls @@ -24,8 +24,7 @@ % \PassOptionsToClass{11pt}{article} -\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}} -\ProcessOptions\relax +\DeclareDefaultOption{\PassOptionsToClass{\CurrentOption}{article}} \ProcessKeyvalOptions*\relax \LoadClass{article} @@ -68,6 +67,8 @@ % settings for the geometry \RequirePackage{hyperref} + + \hypersetup{ pdfborder={0 0 0}, colorlinks=true, @@ -79,13 +80,16 @@ } \RequirePackage[left=1in, right=1in, top=1in, bottom=1in,headheight=0pt,headsep=0pt]{geometry} -\setlength{\voffset}{-0.75in} +% \setlength{\voffset}{-0.75in} \setlength{\headsep}{5pt} % add the \email cmd \newcommand\email[1]{\href{mailto:#1}{\nolinkurl{#1}}} \PassOptionsToPackage{no-math}{fontspec} +\ifdefstring{\ELEGANT@lang}{cn}{ \RequirePackage[UTF8, scheme=plain]{ctex} +} + \RequirePackage[T1]{fontenc} \RequirePackage{newtxtext} \RequirePackage{newtxmath} @@ -110,14 +114,15 @@ \renewcommand\refname{参考文献} % \renewcommand\figurename{图} % \renewcommand\tablename{表}% - \newcommand\versiontext{\itshape 版本:}% - \newcommand\updatetext{\itshape 更新:}% + \newcommand\versiontext{版本:}% + \newcommand\updatetext{更新:}% \renewcommand\abstractname{摘\hspace{2em}要} \setlength{\parindent}{2em} - \renewcommand{\abstracttextfont}{\small\sffamily\kaishu} + \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[authoryear]{gbt7714} }{\relax} \ifdefstring{\ELEGANT@lang}{en}{ \theoremstyle{plain}% default @@ -136,14 +141,16 @@ \renewcommand*{\proofname}{\normalfont\bfseries Proof}% \newcommand\versiontext{\itshape Version: }% \newcommand\updatetext{\itshape Update: }% - \renewcommand{\abstracttextfont}{\sffamily\small\kaishu} + \renewcommand{\abstracttextfont}{\sffamily\small\noindent\ignorespaces} \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}} + \def\IfEmpty#1{% \edef\1{\the#1} \ifx\1\empty @@ -203,12 +210,12 @@ \vskip 1.5em% \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 diff --git a/kvoptions.pdf b/kvoptions.pdf new file mode 100644 index 0000000..1313f05 Binary files /dev/null and b/kvoptions.pdf differ diff --git a/wpref.bib b/wpref.bib index fd2c119..c487039 100644 --- a/wpref.bib +++ b/wpref.bib @@ -34,6 +34,7 @@ @article{cn1, author = {方军雄}, + key = {fang1 jun1 xiong2}, title = {{所有制、制度环境与信贷资金配置}}, journal = {经济研究}, number = {12}, @@ -45,6 +46,7 @@ @article{cn2, author = {刘凤良 and 章潇萌 and 于泽}, + key = {liu2 feng4 liang2 zhang1 xiao1 meng2 yu2 ze2}, title = {{高投资、结构失衡与价格指数二元分化}}, journal = {金融研究}, number = {02}, @@ -56,6 +58,7 @@ @article{cn3, author = {吕捷 and 王高望}, + key = {lv3 jie2 wang2 gao1 wang4}, title = {{CPI 与 PPI “背离”的结构性解释}}, journal = {经济研究}, volume = {50},