-
Notifications
You must be signed in to change notification settings - Fork 8
/
format-biblatex-zh-cn.sty
110 lines (94 loc) · 3.07 KB
/
format-biblatex-zh-cn.sty
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
104
105
106
107
108
109
110
% formats and patches for biblatex-zh-cn
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{format-biblatex-zh-cn}
\RequirePackage{etoolbox}
\RequirePackage{ltxdockit}
\RequirePackage{hologo}
% set Chinese formats
\RequirePackage[UTF8, scheme=chinese, heading=false]{ctex}
\RequirePackage{indentfirst}
\RequirePackage[xindy]{glossaries}
\RequirePackage{glossary-longragged}
\newglossary[glg2]{trans}{gls2}{glo2}{中英文术语对照表}
\makeglossaries
\loadglsentries{biblatex-localcnstring}
% scheme=chinese 的默认设置
%\ctexset{listtablename=表格, tablename=表}%还是用两个字和目录两字对应
% 取消 babel 宏包,low"=level等表述由以下代码实现,见 ltxdockit.cfg, line 17
%\catcode`\'=12 \catcode`\"=\active \lccode`\"=`\'
%\def"#1{\ifx#1=\penalty\@M-\hskip\z@skip\else\char`\"#1\fi}
% environment patches for btxdockit.sty
\renewenvironment*{fieldlist}
{\list{}{%
\setlength{\labelwidth}{\marglistwidth}%
\setlength{\labelsep}{\marglistsep}%
\setlength{\leftmargin}{0pt}%
\renewcommand*{\makelabel}[1]{\hss\marglistfont##1}}%
\def\fielditem##1##2{%
\item[##1]%
\ltd@pdfbookmark{##1}{##1}%
\Field (##2)\par\nobreak
\vspace{\itemsep}}%
\def\listitem##1##2{%
\item[##1]%
\ltd@pdfbookmark{##1}{##1}%
\ListName (##2)\par\nobreak
\vspace{\itemsep}}}
{\endlist}
\renewenvironment*{typelist}
{\list{}{%
\setlength{\labelwidth}{\marglistwidth}%
\setlength{\labelsep}{\marglistsep}%
\setlength{\leftmargin}{0pt}%
\renewcommand*{\makelabel}[1]{\hss\marglistfont##1}}%
\def\typeitem##1{%
\item[{##1}]%
\ltd@pdfbookmark{##1}{##1}}%
\def\reqitem{%
\par\begingroup\itemsep0.5\itemsep\item
\RequireFields\btd@fieldloop}
\def\optitem{%
\par\begingroup\itemsep0.5\itemsep\item
\OptionalFields\btd@fieldloop}}
{\endlist}
\def\Field{域}
\def\ListName{列表}
\def\RequireFields{必选域:}
\def\OptionalFields{可选域:}
% command patches for ltxdockit.sty
\renewcommand*{\apxref}{\refs{附录}{附录}}
\renewcommand*{\Apxref}{\refs{附录}{附录}}
\renewcommand*{\tabref}{\refs{表}{表}}%文中一般都提示有表,可以看的更清楚
\renewcommand*{\Tabref}{\refs{表}{表}}
\renewrobustcmd*{\refs}[3]{%
\begingroup
\@tempcnta\z@
\def\do##1{\advance\@tempcnta\@ne}%
\docsvlist{#3}%
\@tempcntb\@ne
\def\@tempa{\def\@tempa{%
\advance\@tempcntb\@ne
\ifnumequal{\@tempcnta}{2}
{ 和 }
{、}}}%
\def\do##1{\@tempa\ref{##1}}%
\ifnumgreater{\@tempcnta}{1}{#2}{#1}~\docsvlist{#3}%
\endgroup}
% cancel two-column format in toc defined by ltxdockit.def
% \g@addto@macro的定义见source2e中的68.1 hooks
\AtBeginDocument{
\renewcommand*{\@begintochook}{}
\renewcommand*{\@endtochook}{}
\renewcommand*{\@beginlothook}{}
\renewcommand*{\@endlothook}{}
\setcounter{tocdepth}{3}
}
% alias
\let\kaiti\kaishu
\def\BibTeX{\hologo{BibTeX}\xspace}
\def\eTeX{\hologo{eTeX}\xspace}
\def\XeTeX{\hologo{XeTeX}\xspace}
\def\LuaTeX{\hologo{LuaTeX}\xspace}
\def\pdfTeX{\hologo{pdfTeX}\xspace}
\def\XeLaTeX{\hologo{XeLaTeX}\xspace}
\endinput