summaryrefslogtreecommitdiffstats
path: root/tex/docstyle.sty
blob: ad4572c2f89acf89376b57605e4922389d772b56 (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
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{tex/docstyle}[2021/02/26 v0.1 Styling for a Sans-Serif report]

%% Margins
\RequirePackage{geometry}
\newgeometry{margin=2cm}

%% Set math font to sans-serif
%% Note: must be set before text font
% \RequirePackage{cmbright}
% \RequirePackage{sfmath}

%% Set font to sans-serif
\RequirePackage{fontspec}
\PassOptionsToPackage{
  usefilenames,
  DefaultFeatures = {
    Ligatures = Common
  }
}{plex-otf}
\RequirePackage{roboto}
\renewcommand*{\familydefault}{\sfdefault}

%% Headers and footers
\RequirePackage{fancyhdr}
\fancypagestyle{docstyle}{
  \fancyhf{} % clear currrent values
  \fancyhead[L]{\itshape\leftmark}
  \fancyhead[R]{}
  \fancyfoot[C]{\thepage}
  \renewcommand{\headrulewidth}{0pt}
}
\pagestyle{docstyle} % apply style

%% Title style
\RequirePackage{titling}
\setlength{\droptitle}{-1cm}
\pretitle{
  \begin{flushleft}
  \bfseries\huge
}
\posttitle{
  \end{flushleft}
  \large
}
\preauthor{
  \begin{flushleft}
  \large
}
\postauthor{
  \end{flushleft}
}
\predate{
  \begin{flushleft}
}
\postdate{
  \par\end{flushleft}
}

%% Link colors
\PassOptionsToPackage{table}{xcolor}
\RequirePackage{xcolor}
\PassOptionsToPackage{
  plainpages=false,
  pdfpagelabels,
  pdfusetitle,
  colorlinks = true,
  linkcolor = darkgray!50!black,
  urlcolor = blue!60!black,
  citecolor = black,
  anchorcolor = black
}{hyperref}
\RequirePackage{hyperref}

%% Source code listings
\RequirePackage{listings}
\lstset{
  belowcaptionskip=\baselineskip,
  breaklines=true,
  frame=none,
  inputencoding=utf8,
  % margin
  xleftmargin=\parindent,
  % numbers
  numbers=left,
  numbersep=5pt,
  numberstyle=\ttfamily\footnotesize\color{gray},
  % background
  backgroundcolor=\color{white},
  showstringspaces=false,
  % default language
  language=[LaTeX]TeX,
  % break long lines, and show an arrow where the line was broken
  breaklines=true,
  % postbreak=\mbox{\textcolor{blue!60!black}{$\hookrightarrow$}\space},
  % font
  basicstyle=\ttfamily\small,
  identifierstyle=\color{black},
  keywordstyle=\color{blue!60!black},
  commentstyle=\color{red!60!black},
  stringstyle=\color{orange!60!black},
}