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
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
|
%---------------------------------------------------------------------------%
%- -%
%- Document Style -%
%- -%
%---------------------------------------------------------------------------%
%- Copyright (C) Huangrui Mo <[email protected]>
%- This is free software: you can redistribute it and/or modify it
%- under the terms of the GNU General Public License as published by
%- the Free Software Foundation, either version 3 of the License, or
%- (at your option) any later version.
%---------------------------------------------------------------------------%
%->> Identification
%---------------------------------------------------------------------------%
\NeedsTeXFormat{LaTeX2e}%
\ProvidesPackage{artratex}[2014/10/01 v0.1 LaTeX macros package]%
%---------------------------------------------------------------------------%
%->> Declare options
%---------------------------------------------------------------------------%
%-
%-> Platform fontset <windows>, <mac>, <adobe>, <times>, <others>
%-
\RequirePackage{expl3}% LaTeX3 programming environment
\ExplSyntaxOn%
\providecommand{\g__ctex_fontset_tl}{}% platform fontset state variable
\edef\artxfontset{\g__ctex_fontset_tl}% expanded platform fontset state variable
\ExplSyntaxOff%
\newif\ifartx@windows \artx@windowsfalse
\newif\ifartx@mac \artx@macfalse
\newif\ifartx@adobe \artx@adobefalse
\newif\ifartx@times \artx@timesfalse
\newif\ifartx@others \artx@othersfalse
\RequirePackage{etoolbox}% a toolbox of programming facilities
\newcommand{\artxifstreq}{\expandafter\ifstrequal\expandafter}% expansion control
\artxifstreq{\artxfontset}{windows}{\artx@windowstrue\artx@timestrue}{%
\artxifstreq{\artxfontset}{mac}{\artx@mactrue\artx@timestrue}{%
\artxifstreq{\artxfontset}{adobe}{\artx@adobetrue\artx@timestrue}{%
\artx@otherstrue\artx@timesfalse}}}
%-
%-> LaTeX engine <pdflatex>, <lualatex>, <xelatex>
%-
\newif\ifartx@pdftex \artx@pdftexfalse
\newif\ifartx@luatex \artx@luatexfalse
\newif\ifartx@xetex \artx@xetexfalse
\RequirePackage{ifxetex,ifluatex}% LaTeX engine detection
\ifxetex%
\artx@xetextrue
\RequirePackage{xeCJK}% support calling system fonts
\else\ifluatex%
\artx@luatextrue
\else%
\artx@pdftextrue
\fi\fi%
%-
%-> Bibliography engine <bibtex>, <biber>
%-
\newif\ifartx@bibtex \artx@bibtextrue
\newif\ifartx@biber \artx@biberfalse
\DeclareOption{bibtex}{%
\artx@bibtextrue
\artx@biberfalse
}
\DeclareOption{biber}{%
\artx@bibtexfalse
\artx@bibertrue
}
%-
%-> Citation and reference style
%-
\newif\ifartx@numbers \artx@numberstrue
\newif\ifartx@super \artx@superfalse
\newif\ifartx@authoryear \artx@authoryearfalse
\newif\ifartx@alpha \artx@alphafalse
\DeclareOption{numbers}{%
\artx@numberstrue
\artx@superfalse
\artx@authoryearfalse
\artx@alphafalse
}
\DeclareOption{super}{%
\artx@numberstrue
\artx@supertrue
\artx@authoryearfalse
\artx@alphafalse
}
\DeclareOption{authoryear}{%
\artx@numbersfalse
\artx@superfalse
\artx@authoryeartrue
\artx@alphafalse
}
\DeclareOption{alpha}{%
\artx@numbersfalse
\artx@superfalse
\artx@authoryearfalse
\artx@alphatrue
}
%-
%-> Page layout reconfiguration
%-
\newif\ifartx@geometry \artx@geometryfalse
\DeclareOption{geometry}{%
\artx@geometrytrue
}
%-
%-> Landscape layout support
%-
\newif\ifartx@lscape \artx@lscapefalse
\DeclareOption{lscape}{%
\artx@lscapetrue
}
%-
%-> Header and footer
%-
\newif\ifartx@myhdr \artx@myhdrfalse
\DeclareOption{myhdr}{%
\artx@myhdrtrue
}
%-
%-> Color support
%-
\newif\ifartx@color \artx@colorfalse
\DeclareOption{color}{%
\artx@colortrue
}
%-
%-> Page background
%-
\newif\ifartx@background \artx@backgroundfalse
\DeclareOption{background}{%
\artx@colortrue
\artx@backgroundtrue
}
%-
%-> Complex diagrams support
%-
\newif\ifartx@tikz \artx@tikzfalse
\DeclareOption{tikz}{%
\artx@colortrue
\artx@tikztrue
}
%-
%-> Complex tables support
%-
\newif\ifartx@table \artx@tablefalse
\DeclareOption{table}{%
\artx@tabletrue
}
%-
%-> Enhanced list
%-
\newif\ifartx@list \artx@listfalse
\DeclareOption{list}{%
\artx@colortrue
\artx@listtrue
}
%-
%-> Extra math support
%-
\newif\ifartx@math \artx@mathfalse
\DeclareOption{math}{%
\artx@mathtrue
}
%-
%-> Handle non-implemented options
%-
\DeclareOption*{%
\PackageWarning{artratex}{Unknown option '\CurrentOption'}%
}
%-
%-> Terminates all options processing
%-
\ProcessOptions\relax%
%---------------------------------------------------------------------------%
%->> Detect class and counter
%---------------------------------------------------------------------------%
\newcommand*{\ifcounter}[1]{% check if counter exists
\ifcsname c@#1\endcsname%
\expandafter\@firstoftwo%
\else%
\expandafter\@secondoftwo%
\fi
}
\ifcounter{chapter}{\def\maincounter{chapter}}{\def\maincounter{section}}
%---------------------------------------------------------------------------%
%->> Required packages
%---------------------------------------------------------------------------%
%-
%-> Math packages
%-
\RequirePackage{amsmath,amsthm,amssymb}% math structures, theorems, and extended symbols
\theoremstyle{plain}% for theorems, lemmas, propositions, etc
\providecommand{\theoremname}{Theorem}%
\newtheorem{theorem}{\theoremname}[\maincounter]
\providecommand{\axiomname}{Axiom}%
\newtheorem{axiom}[theorem]{\axiomname}
\providecommand{\lemmaname}{Lemma}%
\newtheorem{lemma}[theorem]{\lemmaname}
\providecommand{\corollaryname}{Corollary}%
\newtheorem{corollary}[theorem]{\corollaryname}
\providecommand{\assertionname}{Assertion}%
\newtheorem{assertion}[theorem]{\assertionname}
\providecommand{\propositionname}{Proposition}%
\newtheorem{proposition}[theorem]{\propositionname}
\providecommand{\conjecturename}{Conjecture}%
\newtheorem{conjecture}[theorem]{\conjecturename}
\theoremstyle{definition}% for definitions and examples
\providecommand{\definitionname}{Definition}%
\newtheorem{definition}{\definitionname}[\maincounter]
\providecommand{\examplename}{Example}%
\newtheorem{example}{\examplename}[\maincounter]
\theoremstyle{remark}% for remarks and notes
\providecommand{\remarkname}{Remark}%
\newtheorem*{remark}{\remarkname}
\ifartx@math% extra math packages
\RequirePackage{mathtools}% extension to amsmath
\fi
%-
%-> Language settings
%-
\ifartx@pdftex% <pdflatex> call font packages
\RequirePackage[utf8]{inputenc}% set input encoding, document must use utf-8 encoding
\RequirePackage[T1]{fontenc}% set font encoding to enable modern font encoding
%- Text font: Chinese
%\RequirePackage{zhmCJK}% support calling system fonts
%\ifartx@windows%
% \setCJKmainfont[AutoFakeBold,ItalicFont=simkai.ttf]{simsun.ttc}%
% \setCJKsansfont[AutoFakeBold]{simhei.ttf}%
% \setCJKmonofont{simfang.ttf}%
%\fi
%- Text font: English <default: computer modern|others: font packages>
\RequirePackage{newtxtext}% main font, <times font: newtxtext|others: palatino>
%- Math font: <default: computer modern|others: font packages>
\RequirePackage[cmintegrals]{newtxmath}% times font, load after amsmath and newtxtext packages
\RequirePackage{mathrsfs}% enable \mathscr for script alphabet
\RequirePackage[cal=cm]{mathalfa}% map styles for calligraphic \mathcal and script \mathscr alphabet
\else% <xelatex> or <lualatex> call system fonts
\RequirePackage{fontspec}% support calling system fonts
%- Font properties: <family> + <weight> + <shape> + <size>
%- Specify the three default TeX font families: <main>, <sans>, <mono>
%- \setxxxxfont{<font>}[BoldFont=<font-b>,ItalicFont=<font-i>]%
%- <font>: \mdseries\upshape; <font-b>: \bfseries\upshape; <font-i>: \mdseries\itshape
%- <\lfseries|\mdseries|\bfseries>: weight of font, default <\mdseries>
%- <\upshape|\itshape|\scshape>: shape of font, default <\upshape>
%- Roman or Serif - typefaces with strokes - for main content
%- examples: Times New Roman, Garamond, Adobe Garamond Pro
%\setmainfont{Garamond}[BoldFont=Garamond-Bold,ItalicFont=Garamond-Italic]%
%- font switches: {\rmfamily ...}, \textrm{...}, {\normalfont ...}, \textnormal{...}
%- the latter is due to \renewcommand*{\familydefault}{\rmdefault}
%- Sans serif - typefaces without strokes - for headings demanding high readability
%- examples: Arial, Helvetica, Gill Sans, Futura
%\setsansfont{Gill Sans MT}% font switches: {\sffamily ...}, \textsf{...}
%- Monospaced - typefaces with same width - for programming, etc
%- examples: Rockwell, Andale Mono, Courier
%\setmonofont{Rockwell}% font switches: {\ttfamily, ...}, \texttt{...}
%- Specify user-defined font families and font switches
%- without NFSSFamily option, a font family is defined only if adding a new font name
%\newfontfamily\<font-switch>{<font>}[<font features>]%
%\newcommand{\text<font-switch>}[1]{{\<font-switch> #1}}%
%- Text font: Chinese
\ifartx@windows%
\setCJKmainfont[AutoFakeBold,ItalicFont=KaiTi]{SimSun}%
\setCJKsansfont[AutoFakeBold]{SimHei}%
\setCJKmonofont{FangSong}%
\else\ifartx@mac%
\setCJKmainfont[ItalicFont=Kaiti SC,BoldItalicFont=Kaiti SC Bold]{Songti SC Light}%
\setCJKsansfont{Heiti SC}%
\setCJKmonofont{STFangsong}%
\else\ifartx@adobe%
\setCJKmainfont[AutoFakeBold,ItalicFont=AdobeKaitiStd-Regular]{AdobeSongStd-Light}%
\setCJKsansfont[AutoFakeBold]{AdobeHeitiStd-Regular}%
\setCJKmonofont{AdobeFangsongStd-Regular}%
\fi\fi\fi
%- Text font: English <default: computer modern|fontspec: system fonts|others: font packages>
\ifartx@times%
\setmainfont[NFSSFamily=entextrm]{Times New Roman}%
\setsansfont[NFSSFamily=entextsf]{Times New Roman}%
%\setmonofont[NFSSFamily=entexttt]{Courier New}%
\else
\setmainfont[NFSSFamily=entextrm]{FreeSerif}%
\setsansfont[NFSSFamily=entextsf]{FreeSerif}%
%\setmonofont[NFSSFamily=entexttt]{FreeMono}%
\fi
%\RequirePackage{newtxtext}% main font
%- Math font: <default: computer modern|others: font packages <newtxmath|unicode-math>>
\RequirePackage[cmintegrals]{newtxmath}% times font, load after amsmath and newtxtext packages
\DeclareSymbolFont{operators}{OT1}{ntxtlf}{m}{n}% fix numbers by setting operator font to newtx-family
\SetSymbolFont{operators}{bold}{OT1}{ntxtlf}{b}{n}% fix numbers by setting operator font to newtx-family
\AtBeginDocument{%
\DeclareMathSymbol{0}{\mathalpha}{operators}{`0}%
\DeclareMathSymbol{1}{\mathalpha}{operators}{`1}%
\DeclareMathSymbol{2}{\mathalpha}{operators}{`2}%
\DeclareMathSymbol{3}{\mathalpha}{operators}{`3}%
\DeclareMathSymbol{4}{\mathalpha}{operators}{`4}%
\DeclareMathSymbol{5}{\mathalpha}{operators}{`5}%
\DeclareMathSymbol{6}{\mathalpha}{operators}{`6}%
\DeclareMathSymbol{7}{\mathalpha}{operators}{`7}%
\DeclareMathSymbol{8}{\mathalpha}{operators}{`8}%
\DeclareMathSymbol{9}{\mathalpha}{operators}{`9}%
}
\RequirePackage{mathrsfs}% enable \mathscr for script alphabet
\RequirePackage[cal=cm]{mathalfa}% map styles for calligraphic \mathcal and script \mathscr alphabet
%\RequirePackage{unicode-math}% another math font configuration
%\setmathfont{XITS Math}% a complete symbol set for STIX math fonts
%- mathrm and mathsf can be set by \setmathrm and \setmathsf
\fi
%-
%-> Bibliography processor and package
%-
%- Bibtex processor + natbib package
\ifartx@bibtex%
\ifartx@numbers% enable numbered citation style
\ifartx@super% enable superscripted citation style
\RequirePackage[square,comma,super,sort&compress]{natbib}% superscripted square bracket
\else
\RequirePackage[square,comma,numbers,sort&compress]{natbib}% square bracket
\fi
\bibliographystyle{Biblio/gbt7714-unsrt}% numbered scheme
\fi
\ifartx@authoryear% enable author year citation style
\RequirePackage{natbib}% author year citation mode
\bibliographystyle{Biblio/gbt7714-plain}% author year scheme
\fi
\ifartx@alpha% enable alpha citation style
\RequirePackage[square,comma,numbers]{natbib}% square bracket
\bibliographystyle{alpha}% alpha scheme
\fi
\providecommand*{\citetns}[2][]{% text embedded \citet in superscripted mode
\begingroup%
\let\NAT@mbox=\mbox%
\let\@cite\NAT@citenum%
\let\NAT@space\NAT@spacechar%
\let\NAT@super@kern\relax%
\renewcommand\NAT@open{[}%
\renewcommand\NAT@close{]}%
\citet[#1]{#2}%
\endgroup%
}
\providecommand*{\citepns}[2][]{% text embedded \citep in superscripted mode
\begingroup%
\let\NAT@mbox=\mbox%
\let\@cite\NAT@citenum%
\let\NAT@space\NAT@spacechar%
\let\NAT@super@kern\relax%
\renewcommand\NAT@open{[}%
\renewcommand\NAT@close{]}%
\citep[#1]{#2}%
\endgroup%
}
\fi
%- Biber processor + biblatex package
\ifartx@biber%
\ifartx@numbers% enable numbered citation style
\ifartx@super% enable superscripted citation style
\RequirePackage[style=numeric-comp]{biblatex}%
\else
\RequirePackage[style=numeric-comp]{biblatex}%
\fi
\fi
\ifartx@authoryear% enable author year citation style
\RequirePackage[style=authoryear]{biblatex}%
\fi
\ifartx@alpha% enable alpha citation style
\RequirePackage[style=alphabetic]{biblatex}%
\fi
\addbibresource{ref.bib}%
\fi
%-
%-> Figure environment support
%-
\RequirePackage{graphicx}% packages for including graphics
\RequirePackage[font={small,bf},skip=8pt,labelsep=space]{caption}% options: [margin=10pt,labelfont=bf]
\RequirePackage{subcaption}% package for subfigures
\RequirePackage[list=off]{bicaption}% package for binary captions
\captionsetup[figure][bi-first]{format=hang,hangindent=-0.5em}%
\captionsetup[figure][bi-second]{format=hang,hangindent=-2em,name=Figure}%
\captionsetup[table][bi-first]{format=hang,hangindent=-0.5em}%
\captionsetup[table][bi-second]{format=hang,hangindent=-2em,name=Table}%
\RequirePackage[section]{placeins}% prevent floats from being moved over section
%-
%-> Page layout and spacing
%-
\ifartx@geometry% enable geometry to redefine page layout
\RequirePackage{geometry}% page layout
%\RequirePackage{setspace}% line spacing
\fi
\ifartx@lscape% landscape layout
\RequirePackage{fancyhdr}% fancy headers and footers
%- usage: \begin{landscape} [\thispagestyle{lscape}] text... \end{landscape}
\RequirePackage{pdflscape}% landscape environment
\RequirePackage[absolute]{textpos}% rotated page number
\fi
\ifartx@myhdr% header and footer style
\RequirePackage{fancyhdr}% fancy headers and footers
\fi
%\RequirePackage{microtype}% improves general appearance of the text
%-
%-> Color
%-
\ifartx@color% enable color package to use color
%\RequirePackage{color}%
\RequirePackage[usenames,dvipsnames,table]{xcolor}%
\fi
%-
%-> Draw graphics directly with TeX commands
%-
\ifartx@tikz%
\RequirePackage{tikz}% automatically load pgf package
\usetikzlibrary{% load libraries
positioning,
arrows,
calc,
trees
}%
\fi
%-
%-> Complex tables
%-
\ifartx@table%
\RequirePackage{ctable}% imports the array, tabularx and booktabs packages
\fi
%-
%-> List structures
%-
\ifartx@list% enable enhanced list and verbatim structures
\RequirePackage{verbatim}% improve verbatim environment
\RequirePackage{enumitem}% configure the enumerate environment
\setlist[enumerate]{wide=\parindent}% only indent the first line
\setlist[itemize]{wide=\parindent}% only indent the first line
\setlist{nosep}% default text spacing
\RequirePackage{listings}% source code
\RequirePackage{algpseudocode,algorithm,algorithmicx}% algorithm
\providecommand{\algname}{Algorithm}%
\renewcommand*{\ALG@name}{\algname}% rename label
\fi
%-
%-> Links support
%-
\RequirePackage{hyperref}%
\hypersetup{% set hyperlinks
%bookmarks=true,% show bookmarks bar
pdfencoding=auto,% allows non-Latin based languages in bookmarks
%pdftitle={},% title
%pdfauthor={},% author
%pdfsubject={},% subject
%pdftoolbar=true,% show toolbar
%pdfmenubar=true,% show menu
pdffitwindow=false,% window fit to page when opened
pdfstartview={FitH},% fits the width of the page to the window
%pdfnewwindow=true,% links in new window
%backref=true,% do bibliographical back references
%pagebackref=true,% backreference by page number
colorlinks=true,% false: boxed links; true: colored links
linkcolor=black,% color of internal links
citecolor=blue,% color of links to bibliography
%filecolor=magenta,% color of file links
urlcolor=red,% color of external links
bookmarksnumbered=true,% put section numbers in bookmarks
%hidelinks% remove link color and border
}
%---------------------------------------------------------------------------%
%->> Configuration command
%---------------------------------------------------------------------------%
%-
%-> Extensions and directories for graphics
%-
%- Declare graphic extensions for automatic selection when including graphics
%- via avoiding supplying graphic extensions in \includegraphics command,
%- the source file can be more general and adaptive
\ifartx@xetex%
\DeclareGraphicsExtensions{.pdf,.png,.jpg,.eps,.tif,.bmp,.gif}%
\else% <pdflatex> or <lualatex>
\DeclareGraphicsExtensions{.pdf,.png,.jpg}%
\fi
\graphicspath{{Img/}}% search path for figures
%-
%-> Layout, space, and style
%-
\ifartx@geometry% enable geometry to redefine page layout
\geometry{paper=a4paper,left=31.7mm,right=31.7mm,top=25.4mm,bottom=25.4mm}%
\fi
%\linespread{1.5}% 1.5 for "one and a half" line spacing, and 2.0 for "double" line spacing
%\setlength{\parskip}{0.5ex plus 0.25ex minus 0.25ex}% skip space a paragraph
\setcounter{tocdepth}{2}% depth for the table of contents
\setcounter{secnumdepth}{3}% depth for section numbering, default is 2(subsub)
%- Set equation, figure, table numbering
%\numberwithin{equation}{section}% set enumeration level
%\renewcommand{\theequation}{\thesection\arabic{equation}}% configure the label style
%\numberwithin{figure}{section}% set enumeration level
%\renewcommand{\thefigure}{\thesection\arabic{figure}}% configure the label style
%\numberwithin{table}{section}% set enumeration level
%\renewcommand{\thetable}{\thesection\arabic{table}}% configure the label style
%- Set bibliography entry
\ifartx@bibtex%
\setlength{\bibsep}{0.0ex plus 0.2ex minus 0.2ex}% set distance between entries
\fi
\ifartx@biber%
\setlength\bibitemsep{0.5\baselineskip}% set distance between entries
\fi
\renewcommand*{\bibfont}{\small}% set font size for bibliography
%-
%-> Nomenclature item
%-
\providecommand{\nomenclatureitem}[3][ ]{%
\noindent\makebox[0.15\textwidth][l]{#2}{{#3}\hfill{#1}}\par
}
%-
%-> Macro for adding content link to the table of content and bookmark
%-
\providecommand{\intotoc}[2][\maincounter]{%
\cleardoublepage% ensure correct page reference
\markboth{\MakeUppercase{#2}}{}% set the leftmark
\phantomsection% create link in bookmarks
\addcontentsline{toc}{#1}{#2}% add content #2 to toc as #1
}
%-
%-> Page header and footer Style
%-
%- Page styles in Latex refers to headers and footers of a document.
%- These headers/footers typically contain document titles, chapter
%- or section numbers/names, and page numbers.
%- Configure fancy style
\ifartx@myhdr% user defined header and footer style
\pagestyle{fancy}%
\providecommand{\chaptermark}{}% compatibility for non-book classes
\providecommand{\thechapter}{}% compatibility for non-book classes
\providecommand{\CTEXthechapter}{\thechapter.}% compatibility for non ctex classes
%- reset style of chapter and section mark to actual name
\renewcommand{\chaptermark}[1]{\markboth{\MakeUppercase{#1}}{}}%
\renewcommand{\sectionmark}[1]{\markright{\MakeUppercase{#1}}{}}%
%- deactivate uppercase effect
\renewcommand{\MakeUppercase}[1]{#1}%
%- Define different kinds of header and footer for different parts
\fancypagestyle{frontmatterstyle}{% style for frontmatter
\fancyhf{}% clear fields
\fancyhead[CE]{\footnotesize \@title}% structure elements
\fancyhead[CO]{\footnotesize \leftmark}% structure elements
\fancyfoot[CE]{\footnotesize \thepage}% page number
\fancyfoot[CO]{\footnotesize \thepage}% page number
\renewcommand{\headrulewidth}{0.8pt}% header rule
\renewcommand{\footrulewidth}{0pt}% footer rule
}
\fancypagestyle{mainmatterstyle}{% style for mainmatter
\fancyhf{}% clear fields
\fancyhead[CE]{\footnotesize \@title}% structure elements
\fancyhead[CO]{\footnotesize \CTEXthechapter\ \leftmark}% structure elements
\fancyfoot[LE]{\footnotesize \thepage}% page number
\fancyfoot[RO]{\footnotesize \thepage}% page number
\renewcommand{\headrulewidth}{0.8pt}% header rule
\renewcommand{\footrulewidth}{0pt}% footer rule
}
\fancypagestyle{backmatterstyle}{% header and footer style for backmatter
\fancyhf{}% clear fields
\fancyhead[CE]{\footnotesize \@title}% structure elements
\fancyhead[CO]{\footnotesize \leftmark}% structure elements
\fancyfoot[LE]{\footnotesize \thepage}% page number
\fancyfoot[RO]{\footnotesize \thepage}% page number
\renewcommand{\headrulewidth}{0.8pt}% header rule
\renewcommand{\footrulewidth}{0pt}% footer rule
}
%- Redefine \frontmatter to include the change
\providecommand{\frontmatter}{}% compatibility for non-book classes
\let\myfrontmatter\frontmatter%
\renewcommand{\frontmatter}{%
\myfrontmatter%
\pagestyle{frontmatterstyle}%
}
%- Redefine \mainmatter to include the change
\providecommand{\mainmatter}{}% compatibility for non-book classes
\let\mymainmatter\mainmatter%
\renewcommand{\mainmatter}{%
\mymainmatter%
\pagestyle{mainmatterstyle}%
}
%- Redefine \backmatter to include the change
\providecommand{\backmatter}{}% compatibility for non-book classes
\let\mybackmatter\backmatter%
\renewcommand{\backmatter}{%
\mybackmatter%
\pagestyle{backmatterstyle}%
}
%- Some Latex commands, like \chapter, use the \thispagestyle command
%- to automatically switch to the plain page style, thus ignoring the
%- page style currently in effect. To customize such pages you must
%- redefine the plain pagestyle. If you want the plain style inherits
%- the current style, comment all the lines in plain style definition.
\fancypagestyle{plain}{%
%\fancyhf{}% clear fields
%\renewcommand{\headrulewidth}{0pt}% header rule
%\renewcommand{\footrulewidth}{0pt}% footer rule
}
\fancypagestyle{noheaderstyle}{% header and footer style for no header
\fancyhf{}% clear fields
%\fancyhead[CE]{\footnotesize \@title}% structure elements
%\fancyhead[CO]{\footnotesize \leftmark}% structure elements
\fancyfoot[LE]{\footnotesize \thepage}% page number
\fancyfoot[RO]{\footnotesize \thepage}% page number
\renewcommand{\headrulewidth}{0pt}% header rule
\renewcommand{\footrulewidth}{0pt}% footer rule
}
\fi
%-
%-> Configure landscape environment
%-
\ifartx@lscape%
\fancypagestyle{lscape}{% landscape layout style
\fancyhf{}% clear fields
\fancyfoot[CE,CO]{%
%- textpos: \begin{textblock}{<blockwidth>}[0.5,0.5](<hpos>,<vpos>) text... \end{textblock}
%- origin of the absolute coordinate is the top-left corner of the page
%- [0.5,0.5] means reference point of the block is the middle
\begin{textblock}{0.1}[0.5,0.5](0.85,0.5){\rotatebox{90}{\footnotesize \thepage}}\end{textblock}% position the page number
}
%- set units of <blockwidth>, <hpos>, and <vpos> arguments by corresponding modules
\setlength{\TPHorizModule}{8.5in}% set to the width of page
\setlength{\TPVertModule}{11in}% set to the height of page
\renewcommand{\headrulewidth}{0pt}% header rule
\renewcommand{\footrulewidth}{0pt}% footer rule
}
\fi
\ifartx@list% enable enhanced list
\definecolor{mygreen}{rgb}{0,0.6,0}
\definecolor{mygray}{rgb}{0.5,0.5,0.5}
\definecolor{mymauve}{rgb}{0.58,0,0.82}
\lstset{%
numberbychapter=false,% numbered sequentially or by chapter
backgroundcolor=\color{white},% background color;
basicstyle=\scriptsize,% font size for code
breakatwhitespace=false,% sets if automatic breaks should only happen at whitespace
breaklines=true,% sets automatic line breaking
captionpos=b,% caption-position to bottom
commentstyle=\color{mygreen},% comment style
%deletekeywords={...},% delete keywords from the given language
frame=single,% adds a frame around the code
keepspaces=true,% keeps spaces in text for keeping indentation of code
keywordstyle=\color{blue},% keyword style
%otherkeywords={*,...},% add more keywords to the set
numbers=left,% where to put the line-numbers; possible values are (none, left, right)
numbersep=5pt,% how far the line-numbers are from the code
numberstyle=\tiny\color{mygray},% the style that is used for the line-numbers
rulecolor=\color{black},% if not set, the frame-color may be changed on line-breaks
showspaces=false,% show spaces everywhere adding particular underscores;
showstringspaces=false,% underline spaces within strings only
showtabs=false,% show tabs within strings adding particular underscores
stepnumber=2,% the step between two line-numbers. If it's 1, each line will be numbered
stringstyle=\color{mymauve},% string literal style
tabsize=2,% sets default tabsize to 2 spaces
title=\lstname% show the filename of files
}
\fi
%-
%-> Page background
%-
\ifartx@background%
\definecolor{backgroundcolor}{rgb}{0.85,0.85,0.85}%
\pagecolor{backgroundcolor}% background color
\fi
%---------------------------------------------------------------------------%
\endinput
|