summaryrefslogtreecommitdiff
path: root/info/texproposal/texproposal.sty
blob: d15162aeff0dd23bc37c52f739556b1e3cd5ffbb (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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
% 一些文章常量
\def\tstitle{关于推荐重庆大学开设\TeX 相关课程\\并推广其运用的提议}
\def\etstitle{Proposal for Offering \TeX Courses and Relevant Resources in Chongqing University}
\def\tsabstract{本提案从介绍排版系统\TeX 的背景和特点开始,从研究生期刊论文投稿以及毕业生毕业论文排版工作这两个维度阐述了引入\TeX 作为一种与Office Word平行的写作系统的优势和必要性,最终提出一套基于我校重庆大学实际情况,有效可行的实施方案。}
\def\etsabstract{The present proposal mainly explains the importance and necessity of introducing \TeX, a typeset system often used in academic writing, to students and teachers as the counterpart of Microsoft Word. This proposal starts from a brief introduction of \TeX, then steps further into its fascinating application on academic writing and dissertation formatting. In the end, a set of possible implementation strategies with regard to the proper introduction of \TeX and relevant resources to our university, is proposed.}
\def\tsauthor{Zhennan Li, Chenyu Wu, Chunlei Liu, Pinyong Zhao}
\def\tskeywords{TeX Courses, LaTeX Training, Chongqing University, Proposal, CTAN Mirrors}
\date{}


% 宏包
% 引入新宏包时注意:不要冲突,不要重复
\RequirePackage{fontspec}
\RequirePackage{amsmath}
\RequirePackage{multicol}
\RequirePackage{newpxtext}
\RequirePackage{newpxmath}
\RequirePackage{listings}
\RequirePackage{fancyhdr}
\RequirePackage{xcolor}
\RequirePackage{hyperref}
\RequirePackage{enumitem}
\RequirePackage{etoolbox}
\RequirePackage{metalogo}
\RequirePackage{graphicx}
\RequirePackage{xspace}
\RequirePackage{makeidx}
\RequirePackage{marginnote}
\RequirePackage{pifont}
\RequirePackage{pdfpages}
\RequirePackage{xparse}
\RequirePackage{xspace}
\RequirePackage{tocloft}
\RequirePackage[perpage]{footmisc}
% 表格相关
\RequirePackage{booktabs}
\RequirePackage{longtable}
\newcommand{\ccell}[1]{\multicolumn{1}{c}{\sffamily\heiti #1}}
\setlength\tabcolsep{1pt}
\setlength{\LTpre}{\bigskipamount}
\setlength{\LTpost}{\bigskipamount}
\setlength\LTleft{0pt}
\setlength\LTright{0pt}
\let\cqu@LT@array\LT@array
\def\LT@array{\zihao{-5}\cqu@LT@array}
% 表格相关结束
\RequirePackage[
	top=2.5cm, bottom=3cm,
	inner=2cm, outer=4cm,
	headsep=5mm, bindingoffset =5mm,
	marginparwidth=2.7cm]{geometry}
\RequirePackage[
	square, comma,
	numbers, super,
	sort&compress]{natbib}
	
\setlist{nosep}
\setlength{\cftbeforesecskip}{1mm}

\ifxetex
\hypersetup{%
	CJKbookmarks=true}
\else
\hypersetup{%
	unicode=true,
	CJKbookmarks=false}
\fi
\hypersetup{%
	linktoc=all,
	bookmarksnumbered=true,
	bookmarksopen=true,
	bookmarksopenlevel=1,
	breaklinks=true,
	colorlinks=true,
	allcolors=black,
	urlcolor=magenta,
	plainpages=false,
	pdfborder=0 0 0}
\urlstyle{same}
\ifxetex
\def\CJK@null{\kern\CJKnullspace\Unicode{48}{7}\kern\CJKnullspace}
\defaultfontfeatures{Mapping=tex-text}
\fi

% 定制PDF属性
\hypersetup{%
	pdftitle = {\tstitle},
	pdfauthor = {\tsauthor},
	pdfsubject = {\tsabstract},
	pdfkeywords = {\tskeywords},
	pdfcreator = {texpropoal at https://github.com/CQUtug/TeXProposal}
}

\lstdefinestyle{lstStyleBase}{%
basicstyle=\small\ttfamily,
aboveskip=\medskipamount,
belowskip=\medskipamount,
lineskip=0pt,
boxpos=c,
showlines=false,
extendedchars=true,
upquote=true,
tabsize=2,
showtabs=false,
showspaces=false,
showstringspaces=false,
numbers=none,
linewidth=\linewidth,
xleftmargin=4pt,
xrightmargin=0pt,
resetmargins=false,
breaklines=true,
breakatwhitespace=false,
breakindent=0pt,
breakautoindent=true,
columns=flexible,
keepspaces=true,
gobble=2,
framesep=3pt,
rulesep=1pt,
framerule=1pt,
backgroundcolor=\color{gray!5},
stringstyle=\color{green!40!black!100},
keywordstyle=\bfseries\color{blue!50!black},
commentstyle=\slshape\color{black!60}}

\lstdefinestyle{lstStyleLaTeX}{%
	style=lstStyleBase,
	frame=l,
	rulecolor=\color{cyan},
	language=[LaTeX]TeX}

% LaTeX代码环境
\lstnewenvironment{latex}{\lstset{style=lstStyleLaTeX}}{}

% 定义颜色集
\colorlet{tsTitle}{blue!40!black}
\colorlet{tsNote}{purple}

% 说明性文字,紫色,楷体
\newcommand{\note}[1]{{%
	\color{tsNote}{\noindent\bfseries 说明:}\emph{#1}}}

% 边注和索引
\renewcommand*{\marginfont}{\color{tsNote}\sffamily\heiti}
\DeclareDocumentCommand{\ppt}{s o m}{%
	\IfBooleanTF {#1}
	{%ture
		\IfNoValueTF{#2}{\marginnote[#3]{#3}}{\marginnote[#2]{#3}}
	}{%false
		\IfNoValueTF{#2}{\marginnote[#3]{#3}}{\marginnote[#2]{#3}}
		\index{#3}
	}%
}
% 解决索引ind文件依赖问题
\let\scan@allowedfalse\relax
\let\pfill\dotfill

% 定制章节标题
\ctexset{%
	section = {%
		format = \zihao{2}\color{tsTitle}\sffamily\heiti\centering,
		beforeskip = 36bp \@plus 1ex \@minus .2ex,
		afterskip = 16bp \@plus .2ex,
	},
	subsection = {%
		format = \zihao{3}\color{tsTitle}\sffamily\heiti\raggedright,
		beforeskip = 24bp \@plus 1ex \@minus .2ex,
		afterskip = 12bp \@plus .2ex,
	},
	subsubsection = {
		aftertitle = {\ClassError{CQUTeX}%
			{Level-3 and below sections are unsupported intentionally.}{}},
	},
	appendix = {%
		numbering = false,
		name = {},
	},
	paragraph = {
		aftertitle = {\ClassError{CQUTeX}%
			{Level-3 and below sections are unsupported intentionally.}{}},
	},
	subparagraph = {
		aftertitle = {\ClassError{CQUTeX}%
			{Level-3 and below sections are unsupported intentionally.}{}},
	},
	appendixname=附录,
	contentsname={目\hskip\ccwd 录},
	listfigurename={插图索引},
	listtablename={表格索引},
	figurename=图,
	tablename=表,
	bibname=参考文献,
	indexname=关键词索引,
}

% 单双页打印问题
\newcommand{\pagework}{%
	\if@twoside
		\thispagestyle{empty}
		\clearpage{\pagestyle{empty}\cleardoublepage}
		\pagenumbering{arabic}
	\else
		\thispagestyle{empty}
		\clearpage
		\pagenumbering{arabic}
	\fi
}

% 带圈数字
\def\@circlenum#1{%
	\ifnum \value{#1} >10
	\ClassError{CQUTeX}%
	{Circled number of 11 or more is not supported.}{}
	\fi
	\ding{\the\numexpr\value{#1}+171\relax}%
}
% 脚注使用带圈数字,注意命令的执行时机
\AtBeginDocument{%
	\renewcommand{\thefootnote}{\@circlenum{footnote}}
	\renewcommand{\thempfootnote}{\@circlenum{mpfootnote}}
% 设置分割线、字号和悬挂缩进
	\def\footnoterule{\vskip-3\p@\hrule\@width0.3\textwidth\@height0.4\p@\vskip2.6\p@}
	\let\cqu@footnotesize\footnotesize
	\renewcommand{\footnotesize}{\cqu@footnotesize\zihao{-5}}
	\footnotemargin1.5em\relax
%
% 脚注部分将标注换为正文大小,这个过程是动态的:
	\let\cqu@makefnmark\@makefnmark
	\def\cqu@@makefnmark{\mbox{{\normalfont\@thefnmark}}}
	\pretocmd{\@makefntext}{\let\@makefnmark\cqu@@makefnmark}{}{}
	\apptocmd{\@makefntext}{\let\@makefnmark\cqu@makefnmark}{}{}
}%AtBeginDocument

% 解决\TeX \LaTeX 等命令后吞噬英文间空格
\everylogo{\xspace}

% 定制\autopageref{label}
\AtBeginDocument{%
	\def\figureautorefname{图}
	\def\tableautorefname{表}
	\def\partautorefname{卷}
	\def\appendixautorefname{附录}
	\def\equationautorefname{式}
	\def\Itemautorefname{列表}
	\def\chapterautorefname{章}
	\def\sectionautorefname{节}
	\def\subsectionautorefname{小节}
	\def\subsubsectionautorefname{条目}
	\def\paragraphautorefname{自然段}
	\def\Hfootnoteautorefname{脚注}
	\def\AMSautorefname{式}
	\def\theoremautorefname{理论}
	\def\pageautorefname{页}
}%\AtBeginDocument

% 把索引和参考文献加到目录里
\pretocmd{\bibliography}{%
	\phantomsection
	\addcontentsline{toc}{section}{参考文献}
	\addcontentsline{etoc}{section}{Reference}
}{}{}
\pretocmd{\printindex}{%
	\phantomsection
	\addcontentsline{toc}{section}{关键词索引}
	\addcontentsline{etoc}{section}{Index}
}{}{}

% \CQUThesis 标识
\newcommand{\cquthesis}{\textsc{CQUThesis}\xspace}

% 改变引言字体
\AtBeginEnvironment{quote}{\kaishu}
\AtBeginEnvironment{quotation}{\kaishu}

% 英文封面支持
\def\etocname{\zihao{-3}\bfseries Contents}
\newlistof[section]{econtents}{etoc}{\etocname}
\newcommand\add@engcontents[2]{%
	\addcontentsline{etoc}{#1}{\protect\numberline{\csname the#1\endcsname}#2}}
\AtBeginDocument{%
\let\cqu@section\section
\let\cqu@subsection\subsection
\DeclareDocumentCommand{\section}{s m o}{%
	\IfBooleanTF{#1}{%true
		\cqu@section*{#2}
		\IfNoValueTF{#3}{\relax}{\addcontentsline{etoc}{section}{#3}}
	}{%false
		\cqu@section{#2}
		\IfNoValueTF{#3}{\relax}{\add@engcontents{section}{#3}}
	}
}%section
\DeclareDocumentCommand{\subsection}{s m o}{%
	\IfBooleanTF{#1}{%true
		\cqu@subsection*{#2}
		\IfNoValueTF{#3}{\relax}{\addcontentsline{etoc}{subsection}{#3}}
	}{%false
	\cqu@subsection{#2}
	\IfNoValueTF{#3}{\relax}{\add@engcontents{subsection}{#3}}
	}
}%subsection
}