-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpreamble.sty
134 lines (124 loc) · 5.47 KB
/
preamble.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
\ProvidesPackage{preamble}
% USE PACKAGES ----------------------------------------------------------------
\usepackage{amsmath, amssymb, mathtools} % math; todo: use before fontspec
\usepackage{fontspec, anyfontsize, fontsize, fontawesome5, xcolor} % font
\usepackage{geometry} % page layout, paragraph layout
\usepackage{fancyhdr} % header and footer
\usepackage{titlesec} % title (titleformat)
\usepackage{caption} % caption (captionsetup)
\usepackage{tabularx, threeparttable, booktabs, multirow, subcaption, graphicx, tikz} % table
\usepackage[export]{adjustbox} % figure position in table
\usepackage{enumitem} % list
\usepackage{algorithm, algpseudocode} % algorithm
\usepackage[backend=biber, style=ieee]{biblatex} % references
\usepackage[titles]{tocloft} % toc spacing; todo: use after titlesec
\usepackage{import} % project structure
\usepackage{indentfirst} % indent first paragraph
\usepackage{hyperref}
\usepackage{xurl}
% LAYOUT CONFIG ---------------------------------------------------------------
\setmainfont{Times New Roman}
\changefontsize[19.5pt]{13pt}
\geometry{a4paper, portrait,
top=2cm, bottom=2cm, left=3cm, right=2cm,
headheight=0.8cm, headsep=0.3cm, marginparsep=0.5cm, footskip=0.8cm}
% header and footer
\fancypagestyle{fancy}{
\fancyhf{}
\fancyhead[L]{\fontsize{13pt}{19.5pt}\selectfont\leftmark}
\fancyfoot[C]{\fontsize{12pt}{18pt}\selectfont\thepage}
}
\fancypagestyle{plain}{
\fancyhf{}
\fancyhead[L]{\fontsize{13pt}{19.5pt}\selectfont\leftmark}
\fancyfoot[C]{\fontsize{12pt}{18pt}\selectfont\thepage}
}
% TITLE CONFIG ----------------------------------------------------------------
% modify title style, fontsize
\titleformat{\chapter}[hang] % new chapter name
{\bfseries\fontsize{14pt}{21pt}\selectfont\filcenter\MakeUppercase}
{\chaptertitlename\ \thechapter:}
{10pt}
{\bfseries\fontsize{14pt}{21pt}\selectfont\MakeUppercase}
\titleformat{\section}[hang] % new section name
{\bf\fontsize{13pt}{19.5pt}\selectfont\MakeUppercase}
{\thesection\ }
{0pt}
{\bf\fontsize{13pt}{19.5pt}\selectfont\MakeUppercase}
\titleformat{\subsection}[hang] % new subsection name
{\bf\fontsize{13pt}{19.5pt}\selectfont}
{\thesubsection\ }
{0pt}
{\bf\fontsize{13pt}{19.5pt}\selectfont}
\titleformat{\subsubsection}[hang] % new subsubsection name
{\it\fontsize{13pt}{19.5pt}\selectfont}
{\thesubsubsection\ }
{0pt}
{\it\fontsize{13pt}{19.5pt}\selectfont}
\titleformat{\tablename}[hang] % new toc name
{\bf\fontsize{14pt}{21pt}\selectfont\filcenter\MakeUppercase}
{\thetable}
{0pt}
{\bf\fontsize{14pt}{21pt}\selectfont\MakeUppercase}
% modify title name
\renewcommand*{\contentsname}{Mục lục}
\renewcommand*{\listtablename}{Danh sách bảng}
\renewcommand*{\listfigurename}{Danh sách hình ảnh}
\renewcommand*{\chaptername}{Chương}
\renewcommand*{\appendixname}{Phụ lục}
% modify (name, fontisze) of (table, figure)
\DeclareCaptionFont{table-figure-caption-fontsize}{\fontsize{11pt}{16.5pt}\selectfont}
\captionsetup{tablename=Bảng, figurename=Hình, labelfont=bf, font=table-figure-caption-fontsize}
\captionsetup[subfigure]{font=table-figure-caption-fontsize, justification=centering}
\captionsetup[subtable]{font=table-figure-caption-fontsize, justification=centering}
% TABLE/FIGURE CONFIG ---------------------------------------------------------
% new tabularx column types
\newcolumntype{L}[1]{>{\hsize=#1\hsize\raggedright\arraybackslash}X} % L=left X
\newcolumntype{R}[1]{>{\hsize=#1\hsize\raggedleft\arraybackslash}X} % R=right X
\newcolumntype{C}[1]{>{\hsize=#1\hsize\centering\arraybackslash}X} % C=center X
% LIST CONFIG -----------------------------------------------------------------
\setlist[itemize]{nolistsep}
\setlist[enumerate]{nolistsep}
% ALGORITHM CONFIG ------------------------------------------------------------
\renewcommand*{\ALG@name}{Giải thuật}
% new algorithm command
\algdef{S}[FOR]{ForEach}[1]{\algorithmicforeach\ #1\ \algorithmicdo}
\algnewcommand\algorithmicforeach{\textbf{for each}}
% BIBLIOGRAPHY CONFIG ---------------------------------------------------------
\addbibresource{./references.bib}
\renewcommand*{\bibfont}{\fontsize{11pt}{16.5pt}\selectfont\raggedright}
% SPACING CONFIG --------------------------------------------------------------
% modify title spacing
\titlespacing*{\chapter}{0pt}{-10pt}{0pt}
\titlespacing*{\section}{0pt}{0pt}{0pt}
\titlespacing*{\subsection}{0pt}{0pt}{0pt}
\titlespacing*{\subsubsection}{0pt}{0pt}{0pt}
\titlespacing*{\tablename}{0pt}{0pt}{0pt}
% modify title indent in toc
\setlength{\cftsecindent}{1em}
\setlength{\cftsubsecindent}{2em}
\setlength{\cftsubsubsecindent}{3em}
\setlength{\cftfignumwidth}{2.5em}
\setlength{\cfttabnumwidth}{2.5em}
\renewcommand*{\@tocrmarg}{2.55em plus1fil}
% space between tablenotes and table (threeparttable)
\AddToHook{env/tabular/before}[skip]{\smallskip}
% tablenotes font size (threeparttable)
\AddToHook{env/tablenotes/begin}[fontsize]{\fontsize{10pt}{15pt}\selectfont}
% table font size: 12pt
\AddToHook{env/tabular/before}[fontsize]{\fontsize{12pt}{18pt}\selectfont}
\AddToHook{env/tabularx/before}[fontsize]{\fontsize{12pt}{18pt}\selectfont}
% image centering
\AddToHook{env/figure/begin}[align]{\centering}
% OTHER CONFIG ----------------------------------------------------------------
\setcounter{secnumdepth}{4} % section max counter
\setcounter{tocdepth}{4} % toc max counter
\hypersetup{
colorlinks,
citecolor=black,
filecolor=black,
linkcolor=black,
urlcolor=black,
}
% DEBUG -----------------------------------------------------------------------
% \usepackage{showframe}