Skip to content
Permalink
Browse files

adjust number style of code, set number of code in appendix & add bet…

…ter examples
  • Loading branch information...
sqyx008 committed Jun 6, 2018
1 parent e5135fa commit 22dd51d84e56a9b40c1058b8129108f80b4b8f72
Showing with 44 additions and 6 deletions.
  1. +10 −1 BUPTthesisbachelor.sty
  2. +4 −0 README.md
  3. +4 −0 code/recursion.py
  4. BIN main.pdf
  5. +26 −5 main.tex
@@ -277,7 +277,6 @@ pdfborder=001, linkcolor=black, citecolor=black, urlcolor=black]{hyperref}
% Code
\usepackage{listings}
\usepackage{xcolor}
\renewcommand{\lstlistingname}{\kaishu{代码}}
\lstset{
basicstyle=\ttfamily\wuhao, %五号等宽字体
extendedchars=true,
@@ -293,6 +292,7 @@ pdfborder=001, linkcolor=black, citecolor=black, urlcolor=black]{hyperref}
basewidth={0.5em,0.35em},
frame=single, %单线边框,注释掉则无边框
numbers=left, %行号位于左侧
numberbychapter=true,
% xleftmargin=.5em,
% xrightmargin=.5em,
% aboveskip=1ex,
@@ -301,6 +301,15 @@ pdfborder=001, linkcolor=black, citecolor=black, urlcolor=black]{hyperref}
escapeinside={\%*}{*)}
}

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


% insert PDF
\usepackage[final]{pdfpages}

@@ -46,6 +46,7 @@ https://wj.qq.com/s/2116666/6661</font>
- 新增区分奇偶页与否的配置选择(6/4)
- 修正外文译文的页面样式问题(6/4)
- 重整外文译文的图、表、公式编号(6/4)
- 代码编号统一为图标编号样式,添加附录代码编号设置;增添代码文件引入示例(6/6)
## 系统需求
@@ -63,6 +64,9 @@ https://wj.qq.com/s/2116666/6661</font>

(感谢<a href="https://github.com/MrAdonis">Li Jiarong</a>提供)

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

## 如何使用

### 编辑以下文件
@@ -0,0 +1,4 @@
def numbers(x):
if x > 0:
print(x)
numbers(x-1)
BIN +1.45 KB (100%) main.pdf
Binary file not shown.
@@ -1,7 +1,9 @@
\def\thelstlisting{}

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

@@ -224,13 +226,21 @@ \subsubsection{主成分分析可信度评估方法}
\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不被支持,请上网搜索支持该语言的方法

下面的代码\ref{plus}是用Python编写的加法函数。

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

下面的代码\ref{recursion}是用Python文件中引入的倒序打印$x$$1$的函数。

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

\section{列表样式}

以下是使用圆点作为项目符号的列表样式。
@@ -273,6 +283,12 @@ \chapter*{致\qquad{}谢}
\renewcommand{\theequation}{~附-\arabic{equation}~}
\setcounter{table}{0}
\renewcommand{\thetable}{~附-\arabic{table}~}
\setcounter{lstlisting}{0}
\makeatletter
\renewcommand \thelstlisting
{附-\@arabic\c@lstlisting}
\makeatother


\chapter*{附\qquad{}录}
\phantomsection\addcontentsline{toc}{chapter}{附\qquad{}录}
@@ -308,7 +324,12 @@ \section*{附录1\quad{}缩略语表}
\hline
\end{tabular}
\end{bupttable}
\buptfigure[width=0.2\textheight]{pictures/autoencoder}{自编码器结构}{autoencoder}
\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}

0 comments on commit 22dd51d

Please sign in to comment.
You can’t perform that action at this time.