diff --git a/elegantbook-cn.tex b/elegantbook-cn.tex index 2cce0b3..e017f49 100644 --- a/elegantbook-cn.tex +++ b/elegantbook-cn.tex @@ -1,12 +1,12 @@ -\documentclass[cn,11pt,chinese]{elegantbook} +\documentclass[cn,11pt]{elegantbook} \title{ElegantBook:优美的 \LaTeX{} 书籍模板} \subtitle{Elegant\LaTeX{} 经典之作} \author{Ethan Deng \& Liam Huang} \institute{Elegant\LaTeX{} Program} -\date{June 3, 2020} -\version{4.0.1} +\date{July 6, 2020} +\version{4.0.2} \bioinfo{自定义}{信息} \extrainfo{温柔正确的人总是难以生存,因为这世界既不温柔,也不正确。—— 比企谷八幡} @@ -456,7 +456,7 @@ The content of theorem. \section{参考文献} -此模板使用了 \hologo{BibTeX} 来生成参考文献,在中文示例中,使用了 \lstinline{gbt7714} 宏包。参考文献示例:\cite{en1,en2,en3} 使用了中国一个大型的 P2P 平台(人人贷)的数据来检验男性投资者和女性投资者在投资表现上是否有显著差异。 +此模板使用了 \hologo{BibTeX} 来生成参考文献,在中文示例中,使用了 \lstinline{gbt7714} 宏包。参考文献示例:\cite{cn1,en2,en3} 使用了中国一个大型的 P2P 平台(人人贷)的数据来检验男性投资者和女性投资者在投资表现上是否有显著差异。 你可以在谷歌学术,Mendeley,Endnote 中获得文献条目(bib item),然后把它们添加到 \lstinline{reference.bib} 中。在文中引用的时候,引用它们的键值(bib key)即可。注意需要在编译的过程中添加 \hologo{BibTeX} 编译。如果你想添加未引用的文献,可以使用 \begin{lstlisting}[frame=single] @@ -960,7 +960,7 @@ Lebesgue 积分有几种不同的定义方式。我们将采用逐步定义非 \end{change} \nocite{*} -\bibliography{reference} +\printbibliography \appendix \chapter{基本数学工具} diff --git a/elegantbook-en.tex b/elegantbook-en.tex index 20cb9c8..a2c91bf 100644 --- a/elegantbook-en.tex +++ b/elegantbook-en.tex @@ -1,12 +1,12 @@ -\documentclass[11pt,fancy,authoryear]{elegantbook} +\documentclass[11pt,fancy,twoside]{elegantbook} \title{An Elegant \LaTeX{} Template for Books} \subtitle{Classic Elegant\LaTeX{} Template} \author{Ethan Deng \& Liam Huang} \institute{Elegant\LaTeX{} Program} -\date{June 6, 2020} -\version{4.0.1} +\date{July 6, 2020} +\version{4.0.2} \bioinfo{Bio}{Information} \extrainfo{Victory won\rq t come to us unless we go to it. } @@ -401,7 +401,7 @@ This template uses \lstinline{tikz} to customize the list environments, with \ls \section{Bibliography} -This template uses \hologo{BibTeX} to generate the bibliography, the default bibliography style is \lstinline{aer}. Let's take a glance at the citation effect. ~\cite{en1} use data from a major peer-to-peer lending marketplace in China to study whether female and male investors evaluate loan performance differently. +This template uses \hologo{BibTeX} to generate the bibliography, the default bibliography style is \lstinline{aer}. Let's take a glance at the citation effect. ~\cite{en1} use data from a major peer-to-peer lending \cite{en3} marketplace in China to study whether female and male investors evaluate loan performance differently \parencite{en2}. If you want to use \hologo{BibTeX}, you must create a file named \lstinline{reference.bib}, add bib items (from Google Scholar, Mendeley, EndNote, and etc.) to \lstinline{reference.bib} file, then cite the bibkey in the \lstinline{tex} file. The Bib\TeX{} will automatically generate the bibliography for the reference you cited. If you want to add some noncited reference to the bibliography, you can use \begin{lstlisting}[frame=single] @@ -750,7 +750,8 @@ We revised our templates now and then. This section shows the version story of E \end{change} \nocite{en2,en3} -\bibliography{reference} +\printbibliography + \appendix \chapter{Mathematical Tools} diff --git a/elegantbook.cls b/elegantbook.cls index 69c4900..8bc9ce9 100644 --- a/elegantbook.cls +++ b/elegantbook.cls @@ -8,7 +8,7 @@ %%%%%%%%%%%%%%%%%%%%% % % !Mode:: "TeX:UTF-8" \NeedsTeXFormat{LaTeX2e} -\ProvidesClass{elegantbook}[2020/06/03 v4.0.1 ElegantBook document class] +\ProvidesClass{elegantbook}[2020/07/06 v4.0.2 ElegantBook document class] \RequirePackage{kvoptions} \RequirePackage{etoolbox} @@ -53,13 +53,6 @@ \DeclareVoidOption{normal}{\ekv{device=normal}} \DeclareVoidOption{pad}{\ekv{device=pad}} -\DeclareStringOption[numbers]{cite} -\DeclareVoidOption{numbers}{\ekv{cite=numbers}} -\DeclareVoidOption{authoryear}{\ekv{cite=authoryear}} -\DeclareVoidOption{super}{\ekv{cite=super}} - -\DeclareStringOption[apalike]{bibstyle} - \DeclareVoidOption{newtx}{\ekv{math=newtx}} \DeclareVoidOption{mtpro2}{\ekv{math=mtpro2}} \DeclareVoidOption{cm}{\ekv{math=cm}} @@ -86,6 +79,10 @@ \LoadClass[a4paper,oneside]{book} \RequirePackage{setspace} + +\RequirePackage{csquotes} + + \RequirePackage{hyperref} \hypersetup{ breaklinks, @@ -167,7 +164,9 @@ \fi \AfterEndPreamble{ % \renewcommand{\itshape}{\kaishu} - \setlength\parindent{2\ccwd}}}{\relax} + \setlength\parindent{2\ccwd}} +}{\relax} + \ifcsname kaishu\endcsname \newcommand{\citshape}{\kaishu} @@ -295,9 +294,6 @@ \newcommand{\question}[1]{{\par\citshape #1}\\[0.2ex]} -\ifdefstring{\ELEGANT@lang}{cn}{\relax}{ - \RequirePackage[\ELEGANT@cite,sort&compress]{natbib}} - \RequirePackage{enumerate} % list/itemize/enumerate setting \RequirePackage[shortlabels,inline]{enumitem} @@ -338,6 +334,18 @@ \RequirePackage{fancyvrb} \RequirePackage{makecell,lipsum,hologo} %%中文结构名字 + +\ifdefstring{\ELEGANT@lang}{cn}{ + \RequirePackage[ + backend=biber, + style=gb7714-2015, + sorting=gb7714-2015]{biblatex}}{ + \RequirePackage[ + backend=biber, + style=numeric-comp, + sorting=none]{biblatex} +} + \ifdefstring{\ELEGANT@lang}{cn}{ \renewcommand{\contentsname}{目录} \renewcommand{\figurename}{图} @@ -358,12 +366,6 @@ \newcommand{\institutename}{\citshape 组织:} \newcommand{\datename}{\citshape 时间:} \newcommand{\versionname}{\citshape 版本:} - \RequirePackage{gbt7714} - \ifdefstring{\ELEGANT@cite}{authoryear}{ - \bibliographystyle{gbt7714-author-year}}{ - \bibliographystyle{gbt7714-numerical}} - \ifdefstring{\ELEGANT@cite}{numbers}{ - \citestyle{numbers}}{\relax} \newcommand{\notename}{笔记} \renewcommand*{\proofname}{证明} \newcommand{\problemname}{例题} @@ -385,7 +387,8 @@ \newcommand{\problemsetname}{习题} \newcommand\bioinfo[2]{\gdef\@bioinfo{{\citshape #1}:#2}} \newcommand{\updatename}{更新:} - \newcommand{\historyname}{版本更新历史}}{\relax} + \newcommand{\historyname}{版本更新历史} + }{\relax} \ifdefstring{\ELEGANT@lang}{en}{ \setlength\parindent{2em} \newcommand\figref[1]{\textbf{Figure}~\ref{#1}} @@ -396,7 +399,6 @@ \newcommand{\institutename}{\textbf{Institute: }} \newcommand{\datename}{\textbf{Date: }} \newcommand{\versionname}{\textbf{Version: }} - \bibliographystyle{\ELEGANT@bibstyle} \newcommand{\notename}{Note} \newcommand{\proofname}{Proof} \newcommand{\problemname}{Problem} @@ -431,7 +433,6 @@ \newcommand{\institutename}{\textbf{Istituto: }} \newcommand{\datename}{\textbf{Data: }} \newcommand{\versionname}{\textbf{Versione: }} - \bibliographystyle{\ELEGANT@bibstyle} \newcommand{\notename}{Nota} \newcommand{\proofname}{Dimostrazione} \newcommand{\problemname}{Problema} @@ -456,8 +457,6 @@ \newcommand{\historyname}{Cronologia delle versioni} }{\relax} -\setlength{\bibsep}{0.0pt} -\def\bibfont{\footnotesize} \RequirePackage{xpatch} \xpatchcmd{\part}{ @@ -513,9 +512,7 @@ %%define the note and proof environment \RequirePackage{pifont,manfnt,bbding} - \RequirePackage[many]{tcolorbox} - % \newlength{\normalparindent} % \setlength{\normalparindent}{\parindent} \ifdefstring{\ELEGANT@mode}{fancy}{ @@ -565,7 +562,6 @@ overlay unbroken and last={ \node[anchor=south east, outer sep=0pt] at (\linewidth-width,0) { \textcolor{third}{$\spadesuit$}};}},} - % \newtcbtheorem[auto counter,number within=chapter]{definition}{\definitionname}{defstyle}{def} \DeclareTColorBox[auto counter,number within=chapter]{definition}{ o t\label g }{ common,defstyle, @@ -600,8 +596,7 @@ \DeclareTColorBox[auto counter,number within=chapter]{proposition}{ o t\label g }{ common,propstyle, IfValueTF={#1}{title={\propositionname~\thetcbcounter\ (#1)}}{title=\propositionname~\thetcbcounter}, - IfBooleanTF={#2}{label=#3}{}} -}{\relax} + IfBooleanTF={#2}{label=#3}{}}}{\relax} \ifdefstring{\ELEGANT@mode}{simple}{ @@ -886,4 +881,6 @@ \newenvironment{change}{ \begin{enumerate}[label=\small\protect\circled{\arabic*}]}{ - \end{enumerate}} \ No newline at end of file + \end{enumerate}} + +\addbibresource[location=local]{reference.bib} \ No newline at end of file