From ae7c01d696d7402d68acb024661b66d5d9aa04ec Mon Sep 17 00:00:00 2001 From: Zeping Lee Date: Sat, 16 Apr 2016 16:57:35 +0800 Subject: [PATCH] fix bachelor journal in bib --- README.md | 12 ++++------- chapters/citation.tex | 46 +++++++++++++++++++++---------------------- ustcauthoryear.bst | 12 ++++++++++- ustcnumerical.bst | 12 ++++++++++- ustcthesis.cls | 7 ++++++- ustcthesis.dtx | 9 ++++++++- 6 files changed, 63 insertions(+), 35 deletions(-) diff --git a/README.md b/README.md index f8ad29e..30ae064 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # USTC Thesis -本项目是中国科学技术大学的毕业论文 LaTeX 模板 ustcthesis v2.0。 +本项目是中国科学技术大学的毕业论文 LaTeX 模板 ustcthesis v2.1。 新模板进行了彻底的重写,相对于旧版 [ywgATustcbbs/ustcthesis](https://github.com/ywgATustcbbs/ustcthesis) @@ -8,7 +8,7 @@ * 与最新的 TeX Live 2015 和 ctex 2.x 宏包兼容 * 根据操作系统自动配置字体(Windows, Mac OS X, Ubuntu) -* 设置了符合规范的参考文献的格式 +* 设置了符合规范的参考文献的格式(支持 author-year 和 numerical 两种格式) * 修正了字号的设置错误 * 修正了本科生的页码位置 * 提供了更详细的文档 @@ -16,16 +16,13 @@ 使用前请注意: 1. **使用模板前应阅读说明文档 `ustcthesis.pdf` 的正文部分** -2. **本模板仅适用于 TeX Live 2015、MacTeX-2015 及以上版本,不对旧版本向下兼容** -3. **旧版 [TeX Live](https://www.tug.org/texlive/) 、 [MacTeX](https://www.tug.org/mactex/) 、 [MikTeX](http://www.miktex.org/) 用户请升级最新版本** +2. **本模板仅适用于最新版 [TeX Live](https://www.tug.org/texlive/) 、 [MacTeX](https://www.tug.org/mactex/) 、 [MikTeX](http://www.miktex.org/),不对旧版本向下兼容** +3. 应使用 `tlmgr` 将各个宏包升级到最新 4. **[CTeX套装](http://www.ctex.org/CTeXDownload) v2.9.2.164 发布于2012年,无法使用此模板,用户请使用旧模板** -5. **CTeX套装即将发布新版本,待测试** ## 下载地址 -目前最新的发布版版本号为v2.0.1: - * GitHub Release:https://github.com/ustctug/ustcthesis/releases * 校内镜像:https://git.ustclug.org/ustctug/ustcthesis/tags @@ -84,7 +81,6 @@ Windows用户请参照通用使用说明,暂不提供Windows下的bat脚本。 ## 已知问题 - [ ] 暂不支持英文风格 -- [ ] 参考文献格式不支持 author-year 式 ## 参考规范: diff --git a/chapters/citation.tex b/chapters/citation.tex index 6566f7f..29b318d 100644 --- a/chapters/citation.tex +++ b/chapters/citation.tex @@ -1,4 +1,4 @@ -\chapter{Citation} +\chapter{引用文献标注} \section{著者-出版年制标注法} @@ -28,28 +28,6 @@ \section{著者-出版年制标注法} \verb|\citep{knuth86a,knuth84}| & \citep{knuth86a,knuth84}\\ \end{tabular} -\section{其他形式的标注} - -\noindent -\begin{tabular}{l@{\quad$\Rightarrow$\quad}l} - \verb|\citealt{tlc2}| & \citealt{tlc2}\\ - \verb|\citealt*{tlc2}| & \citealt*{tlc2}\\ - \verb|\citealp{tlc2}| & \citealp{tlc2}\\ - \verb|\citealp*{tlc2}| & \citealp*{tlc2}\\ - \verb|\citealp{tlc2,knuth86a}| & \citealp{tlc2,knuth86a}\\ - \verb|\citealp[pg.~32]{tlc2}| & \citealp[pg.~32]{tlc2}\\ - \verb|\citenum{tlc2}| & \citenum{tlc2}\\ - \verb|\citetext{priv.\ comm.}| & \citetext{priv.\ comm.}\\ -\end{tabular} - -\noindent -\begin{tabular}{l@{\quad$\Rightarrow$\quad}l} - \verb|\citeauthor{tlc2}| & \citeauthor{tlc2}\\ - \verb|\citeauthor*{tlc2}| & \citeauthor*{tlc2}\\ - \verb|\citeyear{tlc2}| & \citeyear{tlc2}\\ - \verb|\citeyearpar{tlc2}| & \citeyearpar{tlc2}\\ -\end{tabular} - \section{顺序编码制标注法} \noindent @@ -78,3 +56,25 @@ \section{顺序编码制标注法} \verb|\citep{knuth86a,knuth84}| & \citep{knuth86a,knuth84}\\ \verb|\cite{knuth86a,knuth84,tlc2}| & \cite{knuth86a,knuth84,tlc2}\\ \end{tabular} + +\section{其他形式的标注} + +\noindent +\begin{tabular}{l@{\quad$\Rightarrow$\quad}l} + \verb|\citealt{tlc2}| & \citealt{tlc2}\\ + \verb|\citealt*{tlc2}| & \citealt*{tlc2}\\ + \verb|\citealp{tlc2}| & \citealp{tlc2}\\ + \verb|\citealp*{tlc2}| & \citealp*{tlc2}\\ + \verb|\citealp{tlc2,knuth86a}| & \citealp{tlc2,knuth86a}\\ + \verb|\citealp[pg.~32]{tlc2}| & \citealp[pg.~32]{tlc2}\\ + \verb|\citenum{tlc2}| & \citenum{tlc2}\\ + \verb|\citetext{priv.\ comm.}| & \citetext{priv.\ comm.}\\ +\end{tabular} + +\noindent +\begin{tabular}{l@{\quad$\Rightarrow$\quad}l} + \verb|\citeauthor{tlc2}| & \citeauthor{tlc2}\\ + \verb|\citeauthor*{tlc2}| & \citeauthor*{tlc2}\\ + \verb|\citeyear{tlc2}| & \citeyear{tlc2}\\ + \verb|\citeyearpar{tlc2}| & \citeyearpar{tlc2}\\ +\end{tabular} diff --git a/ustcauthoryear.bst b/ustcauthoryear.bst index ecabce7..199d3c4 100644 --- a/ustcauthoryear.bst +++ b/ustcauthoryear.bst @@ -647,6 +647,14 @@ FUNCTION {format.series.volume.title} if$ } +FUNCTION {format.journal} +{ journal + is.in.chinese + 'skip$ + { "\ustcjournal{" swap$ * "}" * } + if$ +} + FUNCTION {num.to.ordinal} { duplicate$ text.length$ 'charptr := duplicate$ charptr #1 substring$ 's := @@ -966,7 +974,7 @@ FUNCTION {article} } { "J" format.mark "" output.after new.block - journal "journal" output.check + format.journal "journal" output.check new.block format.date "year" output.check format.vol.num.pages output @@ -1820,6 +1828,8 @@ FUNCTION {begin.bib} write$ newline$ "\begin{thebibliography}{" number.label int.to.str$ * "}" * write$ newline$ + "\ifx\ustcjournal\undefined\newcommand\ustcjournal{\relax}\fi" + write$ newline$ "\providecommand{\natexlab}[1]{#1}" write$ newline$ "\providecommand{\url}[1]{\texttt{#1}}" diff --git a/ustcnumerical.bst b/ustcnumerical.bst index 63fbc19..d772f6f 100644 --- a/ustcnumerical.bst +++ b/ustcnumerical.bst @@ -646,6 +646,14 @@ FUNCTION {format.series.volume.title} if$ } +FUNCTION {format.journal} +{ journal + is.in.chinese + 'skip$ + { "\ustcjournal{" swap$ * "}" * } + if$ +} + FUNCTION {num.to.ordinal} { duplicate$ text.length$ 'charptr := duplicate$ charptr #1 substring$ 's := @@ -965,7 +973,7 @@ FUNCTION {article} } { "J" format.mark "" output.after new.block - journal "journal" output.check + format.journal "journal" output.check new.block format.date "year" output.check format.vol.num.pages output @@ -1683,6 +1691,8 @@ FUNCTION {begin.bib} write$ newline$ "\begin{thebibliography}{" number.label int.to.str$ * "}" * write$ newline$ + "\ifx\ustcjournal\undefined\newcommand\ustcjournal{\relax}\fi" + write$ newline$ "\providecommand{\natexlab}[1]{#1}" write$ newline$ "\providecommand{\url}[1]{\texttt{#1}}" diff --git a/ustcthesis.cls b/ustcthesis.cls index 485eea8..21f3112 100644 --- a/ustcthesis.cls +++ b/ustcthesis.cls @@ -20,7 +20,7 @@ %% \NeedsTeXFormat{LaTeX2e}[1999/12/01] \ProvidesClass{ustcthesis} - [2016/03/10 v2.0.1 USTC thesis template] + [2016/04/16 v2.1 USTC thesis template] \RequirePackage{kvoptions} \SetupKeyvalOptions{family=ustc@opt, prefix=ustc@opt@, setkeys=\kvsetkeys} \DeclareBoolOption[false]{doctor} @@ -414,6 +414,11 @@ \renewcommand\bibfont{\setfontsize{10.5bp}[20bp]} \setlength{\bibsep}{0bp} \setlength{\bibhang}{1em} +\ifustc@opt@bachelor + \newcommand\ustcjournal{\textit} +\else + \newcommand\ustcjournal{\relax} +\fi \renewenvironment{thebibliography}[1]{% \if@openright\cleardoublepage\else\clearpage\fi \@mainmatterfalse diff --git a/ustcthesis.dtx b/ustcthesis.dtx index c12caa8..7f68d82 100644 --- a/ustcthesis.dtx +++ b/ustcthesis.dtx @@ -54,7 +54,7 @@ LaTeX version 1999/12/01 or later. %\NeedsTeXFormat{LaTeX2e}[1999/12/01] %\ProvidesClass{ustcthesis} %<*class> - [2016/03/10 v2.0.1 USTC thesis template] + [2016/04/16 v2.1 USTC thesis template] % % %<*driver> @@ -132,6 +132,8 @@ LaTeX version 1999/12/01 or later. % Right brace \} Tilde \~} % % \changes{v2.0}{2016/02/21}{Initial release.} +% \changes{v2.0.1}{2016/03/10}{Add code and algorithm environments.} +% \changes{v2.1}{2016/04/16}{Support both author-year and numerical bib style.} % % \GetFileInfo{ustcthesis.dtx} % @@ -1170,6 +1172,11 @@ LaTeX version 1999/12/01 or later. \renewcommand\bibfont{\setfontsize{10.5bp}[20bp]} \setlength{\bibsep}{0bp} \setlength{\bibhang}{1em} +\ifustc@opt@bachelor + \newcommand\ustcjournal{\textit} +\else + \newcommand\ustcjournal{\relax} +\fi % \end{macrocode} % \begin{macro}{\bibliography} % 由于 \cs{bibliography} 位于正文中,页眉会默认显示“附录 参考文献”,所以修正页面风格;