-
Notifications
You must be signed in to change notification settings - Fork 0
/
gemplate.sty
142 lines (101 loc) · 3.84 KB
/
gemplate.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
135
136
137
138
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{gemplate}[2024/08/30]
\RequirePackage{import}
\RequirePackage{graphicx}
\RequirePackage{xcolor}
\RequirePackage[hyphens,nobiblatex]{xurl} % break url in the middle to fit in the space
\RequirePackage{subfiles}
% tabularray
\RequirePackage{tabularray}
\UseTblrLibrary{booktabs}
% set tblr caption same as table enviro
\ExplSyntaxOn
\prg_generate_conditional_variant:Nnn \tl_if_empty:n { e } { TF }
\let \IfTokenListEmpty = \tl_if_empty:eTF
\ExplSyntaxOff
% modifying the captions of tabularray
\DefTblrTemplate{firsthead}{default}{%
\addtocounter{table}{-1}%
\IfTokenListEmpty{\InsertTblrText{entry}}{%
\captionof{table}{\InsertTblrText{caption}}%
}{%
\captionof{table}[\InsertTblrText{entry}]{\InsertTblrText{caption}}%
}%
}
\SetTblrTemplate{caption-lot}{empty}
% remove captions at continuing pages in long table
\DefTblrTemplate{capcont}{default}{}
% remove row gaps to make it compact
\SetTblrInner{rowsep=0pt}
\RequirePackage{bookmark}
\RequirePackage{booktabs}
\RequirePackage{csquotes}
\RequirePackage{titling} % multiple \maketitle within a document
\RequirePackage{longtable}
\RequirePackage[normalem]{ulem} % better underline
\RequirePackage{tabu} % long table formatting
\RequirePackage{rotating} % table rotating
\RequirePackage{makecell} % text line breaks in the tabular env
\RequirePackage{setspace} % line spacing
\RequirePackage{multirow}
\RequirePackage[margin=2.5cm,nohead]{geometry}
%\RequirePackage{minted} % source code highlighting
\RequirePackage[toc, title]{appendix}
\RequirePackage{nicefrac} % compact symbols for 1/2, etc.
\RequirePackage{microtype} % microtypography
\RequirePackage[margin=15pt,font=small,labelfont={bf,sf}]{caption}
\RequirePackage{amsmath}
\RequirePackage{amssymb}
\RequirePackage{enumitem}
% \RequirePackage[symbol*]{footmisc}
\RequirePackage[american]{babel}
\RequirePackage[backend=biber,style=apa,uniquename=false,uniquelist=false,citetracker=true,maxcitenames=2,doi=false,annotation=false,natbib=true]{biblatex}
% first cite use full author list, all others use `et al'
\AtEveryCitekey{\ifciteseen{}{\defcounter{maxnames}{99}}}
% remove the letter (2021a, 2021b) following same first author surname
\AtEveryCitekey{\clearfield{extradate}}
\AtEveryBibitem{\clearfield{extradate}}
% fonts
\usepackage[T1]{fontenc}
\usepackage{crimson}
\usepackage{eulervm} % maths font
% document layout
\linespread{1.5}
\usepackage{indentfirst} % indent first sentence of a new section
% but do not indent abstract
\usepackage{etoolbox}
\ifundef{\abstract}{}{\patchcmd{\abstract}%
{\quotation}{\quotation\noindent\ignorespaces}{}{}}
% add chapter functionality in article class
\newcounter{Chapcounter}
\newcommand\showmycounter{\addtocounter{Chapcounter}{1}\themycounter}
\newcommand{\chapter}[1]
{ {\centering
\addtocounter{Chapcounter}{1} \Large \textbf{~#1}}
\addcontentsline{toc}{section}{~#1}
}
% table numbering in appendices (e.g., Table A.1)
% not working properly
%\setcounter{table}{0}
%\renewcommand\thetable{\Alph{section}.\arabic{table}}
% align table cells with large amount of text (using \makecell{})
\renewcommand{\cellalign}{tl}
% increase space between rows in table
\renewcommand{\arraystretch}{1.5}
% definitions
\definecolor{monashblue}{HTML}{006DAE}
\definecolor{darkred}{rgb}{100,0,0}
\RequirePackage{hyperref}
\hypersetup{
colorlinks=true,
urlcolor=monashblue,
linkcolor=monashblue,
citecolor=monashblue}
% define the use of \thanks{} symbol
\def\@fnsymbol#1{\ensuremath{\ifcase#1\or \mathsection\or \dagger\or
\mathparagraph\or \ddagger\or \|\or **\or \dagger\dagger
\or \ddagger\ddagger \else\@ctrerr\fi}}
% new commands
\newcommand{\mc}{\multicolumn} % multicolumn in tables
\newcommand{\red}{\textcolor{red}} % command for red text
\newcommand*\diff{\mathop{}\!\mathrm{d}} % `d` in differentials