-
Notifications
You must be signed in to change notification settings - Fork 0
/
mystyle.sty
157 lines (148 loc) · 4.71 KB
/
mystyle.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
\usepackage{graphicx} % for images
\usepackage{xcolor} % for text colors
\usepackage{hyperref} % hyperlinking
\usepackage{csquotes} % display quotes
\usepackage[T1]{fontenc} % Nicer default font (+ math font) than Computer Modern for most use cases
\usepackage{booktabs} % table support for pandoc > 1.12.2, toprule etc
\usepackage{adjustbox} % Used to constrain images to a maximum size
\usepackage[marginparsep=0.4mm]{geometry} % Used to adjust the document margins
\usepackage{amsmath} % Equations
\usepackage{amssymb} % Equations
\usepackage{comment} % block comments
\usepackage{fontawesome} % emoji stuff
\usepackage{marginnote} % for pyfile command
% Stuff for part images
% epipart.sty
\usepackage{titlesec}
\usepackage{epigraph}
\setlength{\epigraphwidth}{\textwidth}
\titleformat{\part}[display]
{\normalfont\huge\filcenter\bfseries\thispagestyle{epigraph}}
{\partname\ \thepart}
{20pt}
{\Huge}
\titlespacing*{\part}{0pt}{0pt}{40pt}
% Prevent overflowing lines due to hard-to-break entities
\sloppy
% Setup hyperref package
\hypersetup{
breaklinks=true, % so long urls are correctly broken across lines
colorlinks=true,
urlcolor=urlcolor,
linkcolor=linkcolor,
citecolor=citecolor,
}
% Slightly bigger margins than the latex defaults, overwrites book-style left and right margins
\geometry{verbose,tmargin=1in,bmargin=1in,lmargin=1in,rmargin=1in}
% Code Listings
\usepackage{listings} %%%%%%% manual add for more code formatting
\lstdefinestyle{mystyle}{
backgroundcolor=\color{backcolour},
commentstyle=\color{codegreen},
keywordstyle=\color{magenta},
numberstyle=\tiny\color{codegray},
stringstyle=\color{codepurple},
basicstyle=\ttfamily\footnotesize,
breakatwhitespace=false,
breaklines=true,
captionpos=b,
keepspaces=true,
numbers=left,
numbersep=5pt,
showspaces=false,
showstringspaces=false,
showtabs=false,
tabsize=2,
escapeinside={(*@}{@*)}
}
\lstset{style=mystyle}
% Creative Commons licensing
\usepackage[
type={CC},
modifier={by-nc-sa},
version={4.0},
]{doclicense}
% Bibliography
\usepackage[
backend=biber,
style=apa,
citestyle=authoryear
]{biblatex}
\addbibresource{bib.bib} %Imports bibliography file
% force notes to right
% instead of left right
\usepackage{etoolbox}
%\makeatletter
%\patchcmd{\@addmarginpar}{\ifodd\c@page}{\ifodd\c@page\@tempcnta\m@ne}{}{}
%\makeatother
%\reversemarginpar
% https://tex.stackexchange.com/questions/69595/marginnote-always-on-right-side-of-the-page
\makeatletter
\long\def\@mn@@@marginnote[#1]#2[#3]{%
\begingroup
\ifmmode\mn@strut\let\@tempa\mn@vadjust\else
\if@inlabel\leavevmode\fi
\ifhmode\mn@strut\let\@tempa\mn@vadjust\else\let\@tempa\mn@vlap\fi
\fi
\@tempa{%
\vbox to\z@{%
\vss
\@mn@margintest
\if@reversemargin\if@tempswa
\@tempswafalse
\else
\@tempswatrue
\fi\fi
\rlap{%
\ifx\@mn@currxpos\relax
\kern\marginnoterightadjust
\if@mn@verbose
\PackageInfo{marginnote}{%
xpos not known,\MessageBreak
using \string\marginnoterightadjust}%
\fi
\else\ifx\@mn@currxpos\@empty
\kern\marginnoterightadjust
\if@mn@verbose
\PackageInfo{marginnote}{%
xpos not known,\MessageBreak
using \string\marginnoterightadjust}%
\fi
\else
\if@mn@verbose
\PackageInfo{marginnote}{%
xpos seems to be \@mn@currxpos,\MessageBreak
\string\marginnoterightadjust
\space ignored}%
\fi
\begingroup
\setlength{\@tempdima}{\@mn@currxpos}%
\kern-\@tempdima
\if@twoside\ifodd\@mn@currpage\relax
\kern\oddsidemargin
\else
\kern\evensidemargin
\fi
\else
\kern\oddsidemargin
\fi
\kern 1in
\endgroup
\fi
\fi
\kern\marginnotetextwidth\kern\marginparsep
\vbox to\z@{\kern\marginnotevadjust\kern #3
\vbox to\z@{%
\hsize\marginparwidth
\linewidth\hsize
\kern-\parskip
\marginfont\raggedrightmarginnote\strut\hspace{\z@}%
\ignorespaces#2\endgraf
\vss}%
\vss}%
}%
}%
}%
\endgroup
}
\makeatother