Full Code of BYRIO/BUPTBachelorThesis for AI

master 649e5dec6e36 cached
20 files
102.9 KB
39.9k tokens
1 symbols
1 requests
Download .txt
Repository: BYRIO/BUPTBachelorThesis
Branch: master
Commit: 649e5dec6e36
Files: 20
Total size: 102.9 KB

Directory structure:
gitextract_mr4pof22/

├── .gitignore
├── BUPTthesisbachelor.sty
├── Expired.md
├── LICENSE
├── README.md
├── abstract.cfg
├── abstract.tex
├── buptbachelor.bst
├── code/
│   └── recursion.py
├── docs/
│   ├── cover.docx
│   ├── guidance.docx
│   ├── interimReport.docx
│   ├── openingReport.docx
│   ├── scoreTable.docx
│   ├── statement.docx
│   └── task.docx
├── guidebook/
│   └── README.md
├── main.cfg
├── main.tex
└── ref.bib

================================================
FILE CONTENTS
================================================

================================================
FILE: .gitignore
================================================
## Core latex/pdflatex auxiliary files:
*.aux
*.lof
*.log
*.lot
*.fls
*.out
*.toc
*.fmt
*.fot
*.cb
*.cb2
.*.lb

## Bibliography auxiliary files (bibtex/biblatex/biber):
*.bbl
*.bcf
*.blg
*-blx.aux
*-blx.bib
*.run.xml

## Build tool auxiliary files:
*.fdb_latexmk
*.synctex
*.synctex(busy)
*.synctex.gz
*.synctex.gz(busy)
*.pdfsync

## VS Code
.vscode/

## macOS
.DS_Store


================================================
FILE: BUPTthesisbachelor.sty
================================================
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                  %
%   Copyright (c) 2010 - 2011 Caspar Zhang <casparant@gmail.com>   %
%                                                                  %
%   This copyrighted material is made available to anyone wishing  %
%   to use, modify, copy, or redistribute it subject to the terms  %
%   and conditions of the GNU General Public License version 2.    %
%                                                                  %
%   This program is distributed in the hope that it will be        %
%   useful, but WITHOUT ANY WARRANTY; without even the implied     %
%   warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR        %
%   PURPOSE. See the GNU General Public License for more details.  %
%                                                                  %
%   You should have received a copy of the GNU General Public      %
%   License along with this program; if not, write to the Free     %
%   Software Foundation, Inc., 51 Franklin Street, Fifth Floor,    %
%   Boston, MA 02110-1301, USA.                                    %
%                                                                  %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%
\usepackage{ctex} % invole CJKfntef
\usepackage{xeCJKfntef}
\usepackage{setspace} % spacing
\usepackage{xcolor}   % color
\usepackage{xltxtra}  % print a XeLaTeX

% Font family
\setmainfont[Mapping=tex-text]{Times New Roman}

% Font size
\newcommand{\chuhao}{\zihao{0}}
\newcommand{\xiaochuhao}{\zihao{-0}}
\newcommand{\yihao}{\zihao{1}}
\newcommand{\xiaoyihao}{\zihao{-1}}
\newcommand{\erhao}{\zihao{2}}
\newcommand{\xiaoerhao}{\zihao{-2}}
\newcommand{\sanhao}{\zihao{3}}
\newcommand{\xiaosanhao}{\zihao{-3}}
\newcommand{\sihao}{\zihao{4}}
\newcommand{\xiaosihao}{\zihao{-4}}
\newcommand{\wuhao}{\zihao{5}}
\newcommand{\xiaowuhao}{\zihao{-5}}
\newcommand{\liuhao}{\zihao{6}}
\newcommand{\xiaoliuhao}{\zihao{-6}}
\newcommand{\qihao}{\zihao{7}}
\newcommand{\bahao}{\zihao{8}}
% Normal font size is XiaosiHao
\renewcommand{\normalsize}{\xiaosihao\songti\normalfont}

% Serveral Font pre-setting
\newcommand{\thesistitlefont}{\centering\heiti\sanhao\textbf} %论文题目的字体
\newcommand{\thesistitleenfont}{\centering\sanhao\bf}     %论文英文题目的字体
\newcommand{\covernamefont}{\heiti\yihao\bf}    % 封面上“本科论文”字样的字体
\newcommand{\coveritemsfont}{\songti\sanhao\bf} % 封面上姓名等条目的字体
\newcommand{\coverdatefont}{\songti\sanhao\bf}  % 封面上的日期的字体
\newcommand{\statetitlefirst}{\songti\xiaosanhao\bf}   %诚信声明标题第一行的字体
\newcommand{\statetitlesecond}{\songti\xiaosanhao\bf}  %诚信声明标题第二行的字体
\newcommand{\abszhname}{\heiti\xiaosanhao\textbf}         % 中文“摘要”字样的字体
\newcommand{\abszhkey}{\heiti\xiaosihao\textbf}       % 中文摘要“关键字”字样的字体
\newcommand{\abszhkeys}{\songti\xiaosihao\normalfont} % 中文摘要关键字的字体
\newcommand{\absenname}{\xiaosanhao\textbf}               % 英文``Abstract''字样的字体
\newcommand{\absenkey}{\xiaosihao\textbf}                 % 英文``KEY WORDS''字样的字体
\newcommand{\absenkeys}{\xiaosihao\normalfont}        % 英文关键字的字体
\newcommand{\headfont}{\songti\xiaowuhao\normalfont}             % 页眉字体
\newcommand{\toctitlefont}{\heiti\sanhao\textbf}            % “目录”字样的字体
\newcommand{\tocchapterfont}{\heiti\xiaosihao} % 目录上第X章的字体
\newcommand{\tocsectionfont}{\songti\xiaosihao\normalfont}         % 目录上X.Y节的字体
\newcommand{\tocsubsectionfont}{\songti\xiaosihao\normalfont}      % 目录上X.Y.Z小节的字体
\newcommand{\tocsubsubsectionfont}{\songti\xiaosihao\normalfont}      % 目录上X.Y.Z.A小节的字体
\newcommand{\textchapterfont}{\centering\heiti\sanhao\bfseries} % 正文上第X章的字体
\newcommand{\textsectionfont}{\heiti\sihao\bfseries}            % 正文上X.Y节的字体
\newcommand{\textsubsectionfont}{\heiti\xiaosihao\bfseries}     % 正文上X.Y.Z小节的字体
\newcommand{\textsubsubsectionfont}{\heiti\xiaosihao\bfseries}     % 正文上X.Y.Z.A小节的字体
\newcommand{\footnotefont}{\songti\xiaowuhao\normalfont}     % 脚注字体
%\newcommand{\ftcaptionfont}{\kaishu\wuhao\normalfont}         % 图表标题的字体
\newcommand{\ftcaptionfont}{\kaishu\wuhao}         % 图表标题的字体
\newcommand{\reftitlefont}{\heiti\sanhao\textbf}      % “参考文献”字样的字体
\newcommand{\refbodyfont}{\songti\wuhao\normalfont}          % 参考文献字体
\newcommand{\thanktitlefont}{\heiti\sanhao\textbf}    % “致谢”字样的字体
\newcommand{\appendixtitlefont}{\heiti\sanhao\textbf} % “附录”字样的字体
\newcommand{\translationtitlefont}{\heiti\sanhao\textbf} % “外文译文,外文资料”字样的字体

