summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/bjfuthesis/bjfuthesis.cls
blob: ed02764f983dfa499b1cd1d0d54db18ab63948cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
%
% Copyright 2021 Liu Changxin <liuchx@hotmail.com> 
%
% Licensed under the GNU General Public License v3.0 (the "License");
% you may not use this file except in compliance with the License.
% You may obtain a copy of the License at
%
%     https://www.gnu.org/licenses/gpl-3.0.html
%
% Unless required by applicable law or agreed to in writing, software
% distributed under the License is distributed on an "AS IS" BASIS,
% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
% See the License for the specific language governing permissions and
% limitations under the License.
%

\NeedsTeXFormat{LaTeX2e}[2020/10/01]
\newcommand*\@iflatexlater{\@ifl@t@r\fmtversion}
\@iflatexlater{2020/10/01}{}{\ClassError{bjfuthesis}{The version of LaTeX you installed does not meet the minimum version requirements}}
\RequirePackage{iftex}
\ifXeTeX\else\ClassError{bjfuthesis}{XeLaTeX is required to compile this document}\fi
\def\header@text{北京林业大学本科毕业论文}
\def\keywords@label@zh{关键词:}
\def\keywords@label@en{Keywords: }
\def\chartnote@label{注:}
\ProvidesClass{bjfuthesis}[2021/05/30 LaTeX document style for BJFU thesis]
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{ctexbook}}
\ProcessOptions*
\LoadClass[a4paper,oneside,fontset=none]{ctexbook}
\RequirePackage{pdfpages,graphicx}
\graphicspath{{figures/}}
\RequirePackage{silence,bicaption}
\DeclareCaptionFormat{bjfucaption}{\textbf{\fontsize{9}{21}\selectfont#1#2#3}}
\captionsetup{format=bjfucaption,skip=0pt,labelsep=space}
\captionsetup[figure][bi-second]{name=Figure}
\captionsetup[table][bi-second]{name=Table}
\RequirePackage{amsmath}
\setlength\voffset{-10.4mm}
\setlength\topmargin{0mm}
\setlength\textheight{242mm}
\setlength\footskip{10mm}
\setlength\textwidth{155mm}
\setlength\oddsidemargin{4.6mm}
\setlength{\fboxsep}{0pt}
\setlength{\fboxrule}{1pt}
\setmainfont{Times New Roman}
\setCJKmainfont[AutoFakeBold]{SimSun}
\setCJKmonofont{SimSun}
\newCJKfontfamily\kaiti{KaiTi}
\linespread{1}
\emergencystretch=1em
\RequirePackage{amssymb}
\renewcommand\fps@figure{htbp}
\renewcommand\fps@table{htbp}
\WarningFilter*{latex}{Text page \thepage\space contains only floats}
\NewCommandCopy\oldfigure\figure
\def\figure{\@ifnextchar[\figure@i \figure@ii}
\def\figure@i[#1]{\oldfigure[#1]\centering}
\def\figure@ii{\oldfigure\centering}
\NewCommandCopy\oldtable\table
\def\table{\@ifnextchar[\table@i \table@ii}
\def\table@i[#1]{\oldtable[#1]\centering}
\def\table@ii{\oldtable\centering}
\RequirePackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[C]{\fontsize{9}{12}\selectfont \header@text}
\fancyfoot[C]{\thepage}
\renewcommand\headrulewidth{.5pt}
\fancypagestyle{plain}{\fancyhead[C]{\fontsize{9}{12}\selectfont\header@text}\renewcommand\headrulewidth{.5pt}}
\renewcommand\floatpagefraction{1}
\RequirePackage{titlesec}
\titleformat{\chapter}{\centering\fontsize{16}{30}\bfseries}{\thechapter}{.5em}{}
\titleformat{\section}{\fontsize{14}{37}\bfseries}{\thesection}{.5em}{}
\titleformat{\subsection}{\fontsize{12}{21}\bfseries}{\thesubsection}{.5em}{}
\titlespacing{\chapter}{0pt}{0pt}{10pt}
\titlespacing{\section}{0pt}{0pt}{3pt}
\titlespacing{\subsection}{0pt}{0pt}{0pt}
\RequirePackage{booktabs}
\RequirePackage{titletoc}
\ctexset{chapter/number=\arabic{chapter},chapter/name={}}
\titlecontents{chapter}[0em]{\fontsize{10.5}{21}\bfseries}{\thecontentslabel~}{\thecontentslabel}{\hspace{.5em}\titlerule*{.}\contentspage}
\titlecontents{section}[1em]{\fontsize{10.5}{21}}{\thecontentslabel~}{\thecontentslabel}{\hspace{.5em}\titlerule*{.}\contentspage}
\titlecontents{subsection}[2em]{\fontsize{10.5}{21}}{\thecontentslabel~}{\thecontentslabel}{\hspace{.5em}\titlerule*{.}\contentspage}
\RequirePackage[hidelinks]{hyperref}
\RequirePackage[gbpub=false,style=gb7714-2015]{biblatex}
\addbibresource{bibliography.bib}
\renewcommand\topfraction{1}
\renewcommand\bottomfraction{1}
\renewcommand\textfraction{0}
\newenvironment{abstract}{\kaiti}{\vskip \baselinestretch\baselineskip\par}
\newcommand\keywordscn[1]{\noindent\fontsize{12}{21}\selectfont\textbf{\keywords@label@zh}#1\par}
\newcommand\keywordsen[1]{\noindent\fontsize{12}{21}\selectfont\textbf{\keywords@label@en}#1\par}
\NewCommandCopy\oldfrontmatter\frontmatter
\renewcommand\frontmatter{\IfFileExists{cover.pdf}{\includepdf[pages={1-2}]{cover.pdf}}{\typeout{!! cover.pdf not found}\ClassWarning{bjfuthesis}{cover.pdf not found}}\oldfrontmatter\renewcommand\thepage{\Roman{page}}\fontsize{12}{21}\selectfont}
\NewCommandCopy\oldmainmatter\mainmatter
\renewcommand\mainmatter{\oldmainmatter\fontsize{12}{21}\selectfont}
\newcommand\chartnote[1]{\fontsize{9}{21}\selectfont\\\begin{flushleft}\chartnote@label#1\end{flushleft}}
\NewCommandCopy\oldbackmatter\backmatter
\renewcommand\backmatter{\oldbackmatter\fontsize{10.5}{21}\selectfont}
\NewCommandCopy\oldprintbibliography\printbibliography
\renewcommand\printbibliography{\oldprintbibliography[heading=bibintoc]}
\endinput