-
Notifications
You must be signed in to change notification settings - Fork 1
/
tol.sty
186 lines (165 loc) · 6.21 KB
/
tol.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
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
% This is a style file to be used in publications of the Department of Information
% Processing Science in University of Oulu (http://www.tol.oulu.fi).
% It tries to mimic the appearance of the required, official document styling,
% but is far from complete. All help is appreciated...
%
% NOTE: This is barely usable style to be used for creating documents for TOL classes.
% More style fixes coming hopefully someday.
%
% At the moment this style does the following things:
% - Change the page layout to follow the correct style
% - Change the title page to follow the correct style
% - Change table of contents to follow the correct style
% - Sets up the correct citation settings (biblatex-apa)
% -
% TODO:
% - Styling of lists, tables, image settings, ..
% -
%
% Usage:
% 1) Copy this file and oylogo.png (rip it from the .doc file) to the directory where your tex file is
% 2) Add \usepackage{tol} to your tex document
% 3) Define \author, \email, \course, \studentno and \title, and call \hypersetupdefault
% if you want default pdf settings (with title like Course - Title and author(s) set)
% 4) Remember to use \addcontentsline{toc}{section}{$SECTION_TITLE$} to add non numbered section to table of contents
% 4) Call \maketitle after beginning the document environment
% 5) Call \addbibresource{yourbib.bib} just like normally to generate reference list
% 6) Use \parencite{key} for normal citations (Author, 2013).
% And \textcite{key} for Author et al. (2014)
% 7) Included finnish-apa.lbx translates apa terms to finnish (et al. -> ym.). Uncomment finnish language specific lines to support it.
%
% Original Author: Teemu Rytilahti (tol-orig.sty)
% Modified by: Juho Myllylahti (2015?)
% Additional modifications: Mikael Saarinen (2021-07-17)
% Comments, ideas and patches welcome!
% Github: https://github.com/msrn/tol-latex-template
\usepackage{hyperref} %% PDF generation settings. Options at the bottom of this file
\usepackage{graphicx} %% images
\usepackage{chngpage} %% changing layout per page basis, needed for title page
\usepackage{calc}
%%%%%%%%%%%%%%%%%
%%%%LANGUAGE%%%%%
%%%%%%%%%%%%%%%%%
\usepackage[british]{babel}
%\usepackage[finnish]{babel} %finnish support
\usepackage[utf8]{inputenc}
%\usepackage[T1]{fontenc}
%%%%%%%%%%%%%%%%%
%%%%CITATIONS%%%%
%%%%%%%%%%%%%%%%%
% citations using biblatex-apa (7th edition)
\usepackage{csquotes}
\usepackage[backend=biber, urldate=short, style=apa]{biblatex}
\DeclareLanguageMapping{british}{british-apa}
%\DeclareLanguageMapping{finnish}{finnish-apa} %finnish support
%%%%%%%%%%%%%%%%%%%%%
%%%%GENERAL STYLE%%%%
%%%%%%%%%%%%%%%%%%%%%
\usepackage[a4paper,margin=2cm,left=4cm]{geometry}
\usepackage{parskip}
\setlength{\parskip}{12pt} % line between paragraphs
\setlength{\parindent}{0pt} % don't indent paragraphs
%\sloppy
%general layout
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\fancyhead[RE,RO]{\thepage}
\setlength{\headheight}{24pt}
%%%%%%%%%%%%%
%%%%FONTS%%%%
%%%%%%%%%%%%%
%%%% If not available change:
%%%% Times New Roman = Liberation Serif (main),
%%%% Arial = Liberation Sans (sansfont),
%%%% Courier New = Liberation Mono (monofont)
\usepackage{fontspec}
\usepackage{titlesec}
%%%% linux
%\setmainfont[Ligatures={TeX},Mapping=tex-text]{Liberation Serif}
%\setsansfont[Ligatures={TeX},Mapping=tex-text]{Liberation Sans}
%\setmonofont[Ligatures={TeX},Mapping=tex-text, Scale=0.8]{Liberation Mono}
%%%% windows
\setmainfont[Ligatures={TeX},Mapping=tex-text]{Times New Roman}
\setsansfont[Ligatures={TeX},Mapping=tex-text]{Arial}
\setmonofont[Ligatures={TeX},Mapping=tex-text, Scale=0.8]{Courier New}
%%%% Headings = Sections
%\newfontfamily\sectionfont{Arial}
\setcounter{secnumdepth}{4} % Count up to heading 3
%%%% Heading 0
\titleformat*{\section}{\sffamily\Large\mdseries}
%%%% Heading 1
\titleformat*{\subsection}{\sffamily\large\mdseries}
%%%% Heading 2
\titleformat*{\subsubsection}{\sffamily\large\mdseries}
%%%% Heading 3 use \paragraph
\titleformat{\paragraph}[hang]{\sffamily\large\mdseries}{\theparagraph}{1em}{}
\titlespacing*{\paragraph}{0pt}{3.25ex plus 1ex minus .2ex}{0.5em}
%%%% Heading 4 \subparagraph
\titleformat{\subparagraph}[hang]{\sffamily\normalsize\itshape}{\thesubparagraph}{1em}{}
\titlespacing*{\subparagraph}{0pt}{3.25ex plus 1ex minus .2ex}{0.5em}
%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%TABLE OF CONTENTS%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{tocloft}
%%%% Toc title font
\renewcommand*\cfttoctitlefont{\sffamily\mdseries\Large}
%\renewcommand{\cfttoctitlefont}{\fontspec{Times New roman}\Large\mdseries}
\renewcommand{\cftaftertoctitleskip}{24pt} %%%% Margin between Toc listing and heading
\setcounter{tocdepth}{5} %%%% Show all (sub)sections and (sub)paragraphs in TOC
\renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}} %%%% dots to seections
\renewcommand{\cftsecfont}{\normalfont} %%%% normal font for sections instead of bolded
\renewcommand{\cftsecpagefont}{\normalfont} %%%% don't bold section's page numbers
\renewcommand{\cftbeforesecskip}{0pt} %%%% no lineskips between sections
\renewcommand{\cftdotsep}{0} %%%% space between dots
%%%%%%%%%%%%%%%%%%%%
%%%%TITLE PAGE %%%%%
%%%%%%%%%%%%%%%%%%%%
%%%% ability to set variables for titlepage usage eg \institute{University Of Oulu}
\def\course{\def\course}
\def\institute{\def\institute}
\def\faculty{\def\faculty}
\def\email{\def\email}
\def\studentno{\def\studentno}
\def\title{\def\title}
\def\maketitle{{
\begin{titlepage}
\thispagestyle{empty}
\begin{adjustwidth}{-2cm}{0cm}
\vfill
%%%% Logo
\vspace*{4.7cm}
\begin{center}
\includegraphics[height=1.11in,width=2.44in]{style/oylogo.png} \\
\mbox{ }\\
\vspace*{2.5cm}
\begin{LARGE}\sffamily\textbf{\title}\end{LARGE} \\
\end{center}
\vfill
%%%% Comment the variables you want or don't use in the title page
\begin{flushright}
\parbox[l][4cm]{7cm}{
\institute \\
\faculty \\
\course \\
%\mbox{ }\\
\@author \\ \ %\studentno \\
%\email \\
\@date
}
\end{flushright}
\end{adjustwidth}
\end{titlepage}}
}
%%%%%%%%%%%%%%%%%%%%%%
%%%%PDF SETTINGS %%%%%
%%%%%%%%%%%%%%%%%%%%%%
\def\hypersetupdefault{
\hypersetup{
pdfauthor={\@author},
pdftitle={\course - \title},
colorlinks={false},
pdfborder={0 0 0 0},
}
}