% Word spacing
% Usage: \ziju{spacing} spacing can be 1em, 10pt, etc.
%\newcommand{\ziju}[1]{\renewcommand{\CJKglue}{\hskip #1}}

%%%%%% Page Style %%%%%%

% Margin
% FIXME: Not very precise, but meets the need of the Word template.
% \usepackage[left=2.5cm,margin=2.5cm,headheight=1.5cm,footskip=1.5cm]{geometry}
\usepackage[paper=a4paper,left=2.5cm,right=2.5cm,top=2.5cm,bottom=2.5cm,headheight=1.5cm,headsep=0.6cm,footskip=0.5cm]{geometry}


% Header and footer
\usepackage{fancyhdr}

\fancypagestyle{mainmatter}{%
\fancyhf{} % clear all header and footer fields
\fancyhead[C]{\headfont{北京邮电大学本科毕业设计(论文)}}
\fancyfoot[C]{\footnotefont{\thepage}}
\renewcommand{\headrulewidth}{0.8pt}
}

\fancypagestyle{frontmatter}{%
\fancyhf{} % clear all header and footer fields
\fancyhead{}
\fancyfoot[C]{\footnotefont{\thepage}}
\renewcommand{\headrulewidth}{0pt}
}

% Bookmark  (Chinese bookmark supported)
\usepackage{url}
\def\UrlFont{}
\usepackage[xetex, pdfstartview=FitH, 
bookmarksnumbered=true, bookmarksopen=true, bookmarksdepth=2, colorlinks=true, 
pdfborder=001, linkcolor=black, citecolor=black, urlcolor=black]{hyperref}  % 修改bookmarksdepth指定书签层级
% Deal with line breaking in url
\makeatletter
\def\UrlAlphabet{%
    \do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j%
    \do\k\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t%
    \do\u\do\v\do\w\do\x\do\y\do\z\do\A\do\B\do\C\do\D%
    \do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M\do\N%
    \do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X%
    \do\Y\do\Z}
\def\UrlDigits{\do\1\do\2\do\3\do\4\do\5\do\6\do\7\do\8\do\9\do\0}
\g@addto@macro{\UrlBreaks}{\UrlOrds}
\g@addto@macro{\UrlBreaks}{\UrlAlphabet}
\g@addto@macro{\UrlBreaks}{\UrlDigits}
\makeatother
% Eliminate warnings about non-string commands not shown in PDF bookmarks. If you use more commands in section titles or chapter titles, you can add the commands here.
\pdfstringdefDisableCommands{
    \def \quad{}
    \def \qquad{}
}

% Line spread
\renewcommand{\baselinestretch}{1.30}
% \setlength{\itemsep}{-5pt} % item seperate too wide

% Indentation
%\usepackage{indentfirst} 
%\setlength{\parindent}{2em} % indent 2em

% Footnote
% Usage: \footnote{Your Text}
\usepackage[perpage]{footmisc}
% \usepackage{footnpag} % footnote per page
% \usepackage{footnote}
% \let\ftnt=\footnote
% \renewcommand{\footnote}[1]{\ftnt{\footnotefont{#1}}}

% No Number Footnote
% Especially for stating which project the thesis is supported
% Usage: \blfootnote{Your Text}
\usepackage{lipsum}
\newcommand\blfootnote[1]{% 
\begingroup
\renewcommand\thefootnote{}\footnote{#1}% 
\addtocounter{footnote}{-1}% 
\endgroup 
}

%%%%%% Detail style %%%%%%
% Underline
% Usage: \ul[length]{<text>}
\makeatletter
\newcommand\ul[2][4cm]{\hskip1pt\underline{\hb@xt@ #1{\hss#2\hss}}\hskip3pt}
\makeatother
\def\ULthickness{1.1pt}%

% Content style
\setcounter{secnumdepth}{3} % let subsubsection have number
\setcounter{tocdepth}{3} % let subsubsection appear in CONTENTS
\usepackage{titletoc}
\newif{\ifpagenumber}
\pagenumbertrue
\renewcommand\contentsname{\centerline{\toctitlefont{目\qquad{}录}}}
\titlecontents{chapter}[0em]{\tocchapterfont\vspace{0.4mm}} {%
    \ifpagenumber \CTEXnumber{\CJKsection}{\thecontentslabel}{第\CJKsection{章}\quad{}} \fi}{%
    } {%
    \ifpagenumber \hspace{.5em}\titlerule*[6pt]{$\cdot$}\contentspage\fi}
\titlecontents{section}[1em]{\tocsectionfont\vspace{0.4mm}}{%
    \thecontentslabel\quad{}}{}{%
    \ifpagenumber \hspace{.5em}\titlerule*[6pt]{$\cdot$}\contentspage\fi}%
\titlecontents{subsection}[2em]{\tocsubsectionfont\vspace{0.4mm}}{%
    \thecontentslabel\quad{}}{}{%
    \ifpagenumber \hspace{.5em}\titlerule*[6pt]{$\cdot$}\contentspage\fi}%
\titlecontents{subsubsection}[3em]{\tocsubsubsectionfont\vspace{0.4mm}}{%
    \thecontentslabel\quad{}}{}{%
    \ifpagenumber \hspace{.5em}\titlerule*[6pt]{$\cdot$}\contentspage\fi}%
\makeatletter % Content Page style
\renewcommand\frontmatter{%
    \if@openright\cleardoublepage\else\clearpage\fi%
    \@mainmatterfalse%
    \pagenumbering{Roman}% Roman style page number
    \pagestyle{frontmatter}
    }
\makeatother%

\makeatletter % Content Page style
\renewcommand\mainmatter{%
    \if@openright\cleardoublepage\else\clearpage\fi%
    \@mainmattertrue%
    \pagenumbering{arabic}% Arabic style page number
    \pagestyle{mainmatter}
    }
\makeatother%

\makeatletter % Translation Page style
\renewcommand\backmatter{%
    \if@openright\cleardoublepage\else\clearpage\fi%
    \@mainmatterfalse%
    \pagestyle{empty}
}
\makeatother%

% Text style
\usepackage{titlesec}
\titleformat{\chapter}[hang]{\textchapterfont}{第\chinese{chapter}章}{1em}{}
\titlespacing{\chapter}{0pt}{-20pt}{12pt} % 缩短章节标题的上边距
\titleformat{\section}{\textsectionfont}{\thesection}{1em}{}
\titleformat{\subsection}{\textsubsectionfont}{\qquad{}\thesubsection}{1em}{}
\titleformat{\subsubsection}{\textsubsubsectionfont}{\qquad{}\thesubsubsection}{1em}{}

% Reference style
% \usepackage[numbers,sort&compress]{natbib}
\usepackage[super,numbers,sort&compress]{natbib}
%\usepackage[backend=biber,texencoding=utf8,bibencoding=utf8]{biblatex}
\renewcommand\bibname{\centerline{\reftitlefont{参考文献}}}
%\renewcommand{\citet}[1]{\textsuperscript{\cite{#1}}}
\setcitestyle{square}
\setlength{\bibsep}{0.2em}

% Appendix
% TODO: this needs imporvement
\usepackage{appendix}

%% Some tweaking/features/styles

% Figure & Table
\usepackage{caption}
\usepackage[position=t,singlelinecheck=off]{subfig}

% \renewcommand\thesubfigure{\Alph{subfigure}}

\renewcommand{\captionfont}{\ftcaptionfont}
\renewcommand{\captionlabelfont}{\ftcaptionfont}
\DeclareCaptionLabelSeparator{twospace}{ ~}
\captionsetup{labelsep=twospace}  %去掉图1:后冒号
\renewcommand{\tablename}{表}
\renewcommand{\thetable}{~\arabic{chapter}-\arabic{table}~}
\renewcommand{\figurename}{图}
\renewcommand{\thefigure}{~\arabic{chapter}-\arabic{figure}~}
\renewcommand{\theequation}{\arabic{chapter}-\arabic{equation}~}
% 外文文献中表、图、公式、代码编号重置
\newcommand{\newtranschapter}{\thispagestyle{empty}\addtocounter{chapter}{1}\setcounter{table}{0}\setcounter{equation}{0}\setcounter{figure}{0}\setcounter{lstlisting}{0}}

% single figure tweaking
% New figure environment
% Usage: \buptfigure[scale]{figure path}{caption}{label}
\usepackage{graphicx} % graphic package
\newcommand{\buptfigure}[4][width=11cm]{%
\begin{figure}[!htbp]%
    \centering % If you'd like to use center environment here, be advised that it will add extra white space at its top and bottom. So \centering is a better default option.
%    \begin{center}
        \includegraphics[#1]{#2}%
%    \end{center}
    \caption{#3}%
    \label{#4}
\end{figure}}

% table tweaking
% New table environment
% Usage: \begin{bupttable}{caption}{label} 
%            <normal table>
%        \end{bupttable}
\usepackage{array,booktabs,multirow} % multirow, multicolumn and more professional format support
\usepackage{tabularx} % deal with text wrapping in tables
\newenvironment{bupttable}[2]{%
\begin{table}[!htbp]%
    \centering%
    \renewcommand{\arraystretch}{1.38}%
    \setlength{\abovecaptionskip}{0pt}%
    \setlength{\belowcaptionskip}{10pt}%
    \caption{#1}%
    \label{#2}}{%
\end{table}}%

% longtable tweaking
% New longtable environment
% Usage: \begin{buptlongtable}{alignment}{caption}{label}
%            <normal longtable>
%        \end{buptlongtable}
\usepackage{longtable}
\newenvironment{buptlongtable}[3]{
    \renewcommand{\arraystretch}{1.38}%
    \setlength{\abovecaptionskip}{0pt}%
    \setlength{\belowcaptionskip}{10pt}%
    \begin{longtable}{#1}
        \caption{#2}
        \label{#3} \\
    }{
\end{longtable}}

% equation tweaking
\usepackage{amssymb}
\usepackage{bm} % 加粗使用
\usepackage{amsmath,delarray,bm,mathtools}
\newtagform{newtag}[]{式(}{)} %定义公式编号样式
\usetagform{newtag}


% Theorem & definition


% \usepackage{amsthm}
\newtheorem{definition}{定义}[chapter]
\newtheorem{theorem}{定理}[chapter]
\newtheorem{axiom}{公理}[chapter]
\newtheorem{lemma}{引理}[chapter]
\newtheorem{proposition}{命题}[chapter] 
\newtheorem{corollary}{推论}[chapter]

% Algorithm
\usepackage{algorithm}  
\usepackage{algorithmicx}  
\usepackage{algpseudocode}

% Code 
\usepackage{listings}
\usepackage{xcolor}
\lstset{
    basicstyle=\ttfamily\wuhao, %五号等宽字体
    extendedchars=true,
    keywordstyle=\color{blue},
    commentstyle=\color{green!30!black}, 
    showspaces=false,          % 显示空格
    showstringspaces=true,    % 字符串中显示空格
    showtabs=false,            % 显示 TAB
    tabsize=2,                 % TAB 被当作两个空格
    captionpos=t,              % 标题位置
    breaklines=true,           % 自动断行
    breakatwhitespace=true,   
    basewidth={0.5em,0.35em},
    frame=single,              %单线边框,注释掉则无边框
    numbers=left,               %行号位于左侧
    numberbychapter=true,
%    xleftmargin=.5em,
%    xrightmargin=.5em,
%    aboveskip=1ex,
%    columns=flexible,        % 如果不指定等宽字体用这个
%    mathescape,
    escapeinside={\%*}{*)}
}

\renewcommand{\lstlistingname}{\kaishu{代码}}
\makeatletter
\AtBeginDocument{%
  \renewcommand \thelstlisting
       {\ifnum \c@chapter>\z@ \thechapter-\fi \@arabic\c@lstlisting}%
}
\makeatother


% insert PDF
\usepackage[final]{pdfpages}

% insert blank page
\makeatletter
\newcommand\blankmatter{%
    \if@openright\cleardoublepage\else\clearpage\fi%
    \@mainmatterfalse%
    \pagestyle{empty}}%
\makeatother%

% No page number environment for appendix
% \newenvironment{nopagenumber}{%
%     \titleformat{\chapter}[hang]{\textchapterfont}{}{1em}{} %
%     \setcounter{secnumdepth}{0}%
%     \addtocontents{toc}{%
% 	\protect\setcounter{tocdepth}{0}%
% 	\protect\pagenumberfalse%
% 	\ignorespaces}}{%
%     \setcounter{secnumdepth}{3}%
%     \addtocontents{toc}{%
%     \protect\setcounter{tocdepth}{3}%
% 	\protect\pagenumbertrue%
%     \ignorespaces}}
% List environment config
\usepackage[inline]{enumitem}
% Uncomment the two lines below if you want an list environment to share the same indent with a paragraph and no extra blank before, in or after the list.
%\setlist[itemize]{labelindent=\parindent,leftmargin=*,noitemsep,topsep=0pt}
%\setlist[enumerate]{labelindent=\parindent,leftmargin=*,noitemsep,topsep=0pt,label={\arabic*)}} % Modify the label format by yourself if you do not like 1), 2), ... here.


================================================
FILE: Expired.md
================================================
## 问卷调查
如果你使用了本模板完成北京邮电大学本科毕业设计,**请填写以下问卷**,以帮助开源者获得更有效的反馈,谢谢。
https://wj.qq.com/s/2116666/6661

## BTW
欢迎大家去顶在北邮人论坛推广本项目的帖子,让更多人了解本项目:https://bbs.byr.cn/#!article/Paper/30043

欢迎提出issue,**关于模板的问题请使用Issue功能提出,其它途径无法得到答复保证**,当然,更欢迎自行解决后提pull request。

欢迎广而告之,欢迎在word调格式被折磨时投奔初期有一点学习(模仿)成本的LaTeX模板

我不能保证一切都能过教务部门的关(虽然使用了Word的其它人也不能保证),不过我会在2018年使用这个模板提交论文,并在发现问题后及时更新

如果你愿意,不妨在致谢部分留下**本论文使用基于LaTeX的本科生毕业设计模板书写**,如果你愿意附上本GitHub的链接,那是再好不过了

希望能有北邮的开源组织来维护和模块化本科生毕设LaTeX模板

(当然更希望北邮的教务部门**锐意进取、大胆创新、敢为人先**地提供**官方**的毕设LaTeX模板)

================================================
FILE: LICENSE
================================================
MIT License

Copyright (c) 2018 sqyx008

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


================================================
FILE: README.md
================================================
# 北京邮电大学本科学士学位论文模板(本科毕业设计模板)
* 作者: Caspar Zhang    <casparant@gmail.com>
* 修改: Bing Hsu        <hello@antinucleon.com>
* 修改: Guohua Wu       <ghmeta@163.com>
* 修改: 盛强     <sqyx008@outlook.com>(信息与通信工程学院通信工程2014级)
* 修改: Haixin Yu <name1e5s@qq.com>(计算机学院2017级)
* 修改: Luzhan Yuan yuanluzhan@gmail.com (人工智能学院2021级)


## 发布记录

初始上线日期: 2018/4/24  
最新发行版日期: 2025/4/18

### 欢迎在讨论区进行讨论

> https://github.com/BYRIO/BUPTBachelorThesis/discussions

## 系统需求

### Windows

建议直接安装TeX Live(其中已包含需要的XeLaTeX和BibTeX),同时安装TeXworks(安装过程中有勾选框,选中即可)。你也可以使用“ `TeX Live` + 自己喜爱的编辑器 + 扩展 ”的方式,如使用**TeX Live + Visual Studio Code + LaTeX workshop**或**TeX Live + Atom + language-latex + latex + pdf-view**。  
传送门: [官方镜像](https://www.tug.org/texlive/)  [清华镜像](https://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/) [BYRBT](https://bt.byr.cn)   

### Mac OS 

建议直接安装MacTeX,编辑器可以使用MacTeX自带的TeXshop,也可以使用TeXpad等其它选择  
传送门: [官方镜像](http://www.tug.org/mactex/) [清华镜像](https://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/mac/mactex/) [BYRBT](https://bt.byr.cn)      
(感谢 [Li Jiarong](https://github.com/MrAdonis) 提供)  

### Linux

开源人员尚未在Linux系统上进行过测试,欢迎尝试并顺利使用本模板的用户在Issue中提交自己的方案,或进行 Pull Request

### Web Service

您可以使用Overleaf进行编辑
- [官方地址](https://cn.overleaf.com)
- [BYRIO校内服务](https://overleaf.byrio.work) (如果在校外无法访问可以使用webvpn)

## 如何使用

[使用手册](https://github.com/BYRIO/BUPTBachelorThesis/tree/master/guidebook)

### 编辑以下文件

- main.cfg:   
    包含了论文中需要填写的项目,比如论文名称等。论文的致谢部分也放在了这里
- abstract.cfg:   
    包含了论文的中英文摘要
- main.tex:   
    论文的主体、附录、外文译文,目前填充的是示例,对照生成的PDF熟悉代码
- bib.ref:   
    论文的参考文献库

### 用素材填充以下文件夹

- pictures:  
    将图片放入该文件夹
- docs:   
    将封面(cover)、诚信声明(statement)、外文文献原文(translation)、任务书(task)、成绩评定表(scoreTable)、开题报告(openingReport)和中期检查表(interimReport)的PDF放入该文件夹。  
    为了保持清晰度,请在从Word输出PDF时尽可能选择**高质量**的设置(修正官方缺陷的封面及其他材料的word版已放入该文件夹,编辑并保存为PDF即可)

教务处官方相关模板请访问 [官方网站](https://jwc.bupt.edu.cn/info/1220/2479.htm) 
在 TeXworks/Overleaf 中编译main.tex即可,main.pdf即最终输出。

**注意: 如果你在使用中遇到问题,请查看下方FAQ或到Issue板块寻找是否有其它使用者给出的解决方案。**


## 编译

### 本地 Tex Live 环境

先用XeLaTeX编译  
再用BibTeX编译 bib文件  
再用XeLaTeX编译 生成最终结果  

### Overleaf环境

使用XeLatex编译

## FAQ

- **Q: LaTeX怎么这么麻烦?**

    A: 使用LaTeX排版学术材料是极受欢迎的,优秀的国际会议和权威的学术杂志鲜见不接受LaTeX投稿的,相反,它们会主动提供符合自家排版要求的LaTeX模板,学者不需要再根据其要求大费周折。当然,它对新手不如word友好,因为其不具有“所见即所得”的特性。但是,“信息黄埔”的你们,应该对“看代码→写代码→编译→看结果”这一套十分熟悉,熟练后他会让你不再陷于反反复复调整格式的泥淖。

- **Q: 用Word排版有那么不堪么?**

    A: 微软的Word是一个优秀的文字处理软件,用它来书写毕业论文没有问题。然而,我们很多同学对它的使用非常肤浅,你甚至还时常能见到“用敲空格的方式把一个标题居中”的人。如果你不太懂自动生成目录,不太懂项目编号,不太懂文档内链接,不太懂上下标,不太懂Word的公式编辑器,不太会调整段落与缩进,不太会处理表格的边框长度和宽度,不太会设置页眉页脚,不太会分节分页,不太会对不同节设置不同页码格式,不太会用合适的方式排列图文……可以说,**你对Word排版的学习成本也是很高的**,既然可以,不妨尝试一种新的排版方式,在撰写学术论文、求职简历和研究生毕业论文时,这项技能还用得上。

- **Q: 为什么我在TeXworks中编译,到“Require XeLaTeX”处就不动了?**

    A:正如编译提示所言,它需要XeLaTeX。请注意编辑器左上角是否选择“XeLaTeX”,默认状态下是pdfLaTeX。

- **Q: LaTeX语句书写有误,导致编译卡在一半怎么办?**

    A:TeXworks中,本次编译可以通过在下方输入框敲击Enter以忽略错误完成,但有时错误无法忽略会导致本次输出PDF不成功。修正好错误后,到“文件”中选择“删除辅助文件”,然后再重新编译即可。
    
- **Q: 我已经开始写毕设论文了,但该项目的一些样式文件做了更新,怎么办?**

    A:从上面的资料你已经知道需要编辑的文件有哪些,给它们备个份,然后```git pull ```一下,再把备份文件换回;或者直接全盘在另一文件夹编辑你的文档,把更新的配置文件复制过去覆盖即可。
    
- **Q: 有一些我需要的排版方式这里没有怎么办?**
  
    A:模板基于LaTeX,你可以随意加入你需要的package,调用你需要的命令。如果你发现你的改动有一定通用性,欢迎修改相应的配置文件提交Pull Request给我;如果你的能力有限,也可以提Issue详述你的改动。合理的Pull Request会被及时merge进master分支,你将在**Contributors**中看到自己,开源项目需要大家共同努力维护。

- **Q: 引用文献的BibTeX文件可以从哪里获取?**

    A:几乎任何学术文献库都会提供BibTeX格式的引用数据,你可以使用**JabRef**来管理和自动生成你引用文献的BibTeX。但在引用量不大的情况下,直接去学术搜索引擎和数据库(Google Scholar/IEEEXplore/ACM digital library/Springer Link/必应学术/百度学术)或学术组织官网(CVF)去复制也不麻烦。

- **Q: 什么样的图片可以插入?**

    A:主流格式如`.png` `.jpg`都支持,但如果你将图片保存为`.pdf`格式,会取得更快的编译速度。
    
- **Q: 我编译后发现部分引用是问号,怎么办?**

    A:如果是参考文献,确保你已经编译了最新的 `.bib` 文件;如果不是,再用XeLaTeX编译一遍。一种粗放的比喻是,**在这里的“编译”就如同Windows的“重启”一样**,虽然暴力但有用。
    

## 更新日志
- 2018/04
  - **[24日]** 加入外文译文和原文板块 
  - 将附录合并于主文件
  - 将封面、诚信声明改为PDF导入
  - 修正了参考文献中“et al”和“等”的样式问题
  - 修正正文行间距为1.2倍
  - **[28日]** 修正“定义”类型的编号方法(修正后同图表编号形式)
  - **[29日]** 新增并调校“代码”框格式,附示例(指导手册无要求,根据实际需求编入)
  - 为便于阅读学习,重编示例文本
  - 全面按照指导手册要求顺序,插入任务书、成绩评定表、开题报告、中期检查表的PDF
  - 修正原示例中使用\ref引用公式的错误,已改为\eqref
  - 修正英文学位论文引用形式的BUG
- 2018/05
  - **[2日]** 示例文本中新增“列表”示例
  - 迁移示例文本中大部分\usepackages至.sty文件中
  - **[8日]** 将任务书文档(task.*)更新至新版本
  - 启用AutoFakeBold以应对Windows自带黑体无style=Bold的情况(感谢[RicardoMing](https://github.com/RicardoMing) )
  - **[9日]** 修正引用中“@article”类型的格式问题
  - **[13日]** 对照Word版本设置正文行间距(Word版的1.2倍)和目录行间距(20磅)至目测一致
  - 新增定理、引理、公理、推论、推论环境及定义,并增添示例
  - **[16日]** 新增带编号的subsubsection,样式同subsection,并增添示例
  - 新增组图示例,调整子图标号至左上角,子图的所有题注统一于组图题注中
  - **[17日]** 参考文献中电子文献URL的字体调整为Times New Roman,颜色调整为黑色
  - **[21日]** 新增无编号脚注与“科研项目来源”示例
  - 修正附录图、表和公式编号样式为“附-X”,并添加示例
  - 取消参考文献中英文作者姓名的首字母缩写设置
  - **[26日]** 修正页边距和页眉页脚设置至同word版本;更正页码字号
  - **[27日]** 调整摘要页间距;当摘要页超过一页时确保无页码出现
  - **[31日]** 新增外文翻译部分章节编号示例
- 2018/06
  - **[3日]** 修正参考文献中@inproceedings的标点与中英文切换问题
  - **[4日]** 新增区分奇偶页与否的配置选择
  - 修正外文译文的页面样式问题
  - 重整外文译文的图、表、公式编号
  - **[6日]** 代码编号统一为图标编号样式,添加附录代码编号设置;增添代码文件引入示例
  - **[7日]** 增加句内列表支持与示例;增加表格示例;支持URL换行 (感谢[CptGit](https://github.com/CptGit) )
  - **[21日]** 缩短参考文献各条目之间的距离至合适;缩小目录页码至合适;修正外文译文和译文标题的粗细
  - **[23日]** 调整外文译文和原文的顺序;摘要页关键词改为顶格书写;优化正文算法间距;优化部分示例;修复页眉页脚问题
- 2019/6
  - **[11日]** 调整一级标题的上下边距使其接近word样式;修复目录页码大小控制失效问题;使目录引导点更加紧凑,接近word样式
- 2021/4
  - **[30日]** 调整一级标题的上下边距使其接近最新版模版的样式;删除目录“参考文献”以后的章节项目的页码,符合教务处要求
- 2023/5
  - **[18日]** 调整"外文资料”与“外文译文”字体使其符合最新模板要求;在目录页上添加页眉;更新main.pdf
- 2025/4
  - **[18日]** 为目录中的"参考文献"、"致谢"等添加页码以符合最新模版要求;删除目录页眉;更新main.pdf;更新页眉括号为中文括号以适应最新指导手册要求
 

## 后记

欢迎大家在毕业季向自己的同学安利这个项目,比如在论坛水贴或者朋友圈发一发都是非常不错的x  

从本项目的页面可以看到是从 https://github.com/sqyx008/BUPTBachelorThesis Fork过来的,这个项目的维护者也在前文可以看到。在之前的README中有提到希望某个开源组织来维护,~~现在BYRIO就接过了这个坑。~~ 还是希望同学们可以积极的提交PR或者反馈issue!  

以及,BYRIO现在提供了一个校内的[Overleaf服务](https://overleaf.byrio.work)。虽然不如官方能和Github同步,但他胜在网络稳定以及(暂时性的)资源充沛。

总之  
> 当然更希望北邮的教务部门**锐意进取、大胆创新、敢为人先**地提供**官方**的毕设LaTeX模板

> 由于时间和维护人员的关系,原始Repo中的[部分内容](./Expired.md)**很可能已脱离时效期** ,因此这里将其转移到其他Markdown文件中以供查看。


================================================
FILE: abstract.cfg
================================================
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                  %
%   Copyright (c) 2010 - 2011 Caspar Zhang <casparant@gmail.com>   %
%                                                                  %
%   This copyrighted material is made available to anyone wishing  %
%   to use, modify, copy, or redistribute it subject to the terms  %
%   and conditions of the GNU General Public License version 2.    %
%                                                                  %
%   This program is distributed in the hope that it will be        %
%   useful, but WITHOUT ANY WARRANTY; without even the implied     %
%   warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR        %
%   PURPOSE. See the GNU General Public License for more details.  %
%                                                                  %
%   You should have received a copy of the GNU General Public      %
%   License along with this program; if not, write to the Free     %
%   Software Foundation, Inc., 51 Franklin Street, Fifth Floor,    %
%   Boston, MA 02110-1301, USA.                                    %
%                                                                  %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% 你只需要修改下面内容就可以完成中英文摘要,
% 这要求你具有一定的LaTeX基础,但是还是那句话,
% 如果你足够聪明,不具有LaTeX基础也可以完成。

% 中文摘要
\def\abstractzh{
%从这里开始写你的摘要,分段需要空一行。
这是中文摘要的部分。

它可以拥有多段。
这是中文摘要的部分。

它可以拥有多段。

如果你写的太长,甚至可以到第二页。
%摘要结束
}

% 中文关键字 
% TODO: 改成可变长度的
\def\abszhkeyone{北京邮电大学}
\def\abszhkeytwo{本科生}
\def\abszhkeythree{毕业设计}
\def\abszhkeyfour{模板}
\def\abszhkeyfive{示例}

% ABSTRACT
\def\abstracten{
%Your abstract here, to make a new paragraph, give an extra blank line please.
This is ABSTRACT.

You can write more than one paragraph here.

If your abstract is too long, it will take up more pages. 
%Abstract done
}

% Key Words 
% TODO: 改成可变长度的
\def\absenkeyone{BUPT}
\def\absenkeytwo{undergraduate}
\def\absenkeythree{thesis}
\def\absenkeyfour{template}
\def\absenkeyfive{example}




================================================
FILE: abstract.tex
================================================
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                  %
%   Modified by Bing Hsu <hello@antinucleon.com> 2013              %
%   Forked From (c) 2010 - 2011 Caspar Zhang <casparant@gmail.com> %
%                                                                  %
%   This copyrighted material is made available to anyone wishing  %
%   to use, modify, copy, or redistribute it subject to the terms  %
%   and conditions of the GNU General Public License version 2.    %
%                                                                  %
%   This program is distributed in the hope that it will be        %
%   useful, but WITHOUT ANY WARRANTY; without even the implied     %
%   warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR        %
%   PURPOSE. See the GNU General Public License for more details.  %
%                                                                  %
%   You should have received a copy of the GNU General Public      %
%   License along with this program; if not, write to the Free     %
%   Software Foundation, Inc., 51 Franklin Street, Fifth Floor,    %
%   Boston, MA 02110-1301, USA.                                    %
%                                                                  %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\input{abstract.cfg}

% 中文摘要
\begin{titlepage}

    \pagestyle{empty}

    \begin{spacing}{1.05}
        \centering
        % 如果你的标题太长,可能会换行;如果你对换行位置不满意,请调节下面第一个{}的参数
        \parbox[c]{.75\textwidth}{\thesistitlefont{\thesistitle}}
    \end{spacing}

    \begin{spacing}{1.5}
        \centering
        \sanhao\quad{} \\ 
        \abszhname{摘\quad{}要} \\ 
    \end{spacing}
    \xiaosanhao\quad{}

    \normalsize

    \abstractzh
    

    \quad{}

    \par\noindent\abszhkey{关键词}\quad{}%
    \abszhkeys{\abszhkeyone\quad{}%
                      \abszhkeytwo\quad{}%
                      \abszhkeythree\quad{}%
                      \abszhkeyfour\quad{}%
                      \abszhkeyfive}%
\end{titlepage}

\thispagestyle{empty}

% Abstract
\begin{titlepage}

    \pagestyle{empty}

    \begin{spacing}{1.05}
        \centering
        % 如果你的标题太长,可能会换行;如果你对换行位置不满意,请调节下面第一个{}的参数
        \parbox[c]{.75\textwidth}{\thesistitleenfont{\thesistitleen}}
    \end{spacing}

    \begin{spacing}{1.5}
        \centering
        \sanhao\quad{} \\ 
        \abszhname{ABSTRACT} \\ 
    \end{spacing}
    \xiaosanhao\quad{}
    \normalsize

    \abstracten
    
    \quad{}

    \par\noindent\absenkey{KEY WORDS}\quad{}%
    \absenkeys{\absenkeyone\quad{}%
                      \absenkeytwo\quad{}%
                      \absenkeythree\quad{}%
                      \absenkeyfour\quad{}%
                      \absenkeyfive}%
\end{titlepage}

\thispagestyle{empty}

================================================
FILE: buptbachelor.bst
================================================
%% BUPTThesis.bst
%%
%% 北京邮电大学研究生学位论文参考文献 BibTeX 样式
%% 
%% 项目主页:http://code.google.com/p/buptthesis/
%% 
%% 本样式基于 IEEEtran 和 ThuThesis 修改而成,基本满足北京邮电大学研究生论文格式要求
%%
%% 作者:
%% 张煜 (email:dazzlezhang@gmail.com)
%%
%% 更新记录:
%% $LastChangedBy$
%% $LastChangedDate$
%% $LastChangedRevision$

%% 一些设置的缺省值
% 英文姓名排版格式字符串, 按<last name全称>~<first name首字母><, Jr.>格式
FUNCTION {default.name.format.string} {"{vv~}{ll}{~ff}{, Jj}"}

% 列出的最多作者数目, 即当作者数目超过下列数字时, 超出部分的作者姓名将略去
FUNCTION {default.max.num.names.before.forced.et.al} { #3 }

% 是否为盲审版本, #0 表示盲审将隐去作者信息, #1 表示非盲审
FUNCTION {default.is.for.peer.review} { #0 }
%%%%%%%%%%%%%%
% 一些辅助函数
%%%%%%%%%%%%%%
% #0 不在终端显示开始/完成的提示信息
% #1 显示提示信息
FUNCTION {is.print.banners.to.terminal} {#1}

%%%%%%%%%%%%%%%%
% 版本与提示信息
%%%%%%%%%%%%%%%%
% 版本信息
FUNCTION{bst.file.version} { "0.2" }
FUNCTION{bst.file.date} { "2009/01/25" }
FUNCTION{bst.file.website} { 
  "http://code.google.com/p/buptthesis/" }

% 开始提示信息
FUNCTION {banner.message}{ 
  is.print.banners.to.terminal
    { "-- BUPTThesis.bst version" " " * bst.file.version *
      " (" * bst.file.date * ") " * "by Yu Zhang." *
       top$
       "-- " bst.file.website *
       top$
       "-- See the " quote$ * "userguide.pdf" * quote$ * 
       " manual for usage information." *
       top$
    }
    { skip$ }
  if$
}

% 完成提示信息
FUNCTION {completed.message} { 
  is.print.banners.to.terminal
    { "" top$ "Done." top$ }
    { skip$ }
  if$
}

%%%%%%%%%%%%%%%%%%%
%% 预定义的字符串宏
%%%%%%%%%%%%%%%%%%%
% 英文月份
MACRO {jan} {"January"}
MACRO {feb} {"February"}
MACRO {mar} {"March"}
MACRO {apr} {"April"}
MACRO {may} {"May"}
MACRO {jun} {"June"}
MACRO {jul} {"July"}
MACRO {aug} {"August"}
MACRO {sep} {"September"}
MACRO {oct} {"October"}
MACRO {nov} {"November"}
MACRO {dec} {"December"}

%%%%%%%%%%%%
%% 条目定义
%%%%%%%%%%%%
ENTRY { address			% 地址
	assignee		% 标准授权人
	author			% 作者
	booktitle		% 专著/论文集名
	chapter			% 
	day			%
	dayfiled		%
	edition			% 版本
	editor			% 编者
	howpublished		% 出版形式
	esubtype		% 电子文献子类
	institution		% 
	journal			% 期刊
	key			%
	language		% 语言
	month			% 月
	monthfiled		%
	nationality		%
	newsletter		%
	note			%
	number			%
	number2			%
	organization		%
	pages			%
	publisher		%
	refdate			%
	update			% 电子文档更新或修改日期
	school			%
	series			%
	title			%
	translator		%
	type			%
	volume			%
	volume2			%
	year			%
	year2			%
	yearfiled		%
	url			% URL
	pubaddress		% 出版地
	CTLname_format_string	% 作者英文姓名排版格式
	CTLmax_names_forced_etal % 强制略去的最大作者数
	CTLauthor_name_english	 % 作者英文姓名
	CTLauthor_name_chinese	 % 作者中文姓名
	CTLfor_peer_review	 % 是否匿名
  }
  {}
  { label }

%%%%%%%%%%%%%
%% 字符串常量
%%%%%%%%%%%%%
% FUNCTION {bbl.anonymous}   { language empty$ { "Anon" }  { "佚名" } if$ }
FUNCTION {bbl.anonymous} { "" }
FUNCTION {bbl.etal}        { language empty$ { "~et~al" } { "~等" } if$ }
FUNCTION {bbl.sine.loco}   { language empty$ { "S.~l." } { "出版地不详" } if$ }
FUNCTION {bbl.sine.nomine} { language empty$ { "s.~n." } { "出版者不详" } if$ }

FUNCTION {bbl.comma}       { language empty$ { ", " } { "," } if$ }
FUNCTION {bbl.colon}       { language empty$ { ": " } { ":" } if$ }
FUNCTION {bbl.period}      { language empty$ { "." } { "." } if$ }
FUNCTION {bbl.parallel}    { "~//~" }

FUNCTION {bbl.st}          { "st" }	% 序数词后缀
FUNCTION {bbl.nd}          { "nd" }	% 序数词后缀
FUNCTION {bbl.rd}          { "rd" }	% 序数词后缀
FUNCTION {bbl.th}          { "th" }	% 序数词后缀

FUNCTION {bbl.number}      { "第" }
FUNCTION {bbl.author}      { "作者" }

%%%%%%%%%%%%
%% 整型变量
%%%%%%%%%%%
INTEGERS { output.state before.all mid.sentence after.title after.sentence url.sentence after.block before.pages }
INTEGERS { number.label longest.label.width multiresult 
	   nameptr namesleft numnames lastnamecapitalized namelength charptr }
INTEGERS { max.num.names.before.forced.et.al }
INTEGERS { is.for.peer.review }

%%%%%%%%%%%%%
%% 字符串变量
%%%%%%%%%%%%%
STRINGS { s 
	  t 
	  longest.label 
	  thename 
	  name.emph.author.en	% 强调现实的作者英文姓名
	  name.emph.author.zh	% 强调显示的作者中文姓名
	  name.format.string	% 姓名的格式字符串
	  author.name.in.english % 作者英文姓名
	  author.name.in.chinese % 作者中文姓名
}

%%%%%%%%%%%%%%%%%%%%%
%% LaTeX 参考文献代码
%%%%%%%%%%%%%%%%%%%%%

% 输出 .bbl 文件开始
FUNCTION {begin.bib} { 
  "% Generated by BUPTThesis.bst, version: " bst.file.version * 
  " (" * bst.file.date * ")" *
  write$ newline$		% 输出注释行,说明产生该bbl的bst及版本

  preamble$ empty$		% 输出前导
    'skip$
    { preamble$ write$ newline$ }
  if$

  "\begin{thebibliography}{"  longest.label  * "}" * 
  write$ newline$		% 输出 \begin{thebiliography}{x}
}

% 输出 .bbl 文件结束部分
FUNCTION {end.bib} {
  newline$
  "\end{thebibliography}" 
  write$ newline$
}

%%%%%%%%%%%%
%% 底层函数
%%%%%%%%%%%%

% 控制变量初始化
FUNCTION {initialize.controls} {
  default.name.format.string 'name.format.string :=
  default.max.num.names.before.forced.et.al 'max.num.names.before.forced.et.al :=
  default.is.for.peer.review 'is.for.peer.review :=
}

% 初始化最长 label
FUNCTION {initialize.longest.label} { 
  "" 'longest.label :=
  #1 'number.label :=
  #0 'longest.label.width :=
}

% 最长 label pass
FUNCTION {longest.label.pass}
{ number.label int.to.str$ 'label :=
  number.label #1 + 'number.label :=
  label width$ longest.label.width >
    { label 'longest.label :=
      label width$ 'longest.label.width :=
    }
    { skip$ }
  if$
}

% 逻辑非: 栈顶元素的逻辑非
FUNCTION {not} {
    { #0 }
    { #1 }
  if$
}

% 逻辑与
FUNCTION {and} {   
    { skip$ }
    { pop$ #0 }
  if$
}

% 逻辑或
FUNCTION {or} {
    { pop$ #1 }
    { skip$ }
  if$
}

% 返回 #1 : 栈顶字符是数字"0"~"9"
% 返回 #0 : 其他
FUNCTION {is.num} {
  chr.to.int$
  duplicate$ "0" chr.to.int$ < not
  swap$ "9" chr.to.int$ > not and
}

% 栈顶整数乘以10
FUNCTION {bump.int.mag} {
  #0 'multiresult :=		% 初始化乘运算结果 y <- 0
  { duplicate$ #0 > }		% 栈顶整数 x = 0 时才停止循环
  { #1 -			% x <- x - 1
    multiresult #10 +		
    'multiresult :=		% y <- y + 10
  }
  while$
  pop$				% 释放 x 
  multiresult			% y 压栈返回
}

% 将栈顶字符("0"~"9")转换为整数(0~9)
FUNCTION {char.to.integer} { 
  duplicate$ 
  is.num
    { chr.to.int$ "0" chr.to.int$ - }
    { "noninteger character " quote$ * swap$ * quote$ *
      " in integer field of " * cite$ * warning$
      #0			% 如果栈定字符不是("0"~"9"), 给出警告返回 0
    }
  if$
}

% 将栈顶字符串转换为整数
FUNCTION {string.to.integer} { 
  duplicate$ text.length$ 'namesleft := % namesleft <- 字符串长度
  #1 'nameptr :=			% nameptr   <- 1
  #0 'numnames :=			% numnames  <- 0
  { nameptr namesleft > not }		% while( ! ( nameptr > namesleft ) )
  { duplicate$ nameptr #1 substring$	% 取第 nameptr 个字符 x
    char.to.integer numnames bump.int.mag + 
    'numnames :=		        % numnames <- chr2int( x ) + 10 * numnames
    nameptr #1 +			
    'nameptr :=				% nameptr <- nameptr + 1
  }
  while$
  pop$				        % 释放栈顶元素
  numnames				% numnames 压栈返回
}

% convert the strings "yes" or "no" to #1 or #0 respectively
FUNCTION {yes.no.to.int}
{ "l" change.case$ duplicate$
    "yes" =
    { pop$  #1 }
    { duplicate$ "no" =
        { pop$ #0 }
        { "unknown boolean " quote$ * swap$ * quote$ *
          " in " * cite$ * warning$
          #0
        }
      if$
    }
  if$
}

% 初始化状态常量
FUNCTION {initialize.status.constants}
{ #0 'before.all :=		% 起始
  #1 'mid.sentence :=		% 句中
  #2 'after.sentence :=		% 句末
  #3 'after.block :=		% 块后
  #4 'after.title :=            %
  #5 'before.pages :=		%
}

FUNCTION {remove.char}
{ 't :=
  's :=
  ""
  { s empty$ not }
  { s #1 #1 substring$
    s #2 global.max$ substring$ 's :=
    duplicate$ t = 'pop$
      { * }
    if$
  }
  while$
}

STRINGS {z}
FUNCTION {remove.period}
{ 'z :=
  ""
  { z empty$ not }
  { z #1 #1 substring$
    z #2 global.max$ substring$ 'z :=
    duplicate$ "." = 'pop$
      { * }
    if$
  }
  while$
}

FUNCTION {remove.dots} {
  duplicate$ "input=" swap$ * warning$ 
  "language=" language * warning$
  language empty$
    { "." remove.char 
      duplicate$ "output('.')=" swap$ * warning$ }
    { "." remove.char 
      duplicate$ "output('.')=" swap$ * warning$
      "." remove.char 
      duplicate$ "output('.')=" swap$ * warning$ }
  if$
}

FUNCTION {bibinfo.check}
{ swap$
  duplicate$ missing$
    {
      pop$ pop$
      ""
    }
    { duplicate$ empty$
        {
          swap$ pop$
        }
        { swap$
          pop$
        }
      if$
    }
  if$
}

%%%%%%%%%%%%
%% 调试例程
%%%%%%%%%%%%

% 默认调试输出函数
FUNCTION {debug.output} {
  "[DEBUG] " swap$ * top$ 
}

% 状态调试输出函数
FUNCTION {debug.output.status} {
  "---- output.state=" 
  output.state before.all = 
    { "before.all" }
    { output.state mid.sentence =
	{ "mid.sentence" }
	{ output.state after.sentence =
	    { "after.sentence" }
	    { output.state url.sentence =
		{ "url.sentence" }	
		{ output.state before.pages =
		    { "before.pages" }
		      { "after.block" }
		  if$
		}
	      if$
	    }
	  if$
	}
      if$
    }
  if$
  * debug.output
}

FUNCTION {output.year}
{ 't :=
  number empty$
  volume empty$
  and
    { add.period$ write$ }
    { ", " * write$ }
  if$
  t
}

% STRINGS {z}
% FUNCTION {remove.dots}
% { 'z :=
%   ""
%   { z empty$ not }
%   { z #1 #1 substring$
%     z #2 global.max$ substring$ 'z :=
%     duplicate$ bbl.period = 'pop$
%       { * }
%     if$
%   }
%   while$
%   %z
% }

% 对于中文文献, 用全角句点替换英文句点
FUNCTION {replace.half.width.period} {
%   % DEBUG
%   duplicate$ "-- replace.half.width.period(" swap$ * ")" * debug.output
%   % END OF DEBUG
  language empty$
    { " " * }				   % 对于英文文献, 在句点后加一空格
    { duplicate$ text.length$ 'numnames := % numnames 等于字符串长度
%       % DEBUG
%       numnames int.to.str$ "---- text.length$=" swap$ * debug.output
%       % END OF DEBUG
      duplicate$ numnames #1 substring$ "." =
	{ % % DEBUG
% 	  "---- Found '.' at the end" debug.output
% 	  % END OF DEBUG
	  numnames #1 -
	  #1 swap$ substring$
	  bbl.period *
	}
	{ skip$ }
      if$
    }
  if$
%   % DEBUG
%   duplicate$ "---- Return=" swap$ * debug.output
%   % END OF DEBUG
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 输出例程: 输出栈顶项并根据需要添加标点符号
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% 非空项输出函数: 用于输出非空项
FUNCTION {output.nonnull} {
%   % DEBUG
%   duplicate$ "output.nonnull(" swap$ * ")" * debug.output
%   debug.output.status
%   % END OF DEBUG
  swap$
  % 根据当前输出状态添加前置标点符号
  % before.all      起始, 不添加任何标点符号直接输出
  % mid.sentence    句中, 前置逗号输出
  % after.sentence  句末, 前置句号输出
  % after.block     块后, 前置句号, 后置 \newblock 输出
  % after.title
  output.state mid.sentence =
    { bbl.comma * write$ }	% mid.sentence 前置逗号
    { output.state after.block =
	{ add.period$		    % 块后, 后置句号
	  replace.half.width.period % 为中文文献替换句点
	  write$ 
	  newline$  
%	  "\newblock "  write$ 
	} % 后置 \newblock 输出
	{ output.state before.all =
            { write$ }		% 起始, 不添加任何标点符号直接输出
            { output.state after.title =
		{ bbl.parallel *
		  write$ }
		{ output.state before.pages =
		    { bbl.colon * 
		      write$ }
		    { add.period$ 	% 句末, 前置句号输出
		      replace.half.width.period 
		      write$ }		% 
		  if$
		}
	      if$
	    }
	  if$
	}
      if$
      mid.sentence 'output.state :=
    }
  if$
  % s
}

% 无警告输出函数
FUNCTION {output} { 
  duplicate$ empty$
    { pop$ }			% 若输出项为空, 则舍去空输出项
    { output.nonnull }		% 否则调用非空输出函数
  if$
}

% 警告输出函数: 同 output, 但是对于空项给出警告提示
FUNCTION {output.warn}
{ 't :=
  duplicate$ empty$
    { pop$ "empty " t * " in " * cite$ * warning$ }
    { output.nonnull }
  if$
}

% 将数字字符串转换成序数词形式字符串(例如: "7" -> "7th")
FUNCTION {num.to.ordinal} { 
  duplicate$ #-1 #1 substring$ "1" =
     { bbl.st * }
     { duplicate$ #-1 #1 substring$ "2" =
         { bbl.nd * }
         { duplicate$ #-1 #1 substring$ "3" =
             { bbl.rd * }
             { bbl.th * }
           if$
         }
       if$
     }
   if$
}

% 从字符串中提取前导数字的函数
% 如果栈顶字符串以数字开头(例如: "11th"), 则将字符串用其数字部分(即,"11")
% 替换. 否则, 保持原字符串不变. 用于版本转换函数(convert.edition)
% s 保存提取出的数字, t 保存剩余待扫描的字符串.
FUNCTION {extract.num} {
  duplicate$ 't :=		% t <- 输入字符串
  "" 's :=			% s <- ""
  { t empty$ not }		% while( t != "" ) {
  { t #1 #1 substring$		%   tmp <- t[0]
    t #2 global.max$ substring$ 
    't :=			%   t <- t[2:global.max$]
    duplicate$ is.num		%   if( is.num( tmp ) )
      { s swap$ * 's := }	%     s <- s & tmp
      { pop$ "" 't := }		%   else t <- ""
    if$				% }
  }				% 
  while$			% if( s == "" )
  s empty$			%   ;
    'skip$			% else
    { pop$ s }			%   return s
  if$				%
}

% 将1st~10th单词形式的序数词转换成阿拉伯数字形式
FUNCTION {word.to.num} {
  duplicate$ "l" change.case$ 
  's :=				% s <- lower( arg )
  s "first" =			% if ( s == "first" )
    { pop$ "1" }		%   return "1"
    { skip$ }
  if$
  s "second" =			% if ( s == "second" )
    { pop$ "2" }		%   return "2"
    { skip$ }
  if$
  s "third" =
    { pop$ "3" }
    { skip$ }
  if$
  s "fourth" =
    { pop$ "4" }
    { skip$ }
  if$
  s "fifth" =
    { pop$ "5" }
    { skip$ }
  if$
  s "sixth" =
    { pop$ "6" }
    { skip$ }
  if$
  s "seventh" =
    { pop$ "7" }
    { skip$ }
  if$
  s "eighth" =
    { pop$ "8" }
    { skip$ }
  if$
  s "ninth" =
    { pop$ "9" }
    { skip$ }
  if$
  s "tenth" =
    { pop$ "10" }
    { skip$ }
  if$
}

% 转换字符串形式的序数词为数字形式的序数词
% 例如: 将 "Eleventh" 转换为 "11th"
FUNCTION {convert.edition} { 
  duplicate$ empty$ 'skip$
    { duplicate$ #1 #1 substring$ 
      is.num			% if( is.num( arg[1] ) ) {
        { extract.num		%   tmp <- extract.num( arg )
          num.to.ordinal	%   tmp <- num.to.ordinal( tmp )
        }			% } else {
        { word.to.num		%   tmp <- word.to.num( arg )
          duplicate$ #1 #1 substring$ 
	  is.num		%   if( is.num( tmp[1] ) )
            { num.to.ordinal }	%     tmp <- num.to.ordinal( tmp )
            { "edition ordinal word " 
	      quote$ * edition * quote$ *
              " may be too high (or improper) for conversion" * 
	      " in " * cite$ * warning$ % else output warning
            }
          if$
        }
      if$
    }
  if$
}

FUNCTION {start.entry}
{ newline$
  "\bibitem{" write$
  cite$ write$
  "}" write$
  newline$
  ""
  before.all 'output.state :=
}

FUNCTION {fin.entry}
{ add.period$
  replace.half.width.period
  write$
  newline$
}

% FUNCTION {fin.entry}
% { duplicate$ empty$
%     'pop$
%     'write$
%   if$
%   newline$
% }

FUNCTION {new.block}
{ output.state before.all =
    'skip$
    { after.block 'output.state := }
  if$
}

FUNCTION {new.sentence}
{ output.state after.block =
    'skip$
    { output.state before.all =
    'skip$
    { after.sentence 'output.state := }
      if$
    }
  if$
}

FUNCTION {new.block.checka}
{ empty$
    'skip$
    'new.block
  if$
}

FUNCTION {new.block.checkb}
{ empty$
  swap$ empty$
  and
    'skip$
    'new.block
  if$
}

FUNCTION {new.sentence.checka}
{ empty$
    'skip$
    'new.sentence
  if$
}

FUNCTION {new.sentence.checkb}
{ empty$
  swap$ empty$
  and
    'skip$
    'new.sentence
  if$
}

FUNCTION {field.or.null}
{ duplicate$ empty$
    { pop$ "" }
    'skip$
  if$
}

FUNCTION {emphasize}
{ duplicate$ empty$
    { pop$ "" }
    { "{\em " swap$ * "}" * }
  if$
}





FUNCTION {format.language}
{ language empty$
    'skip$
    'skip$
  if$
 }
FUNCTION {is.space}
{ chr.to.int$
  duplicate$ #32 =
    { pop$ #1 }
    { pop$ #0 }
  if$
}
FUNCTION {is.lower.char}
{
  chr.to.int$
  duplicate$ #96 >
    { #123 < 
	{ #1 }
	{ #0 }
      if$
    }
    { pop$ #0 }
  if$
}

% 将last name转换为全大写
FUNCTION {capitalize.last.name} {
  "u" change.case$
}
% FUNCTION {capitalize.last.name}
% { 
%   'thename :=			% 输入参数 thename
%   thename text.length$ 
%   'namelength :=		% namelength := thename 的长度
%   #1 'charptr :=
%   #0 'lastnamecapitalized :=
%   ""
  
%   { charptr #1 - namelength < 
%     %     % debug
%     %     duplicate$ int.to.str$ "( charptr + #1 > namelength ) == " swap$ * warning$ 
%     %     % eod
%   }
%   { 
%     %     % debug
%     %     "charptr = " charptr int.to.str$ * 
%     %     ", lastnamecapitalized = " * 
%     %     lastnamecapitalized int.to.str$ * warning$
%     %     % eod
%     lastnamecapitalized #1 = 
% 	{	thename charptr namelength charptr - #1 + substring$ *
% 		namelength #1 + 'charptr := 
% 		% 	% debug
% 		% 	duplicate$ "top of the stack = " swap$ * warning$
% 		% 	% eod
% 	}
% 	{ thename charptr #1 substring$ 
% 	  % 	% debug
% 	  % 	duplicate$ "the char = " swap$ * warning$
% 	  % 	% eod
% 	  duplicate$ is.lower.char 
% 	    % 	% debug
% 	    % 	duplicate$ int.to.str$ "is.lower.char = " swap$ * warning$
% 	    % 	  % eod
% 	    { "u" change.case$ * }
% 	    { duplicate$ is.space
% 		% 	    % debug
% 		% 	    duplicate$ int.to.str$ "is.space = " swap$ * warning$
% 		% 	      % eod
% 		{ #1 'lastnamecapitalized :=
% 		  *
% 		}
% 		{ *
% 		}
% 	      if$
% 	    }
% 	  if$
% 	  % 	% debug
% 	  % 	duplicate$ "top of the stack = " swap$ * warning$
% 	  % 	% eod
% 	  charptr #1 + 'charptr :=
% 	}
%     if$
%   }
%   while$
% }
% 格式化盲审姓名
FUNCTION {format.names.for.peer.review} {
  's :=				% s := author域
  #1 'nameptr :=		% nameptr 是姓名指针,初始化为 1
  s num.names$ 'numnames :=     % 利用 num.names$ 获得 s 中的作者数量存入 nameptr
  numnames 'namesleft :=	% 未处理的姓名数 namesleft := numnames
  % 循环处理所有姓名
  { namesleft #0 > }		% if namesleft > #0 (还有姓名没有格式化)
  { s nameptr 			% 选择第 nameptr 个姓名
    name.format.string		% 按 name.format.string 的格式排版
    format.name$		% 调用 format.name$
    remove.period		% 并删除缩写符号'.'
    't :=			% 格式化后的姓名暂存于 t
    language empty$		
      { author.name.in.english }% 如果是英文文献将 author.name.in.english 压栈
      { author.name.in.chinese } % 否则将 author.name.in.chinese 压栈
    if$
    t =				% 用当前的姓名与栈上的姓名做比较
      { nameptr int.to.str$	% 将作者序号转化为字符串
	"\CJKnumber{" swap$ * "}" * % 使用中文数字
	bbl.number swap$ * bbl.author * % 加上``第''和``作者''
%	duplicate$ debug.output
      }
      { skip$ }
    if$
    nameptr #1 + 'nameptr :=	% 姓名指针加 1
    namesleft #1 - 'namesleft := % 剩余姓名数减 1
  }
  while$
}
% 格式化非盲审姓名
FUNCTION {format.names.for.non.peer.review} { 
  % 初始化
  's :=				% s := author域
  #1 'nameptr :=		% nameptr 是姓名指针,初始化为 1
  s num.names$ 'numnames :=	% 利用 num.names$ 获得 s 中的作者数量存入 nameptr
  numnames 'namesleft :=	% 未处理的姓名数 namesleft := numnames
  % 循环处理所有姓名
  { namesleft #0 > }		% if namesleft > #0 (还有姓名没有格式化)
  { s nameptr 			% 选择第 nameptr 个姓名
    name.format.string		% 按 name.format.string 的格式排版
    format.name$		% 调用 format.name$
%     language empty$		
%       {	"u" change.case$ }	% 如果不是语言为空, 做大写转换
%       {	skip$ }
%     if$				% <language 判断结束>
    remove.period		% 并删除缩写符号'.'
    't :=			% 格式化后的姓名暂存于 t
    nameptr #1 >
      { nameptr max.num.names.before.forced.et.al #1 + =
          { "others" 't :=	% 如果当前作者的序数已经超出了最大列显作者数
            #1 'namesleft := }	% 则置未处理姓名数为#1, 以便跳出循环
          { bbl.comma * }		% 如果作者序数在允许范围内, 则添加逗号
        if$			% <et al 判断结束>
        namesleft #1 >		% 若当前姓名不是最后一个
          { t * }		% 显示当前姓名	
          { t "others" =	% 若当前姓名是最后一个且后面有略去的姓名
              { bbl.etal * }	% 添加", et~al"或",等"
	            { t * }		% 如果没有略去姓名,以句点结束
	          if$			% <others 判断结束>
	        }
        if$ 			% <namesleft 判断结束>
      }
      { t }			% 如果是第一个作者, 直接将排版后的姓名压栈
    if$
    nameptr #1 + 'nameptr :=	% 姓名指针加 1
    namesleft #1 - 'namesleft := % 剩余姓名数减 1
  }
  while$
}
% 格式化姓名
FUNCTION {format.names} {
  is.for.peer.review 
    { format.names.for.peer.review }	 % 格式化盲审姓名
    { format.names.for.non.peer.review } % 格式化非盲审姓名
  if$
}
FUNCTION {format.authors}
{ author empty$
    { bbl.anonymous
      "The author in " cite$ * " is missing." * warning$ }
    { author format.names }
  if$
}

FUNCTION {format.editors}
{ editor empty$
    { bbl.anonymous
      "The editor in " cite$ * " is missing." * warning$ 
    }
    { editor format.names }
  if$
}

FUNCTION {format.assignees} {
  assignee empty$
    { "" }
    { assignee format.names }
  if$
}

% 译者格式
FUNCTION {format.translators}
{ translator empty$
    { "" }			% 无译者
    { new.block			% 有译者
      translator format.names ",译" *
    }
  if$
}

% 机构格式
FUNCTION {format.institution} { 
  institution empty$
    { "" }
    { institution }
  if$
}

% 组织格式
FUNCTION {format.organization} { 
  organization empty$
    { "" }
    { organization }
  if$
}

% 文献类型标志代码/电子文献载体标志代码
FUNCTION {bib.type.designator} {
%   % DEBUG
%   "bib.type.designator(type:" type$ * debug.output
%   "                    url: " url empty$ { "<N/A>" }{ url } if$  * debug.output
%   % END OF DEBUG

  % 文献类型标志代码
  type$ "book" = type$ "inbook" = or
    { "M" }
    { type$ "standard" = 
	{ "S" }
	{ type$ "proceedings" = type$ "conference" = or type$ "inproceedings" = or
	    { "C" }
	    { type$ "patent" =
		{ "P" }
		{ type$ "phdthesis" = type$ "masterthesis" = or
		    {language "Chinese" = { "学位论文" } { language empty$ = {"Dissertation"}  if$} if$}
		    { type$ "techreport" = 
			{ "R" }
			{ type$ "article" = type$ "periodical" = or
			    { "J" }
			    { type$ "online" = type$ "webpage" = or type$ "www" = or
				{ "EB" }
				{ type$ "electronic" =
				    { esubtype empty$
					{ url empty$
					    { "" }
					    { "EB" }
					  if$
					}
					{ esubtype "webpage" = 
					    { "EB" }
					    { esubtype "database" =
						{ "DB" }
						{ esubtype "program" =
						    { "CP" }
						    { "" }
						  if$ % electronics[program]
						}
					      if$ % electronics[database]
					    }
					  if$ % electronics[webpage]
					}
				      if$
				    }
				    { "" } % 其他
				  if$	   % electronics
				}
			      if$ % online/webpage/www
			    }
			  if$	% article/periodical
			}
		      if$ 	% techreport
		    }
		  if$		% phdthesis/mastersthesis
		}
	      if$ 		% patent
	    }
	  if$			% proceedings/inproceedings/conference
	}
      if$			% standard
    }
  if$ 				% book/inbook
%   % DEBUG
%   duplicate$ "                    doc.designator: " swap$ * debug.output
%   % END OF DEBUG
  % 电子文献载体标志代码
  duplicate$ "" =
    { skip$ }
    { "~[" swap$ *
      howpublished empty$ 
	{ url empty$
	    { "" }
	    { "/OL" }
	  if$
	}
	{ howpublished "online" =
	    { "/OL" }
	    { howpublished "magtype" =
		{ "MT" }
		{ howpublished "disk" =
		    { "DK" }
		    { howpublished "cdrom" =
			{ "CD" }
			{ "" }
		      if$	% cdrom
		    }
		  if$		% disk
		}
	      if$		% magitude type
	    }
	  if$			% online
	}
      if$ 
      * "]" *
    }
  if$
}

FUNCTION {format.title}
{ title empty$
    { "" }
    { new.block
      title }
  if$
}

% 格式化年月日``YYYY-MM-DD''
FUNCTION {format.year.month.day} { 
  year empty$
    { "YYYY" }
    { year }
  if$
  "-" *
  month empty$
    { "MM" * } 
    { month text.length$ #2 <
	{ "0" * }
	{ skip$ }
      if$
      month * 
    }
  if$
  "-" *
  day empty$
    { "DD" * }
    { day text.length$ #2 <
	{ "0" * }
	'skip$
      if$
      day *
    }
  if$
}

FUNCTION {format.reference.date} {
  refdate empty$
    { ""
      url empty$
	{ skip$ }
	{ "The refdate in " cite$ * " is missing." * warning$ }
      if$
    }
    { output.state mid.sentence =
	{ before.all 'output.state := }
	{ skip$ }
      if$
      "~[" refdate * "]" * }
  if$
}

% patent的题名项: 专利题名: 专利国别, 专利号~[文献类型标志]
FUNCTION {format.patent.title} { 
  title empty$			% 专利提名
    { "" }
    { new.block
      title bbl.colon * 
      nationality empty$		% 专利国别, 专利号
	{ % 专利国别为必备项
	  "The nationality in " cite$ * " is missing." * warning$
	}
	{ number empty$
	    { % 专利号为必选项
	      "The number in " cite$ * " is missing." * warning$
	    }
	    { % 产生``专利国别, 专利号''
	      nationality * bbl.comma * number *
	    }
	  if$
	}
      if$
      % 文献类型标志
      bib.type.designator *
    }
  if$
}

% patent的出版项:
FUNCTION {format.patent.publication} { 
  new.block
  format.year.month.day
%   % DEBUG
%   duplicate$ "End of format.patent.publication, top = " swap$ * debug.output
%   % END OF DEBUG
  url empty$
    { skip$ }
    { refdate empty$
	{ "The refdate in " cite$ * " is missing." * warning$ }
	{ "~[" * refdate * "]" * }
      if$
    }
  if$
}

% electronic的主要责任者:
%   author 或 organization
FUNCTION {format.electronic.authors}
{
  author empty$
    { organization empty$
	{ " " }
	{ organization }
      if$
    }
    { format.authors }
  if$
}

% electronic的出版项
FUNCTION {format.electronic.publication} { 
  new.block
  % 出版地: 出版者
  address empty$
    { "" }
    { address 
      publisher empty$
	{ skip$ }
	{ bbl.colon * publisher * }
      if$
    }
  if$
  
  % 出版年
  year empty$
    { skip$ }
    { publisher empty$ 
	{ "" }
	{ bbl.comma }
      if$ 
      * year * }
  if$
}

%% article的标题格式
FUNCTION {format.atitle}
{ title empty$
    { "" }
    { title 
      newsletter empty$
	{ "~[J" * }
	{ newsletter "yes" =
	    { "~[N" * }
	    { "~[J" * }
	  if$
	}
      if$
      url empty$
	{ "]" * }
	{ "/OL]" * }
      if$
    }
  if$
}
%% incollection的标题格式
FUNCTION {format.ictitle}
{ title empty$
    { "" }
    { title "~[M]~//~" * 
      editor format.names *
    }
  if$
}
%% inproceedings的标题格式
FUNCTION {format.iptitle}
{ title empty$
    { "" }
    { title "~[C]~//~" * 
      editor format.names *
    }
  if$
}

FUNCTION {n.dashify}
{ 't :=
  ""
    { t empty$ not }
    { t #1 #1 substring$ "-" =
    { t #1 #2 substring$ "--" = not
        { "--" *
          t #2 global.max$ substring$ 't :=
        }
        {   { t #1 #1 substring$ "-" = }
        { "-" *
          t #2 global.max$ substring$ 't :=
        }
          while$
        }
      if$
    }
    { t #1 #1 substring$ *
      t #2 global.max$ substring$ 't :=
    }
      if$
    }
  while$
}

% 年,卷(期)
FUNCTION {format.year.volume.number} {
  year empty$
    { "" }
    { type$ "periodical" =
	{ new.block }
	{ mid.sentence 'output.state := }
      if$
      year 
      volume empty$
	'skip$
	{ bbl.comma * volume * }
      if$
      number empty$
	'skip$
	{ "~(" * number * ")" * }
      if$ 
      year2 empty$
	{ skip$ }
	{ "~--" * 
	  year2 "now" =
	    { skip$ }
	    { year2 * 
	      volume2 empty$
		{ skip$ }
		{ bbl.comma * volume2 * }
	      if$
	      number2 empty$
		'skip$
		{ "~(" * number2 * ")" * }
	      if$
	    }
	  if$
	}
      if$
    }
  if$
%   %% DEBUG
%   duplicate$ "format.year.volume.number=" swap$ * debug.output
%   %% END OF DEBUG
}

% 卷(期).年,月(for article only)
FUNCTION {format.volume.number.year.month} {
  add.period$
  year empty$
    { "" }
    {
      volume empty$
        'skip$
        { "~" * volume * }
      if$
      number empty$
        'skip$
        { "~(" * number * ")" * }
      if$
      new.block
      year
      month empty$
        'skip$
        { bbl.comma * month * }
      if$
    }
  if$
}

%
FUNCTION {format.date}
{ year empty$
    { month empty$
      { "" }
      { "there's a month but no year in " cite$ * warning$
        month
      }
      if$
    }
    { month empty$
      { year }
      { month bbl.comma * year * }
      if$
    }
  if$
}

function {format.year.year}
{ year empty$
    'skip$
    { year "--" *
    year2 empty$
      'skip$
      { year2 "now" =
	  'skip$
	  { year2 * }
	if$
      }
    if$
    }
  if$
}

% 专著标题格式
FUNCTION {format.book.title} { 
  new.block			% 生成一个新的block
  title 
  type$ "proceedings" =
    { address empty$
	{ skip$ }
	{ bbl.comma * address * bbl.comma * 
	  month empty$
	    { skip$ }
	    { month * }
	  if$
	  year empty$
	    { skip$ }
	    { year * }
	  if$
	}
      if$
    }
    { skip$ }
  if$
  bib.type.designator *	% 标题 + [文献标志代码/电子文献载体标志代码]
}

% 科技报告标题格式
FUNCTION {format.techreport.title} { 
  title empty$
    { "" }
    { new.block			% 生成一个新的block
      title			% 标题 + 
      number empty$		% 编号 +
	{ "" }
	{ bbl.comma * number }
      if$ *	  
      bib.type.designator *	% [文献标志代码/电子文献载体标志代码]
    }
  if$
}

% 连续出版物标题格式
FUNCTION {format.jtitle}
{ title "~[J" *
  url empty$
    { "]" * }
    { "/OL]" * }
  if$
}

% 论文集标题格式
FUNCTION {format.ptitle.volume}
{ title 
  volume empty$
    { "~[C]" }
    { bbl.colon volume * "~[C]" * }
  if$ *
  %emphasize
}
FUNCTION {tie.or.space.connect}
{ duplicate$ text.length$ #3 <
    { "~" }
    { " " }
  if$
  swap$ * *
}

FUNCTION {either.or.check}
{ empty$
    'pop$
    { "can't use both " swap$ * " fields in " * cite$ * warning$ }
  if$
}

FUNCTION {format.bvolume}
{ volume empty$
    { "" }
    { language empty$
	{ "volume" volume tie.or.space.connect }
	{ volume }
      if$
      series empty$
    'skip$
    { " of " * series emphasize * }
      if$
      "volume and number" number either.or.check
    }
  if$
}

FUNCTION {format.number.series}
{ volume empty$
    { number empty$
    { series field.or.null }
    { output.state mid.sentence =
        { "number" }
        { "Number" }
      if$
      number tie.or.space.connect
      series empty$
        { "there's a number but no series in " cite$ * warning$ }
        { " in " * series * }
      if$
    }
      if$
    }
    { "" }
  if$
}

% 版本项格式
FUNCTION {format.edition} { 
  edition empty$
    { "" }
    { new.block			% 版本项按一个block输出
      language empty$		% 英文文献版本号自动转换成数字形式的序数词
	{ edition convert.edition
	  "l" change.case$ " ed" * 
	}
	{ edition }		% 中文文献版本号直接输出
      if$
    }
  if$
}


FUNCTION {format.url}
{ url empty$
    { "" }
    { new.block
      "\url{" url * "}" * 
    }
  if$
}

FUNCTION {multi.page.check}
{ 't :=
  #0 'multiresult :=
    { multiresult not
      t empty$ not
      and
    }
    { t #1 #1 substring$
      duplicate$ "-" =
      swap$ duplicate$ "," =
      swap$ "+" =
      or or
    { #1 'multiresult := }
    { t #2 global.max$ substring$ 't := }
      if$
    }
  while$
  multiresult
}

FUNCTION {format.pages}
{ pages empty$
    { "" }
    { before.pages 'output.state :=
      pages multi.page.check
      { "" pages n.dashify tie.or.space.connect }
      { "" pages tie.or.space.connect }
      if$
    }
  if$
}

FUNCTION {format.vol.num.pages}
{ volume field.or.null
  number empty$
    'skip$
    { "(" number * ")" * *
      volume empty$
	{ newsletter empty$
	    { "there's a number but no volume in " cite$ * warning$ }
	    'skip$
	  if$
	}
	'skip$
      if$
    }
  if$
  pages empty$
    'skip$
    { duplicate$ empty$
	{ pop$ format.pages }
	{ bbl.colon * pages n.dashify * }
      if$
    }
  if$
  % duplicate$ "top of stack = " swap$ * warning$
  url empty$
    'skip$
    { refdate empty$ 
	{ "there's an url but no refdate  in " cite$ * warning$ }
	{ %duplicate$ "url and refdate is not empty, top of stack = " swap$ * warning$
	  "~[" * refdate * "]" * 
	}
      if$
      %duplicate$ "top of stack = " swap$ * warning$
    }
  if$
}

FUNCTION {format.chapter.pages}
{ chapter empty$
    { "" }
    { type empty$
      { "chapter" }
      { type "l" change.case$ }
    if$
    chapter tie.or.space.connect
    pages empty$
      'skip$
      { ", " * format.pages * }
    if$
    }
  if$
}

FUNCTION {format.in.booktitle}
{ booktitle empty$
    { "" }
    { editor empty$
	{ language empty$
	    { " " booktitle * }
	    %        { "Proceedings of " booktitle * }
            { " " booktitle * }
	  if$
	}
	{ language empty$
%            { "In: " format.editors * ", Proceedings of " * booktitle * }
	    { " " booktitle * }
            { " " booktitle * }
	  if$
	}
      if$
    }
  if$
}

FUNCTION {format.in.ed.booktitle.volume}
{ booktitle empty$
    { "" }
    { editor empty$
	{ language empty$
%            { "Proceedings of " booktitle * }
	    { " " booktitle * }
            { " " booktitle * }
	  if$
	}
	{ language empty$
          %{ "In: " format.editors * ", Proceedings of " * booktitle * }
	    { " " booktitle * }
            { " " booktitle * }
	  if$
	}
      if$
      %% volume
      volume empty$
	'skip$
	{ language empty$
	    { "Vol." * volume * }
	    { ":第" * volume * "卷" * }
	  if$
	}
      if$
    }  
  if$
}

FUNCTION {empty.misc.check}
{ author empty$ title empty$ howpublished empty$
  month empty$ year empty$ note empty$
  and and and and and
    { "all relevant fields are empty in " cite$ * warning$ }
    'skip$
  if$
}

FUNCTION {format.thesis.type}
{ type empty$
    'skip$
    { pop$
      type "t" change.case$
    }
  if$
}

FUNCTION {format.tr.number}
{ type empty$
    { "Technical Report" }
    'type
  if$
  number empty$
    { "t" change.case$ }
    { number tie.or.space.connect }
  if$
}

FUNCTION {format.article.crossref}
{ key empty$
    { journal empty$
    { "need key or journal for " cite$ * " to crossref " * crossref *
      warning$
      ""
    }
    { "In {\em " journal * "\/}" * }
      if$
    }
    { "In " key * }
  if$
  " \cite{" * crossref * "}" *
}

FUNCTION {format.crossref.editor}
{ editor #1 "{ll }{f{~}}" format.name$
  editor num.names$ duplicate$
  #2 >
    { pop$ " et~al." * }
    { #2 <
	'skip$
	{ editor #2 "{ll }{f{~}}" format.name$ "others" =
            { " et~al." * }
            { " and " * editor #2 "{ll }{f{~}}" format.name$ * }
	  if$
	}
      if$
    }
  if$
}

FUNCTION {format.book.crossref}
{ volume empty$
    { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
      "In "
    }
    { "Volume" volume tie.or.space.connect
      " of " *
    }
  if$
  editor empty$
  editor field.or.null author field.or.null =
  or
    { key empty$
	{ series empty$
            { "need editor, key, or series for " cite$ * " to crossref " *
              crossref * warning$
              "" *
            }
            { "{\em " * series * "\/}" * }
	  if$
	}
	{ key * }
      if$
    }
    { format.crossref.editor * }
  if$
  " \cite{" * crossref * "}" *
}

FUNCTION {format.incoll.inproc.crossref}
{ editor empty$
  editor field.or.null author field.or.null =
  or
    { key empty$
    { booktitle empty$
        { "need editor, key, or booktitle for " cite$ * " to crossref " *
          crossref * warning$
          ""
        }
        { "In {\em " booktitle * "\/}" * }
      if$
    }
    { "In " key * }
      if$
    }
    { "In " format.crossref.editor * }
  if$
  " \cite{" * crossref * "}" *
}

% 出版地: 出版者
FUNCTION {format.address.publisher} {
  new.block
  type$ "inproceedings" =
    { pubaddress empty$
	{ "[" bbl.sine.loco * "]" * bbl.colon * % 无出版地
	  publisher empty$
	    { "there's neither pubaddress nor publisher in " cite$ * warning$
	      "[" * bbl.sine.nomine * "]" * % 无出版者
	    }
	    { "there's a publisher but no pubaddress in " cite$ * warning$
	      publisher *		% 有出版者
	    }
	  if$
	}
	{ pubaddress bbl.colon *	% 有出版地
	  publisher empty$
	    { "there's a pubaddress but no publisher in " cite$ * warning$
	      "[" * bbl.sine.nomine * "]" * % 无出版者
	    }
	    { publisher * }		% 有出版者
	  if$
	}
      if$
    }
    { address empty$
	{ "[" bbl.sine.loco * "]" * bbl.colon * % 无出版地
	  publisher empty$
	    { "there's neither address nor publisher in " cite$ * warning$
	      "[" * bbl.sine.nomine * "]" * % 无出版者
	    }
	    { "there's a publisher but no address in " cite$ * warning$
	      publisher *		% 有出版者
	    }
	  if$
	}
	{ address bbl.colon *	% 有出版地
	  publisher empty$
	    { "there's a address but no publisher in " cite$ * warning$
	      "[" * bbl.sine.nomine * "]" * % 无出版者
	    }
	    { publisher * }		% 有出版者
	  if$
	}
      if$
    }
  if$
}

% 出版地: 出版者, 出版年
FUNCTION {format.address.publisher.year} { 
%   % DEBUG
%   "-- format.address.publisher.year(){" debug.output
%   "--   address  =" address * debug.output
%   "--   publisher=" publisher * debug.output
%   "--   year     =" year * debug.output
%   % END OF DEBUG
  new.block
  type$ "inproceedings" =
    { pubaddress empty$
	{ "" % "[" bbl.sine.loco * "]" * bbl.colon * % 无出版地
	  publisher empty$
	    { "there's neither pubaddress nor publisher in " cite$ * warning$
	      "" * % "[" * bbl.sine.nomine * "]" * % 无出版者
	    }
	    { "there's a publisher but no pubaddress in " cite$ * warning$
	      publisher *		% 有出版者
	    }
	  if$
	}
	{ publisher empty$
	    { "there's a pubaddress but no publisher in " cite$ * warning$
	      "" % "[" * bbl.sine.nomine * "]" * % 无出版者
	    }
	    { pubaddress bbl.colon *	% 有出版地
	      publisher * }		% 有出版者
	  if$
	}
      if$
    }
    { address empty$
	{ "" % "[" bbl.sine.loco * "]" * bbl.colon * % 无出版地
	  publisher empty$
	    { "there's neither address nor publisher in " cite$ * warning$
	      "" * % "[" * bbl.sine.nomine * "]" * % 无出版者
	    }
	    { "there's a publisher but no address in " cite$ * warning$
	      publisher *		% 有出版者
	    }
	  if$
	}
	{ publisher empty$
	    { "there's a address but no publisher in " cite$ * warning$
	      "" % "[" * bbl.sine.nomine * "]" * % 无出版者
	    }
	    { address bbl.colon *	% 有出版地
	      publisher * }		% 有出版者
	  if$
	}
      if$
    }
  if$
  
  % 出版年
  year empty$
    { "there's no year in " cite$ * warning$ }
    { type$ "inproceedings" =
	{ bbl.comma * year * }
	{ publisher empty$ 
	    { year * }
	    { bbl.comma * year * }
	  if$
	}
      if$
	
      type$ "periodical" =
	{ year2 empty$		% 对连续出版物可以排版 year2
	    { skip$ }
	    { "--" * 
	      year2 "l" change.case$ "now" =
		{ skip$ }
		{ year2 * }
	      if$
	    }
	  if$
	}
	{ skip$ }
      if$
    }
  if$
%   % DEBUG
%   duplicate$ "-- }=" swap$ * debug.output
%   % END OF DEBUG
}

% 出版地: 学校, 出版年
FUNCTION {format.address.school.year} {   
  new.block
  address empty$
    { "[" bbl.sine.loco * "]" * bbl.colon * % 无出版地
      school empty$
	{ "there's neither address nor school in " cite$ * warning$
	  "[" bbl.sine.nomine * "]" * % 无出版者
	}
	{ "there's a school but no address in " cite$ * warning$
	   school *		% 有出版者
	}
      if$
    }
    { address bbl.colon *	% 有出版地
      school empty$
	{ "there's a address but no school in " cite$ * warning$
	  "[" bbl.sine.nomine * "]" * % 无出版者
	}
	{ school * }		% 有出版者
      if$
    }
  if$
  % 出版年
  year empty$
    { "there's no year in " cite$ * warning$ }
    { bbl.comma * year * }
  if$
}


% FUNCTION {format.title.type}
% { title empty$
%     { type empty$
%         { "" }
%         { "there's a type but no title in " cite$ * warning$
%           type
%         }
%       if$
%     }
%     { type empty$
%         'title
%         { title bbl.colon * type * }
%       if$
%     }
%   if$
% }

FUNCTION {format.note} {
  note empty$
    { new.block "" }
    { url empty$
      { new.block }
      { before.all 'output.state := }
      if$
      note 
    }
  if$
}

%%%%%%%%%%%%%%%%%
%% 著录格式: 专著
%%%%%%%%%%%%%%%%%

% 普通图书
FUNCTION {book} { 
  start.entry			% 开始

  author empty$			% 主要责任者
    { format.editors "author and editor" output.warn }
    { format.authors output.nonnull }
  if$		
  format.book.title "title"      output.warn	   % 题名项		
  format.translators             output		   % 其他责任者(可选)
  format.edition                 output		   % 版本项
  format.address.publisher.year  output.nonnull	   %
  format.reference.date          output		   % 
  format.url                     output		   % 获取或访问路径
  format.note                    output		   % 备注  

  fin.entry
}

% 标准
FUNCTION {standard} { 
  start.entry
  
  organization empty$		% 主要责任人
    { format.institution "organization and institution" output.warn }
    { format.organization output.nonnull }
  if$
  format.book.title "title"     output.warn    % 题名项
  format.translators            output	       % 其他责任人
  format.edition                output	       % 版本项
  format.address.publisher.year output.nonnull % 出版项
  format.url                    output	       % URL
  format.note                   output	       % 备注项

  fin.entry
}

% 学位论文 
FUNCTION {phdthesis} {
  start.entry

  format.authors "author"    output.warn
  format.book.title "title"  output.warn
  format.address.school.year output
  format.note                output

  fin.entry
}

% 会议录/论文集
FUNCTION {proceedings} { 
  start.entry
  
  editor empty$
    { organization empty$
	{ format.institution "author, organization institution" output.warn }
	{ format.organization output.nonnull }
      if$
    }
    { format.editors output.nonnull }
  if$
  format.book.title "title"     output.warn
  format.address.publisher.year output
  format.note                   output

  fin.entry
}

% 科技报告
FUNCTION {techreport} { 
  start.entry
  
  author empty$
    { organization empty$
	{ format.institution 
	  "author, organization and institution" output.warn }
	{ format.organization output.nonnull }
      if$
    }
    { format.authors output.nonnull }
  if$
  format.techreport.title "title" output.warn
  format.address.publisher.year   output.nonnull
  format.url                      output
  format.note                     output

  fin.entry
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 著录格式: 专著中析出的文献
%%%%%%%%%%%%%%%%%%%%%%%%%%%%

FUNCTION {format.collection.editors} {
  booktitle empty$
    { "" }
    { after.title 'output.state :=
      format.editors }
  if$
}
FUNCTION {format.address} {
  booktitle empty$
    { new.block }
    { mid.sentence 'output.state := }
  if$
  address empty$
    { "" }
    { 
      new.block
      address 
    }
  if$
}

FUNCTION {format.month.year} {
  month empty$
    { "" }
    { month " " * }
  if$
  year empty$
    { "There is month but no year in " cite$ * warning$ }
    { year * }
  if$ 
}

FUNCTION {format.year} {
  year empty$
    { "There is month but no year in " cite$ * warning$ }
    { new.block
      year " " * 
    }
  if$ 
}

FUNCTION {format.collection.title} {
  booktitle empty$
    { "" }
    { new.block 
      language empty$
        {"In "}
        {"见"}
      if$
      booktitle *
%       address empty$
% 	      { skip$ }
% 	      { bbl.comma * address * bbl.comma * 
% 	    month empty$
% 	      { skip$ }
% 	      { month * }
% 	    if$
% 	    year empty$
% 	      { skip$ }
% 	      { " " * year * }
% 	    if$
% 	}
%       if$
    }
  if$
}
% 图书中析出的文献
FUNCTION {inbook} { 
  start.entry
  
  author empty$
    { format.editors "author and editor" output.warn }
    { format.authors output.nonnull }
  if$
  format.book.title "title"     output.warn
  format.collection.editors "editor" output.warn
  format.collection.title "booktitle" output.warn
  format.translators            output	       % 其他责任人
  format.edition                output	       % 版本项
  format.address.publisher.year	output.nonnull % 出版项
  format.pages "pages"          output.warn    %
  format.url                    output	       % URL
  format.note                   output	       % 备注项

  fin.entry
}

%%%%%%%%%%%%%%%%%
%% 著录格式: 专利
%%%%%%%%%%%%%%%%%
FUNCTION {patent} {
  start.entry
  
  author empty$
    { format.assignees "assignee" output.warn }
    { format.authors output.nonnull }
  if$
  format.patent.title "title" output.warn
  format.patent.publication output 
  format.url output
  format.note output
  
  fin.entry
}

% 电子文献更新或修改日期
FUNCTION {format.update.date} {
  update empty$
    { "" }
    { output.state mid.sentence =
	{ before.all 'output.state := }
	{ skip$ }
      if$
      "~(" update * ")" * }
  if$
}

%%%%%%%%%%%%%%%%%%%%%
%% 著录格式: 电子文献
%%%%%%%%%%%%%%%%%%%%%
FUNCTION {electronic} {
  start.entry
  
  author empty$
    { organization "author and organization" output.warn }
    { format.authors output.nonnull }
  if$
  format.book.title output
  format.electronic.publication output
  format.update.date output
  format.reference.date output
  format.url output
  format.note output

  fin.entry
}

%%%%%%%%%%%%%%%%%%%%%%%
%% 著录格式: 连续出版物
%%%%%%%%%%%%%%%%%%%%%%%
FUNCTION {periodical} { 
  start.entry
  
  editor empty$
    { format.organization "editors and organization" output.warn }
    { format.editors output.nonnull }
  if$
  format.book.title "title" output.warn
  format.year.volume.number output
  format.address.publisher.year output
  format.url output
  format.note output

  fin.entry
}

FUNCTION {format.journal.title} {
  journal empty$
    { "" }
    { new.block journal }
  if$
}

% 连续出版物中析出的文献
FUNCTION {article}
{ start.entry

  format.authors "author" output.warn
  format.book.title "title" output.warn
  format.journal.title "journal" output.warn
  format.volume.number.year.month output
  %format.year.volume.number output
  format.pages "pages" output.warn
  format.reference.date output
  format.url output
  format.note output
  
  fin.entry
}

FUNCTION {booklet}
{ start.entry
  format.authors output
  new.block
  format.title "title" output.warn
  howpublished address new.block.checkb
  howpublished output
  address output
  format.date output
  new.block
  note output
  fin.entry
}

FUNCTION {incollection}
{ start.entry
  format.authors "author" output.warn
  new.block
  format.ictitle "title" output.warn
  new.block
  crossref missing$
    { %format.in.ed.booktitle "booktitle" output.warn
      %format.bvolume output
      format.in.ed.booktitle.volume "booktitle" output.warn
      format.number.series output
      format.chapter.pages output
      new.sentence
%      publisher "publisher" output.warn
%      address output
      format.address.publisher.year output
      format.edition output
      format.date ":" * format.pages * output
      %format.date "year" output.warn
    }
    { format.incoll.inproc.crossref output.nonnull
      format.chapter.pages output
    }
  if$
  new.block
  note output
  fin.entry
}

% 论文集中析出的文献
FUNCTION {inproceedings} { 
  start.entry

  format.authors "author" output.warn
  format.book.title "title"  output.warn
%  format.collection.editors "editor" output.warn
  format.collection.title "booktitle" output.warn
  format.address output
%  format.month.year output
  format.year output
%  format.address.publisher.year	output.nonnull % 出版项
  format.pages "pages"          output.warn    %
%  format.url                    output	       % URL
%  format.note                   output	       % 备注项 
%   format.in.booktitle "booktitle" output.warn
%       %format.bvolume output
%       %format.number.series output
%       %format.pages output
%       address empty$
% 	{ organization publisher new.sentence.checkb
% 	  organization output
% 	  publisher output
% 	  %format.date "year" output.warn
% 	  %year output
% 	  format.date ":" * format.pages * output
% 	}
% 	{ %address output.nonnull
% 	  format.address.publisher.year output  
% 	  %format.date "year" output.warn
% 	  % year output
% 	  format.date ":" * format.pages * output
% 	  new.sentence
% 	  organization output
% 	  %publisher output
% 	}
%       if$
%       new.block
      % pages output
      %remove.dots
    
%     { format.incoll.inproc.crossref output.nonnull
%       format.pages output
%     }
%   if$
%   new.block
%   note output  
  fin.entry
}

FUNCTION {manual}
{ start.entry
  author empty$
    { organization empty$
    'skip$
    { organization output.nonnull
      address output
    }
      if$
    }
    { format.authors output.nonnull }
  if$
  new.block
  format.book.title "title" output.warn
  author empty$
    { organization empty$
    { address new.block.checka
      address output
    }
    'skip$
      if$
    }
    { organization address new.block.checkb
      organization output
      address output
    }
  if$
  format.edition output
  format.date output
  new.block
  note output
  fin.entry
}

FUNCTION {thesis.type}
{ 
%"~[D]" 
 language empty$
     { "[Dissertation]" }
     { "[学位论文]" }
   if$
}

FUNCTION {masterthesis}
 { start.entry
   format.authors "author" add.period$ output.warn
   new.block
   format.title remove.dots " " * thesis.type * output
   new.block
   %format.address.school output
   %address output
   school "school" output.warn  
   format.date "year" output.warn
   new.block
   %note output
   fin.entry
 }

%FUNCTION {phdthesis}
 %{ start.entry
  % format.authors "author" add.period$ output.warn
   %new.block
   %format.title remove.dots " " * thesis.type * output
   %new.block
   %format.address.school output
   %%address output
   %school "school" output.warn  
   %format.date "year" output.warn
   %new.block
   %%note output
   %fin.entry
 %}

FUNCTION {misc}
{ start.entry

  format.authors output
%  title howpublished new.block.checkb
  format.title output
%  howpublished new.block.checka
%  howpublished output
%  format.date output
  format.address output
  format.month.year output
  format.pages "pages" output.warn
  format.url output
%  new.block
  format.note output
  fin.entry
%  empty.misc.check
}


FUNCTION {unpublished}
{ start.entry
  format.authors "author" output.warn
  new.block
  format.title "title" output.warn
  new.block
  note "note" output.warn
  format.date output
  fin.entry
}

% 专用控制条目 BUPTThesisBSTCTL 用于提供方便的用户设置接口
FUNCTION {BUPTThesisBSTCTL}{
  is.print.banners.to.terminal
    { "** BUPTThesis BST control entry " quote$ * cite$ * 
      quote$ * " detected." *
      top$
    }
    { skip$ }
  if$
%   CTLuse_article_number
%   empty$
%     { skip$ }
%     { CTLuse_article_number
%       yes.no.to.int
%       'is.use.number.for.article :=
%     }
%   if$
%   CTLuse_paper
%   empty$
%     { skip$ }
%     { CTLuse_paper
%       yes.no.to.int
%       'is.use.paper :=
%     }
%   if$
%   CTLuse_forced_etal
%   empty$
%     { skip$ }
%     { CTLuse_forced_etal
%       yes.no.to.int
%       'is.forced.et.al :=
%     }
%   if$
  % 显示作者数目
  CTLmax_names_forced_etal
  empty$
    { skip$ }
    { CTLmax_names_forced_etal
      string.to.integer
      'max.num.names.before.forced.et.al :=
    }
  if$
  % 论文作者英文姓名
  CTLauthor_name_english
  empty$
    { skip$ }
    { CTLauthor_name_english 
      'author.name.in.english := 
      % #1 'is.for.peer.review := 
%      "CTLauthor_name_english=" author.name.in.english * debug.output
    }
  if$
  % 论文作者中文姓名
  CTLauthor_name_chinese
  empty$
    { skip$ }
    { CTLauthor_name_chinese
      'author.name.in.chinese := 
      % #1 'is.for.peer.review :=
%      "CTLauthor_name_chinese=" author.name.in.chinese * debug.output
    }
  if$
  CTLfor_peer_review
  empty$
    { skip$ }
    { CTLfor_peer_review
      yes.no.to.int
      'is.for.peer.review :=
    }
  if$
%   CTLnames_show_etal
%   empty$
%     { skip$ }
%     { CTLnames_show_etal
%       string.to.integer
%       'num.names.shown.with.forced.et.al :=
%     }
%   if$
%   CTLuse_alt_spacing
%   empty$
%     { skip$ }
%     { CTLuse_alt_spacing
%       yes.no.to.int
%       'is.use.alt.interword.spacing :=
%     }
%   if$
%   CTLalt_stretch_factor
%   empty$
%     { skip$ }
%     { CTLalt_stretch_factor
%       'ALTinterwordstretchfactor :=
%       "\renewcommand{\BIBentryALTinterwordstretchfactor}{"
%       ALTinterwordstretchfactor * "}" *
%       write$ newline$
%     }
%   if$
%   CTLdash_repeated_names
%   empty$
%     { skip$ }
%     { CTLdash_repeated_names
%       yes.no.to.int
%       'is.dash.repeated.names :=
%     }
%  if$
%   CTLname_emph_author_en	% 强调显示的作者英文姓名
%   empty$
%     { skip$ }			% 若没有给出则跳过
%     { CTLname_emph_author_en
%       'name.emph.author.en :=	% 否则更新 name.emph.author.en
%     }
%   if$
%   CTLname_emph_author_zh	% 强调显示的作者中文姓名
%   empty$
%     { skip$ }			% 若没有给出则跳过
%     { CTLname_emph_author_zh
%       'name.emph.author.zh :=	% 否则更新 name.emph.author.zh
%     }
%   if$
  CTLname_format_string		% 英文姓名排版格式字符串
  empty$
    { skip$ }			% 若没有自定义则跳过
    { CTLname_format_string	% 否则更新 name.format.string
      'name.format.string :=
    }
  if$
%   CTLname_latex_cmd
%   empty$
%     { skip$ }
%     { CTLname_latex_cmd
%       'name.latex.cmd :=
%     }
%   if$
%   CTLname_url_prefix
%   missing$
%     { skip$ }
%     { CTLname_url_prefix
%       'name.url.prefix :=
%     }
%   if$


%   num.names.shown.with.forced.et.al max.num.names.before.forced.et.al >
%     { "CTLnames_show_etal cannot be greater than CTLmax_names_forced_etal in " cite$ * warning$ 
%       max.num.names.before.forced.et.al 'num.names.shown.with.forced.et.al :=
%     }
%     { skip$ }
%   if$
}

%%%%%%%%%%%%
%% 条目别名
%%%%%%%%%%%%
%FUNCTION {phdthesis} {thesis}
%FUNCTION {masterthesis} {thesis}
FUNCTION {conference}    {inproceedings}
FUNCTION {online}        {electronic}
FUNCTION {internet}      {electronic}
FUNCTION {webpage}       {electronic}
FUNCTION {www}           {electronic}
FUNCTION {default.type}  {misc}


%%%%%%%%%%
%% 主程序
%%%%%%%%%%

READ

EXECUTE {initialize.controls}	      % 初始化控制变量
EXECUTE {initialize.status.constants} % 初始化状态常量
EXECUTE {banner.message}	      % 显示初始提示信息

EXECUTE {initialize.longest.label}    % 初始化最长的标号
ITERATE {longest.label.pass}	      % 处理最长的标号

EXECUTE {begin.bib}	              % 开始
ITERATE {call.type$}		      %
EXECUTE {end.bib}		      % 结束

EXECUTE {completed.message}	      % 显示完成提示信息

%% EOF


================================================
FILE: code/recursion.py
================================================
def numbers(x):
    if x > 0:
        print(x)
        numbers(x-1)


================================================
FILE: guidebook/README.md
================================================
# 用户手册

这里是关于使用本模版的详细指导。

## 编译与编辑

完成 LaTeX 的环境安装后,即可在不同的编辑器中编辑、编译文档。

### VSCode

#### 安装扩展 `Latex Workshop`

首先,在 VSCode 中安装扩展 `Latex Workshop`(本手册使用 6.5.1 版)。

#### 设置扩展

安装完成后,对 `Latex Workshop` 进行工作区或用户设置。将下面的 JSON 字符串写入 `settings.json` 中:

```json
{
    "latex-workshop.latex.recipes": [
        {
            "name": "latexmk 🔃",
            "tools": [
                "xelatex",
                "bibtex",
                "xelatex",
                "xelatex"
            ]
        },
        {
            "name": "pdflatex ➞ bibtex ➞ pdflatex`×2",
            "tools": [
                "pdflatex",
                "bibtex",
                "pdflatex",
                "pdflatex"
            ]
        }
    ],
    "latex-workshop.latex.tools": [
        {
            "name": "latexmk",
            "command": "latexmk",
            "args": [
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "-pdf",
                "-outdir=%OUTDIR%",
                "%DOC%"
            ],
            "env": {}
        },
        {
            "name": "pdflatex",
            "command": "pdflatex",
            "args": [
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "%DOC%"
            ],
            "env": {}
        },
        {
            "name": "bibtex",
            "command": "bibtex",
            "args": [
                "%DOCFILE%"
            ],
            "env": {}
        },
        {
            "name": "xelatex",
            "command": "xelatex",
            "args": [
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "%DOC%"
            ]
        }
    ]
}
```

建议仅对当前工作区进行设置,以免影响 `Latex Workshop` 在其他地方的运行。

#### 开始使用

打开 `main.tex`,使用快捷键 `Ctrl + Alt + B`(`Cmd + Opt + B`)即可编译文档,并在统一目录下生成 `main.pdf`。

### Overleaf

[官方的使用指导](https://cn.overleaf.com/learn/how-to/Creating_a_document_in_Overleaf)  
BYRIO社区也提供了[校内服务](https://overleaf.byrio.work/),如果遇到访问性问题可以使用校内服务。

### TEXMAKER

`TEXMAKER` 是一款免费的跨平台 LaTeX 编辑器,同时提供了图形化的编译界面。

下载地址:[texmaker](http://www.xm1math.net/texmaker/)

在软件中打开 `main.tex`,依次执行 `xelatex`、`bibtex`、`xelatex`、`xelatex` 即完成编译,并在统一目录下生成 `main.pdf`。


================================================
FILE: main.cfg
================================================
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                                  %
%   Copyright (c) 2010 - 2011 Caspar Zhang <casparant@gmail.com>   %
%                                                                  %
%   This copyrighted material is made available to anyone wishing  %
%   to use, modify, copy, or redistribute it subject to the terms  %
%   and conditions of the GNU General Public License version 2.    %
%                                                                  %
%   This program is distributed in the hope that it will be        %
%   useful, but WITHOUT ANY WARRANTY; without even the implied     %
%   warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR        %
%   PURPOSE. See the GNU General Public License for more details.  %
%                                                                  %
%   You should have received a copy of the GNU General Public      %
%   License along with this program; if not, write to the Free     %
%   Software Foundation, Inc., 51 Franklin Street, Fifth Floor,    %
%   Boston, MA 02110-1301, USA.                                    %
%                                                                  %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% 你只需要修改下面几行就可以完成大部分内容的填写,
% 这要求你具有一定的LaTeX基础,但是如果你足够聪明,
% 不具有LaTeX基础也可以完成。

% 论文中文题目
\def\thesistitle{社猜猜看这个毕设题目是什么}

% 论文英文题目
%提示:英文摘要页的标题注意格式要求。
\def\thesistitleen{HAVE A TRY TO GUESS WHAT THE TITLE IS}

% Thank Words
\def\thankwords{

此处请写致谢的内容。

它可以有多段。
}


================================================
FILE: main.tex
================================================
\def\thelstlisting{}

%不需要区分奇偶页的请使用下面一行
\documentclass[a4paper,AutoFakeBold,oneside,12pt]{book}
%需要区分奇偶页的(即每一章第一页一定在奇数页上)请使用下面一行
%\documentclass[a4paper,AutoFakeBold,openright,12pt]{book}
\usepackage{BUPTthesisbachelor}
\usepackage{setspace}

%\lstdefinestyle{sharpc}{language=[Sharp]C, frame=lrtb, rulecolor=\color{blue!80!black}}


%%%%%%%%%%%%%%%%%%%%%%%%% Begin Documents %%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}

% 封面
\blankmatter
\includepdf[pages=-]{docs/cover.pdf}  

% 任务书
\blankmatter
\includepdf[pages=-]{docs/task.pdf}  

% 成绩评定表
\blankmatter
\includepdf[pages=-]{docs/scoreTable.pdf}  

% 诚信声明
\blankmatter
\includepdf[pages=-]{docs/statement.pdf} 

\input{main.cfg}    % Main items 
\include{abstract}  % Abstract

% 目录
\fancypagestyle{plain}{\pagestyle{frontmatter}}
\frontmatter
\tableofcontents % Content

% 正文
\newpage\mainmatter
\fancypagestyle{plain}{\pagestyle{mainmatter}}

%\let\cleardoublepagebak=\cleardoublepage
%\let\cleardoublepage\relax % Make new chapter stay on old page

%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Main Area %%%%%%%%%%%%%%%%%%%%%%%%%%%%

\chapter{基础模块示例}

\section{特殊文本类型}
\subsection{脚注}
% 如果你的项目来源于科研项目,可以使用以下指令插入无编号脚注于正文第一页
\blfootnote{本项目来源于科研项目“基于\LaTeX{}的本科毕业设计”,项目编号1124}
社交媒体是一种供用户创建在线社群来分享信息、观点、个人信息和其它内容(如视频)的电子化交流平台,社交网络服务(social network service, SNS)和微博客(microblogging)都属于社交媒体的范畴\cite{webster_social_media},国外较为知名的有Facebook\footnote{http://www.facebook.com/}、Instagram\footnote{https://www.instagram.com/}、Twitter\footnote{http://www.twitter.com/}、LinkedIn\footnote{http://www.linkedin.com/}等,国内较为知名的有新浪微博\footnote{http://www.weibo.com/}。

在社交媒体的强覆盖下,新闻信息的传播渠道也悄然了发生变化。\cite{false_news_spread_2018}

\subsection{定义、定理与引理等}
\begin{definition}
这是一条我也不知道在说什么的定义,反正我就是写在这里做个样子罢了,也没人会仔细读。\cite{周兴2017基于深度学习的谣言检测及模式挖掘}
\end{definition}

\begin{theorem}
这是一条我也不知道在说什么的定理,反正我就是写在这里做个样子罢了,也没人会仔细读。
\end{theorem}

\begin{axiom}
这是一条我也不知道在说什么的公理,反正我就是写在这里做个样子罢了,也没人会仔细读。
\end{axiom}

\begin{lemma}
这是一条我也不知道在说什么的引理,反正我就是写在这里做个样子罢了,也没人会仔细读。
\end{lemma}

\begin{proposition}
这是一条我也不知道在说什么的命题,反正我就是写在这里做个样子罢了,也没人会仔细读。
\end{proposition}

\begin{corollary}
这是一条我也不知道在说什么的推论,反正我就是写在这里做个样子罢了,也没人会仔细读。
\end{corollary}

\subsection{中英文文献、学位论文引用}
根据美国皮尤研究中心的2017年9月发布的调查结果\cite{pew_news_use_2017},67\%的美国民众会从社交媒体上获取新闻信息,其中高使用频率用户占20\%。在国内,中国互联网信息中心《2016年中国互联网新闻市场研究报告》\cite{internet_news_2016}也显示,社交媒体已逐渐成为新闻获取、评论、转发、跳转的重要渠道,在2016年下半年,曾经通过社交媒体获取过新闻资讯的用户比例高达90.7\%,在微信、微博等社交媒体参与新闻评论的比例分别为62.8\%和50.2\%。社交媒体正在成为网络上热门事件生成并发酵的源头,在形成传播影响力后带动传统媒体跟进报道,最终形成更大规模的舆论浪潮。\cite{Yang2012Automatic}

在国内,新浪微博由于其发布方便、传播迅速、受众广泛且总量大的特点,成为了虚假信息传播的重灾区:《中国新媒体发展报告(2013)》\cite{唐绪军2013中国新媒体发展报告}显示,2012年的100件微博热点舆情案例中,有超过1/3出现谣言;《中国新媒体发展报告(2015)》\cite{唐绪军2015中国新媒体发展报告}对2014年传播较广、比较典型的92条假新闻进行了多维度分析,发现有59\%的虚假新闻首发于新浪微博。

此等信息的传播严重损害了有关公众人物的名誉权,降低了社交媒体服务商的商业美誉度,扰乱了网络空间秩序,冲击着网民的认知,极易对民众造成误导,带来诸多麻烦和经济损失,甚至会导致社会秩序的混乱。针对社交媒体谣言采取行动成为了有关部门、服务提供商和广大民众的共同选择。\cite{周兴2017基于深度学习的谣言检测及模式挖掘}

\section{图表及其引用}
此处引用了简单的表\ref{crowdwisdom_TMP}。

请注意,\LaTeX{}的图表排版规则决定了图表\textbf{不一定会乖乖呆在你插入的地方},这是为了避免Word中由于图片尺寸不匹配在页面下部出现的的空白,所以请不要使用“下图”“下表”作为指向文字,应使用“图1-1所示”这样的表述。

\begin{bupttable}{基于浏览者行为的特征}{crowdwisdom_TMP}

    \begin{tabular}{l|l|l}
		\hline \textbf{特征} & \textbf{描述} & \textbf{形式与理论范围}\\
		\hline 点赞量 & 微博的点赞数量 & 数值,$\mathbb{N}$ \\
		\hline 评论量 & 微博的评论数量 & 数值,$\mathbb{N}$ \\
		\hline 转发量 & 微博的转发数量 & 数值,$\mathbb{N}$ \\
		\hline
    \end{tabular}
\end{bupttable}

此处引用了复杂的表\ref{complexcrowdwisdom_TMP}。


\begin{bupttable}{基于浏览者行为的复杂特征}{complexcrowdwisdom_TMP}
    \begin{tabular}{l|l|l|l}
        \hline
        \multicolumn{1}{c|}{\multirow{2}{*}{\textbf{类别}}} & \multicolumn{1}{c|}{\multirow{2}{*}{\textbf{特征}}} & \multicolumn{2}{c}{\textbf{不知道叫什么的表头}} \\
        \cline{3-4}
        & & \multicolumn{1}{c|}{\textbf{描述}} & \multicolumn{1}{c}{\textbf{形式与理论范围}} \\
        \hline
        \multirow{3}{*}{正常互动} & 点赞量 & 微博的点赞数量 & 数值,$\mathbb{N}$ \\
        \cline{2-4}
        & 评论量 & 微博的评论数量 & 数值,$\mathbb{N}$ \\
        \cline{2-4}
        & 转发量 & 微博的转发数量 & 数值,$\mathbb{N}$ \\
        \hline
        非正常互动 & 羡慕量 & 微博的羡慕数量 & 数值,$\mathbb{N}$ \\
        \hline
    \end{tabular}
\end{bupttable}

此处展示了更专业的表\ref{tab:abbr_table},一个好的表格没有竖线。
% 请注意1)tabularx环境对多行文本的处理;2)booktabs宏包中支持的更粗的顶端和底端表格边界线,边界线与文本间更大的间距。
\begin{bupttable}{红警2名词解释}{tab:abbr_table}
    \begin{tabularx}{\textwidth}{llX}
        \toprule
        \textbf{术语类别} & \textbf{缩略语} & \textbf{解释} \\ \midrule
        & 兵营 & 兵营(Barracks),《命令与征服\ 红色警戒2:尤里的复仇》游戏中的一种生产建筑,用以生产步兵单位 \\ \cmidrule(l){2-3}
        & 建造场 & 建造场(Construction Yard),《命令与征服\ 红色警戒2:尤里的复仇》游戏中的一种基础建筑,用以支持其他建筑的建造 \\ \cmidrule(l){2-3}
        & 矿厂 & 矿石精炼厂(Ore Refinery),《命令与征服\ 红色警戒2:尤里的复仇》游戏中的一种资源建筑,用以将矿车采集的矿石转化为游戏资金 \\ \cmidrule(l){2-3}
        游戏 & 空指 & 空指部(Airforce Command Headquarters),《命令与征服\ 红色警戒2:尤里的复仇》游戏中的一种资源建筑,用以提供雷达功能和T2科技及生产部分空军单位 \\ \cmidrule(l){2-3}
        & 相机 & 游戏术语,特指游戏内的观察区域和视角 \\ \cmidrule(l){2-3}
        & 重工 & 战车工厂(War Factory),《命令与征服\ 红色警戒2:尤里的复仇》游戏中的一种生产建筑,用以生产载具单位 \\ \cmidrule(l){2-3}
        & 战争迷雾 & 游戏术语,《命令与征服\ 红色警戒2:尤里的复仇》中指黑色的未探索区域 \\ \bottomrule
    \end{tabularx}
\end{bupttable}

此处引用了一张图。图\ref{autoencoder_TMP}表示的是一个由含有4个神经元的输入层、含有3个神经元的隐藏层和含有4个神经元的输出层组成的自编码器,$+1$代表偏置项。

%图片宽度设置为文本宽度的75%,可以调整为合适的比例
\buptfigure[width=0.7\textwidth]{pictures/autoencoder}{自编码器结构}{autoencoder_TMP}

%组图示例,已按照指导手册要求设计,由于子图数量不同,无法压缩成\buptfigure那样,大家对照示例即可
\begin{figure}[!htbp]
    \centering
    \subfloat[]{ %[]对齐方式,t为top,b为bottom,留空即可
	\label{Fig:R1} % 子图1标签名
    	\includegraphics[width=0.45\textwidth]{pictures/autoencoder} %插入图片命令,格式为[配置]{图片路径}
    }
    \quad %空格
    \subfloat[]{
	\label{Fig:R2} % 子图2标签名
    	\includegraphics[width=0.45\textwidth]{pictures/autoencoder}
    }
    \caption{这是两个自编码器结构,我就是排一下子图的效果:\protect\subref{Fig:R1}左边的自编码器,\protect\subref{Fig:R2}右边的自编码器} %注意须使用\protect\subref{}进行标号引用
    \label{Fig:RecAccuracy} % 整个组图的标签名
\end{figure}

\section{公式与算法表示}

\subsection{例子:基于主成分分析}

\subsubsection{主成分分析算法}

下面对主成分分析进行介绍。

主成分分析是一种简单的机器学习算法,其功能可以从两方面解释:一方面可以认为它提供了一种压缩数据的方式,另一方面也可以认为它是一种学习数据表示的无监督学习算法。\cite{Goodfellow2016DeepLearning}
通过PCA,我们可以得到一个恰当的超平面及一个投影矩阵,通过投影矩阵,样本点将被投影在这一超平面上,且满足最大可分性(投影后样本点的方差最大化),直观上讲,也就是能尽可能分开。

对中心化后的样本点集$\bm{X}=\{\bm{x}_1,\bm{x}_2,\ldots,\bm{x}_i,\ldots,\bm{x}_m\}$(有$\sum_{i=1}^{m}\bm{x}_i = 0$),考虑将其最大可分地投影到新坐标系\ $\bm{W}= \{\bm{w}_1,\bm{w}_2,\ldots,\bm{w}_i,\ldots,\bm{w}_d\} $,其中$\bm{w}_i$是标准正交基向量,满足$\|\bm{w}_i\|_2 = 1$, $\bm{w}_i^T\bm{w}_j = 0$($i \not= j$)。假设我们需要$d^\prime$($d^\prime < d$)个主成分,那么样本点$\bm{x}_i$在低维坐标系中的投影是$\bm{z}_i = (z_{i1};z_{i2};\ldots;z_{id^\prime})$,其中$z_{ij} = \bm{w}_j^\mathrm{T}\bm{x}_i$,是$\bm{x}_i$在低维坐标系下第$j$维的坐标。
对整个样本集,投影后样本点的方差是
\begin{equation}
\begin{aligned}
    & \frac{1}{m}\sum_{i=1}^m \bm{z}_i^\mathrm{T}\bm{z}_i \\
= & \frac{1}{m}\sum_{i=1}^m (\bm{x}_i^\mathrm{T}\bm{W})^\mathrm{T}(\bm{x}_i^\mathrm{T}\bm{W}) \\
= & \frac{1}{m}\sum_{i=1}^m \bm{W}^\mathrm{T}\bm{x}_i\bm{x}_i^\mathrm{T}\bm{W} \\
= & \frac{1}{m} \bm{W}^\mathrm{T}\bm{X}\bm{X}^\mathrm{T}\bm{W} \\
\end{aligned}
\end{equation}

由于我们知道新坐标系$\bm{W}$的列向量是标准正交基向量,且样本点集$\bm{X}$已经过中心化,则PCA的优化目标可以写为
\begin{equation}
\label{PCA_goal_TMP}
\begin{aligned}
& \max_{\substack{\bm{W}}}  &  tr(\bm{W}^\mathrm{T}\bm{X}\bm{X}^ \mathrm{T}\bm{W}) \\
& \operatorname{ s.t. }  &  \bm{W}^\mathrm{T}\bm{W} = \bm{I} \\
\end{aligned}
\end{equation}

由于$\bm{X}\bm{X}^ \mathrm{ T }$是协方差矩阵,那么只需对它做特征值分解,即
\begin{equation}
\label{PCA_eigenvalue}
\bm{X}^ \mathrm{ T }\bm{X} = \bm{W}\bm{\Lambda}\bm{W}^ \mathrm{ T } \\
\end{equation}
其中$\bm{\Lambda}=diag(\bm{\lambda})$,$\bm{\lambda} = \{\lambda_1,\lambda_2,\ldots,\lambda_m\}$。

具体地,考虑到它是半正定矩阵的二次型,存在最大值,可对\eqref{PCA_goal_TMP}使用拉格朗日乘数法
\begin{equation}
\bm{X}\bm{X}^ \mathrm{ T }\bm{w}_i  = \lambda_i \bm{w}_i \\
\end{equation}

之后将求得的特征值降序排列,取前$d^\prime$个特征值对应的特征向量组成所需的投影矩阵$\bm{W}^\prime =(\bm{w}_1,\bm{w}_2,\ldots,\bm{w}_{d^\prime})$,即可得到PCA的解。PCA算法的描述如算法\ref{PCA_algorithm}所示。

\begin{algorithm} 
	\begin{spacing}{1.3}
		\floatname{algorithm}{算法}
		\caption{主成分分析(PCA)} 
		\label{PCA_algorithm}
		\renewcommand{\algorithmicrequire}{\textbf{输入:}}
		\renewcommand{\algorithmicensure}{\textbf{输出:}} 
		\begin{algorithmic}[1] 
			\Require 样本集$\bm{x}=\{\bm{x}_1,\bm{x}_2,\ldots,\bm{x}_i,\ldots,\bm{x}_m\}$,低维空间维数$d^\prime$ 
			\Ensure 投影矩阵  $\bm{W}^\prime =(\bm{w}_1,\bm{w}_2,\ldots,\bm{w}_{d^\prime})$
			\State 对所有样本中心化$\bm{x}_i \gets \bm{x}_i - \frac{1}{m}\sum_{i=1}^m \bm{x}_i$
			\State  计算样本的协方差$\bm{X}\bm{X}^ \mathrm{T}$
			\State 对协方差矩阵$\bm{X}\bm{X}^ \mathrm{T}$做特征值分解
			\State 取最大的$d^\prime$个特征值所对应的特征向量$\bm{w}_1,\bm{w}_2,\ldots,\bm{w}_{d^\prime}$
		\end{algorithmic}  
	\end{spacing}
\end{algorithm}

\subsubsection{主成分分析可信度评估方法}
记待判定微博$\bm{w}_0$的经典特征向量为$\bm{f}^{c}_{0}$,它的发布者在$\bm{w_0}$前发布的$k$条微博为$\bm{W} = \bm{w}_1,\bm{w}_2,\ldots,\bm{w}_k$,这$k$条微博对应的经典特征向量集为$\bm{F}^{c}_{W} = \{ \bm{f}^{c}_{1},\bm{f}^{c}_{2},\ldots,\bm{f}^{c}_{k} \}$。令$label = 1$代表谣言,$label = 0$代表非谣言。算法的具体流程如算法\ref{PCA_model}所示。

\begin{algorithm}
	\begin{spacing}{1.3}
		\floatname{algorithm}{算法}
		\caption{基于PCA的信息可信度评估} 
		\label{PCA_model}
		\renewcommand{\algorithmicrequire}{\textbf{输入:}}
		\renewcommand{\algorithmicensure}{\textbf{输出:}} 
			\begin{algorithmic}[1] 
				\Require $\bm{f}^{c}_{0}$,$\bm{F}^{c}_{W}$,保留主成分数$n$
				\Ensure 标签$label\in \{0,1\}$
				\State 对所有特征向量应用PCA,保留前$n$个主成分$\bm{o}^{c}_{i} \gets PCA(\bm{f}^{c}_{i}, n)$($i = 0,1,\ldots,k$)
				\State 计算$\bm{F}^{c}_{W}$中各向量的平均距离$\mu$和标准差$\sigma$
				\State 计算阈值$thr = {\mu} / {\sigma}$
				\If {$\min_{1<j\le k} \|\bm{o}^{c}_{0} - \bm{o}^{c}_{j} \|_2 > thr$}
					\State $ label \gets 1 $
				\Else
					\State $ label \gets 0 $
				\EndIf
			\end{algorithmic}
	\end{spacing}
\end{algorithm}

\section{代码表示}

%据悉以下语言被lstlisting支持:Awk, bash, Basi4, C#, C++, C, Delphi, erlang, Fortran, GCL, Haskell, HTML, Java, JVMIS, Lisp, Logo, Lua, make, Mathematica, Matlab, Objective C , Octave, Pascal, Perl, PHP, Prolog,  Python, R, Ruby, SAS, Scilab, sh, SHELXL, Simula, SQL, tcl, TeX, VBScript, Verilog, VHDL, XML, XSLT
%遗憾的是,JavaScript不被支持,请上网搜索支持该语言的方法

\subsection{直接书写代码在.tex中}
下面的代码\ref{plus}是用Python编写的加法函数。

\begin{lstlisting}[language=Python, caption=加法, label=plus, tabsize=2]  
def plusFunc(a, b):
	return a + b 
\end{lstlisting}  

\subsection{引用代码文件}
下面的代码\ref{recursion}是用Python文件中引入的倒序打印$x$到$1$的函数,请查看code文件夹。

\lstinputlisting[language=Python, caption=倒序打印数字, label=recursion, tabsize=2]{code/recursion.py}

\section{列表样式}

\subsection{使用圆点作为项目符号}

\begin{itemize}
\item \textbf{第一章为基础模块示例},是的,本章的名字就是基础模块示例,正如你看到这个样子。
\item \textbf{第二章为不存在},是的,其实它不存在。
\end{itemize}

\subsection{使用数字作为项目符号}

\begin{enumerate}
\item \textbf{第一章为基础模块示例},是的,本章的名字就是基础模块示例,正如你看到这个样子。
\item \textbf{第二章为不存在},是的,其实它不存在。
\end{enumerate}

\subsection{句中数字编号列表样式}

\begin{enumerate*}
    \item \textbf{第一章为基础模块示例},是的,本章的名字就是基础模块示例,正如你看到这个样子;
    \item \textbf{第二章为不存在},是的,其实它不存在。
\end{enumerate*}

\chapter{为了目录撑到第二页}
\section{我不得不再添加一点内容}
\section{尽管这些章节一点正文都没有}
\section{是的}
\section{真的没有}
\section{我已经不知道说什么了}
\section{如果有,我们就祝愿一下学校教务处什么时候转变一下思维}
\section{把控制格式这种事情往前做}
\section{不要总是觉得折磨学生是合理的}
\section{你拿着教学管理岗位的工资}
\section{你需要折磨一下你自己才对}
\section{不要觉得我对别人要求太高,对自己太低}
\section{我对自己要求低的话也不至于想要修订这份模板}
%%%%%%%%%%%%%%%%%%%%%%% Main Area ENDs Here %%%%%%%%%%%%%%%%%%%%%%%%
%\let\cleardoublepage=\cleardoublepagebak

% Reference
\clearpage\phantomsection\addcontentsline{toc}{chapter}{参考文献}
\bibliographystyle{buptbachelor}
\refbodyfont{\bibliography{ref}}

% Thanks to page
\clearpage
\chapter*{致谢}
\phantomsection\addcontentsline{toc}{chapter}{致谢}
\normalsize\thankwords

% Appendix
\setcounter{figure}{0} 
\renewcommand{\thefigure}{~附-\arabic{figure}~}
\setcounter{equation}{0} 
\renewcommand{\theequation}{~附-\arabic{equation}~}
\setcounter{table}{0} 
\renewcommand{\thetable}{~附-\arabic{table}~}
\setcounter{lstlisting}{0} 
\makeatletter
  \renewcommand \thelstlisting
       {附-\@arabic\c@lstlisting}
\makeatother


\chapter*{附录}
\phantomsection\addcontentsline{toc}{chapter}{附录}

\phantomsection\addcontentsline{toc}{section}{附录1\quad{}缩略语表}
\section*{附录1\quad{}缩略语表}

\begin{bupttable}{基于浏览者行为的特征}{crowdwisdom2}
    \begin{tabular}{l|l|l}
        \hline \textbf{特征} & \textbf{描述} & \textbf{形式与理论范围}\\
        \hline 点赞量 & 微博的点赞数量 & 数值,$\mathbb{N}$ \\
        \hline 评论量 & 微博的评论数量 & 数值,$\mathbb{N}$ \\
        \hline 转发量 & 微博的转发数量 & 数值,$\mathbb{N}$ \\
        \hline
    \end{tabular}
\end{bupttable}

\begin{bupttable}{基于浏览者行为的复杂特征}{complexcrowdwisdom2}
    \begin{tabular}{l|l|l|l}
		\hline
        \multicolumn{1}{c|}{\multirow{2}{*}{\textbf{类别}}} & \multicolumn{1}{c|}{\multirow{2}{*}{\textbf{特征}}} & \multicolumn{2}{c}{\textbf{不知道叫什么的表头}} \\
        \cline{3-4}
         & & \multicolumn{1}{c|}{\textbf{描述}} & \multicolumn{1}{c}{\textbf{形式与理论范围}} \\
		\hline
        \multirow{3}{*}{正常互动} & 点赞量 & 微博的点赞数量 & 数值,$\mathbb{N}$ \\
		\cline{2-4}
         & 评论量 & 微博的评论数量 & 数值,$\mathbb{N}$ \\
		\cline{2-4}
         & 转发量 & 微博的转发数量 & 数值,$\mathbb{N}$ \\
		\hline
        非正常互动 & 羡慕量 & 微博的羡慕数量 & 数值,$\mathbb{N}$ \\
        \hline
    \end{tabular}
\end{bupttable}
\buptfigure[width=0.15\textheight]{pictures/autoencoder}{自编码器结构}{autoencoder}

\begin{lstlisting}[language=Python, caption=减法, label=minus, tabsize=2]  
def minusFunc(a, b):
	return a - b 
\end{lstlisting}  

\begin{equation}
\label{PCA_goal}
\begin{aligned}
\max_{\substack{\bm{W}}}  &  tr(\bm{W}^\mathrm{T}\bm{X}\bm{X}^ \mathrm{T}\bm{W})
\end{aligned}
\end{equation}

\clearpage
\phantomsection\addcontentsline{toc}{section}{附录2\quad{}数学符号}
\section*{附录2\quad{}数学符号}
\begin{center}
	\begin{tabular}{ccc}
		\multicolumn{2}{c}{\textbf{数和数组}} \\
		\\
		$a$ & 标量(整数或实数)\\
		$\bm{a}$ & 向量\\
		$dim()$ & 向量的维数\\
		$\bm{A}$ & 矩阵\\
		$\bm{A}^\mathrm{T}$ & 矩阵$\textbf{A}$的转置\\
		$\bm{I}$ & 单位矩阵(维度依据上下文而定) \\
 		$diag(\bm{a})$ & 对角方阵,其中对角元素由向量$\bm{a}$确定 \\

	\end{tabular}
\end{center}


% Translated Article
\newpage\backmatter
\thispagestyle{empty}
\phantomsection\addcontentsline{toc}{chapter}{外文资料}
% 原文第一页,PDF缩放比例为0.95,可以自行调整
\includepdf[pages=1, scale=0.95, pagecommand=\begin{center}\translationtitlefont{外文资料}\end{center}]{docs/translation.pdf}
% 原文剩余部分
\includepdf[pages=2-, scale=0.95]{docs/translation.pdf}

% Translation
\setcounter{chapter}{0}
\renewcommand{\thefigure}{~外\arabic{chapter}-\arabic{figure}~}
\renewcommand{\theequation}{~外\arabic{chapter}-\arabic{equation}~}
\renewcommand{\thetable}{~外\arabic{chapter}-\arabic{table}~}
\renewcommand{\thelstlisting}{~外\arabic{chapter}-\arabic{lstlisting}~}

\begin{center}
\phantomsection\addcontentsline{toc}{chapter}{外文译文}
\translationtitlefont{外文译文}
\end{center}
\vspace{8mm}
\thispagestyle{empty}


\begin{center}
\sanhao\heiti\textbf{真假新闻的在线传播}

\xiaosihao\songti{Soroush Vosoughi, Deb Roy, Sinan Aral}

\xiaosihao\songti{麻省理工学院}
\end{center}

\songti{}
\begingroup % 限制两个let语句的作用范围在外文译文部分
\let\clearpage\relax
\let\cleardoublepage\relax

%以下是排版示例,在这里为了使章节编号不出现在目录中,使用了无编号的样式,代价是这些数字都要自己书写。

\chapter*{第一章\quad{}概述}
%每一个chapter后记得以下两行
\newtranschapter

\section*{1.1\quad{}概述}
决策、合作、通信和市场领域的基础理论全都将对真实或准确度的概念化作为几乎一切人类努力的核心。然而,不论是真实信息还是虚假信息都会于在线媒体上迅速传播。定义什么是真、什么是假成了一种常见的政治策略,而不是基于一些各方同意的事实的争论。我们的经济也难免遭受虚假信息传播的影响。虚假流言会影响股价和大规模投资的动向,例如,在一条声称巴拉克·奥巴马在爆炸中受伤的推文发布后,股市市值蒸发了1300亿美元。的确,从自然灾害到恐怖袭击,我们对一切事情的反应都受到了扰乱。

新的社交网络技术在使信息的传播速度变快和规模变大的同时,也便利了不实信息(即不准确或有误导性的信息)的传播。然而,尽管我们对信息和新闻的获取越来越多地收到这些新技术的引导,但我们仍然对他们在虚假信息传播上的作用知之甚少。尽管媒体对假新闻传播的轶事分析给予了相当多的关注,但仍然几乎没有针对不实信息扩散或其发布源头的大规模实证调查。目前,虚假信息传播的研究仅仅局限于小的、局部的样本的分析上,而这些分析忽略了两个最重要的科学问题:真实信息和虚假信息的传播有什么不同?哪些人类判断中的因素可以解释这些不同?

\begin{equation}
\label{PCA_goal_appx1}
\begin{aligned}
\max_{\substack{\bm{W}}}  &  tr(\bm{W}^\mathrm{T}\bm{X}\bm{X}^ \mathrm{T}\bm{W})
\end{aligned}
\end{equation}

我只是为了把第二章挤到下一页而凑的字。我只是为了把第二章挤到下一页而凑的字。我只是为了把第二章挤到下一页而凑的字。我只是为了把第二章挤到下一页而凑的字。我只是为了把第二章挤到下一页而凑的字。我只是为了把第二章挤到下一页而凑的字。我只是为了把第二章挤到下一页而凑的字。我只是为了把第二章挤到下一页而凑的字。我只是为了把第二章挤到下一页而凑的字。我只是为了把第二章挤到下一页而凑的字。我只是为了把第二章挤到下一页而凑的字。我只是为了把第二章挤到下一页而凑的字。我只是为了把第二章挤到下一页而凑的字s。我只是为了把第二章挤到下一页而凑的字。我只是为了把第二章挤到下一页而凑的字。我只是为了把第二章挤到下一页而凑的字。我只是为了把第二章挤到下一页而凑的字。我只是为了把第二章挤到下一页而凑的字。我只是为了把第二章挤到下一页而凑的字。我只是为了把第二章挤到下一页而凑的字。我只是为了把第二章挤到下一页而凑的字。我只是为了把第二章挤到下一页而凑的字。我只是为了把第二章挤到下一页而凑的字。我只是为了把第二章挤到下一页而凑的字。

\newpage %每一章需要另起一页,为了灵活,我没有把它固定在样式中,你可以根据需求添加分页符
\chapter*{第二章\quad{}我也不知道是什么}
\newtranschapter

新的社交网络技术在使信息的传播速度变快和规模变大的同时,也便利了不实信息(即不准确或有误导性的信息)的传播。然而,尽管我们对信息和新闻的获取越来越多地收到这些新技术的引导,但我们仍然对他们在虚假信息传播上的作用知之甚少。尽管媒体对假新闻传播的轶事分析给予了相当多的关注,但仍然几乎没有针对不实信息扩散或其发布源头的大规模实证调查。目前,虚假信息传播的研究仅仅局限于小的、局部的样本的分析上,而这些分析忽略了两个最重要的科学问题:真实信息和虚假信息的传播有什么不同?哪些人类判断中的因素可以解释这些不同?

新的社交网络技术在使信息的传播速度变快和规模变大的同时,也便利了不实信息(即不准确或有误导性的信息)的传播。然而,尽管我们对信息和新闻的获取越来越多地收到这些新技术的引导,但我们仍然对他们在虚假信息传播上的作用知之甚少。尽管媒体对假新闻传播的轶事分析给予了相当多的关注,但仍然几乎没有针对不实信息扩散或其发布源头的大规模实证调查。目前,虚假信息传播的研究仅仅局限于小的、局部的样本的分析上,而这些分析忽略了两个最重要的科学问题:真实信息和虚假信息的传播有什么不同?哪些人类判断中的因素可以解释这些不同?

新的社交网络技术在使信息的传播速度变快和规模变大的同时,也便利了不实信息(即不准确或有误导性的信息)的传播。然而,尽管我们对信息和新闻的获取越来越多地收到这些新技术的引导,但我们仍然对他们在虚假信息传播上的作用知之甚少。尽管媒体对假新闻传播的轶事分析给予了相当多的关注,但仍然几乎没有针对不实信息扩散或其发布源头的大规模实证调查。目前,虚假信息传播的研究仅仅局限于小的、局部的样本的分析上,而这些分析忽略了两个最重要的科学问题:真实信息和虚假信息的传播有什么不同?哪些人类判断中的因素可以解释这些不同?

\begin{equation}
\label{PCA_goal_appx2}
\begin{aligned}
\max_{\substack{\bm{W}}}  &  tr(\bm{W}^\mathrm{T}\bm{X}\bm{X}^ \mathrm{T}\bm{W})
\end{aligned}
\end{equation}

新的社交网络技术在使信息的传播速度变快和规模变大的同时,也便利了不实信息(即不准确或有误导性的信息)的传播。然而,尽管我们对信息和新闻的获取越来越多地收到这些新技术的引导,但我们仍然对他们在虚假信息传播上的作用知之甚少。尽管媒体对假新闻传播的轶事分析给予了相当多的关注,但仍然几乎没有针对不实信息扩散或其发布源头的大规模实证调查。目前,虚假信息传播的研究仅仅局限于小的、局部的样本的分析上,而这些分析忽略了两个最重要的科学问题:真实信息和虚假信息的传播有什么不同?哪些人类判断中的因素可以解释这些不同?

新的社交网络技术在使信息的传播速度变快和规模变大的同时,也便利了不实信息(即不准确或有误导性的信息)的传播。然而,尽管我们对信息和新闻的获取越来越多地收到这些新技术的引导,但我们仍然对他们在虚假信息传播上的作用知之甚少。尽管媒体对假新闻传播的轶事分析给予了相当多的关注,但仍然几乎没有针对不实信息扩散或其发布源头的大规模实证调查。目前,虚假信息传播的研究仅仅局限于小的、局部的样本的分析上,而这些分析忽略了两个最重要的科学问题:真实信息和虚假信息的传播有什么不同?哪些人类判断中的因素可以解释这些不同?

新的社交网络技术在使信息的传播速度变快和规模变大的同时,也便利了不实信息(即不准确或有误导性的信息)的传播。然而,尽管我们对信息和新闻的获取越来越多地收到这些新技术的引导,但我们仍然对他们在虚假信息传播上的作用知之甚少。尽管媒体对假新闻传播的轶事分析给予了相当多的关注,但仍然几乎没有针对不实信息扩散或其发布源头的大规模实证调查。目前,虚假信息传播的研究仅仅局限于小的、局部的样本的分析上,而这些分析忽略了两个最重要的科学问题:真实信息和虚假信息的传播有什么不同?哪些人类判断中的因素可以解释这些不同?

\endgroup

% 开题报告
\blankmatter
\phantomsection\addcontentsline{toc}{chapter}{开题报告}
\includepdf[pages=-]{docs/openingReport.pdf}

% 中期检查表
\blankmatter
\phantomsection\addcontentsline{toc}{chapter}{中期检查表}
\includepdf[pages=-]{docs/interimReport.pdf}

% 教师指导毕业设计(论文)记录表
\blankmatter
\phantomsection\addcontentsline{toc}{chapter}{教师指导毕业设计(论文)记录表}
\includepdf[pages=-]{docs/guidance.pdf}

\end{document}


================================================
FILE: ref.bib
================================================
% (1)专著中的文献
% [序号] 作者.专著名称.版本(第1版不加标注).出版者.出版年:参考页码.

@book{唐绪军2013中国新媒体发展报告,
  title={中国新媒体发展报告No.4(2013)},
  author={唐绪军 and 吴信训 and 黄楚新 and 刘瑞生},
  publisher={社会科学文献出版社},
  year={2013},
  language = {Chinese}
}

@book{唐绪军2015中国新媒体发展报告,
  title={中国新媒体发展报告No.6(2015)},
  author={唐绪军 and 吴信训 and 黄楚新 and 刘瑞生},
  publisher={社会科学文献出版社},
  year={2015},
  language = {Chinese}
}

@book{Kimmel2004Rumors,
  title={Rumors and Rumor Control: A Manager's Guide to Understanding and Combatting Rumors},
  author={Kimmel, Allan J},
  publisher={Lawrence Erlbaum Associates},
  year={2004}
}

@book{Goodfellow2016DeepLearning,
 author = {Goodfellow, Ian and Bengio, Yoshua and Courville, Aaron},
 title = {Deep Learning},
 year = {2016},
 publisher = {The MIT Press},
} 


% (2)期刊中的文献
% [序号] 作者.文献名称.期刊名称.卷号(期号).年,月:页码范围.
@article{false_news_spread_2018,
  title={The spread of true and false news online},
  author={Vosoughi, Soroush and Roy, Deb and Aral, Sinan},
  journal={Science},
  volume={359},
  number={6380},
  pages={1146-1151},
  year={2018},
  month={3}
}


@article{Difonzo2007Rumor,
  title={Rumor psychology: Social and organizational approaches.},
  author={Difonzo, Nicholas and Bordia, Prashant},
  journal={American Psychological Association},
  year={2007}
}

@article{Bengio2006A,
  title={A neural probabilistic language model.},
  author={Bengio, Yoshua and Ducharme, Réjean and Vincent, Pascal and Jauvin, Christian and Kandola, Jaz and Hofmann, Thomas and Poggio, Tomaso and Shawetaylor, John},
  journal={Journal of Machine Learning Research},
  volume={3},
  number={6},
  pages={1137-1155},
  year={2006},
}

@article{Rumerlhar1986Learning,
  title={Learning representation by back-propagating errors},
  author={Rumerlhar, D. E},
  journal={Nature},
  volume={323},
  number={3},
  pages={533-536},
  year={1986},
}

% 以下类型未在bst文件中验证过,如果需要请自行修改bst文件……

% (3)论文集
% [序号] 作者.论文题目.见(英文用In).主编.论文集名.出版地.出版年:页码范围.
% 本模板没有实现“主编”部分,因为“见”和“论文集名”分离实在是很诡异的事情,且很多事情我们得到的bibTeX不含主编
% 中文需要加language={Chinese}字段,才会把"In"换成"见"
@inproceedings{Yang2012Automatic,
  title={Automatic detection of rumor on Sina Weibo},
  author={Yang, Fan and Liu, Yang and Yu, Xiaohui and Yang, Min},
  booktitle={Proceedings of the ACM SIGKDD Workshop on Mining Data Semantics},
  pages={1--7},
  year={2012},
  address = {New York, NY, USA},
  organization={ACM},
}

% (4)学位论文(格式已验证)
% [序号] 作者.题目.[学位论文](英文用[Dissertation]).保存地点.保存单位:年份.
% 中文需要使用language={Chinese}字段,英文输入language={}
@masterthesis{周兴2017基于深度学习的谣言检测及模式挖掘,
  title={基于深度学习的谣言检测及模式挖掘},
  author={周兴},
  school={中国科学院大学},
  year={2017},
  language={Chinese}
}


% (5)专利
% [序号] 专利申请者.题目.国别.专利文献种类.专利号.批准日期.

% (6)技术标准
% [序号] 起草责任者.标准代号.标准顺序号-发布年.标准名称.出版地.出版者.出版年度.


%(7)在线资料

@ELECTRONIC{webster_social_media,
  title = {Social Media},
  organization = {Merriam-Webster},
  year = {2018},
  howpublished = {online},
  refdate = {2018-04-15},
  url = {http://www.merriam-webster.com/dictionary/social media},
} 

@ELECTRONIC{digital_in_2018,
  title = {Digital in 2018: World's Internet Users Pass the 4 Billion Mark},
  organization = {We Are Social},
  year = {2018},
  howpublished = {online},
  refdate = {2018-04-15},
  url = {https://wearesocial.com/uk/blog/2018/01/global-digital-report-2018},
} 

@ELECTRONIC{pew_news_use_2017,
  title = {News Use Across Social Media Platforms 2017},
  organization = {Pew Research Center},
  year = {2017},
  howpublished = {online},
  refdate = {2018-04-15},
  url = {http://www.journalism.org/2017/09/07/news-use-across-social-media-platforms-2017},
} 

@ELECTRONIC{internet_news_2016,
  title = {2016年中国互联网新闻市场研究报告},
  organization = {中国互联网络信息中心},
  year = {2017},
  howpublished = {online},
  refdate = {2018-04-15},
  url = {http://www.cnnic.cn/hlwfzyj/hlwxzbg/mtbg/201701/P020170112309068736023.pdf},
  language = {Chinese}
} 

%(8)不属于任何上述类别的资料,指导手册中无规定,使用默认设置
@misc{thulac,
  author = {Sun, Maosong and Chen, Xinxiong and Zhang, Kaixu and Guo, Zhipeng and Liu, Zhiyuan},
  title = {THULAC: An Efficient Lexical Analyzer for Chinese},
  year = {2016}
}
Download .txt
gitextract_mr4pof22/

├── .gitignore
├── BUPTthesisbachelor.sty
├── Expired.md
├── LICENSE
├── README.md
├── abstract.cfg
├── abstract.tex
├── buptbachelor.bst
├── code/
│   └── recursion.py
├── docs/
│   ├── cover.docx
│   ├── guidance.docx
│   ├── interimReport.docx
│   ├── openingReport.docx
│   ├── scoreTable.docx
│   ├── statement.docx
│   └── task.docx
├── guidebook/
│   └── README.md
├── main.cfg
├── main.tex
└── ref.bib
Download .txt
SYMBOL INDEX (1 symbols across 1 files)

FILE: code/recursion.py
  function numbers (line 1) | def numbers(x):
Condensed preview — 20 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (141K chars).
[
  {
    "path": ".gitignore",
    "chars": 372,
    "preview": "## Core latex/pdflatex auxiliary files:\n*.aux\n*.lof\n*.log\n*.lot\n*.fls\n*.out\n*.toc\n*.fmt\n*.fot\n*.cb\n*.cb2\n.*.lb\n\n## Bibli"
  },
  {
    "path": "BUPTthesisbachelor.sty",
    "chars": 14621,
    "preview": "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%                                                  "
  },
  {
    "path": "Expired.md",
    "chars": 522,
    "preview": "## 问卷调查\n如果你使用了本模板完成北京邮电大学本科毕业设计,**请填写以下问卷**,以帮助开源者获得更有效的反馈,谢谢。\nhttps://wj.qq.com/s/2116666/6661\n\n## BTW\n欢迎大家去顶在北邮人论坛推广本项"
  },
  {
    "path": "LICENSE",
    "chars": 1064,
    "preview": "MIT License\n\nCopyright (c) 2018 sqyx008\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
  },
  {
    "path": "README.md",
    "chars": 5915,
    "preview": "# 北京邮电大学本科学士学位论文模板(本科毕业设计模板)\n* 作者: Caspar Zhang    <casparant@gmail.com>\n* 修改: Bing Hsu        <hello@antinucleon.com>\n*"
  },
  {
    "path": "abstract.cfg",
    "chars": 2065,
    "preview": "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%                                                  "
  },
  {
    "path": "abstract.tex",
    "chars": 2842,
    "preview": "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%                                                  "
  },
  {
    "path": "buptbachelor.bst",
    "chars": 51770,
    "preview": "%% BUPTThesis.bst\n%%\n%% 北京邮电大学研究生学位论文参考文献 BibTeX 样式\n%% \n%% 项目主页:http://code.google.com/p/buptthesis/\n%% \n%% 本样式基于 IEEEtr"
  },
  {
    "path": "code/recursion.py",
    "chars": 68,
    "preview": "def numbers(x):\n    if x > 0:\n        print(x)\n        numbers(x-1)\n"
  },
  {
    "path": "guidebook/README.md",
    "chars": 2322,
    "preview": "# 用户手册\n\n这里是关于使用本模版的详细指导。\n\n## 编译与编辑\n\n完成 LaTeX 的环境安装后,即可在不同的编辑器中编辑、编译文档。\n\n### VSCode\n\n#### 安装扩展 `Latex Workshop`\n\n首先,在 VSC"
  },
  {
    "path": "main.cfg",
    "chars": 1573,
    "preview": "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%                                                  "
  },
  {
    "path": "main.tex",
    "chars": 18172,
    "preview": "\\def\\thelstlisting{}\n\n%不需要区分奇偶页的请使用下面一行\n\\documentclass[a4paper,AutoFakeBold,oneside,12pt]{book}\n%需要区分奇偶页的(即每一章第一页一定在奇数页上"
  },
  {
    "path": "ref.bib",
    "chars": 4046,
    "preview": "% (1)专著中的文献\n% [序号] 作者.专著名称.版本(第1版不加标注).出版者.出版年:参考页码.\n\n@book{唐绪军2013中国新媒体发展报告,\n  title={中国新媒体发展报告No.4(2013)},\n  author={唐"
  }
]

// ... and 7 more files (download for full content)

About this extraction

This page contains the full source code of the BYRIO/BUPTBachelorThesis GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 20 files (102.9 KB), approximately 39.9k tokens, and a symbol index with 1 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!