Skip to content

Commit

Permalink
Merge pull request #87 from BITNP/paper-translation
Browse files Browse the repository at this point in the history
Regular Maintainance: year 2021.
  • Loading branch information
fky2015 authored Sep 10, 2021
2 parents dda3abf + 71cda67 commit 12f7e1b
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
template: [graduation-thesis, proposal-report, lab-report]
template: [graduation-thesis, proposal-report, lab-report, paper-translation]

steps:
- name: Checkout to BIThesis-scaffold
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,11 @@ clean-dist:
clean-all: clean clean-dist FORCE_MAKE


copy:
copy: cls
cp bitbook.cls $(SCAFFOLDDIR)/graduation-thesis
cp bitart.cls $(SCAFFOLDDIR)/lab-report
cp bitart.cls $(SCAFFOLDDIR)/proposal-report
cp bitbook.cls $(SCAFFOLDDIR)/paper-translation

dev:
ls bithesis.dtx | entr -s 'yes y | make doc && make copy'
Expand All @@ -56,4 +57,6 @@ pkg: doc
rm -rf ./bithesis
mkdir bithesis
cp bithesis.{ins,dtx,pdf} *.md ./bithesis
mv ./bithesis/README.md ./bithesis/README-zh.md
mv ./bithesis/README-en.md ./bithesis/README.md
zip -r bithesis.zip bithesis
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

📖 [_非官方本科生毕业设计毕业论文 LaTeX 模板(以及更多)_](https://bithesis.bitnp.net)

![BIThesis](./assets/bithesis_badge_solid.svg)
![GitHub all releases](https://img.shields.io/github/downloads/BITNP/BIThesis/total)
[![English version](./assets/english.svg)](./README-en.md)
[![Latexmk](https://badgen.net/badge/compiler/Latexmk?color=blue&labelColor=2b2b2b)](https://mg.readthedocs.io/latexmk.html)
[![License](https://badgen.net/github/license/BITNP/BIThesis?color=008080&labelColor=2b2b2b)](./LICENSE)
Expand All @@ -21,8 +21,6 @@

BIThesis 是针对北京理工大学本科同学毕业设计、毕业论文制作的一个非官方的 LaTeX 模板,BIThesis 同时也包括其他本科学习中涉及到的文献综述、实验报告等的 LaTeX 模板。

**我们正在对项目持续更新!目前,你完全可以使用现有的版本开始你的毕业设计开题报告的写作;不过与此同时,我们也在持续推进代码的升级和更新(主要是不影响使用的底层逻辑)。更多开发计划请访问我们的 [Roadmap](https://github.com/BITNP/BIThesis/projects)。想帮助这个项目持续前进?参见我们的[贡献者指南](./contributing-zh.md)**

> 本项目获得了 [北京理工大学教务部](http://jwc.bit.edu.cn/)[北京理工大学计算机学院](http://cs.bit.edu.cn/) 的认可、背书与大力支持。详见:[致谢 - 官方赞助](https://bithesis.bitnp.net/Guide/5-Acknowledgements/Acknowledgements.html#%E5%AE%98%E6%96%B9%E8%B5%9E%E5%8A%A9-official-sponsors)
<h2>Slack 社区</h2>
Expand Down Expand Up @@ -86,11 +84,12 @@ ls bithesis.dtx | entr -s 'yes -y y | make doc && make copy'

| CI | Build status |
| :------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| GitHub Release | ![GitHub Release](https://github.com/BITNP/BIThesis/workflows/Release/badge.svg?branch=master) |
| Netlify Deploy | [![Netlify Status](https://api.netlify.com/api/v1/badges/81f7b49b-59a1-46bc-ba52-02f8be71d247/deploy-status)](https://app.netlify.com/sites/vigorous-hoover-a697eb/deploys) |
| GitHub Release | [![GitHub release (latest by date)](https://img.shields.io/github/v/release/BITNP/BIThesis?style=flat-square)](https://github.com/BITNP/BIThesis/releases) |
| Vercel Deploy | [![Vercel Status](https://img.shields.io/github/deployments/fky2015/BIThesis-wiki/production?label=vercel&style=flat-square)](https://vercel.com/fkynjyq/bithesis-wiki/deployments) |


---

📖 **BIThesis** ©BITNP/BIThesis. Released under the [LaTeX Project Public License](LICENSE).

Authored by Spencer Woo. Maintained with help from [contributors](https://github.com/BITNP/BIThesis/graphs/contributors).
Maintained with help from [contributors](https://github.com/BITNP/BIThesis/graphs/contributors).
88 changes: 82 additions & 6 deletions bithesis.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
%<cls>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<book>\ProvidesClass{bitbook}
%<article>\ProvidesClass{bitart}
%<cls> [2021/01/06 v1.0.1 BIT Thesis Templates]
%<cls> [2021/09/07 v1.1.0 BIT Thesis Templates]
%
%<*driver>
\ProvidesFile{bithesis.dtx}[2021/01/06 1.0.1 BIT Thesis Templates]
\ProvidesFile{bithesis.dtx}[2021/09/07 1.1.0 BIT Thesis Templates]
\documentclass{ltxdoc}
\usepackage{dtx-style}

Expand Down Expand Up @@ -126,6 +126,7 @@
% \item 在此期间,冯开宇将原来的 .tex 文件制作成了宏包,并发布到 CTAN 上。
% \item 项目代码也随之被拆分成了 \BIThesisMacroPackage,\BIThesisWiki 和 \BIThesisScaffold。
% \end{itemize}
% \item 2021 - 2022 年,2021 级(硕士研究生)的冯开宇针对 2021 年毕业季收到的反馈对该项目进行维护升级(前向兼容)。
% \end{itemize}
% \subsection{\BIThesis 是什么?}
% \BIThesis 之名是英文单词 Beijing Institution of Technology(北京理工大学)的首字母缩写“BIT” 与“Thesis”结合而成。在纯文本环境下,该名字应写作“BIThesis”。
Expand Down Expand Up @@ -203,16 +204,33 @@
% \end{macrocode}
% \begin{macrocode}

% 目前只有本科的模板,但仍旧要为可能预留空间。
\newif\if@bit@bachelor
\newif\if@bit@docTranslation
\newif\if@bit@master
\newif\if@bit@docter

\RequirePackage{kvoptions}

\SetupKeyvalOptions{
family=BIThesis,
prefix=BIThesis@
}

\DeclareStringOption[14pt]{footskip}
\DeclareBoolOption{titleNumberHeiti}
\ProcessKeyvalOptions*


\DeclareOption{bachelor}{\@bit@bachelortrue}
\DeclareOption{translation}{\@bit@docTranslationtrue}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{ctexbook}}

\ExecuteOptions{bachelor}

\ProcessOptions\relax


\LoadClass[UTF8,AutoFakeBold,AutoFakeSlant,zihao=-4,oneside,openany]{ctexbook}

\RequirePackage[a4paper,left=3cm,right=2.6cm,top=3.5cm,bottom=2.9cm]{geometry}
Expand All @@ -236,6 +254,9 @@
\RequirePackage{amsmath}
\RequirePackage{amssymb}
\RequirePackage{pdfpages}
\RequirePackage{listings}

%\PackageError{zzzz}{Main \BIThesis@footskip hellp}{test}

% 设置参考文献编译后端为 biber,引用格式为 GB/T7714-2015 格式
% 参考文献使用宏包见 https://github.com/hushidong/biblatex-gb7714-2015
Expand All @@ -260,14 +281,20 @@
\setCJKfamilyfont{xihei}[AutoFakeBold,AutoFakeSlant]{[STXIHEI.TTF]} % 若希望使用本机字体,也可以用 {STXihei} 来调用
\newcommand{\xihei}{\CJKfamily{xihei}}

\ifBIThesis@titleNumberHeiti
\newcommand{\arabicHeiti}[1]{\xeCJKsetup{CJKspace=true}\xeCJKDeclareCharClass{CJK}{`0 -> `9}{\heiti\raisebox{-0.1ex}{#1}}\normalspacedchars{0,1,2,3,4,5,6,7,8,9}\xeCJKsetup{CJKspace=false}}
\else
\newcommand{\arabicHeiti}[1]{#1}
\fi



% 主题页面格式:BIThesis
\fancypagestyle{BIThesis}{
% 页眉高度
\setlength{\headheight}{20pt}
% 页码高度(不完美,比规定稍微靠下 2mm)
\setlength{\footskip}{14pt}
\setlength{\footskip}{\BIThesis@footskip}

\fancyhf{}
% 定义页眉、页码
Expand All @@ -277,11 +304,29 @@
\renewcommand{\headrulewidth}{0.6pt}
}

\if@bit@docTranslation
% 主题页面格式:BIThesis
\fancypagestyle{BIThesis}{
% 页眉高度
\setlength{\headheight}{20pt}
% 页码高度(不完美,比规定稍微靠下 2mm)
\setlength{\footskip}{\BIThesis@footskip}

\fancyhf{}
% 定义页码
\fancyfoot[C]{\songti\zihao{5} \thepage}
% 页眉分割线稍微粗一些
\renewcommand{\headrulewidth}{0.6pt}

% 定义页眉
\fancyhead[C]{\zihao{4}\ziju{0.08}\songti{北京理工大学本科生毕业设计(论文)外文翻译}}
}
\fi
% 设置章节格式
% 一级标题:黑体,三号,加粗;间距:段前 0.5 行,段后 1 行;
\ctexset{chapter={
name = {第,章},
number = {\arabic{chapter}},
number = {\arabicHeiti{ \arabic{chapter} }},
format = {\heiti \bfseries \centering \zihao{3}},
aftername = \hspace{9bp},
pagestyle = BIThesis,
Expand All @@ -293,7 +338,7 @@

% 二级标题:黑体,四号,加粗;间距:段前 0.5 行,段后 0 行;
\ctexset{section={
number = {\thechapter.\hspace{4bp}\arabic{section}},
number = {\arabicHeiti{\thechapter.\hspace{1bp}\arabic{section}}},
format = {\heiti \raggedright \bfseries \zihao{4}},
aftername = \hspace{8bp},
beforeskip = 20bp plus 1ex minus .2ex,
Expand All @@ -304,7 +349,7 @@

% 三级标题:黑体、小四、加粗;间距:段前 0.5 行,段后 0 行;
\ctexset{subsection={
number = {\thechapter.\hspace{3bp}\arabic{section}.\hspace{3bp}\arabic{subsection}},
number = {\arabicHeiti{\thechapter.\hspace{1bp}\arabic{section}.\hspace{1bp}\arabic{subsection}}},
format = {\heiti \bfseries \raggedright \zihao{-4}},
aftername = \hspace{7bp},
beforeskip = 17bp plus 1ex minus .2ex,
Expand Down Expand Up @@ -354,6 +399,37 @@
\renewcommand{\thefigure}{\thechapter-\arabic{figure}}
\captionsetup[figure]{font=small,labelsep=space}

% 设置 listings 源代码高亮的格式
\AtBeginDocument{
\renewcommand{\lstlistingname}{代码}
\renewcommand{\thelstlisting}{\arabic{chapter}-\arabic{lstlisting}}
}

\definecolor{codegreen}{rgb}{0,0.6,0}
\definecolor{codegray}{rgb}{0.5,0.5,0.5}
\definecolor{codepurple}{rgb}{0.58,0,0.82}
\definecolor{backcolour}{rgb}{0.95,0.95,0.92}
\lstdefinestyle{examplestyle}{
backgroundcolor=\color{backcolour},
commentstyle=\color{codegreen},
keywordstyle=\color{magenta},
numberstyle=\tiny\color{codegray},
stringstyle=\color{codepurple},
basicstyle=\ttfamily\footnotesize,
breakatwhitespace=false,
breaklines=true,
captionpos=b,
keepspaces=true,
numbers=left,
numbersep=5pt,
showspaces=false,
showstringspaces=false,
showtabs=false,
tabsize=2
}
\lstset{style=examplestyle}


% 设置表格的 caption 格式和 caption 与 table 之间的垂直距离
\renewcommand{\thetable}{\thechapter-\arabic{table}}
\captionsetup[table]{font=small,labelsep=space,skip=2pt}
Expand Down

0 comments on commit 12f7e1b

Please sign in to comment.