tugraz_defaults.sty 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455
  1. \ProvidesPackage{tugraz_defaults}
  2. %\usepackage[hyphens]{url}
  3. \PassOptionsToPackage{bookmarks,hidelinks}{hyperref}
  4. \usepackage{hyperref}
  5. \hypersetup{breaklinks=true}
  6. \usepackage[utf8]{inputenc}
  7. \usepackage{amsmath}
  8. \usepackage{collcell}
  9. \usepackage{comment}
  10. \usepackage{float}
  11. \usepackage{adjustbox}
  12. \usepackage{paralist}
  13. \usepackage[binary-units=true,per-mode=symbol]{siunitx}
  14. \sisetup{detect-weight=true,unit-mode=text,group-minimum-digits=4}
  15. \usepackage{xspace}
  16. \usepackage{placeins}
  17. \usepackage{xcolor}
  18. \usepackage{tikz}
  19. \usetikzlibrary{external}
  20. \usepackage{pgfplots}
  21. \usepackage{pgfplotstable}
  22. \usetikzlibrary{pgfplots.groupplots}
  23. \usetikzlibrary{arrows}
  24. \usetikzlibrary{patterns}
  25. \usetikzlibrary{positioning}
  26. \usetikzlibrary{decorations.pathreplacing}
  27. \usetikzlibrary{shapes.arrows}
  28. \usetikzlibrary{shapes.geometric,shapes.misc}
  29. \usetikzlibrary{pgfplots.groupplots}
  30. \pgfplotsset{compat=newest}
  31. \usepackage{caption}
  32. \usepackage{subcaption}
  33. \captionsetup{compatibility=false}
  34. \captionsetup[figure]{aboveskip=0.5em, belowskip=0.5em,labelfont={small},font={small}}
  35. %\captionsetup[subfigure]{skip=10pt,labelfont={bf,normal},font={bf,normal}}
  36. \captionsetup[table]{aboveskip=0.5em, belowskip=0.5em,labelfont={small},font={small}}
  37. \captionsetup[lstlisting]{labelformat=simple,skip=5pt,labelfont={small},font={small}}
  38. \captionsetup[subfloat]{font={small}}
  39. % ------------------------------
  40. \definecolor{lukasred}{HTML}{950000}
  41. \definecolor{andreasgreen}{HTML}{e9f5db}
  42. \definecolor{vsblack}{cmyk}{0,0,0,1}
  43. \definecolor{vswhite}{HTML}{24292e}
  44. \definecolor{vsbackground}{HTML}{ffffff} %background in Visual Studio
  45. \definecolor{vscomment}{HTML}{047f04} %comments in Visual Studio
  46. \definecolor{vskeyword}{HTML}{0024fe} %keywords in Visual Studio
  47. \definecolor{vsstring}{cmyk}{0,0.26,0.38,0} %strings in Visual Studio
  48. \definecolor{vsctrlflow}{HTML}{ad1eda} %if/else,switch/case etc. in Visual Studio
  49. \definecolor{vslocalvar}{HTML}{001780} %local variables in Visual Studio
  50. \definecolor{vsclass}{HTML}{1d809d} %class types in Visual Studio
  51. \definecolor{vsfunctions}{HTML}{7a5d27} %enumerations and methods in Visual Studio
  52. % ------------------------------
  53. % Fancy notes
  54. \usepackage{letltxmacro}
  55. \usepackage{xparse}
  56. \setdefaultleftmargin{1.5em}{}{}{}{.5em}{.5em}
  57. \NewDocumentEnvironment{figureA}{omo}{\begin{figure}[#1]\tikzsetnextfilename{#2}\centering}{\IfNoValueTF {#3}{}{\caption{#3}}\label{fig:#2}\end{figure}}
  58. \NewDocumentEnvironment{subfigureA}{ommo}{\begin{subfigure}[#1]{#2}\tikzsetnextfilename{#3}\centering}{\IfNoValueTF {#4}{}{\caption{#4}}\label{fig:#3}\end{subfigure}}
  59. \NewDocumentEnvironment{figureA*}{omo}{\begin{figure*}[#1]\tikzsetnextfilename{#2}\centering}{\IfNoValueTF {#3}{}{\caption{#3}}\label{fig:#2}\end{figure*}}
  60. \NewDocumentEnvironment{subfigureA*}{ommo}{\begin{subfigure*}[#1]{#2}\tikzsetnextfilename{#3}\centering}{\IfNoValueTF {#4}{}{\caption{#4}}\label{fig:#3}\end{subfigure*}}
  61. \usepackage{algorithmic}
  62. \usepackage[ruled]{algorithm2e}
  63. \usepackage{listings}
  64. \newfloat{listing}{tbhp}{lst}%[section]
  65. \floatname{listing}{Listing}
  66. \lstset{ %
  67. backgroundcolor=\color{vsbackground},
  68. basicstyle=\scriptsize\bf\ttfamily\upshape\color{vswhite},
  69. belowcaptionskip=1\baselineskip,
  70. breakatwhitespace=true,
  71. breakautoindent=false,
  72. breakindent=0pt,
  73. breaklines=true, % sets automatic line breaking
  74. captionpos=b, % sets the caption-position to bottom
  75. columns=fixed,
  76. commentstyle=\color{vscomment},
  77. emphstyle={[2]\color{vslocalvar}},
  78. emphstyle={[3]\color{vsclass}},
  79. emphstyle={[4]\color{vsfunctions}},
  80. emphstyle=\color{vsctrlflow},
  81. escapeinside={(*@}{@*)},
  82. extendedchars=true, % lets you use non-ASCII characters; for 8-bits encodings only, does not work with UTF-8
  83. frame=single, % adds a frame around the code
  84. %framesep=5pt,
  85. framexleftmargin=13pt,
  86. framexrightmargin=-20.5pt,
  87. keepspaces=true, % keeps spaces in text, useful for keeping indentation of code (possibly needs columns=flexible)
  88. keywordstyle=\color{vskeyword},
  89. language=C, % the language of the code
  90. %linewidth=\listingwidth,
  91. morecomment=[s][\color{vscomment}]{/*-}{*/},
  92. morecomment=[s][\color{vscomment}]{/*+}{*/},
  93. numbers=left, % where to put the line-numbers; possible values are (none, left, right)
  94. numbersep=4pt, % how far the line-numbers are from the code
  95. numberstyle=\tiny\bf\color{vsblack},
  96. postbreak=\mbox{\textcolor{red}{->}\space},
  97. rulecolor=\color{black}, % if not set, the frame-color may be changed on line-breaks within not-black text (e.g. comments (green here))
  98. rulecolor=\color{vsbackground},
  99. rulesep=0pt,
  100. showspaces=false, % show spaces everywhere adding particular underscores; it overrides 'showstringspaces'
  101. showstringspaces=false, % underline spaces within strings only
  102. showtabs=false, % show tabs within strings adding particular underscores
  103. stringstyle=\color{vsstring},
  104. tabsize=2, % sets default tabsize to 2 spaces
  105. xleftmargin=10pt,
  106. xrightmargin=10pt
  107. }
  108. \lstdefinelanguage
  109. [x64]{Assembler} % add a "x64" dialect of Assembler
  110. [x86masm]{Assembler} % based on the "x86masm" dialect
  111. % with these extra keywords:
  112. {morekeywords={CDQE,CQO,CMPSQ,CMPXCHG16B,JRCXZ,LODSQ,MOVSXD, %
  113. POPFQ,PUSHFQ,SCASQ,STOSQ,IRETQ,RDTSCP,SWAPGS, %
  114. rax,rdx,rcx,rbx,rsi,rdi,rsp,rbp, %
  115. r8,r8d,r8w,r8b,r9,r9d,r9w,r9b}} % etc.
  116. \lstdefinestyle{cpp}
  117. {
  118. language=c++,
  119. % syntax higlights
  120. morekeywords={partial, var, value, get, set, uint64\_t, func},
  121. % control flow
  122. emph={if, else, return, throw, switch, case, for, repeat},
  123. % local vars
  124. emph={[2]start, end, samples, N, L, cache\_line, victim_cache_line,KEY_FLAG_REVOKED,keyring,ns},
  125. % class and structs
  126. emph={[3]SomeOwnClassType, Measurement, Sample, key},
  127. % functions
  128. emph={[4]measure,fill,ioctl,measure_power,record_sample,diff,access,find\_keyring\_by\_name,list\_for\_each\_entry,test\_bit,kuid_has_mapping,keyctl_join_session_keyring,KEYCTL_JOIN_SESSION_KEYRING},
  129. }
  130. \usepackage{fancyvrb}
  131. \lstdefinestyle{asm}
  132. {
  133. language={[x64]Assembler},
  134. % syntax higlights
  135. morekeywords={ud2,syscall,movq,prefetcht0},
  136. % control flow
  137. emph={},
  138. % local vars
  139. emph={[2]victim\_cache\_line,MSR\_PKG\_POWER\_LIMIT},
  140. % class and structs
  141. emph={[3]rip,rax,rdx,eax,rsp},
  142. % functions
  143. emph={[4]module\_ioctl,misspeculation,retpoline,retpoline\_end},
  144. }
  145. \newcommand\Highlight[1]{\underline{\textcolor{red}{#1}}}
  146. \newcommand\HighlightB[1]{\textbf{\textcolor{blue}{#1}}}
  147. \newcommand\HighlightD[1]{{\textcolor{green!80!black}{#1}}}
  148. \newenvironment{Plain}[1][]
  149. { \VerbatimEnvironment%
  150. \begin{Verbatim}[#1]}
  151. { \end{Verbatim} }
  152. \newcommand{\gbr}[1]{\left\{#1\right\}}
  153. \newcommand{\SIx}[1]{\num{#1}\relax}
  154. \newcommand{\xor}{\oplus}
  155. \newcommand{\etal}{et~al.\ } % typography nerd
  156. \newcommand{\ie}{\textit{i.e.},\ } % typography nerd
  157. \newcommand{\eg}{e.g.,\ } % typography nerd
  158. \newcommand{\cf}{cf.\ } % typography nerd
  159. \newcommand{\KeyDrown}{\emph{KeyDrown}\xspace}
  160. \newcommand{\FlushOnly}{Flush+Flush\xspace}
  161. \newcommand{\clflush}{\texttt{clflush}\xspace}
  162. \newcommand{\FlushReload}{Flush+\allowbreak Reload\xspace}
  163. \newcommand{\EvictReload}{Evict+\allowbreak Reload\xspace}
  164. \newcommand{\EvictTime}{Evict+\allowbreak Time\xspace}
  165. \newcommand{\PrimeProbe}{Prime+\allowbreak Probe\xspace}
  166. \newcommand{\MultiPrimeProbe}{Multi-\allowbreak Prime+\allowbreak Probe\xspace}
  167. \newcommand{\FlushFlush}{Flush+\allowbreak Flush\xspace}
  168. \newcommand{\GTKplus}{\emph{GTK+}\xspace}
  169. \newcommand{\libgdk}{\emph{libgdk}\xspace}
  170. \newcommand{\OnePlus}{OnePlus 3t\xspace}
  171. \newcommand{\FScore}{F-score\xspace}
  172. \newcommand{\ReqOne}{\emph{R1}\xspace}
  173. \newcommand{\ReqTwo}{\emph{R2}\xspace}
  174. \newcommand{\ReqThree}{\emph{R3}\xspace}
  175. \usepackage{pifont}
  176. \newcommand{\xmark}{\leavevmode{\color{red}\ding{55}}}%
  177. \newcommand{\cmark}{\leavevmode{\color{TolDarkGreen}\ding{51}}}%
  178. \newcommand{\tmark}{\leavevmode{\color{orange!90!red}\large $\mathbf{\thicksim}$}}%
  179. \mathchardef\mhyphen="2D
  180. \newcommand*\circled[1]{\tikz[baseline=(char.base)]{
  181. \node[shape=circle,draw,inner sep=2pt] (char) {#1};}}
  182. \newcommand*\circledb[1]{\tikz[baseline=(char.base)]{
  183. \node[shape=circle,draw,inner sep=2pt,fill=black,text=white] (char) {#1};}}
  184. \newcommand*\circleds[1]{\tikz[baseline=(char.base)]{
  185. \node[shape=circle,draw,inner sep=1pt] (char) {\footnotesize #1};}}
  186. \newcommand*\circledsb[1]{\tikz[baseline=(char.base)]{
  187. \node[shape=circle,draw,inner sep=0.7pt,fill=black,text=white] (char) {\footnotesize #1};}}
  188. % ------------------------------
  189. \newcommand{\FakeMarker}{{\color{red}$\blacktriangle$}}
  190. \newcommand{\RealMarker}{{\color{green}$\bullet$}}
  191. \newfloat{lstfloat}{htbp}{lop}
  192. \floatname{lstfloat}{Listing}
  193. \usepackage{epsdice}
  194. \usepackage{soul}
  195. \usepackage[noabbrev,capitalize]{cleveref}
  196. \widowpenalty10000
  197. \clubpenalty10000
  198. % plot default colors
  199. \definecolor{TolDarkPurple}{HTML}{332288}
  200. \definecolor{TolDarkBlue}{HTML}{6699CC}
  201. \definecolor{TolLightBlue}{HTML}{88CCEE}
  202. \definecolor{TolLightGreen}{HTML}{44AA99}
  203. \definecolor{TolDarkGreen}{HTML}{117733}
  204. \definecolor{TolDarkBrown}{HTML}{999933}
  205. \definecolor{TolLightBrown}{HTML}{DDCC77}
  206. \definecolor{TolDarkRed}{HTML}{661100}
  207. \definecolor{TolLightRed}{HTML}{CC6677}
  208. \definecolor{TolLightPink}{HTML}{AA4466}
  209. \definecolor{TolDarkPink}{HTML}{882255}
  210. \definecolor{TolLightPurple}{HTML}{AA4499}
  211. % plot
  212. \definecolor{PlotColorBlue}{HTML}{2C7FB8}
  213. \definecolor{PlotColorRed}{HTML}{F03B20}
  214. \definecolor{PlotColorGreen}{HTML}{31A354}
  215. % colors
  216. \definecolor{red}{HTML}{F03B20}
  217. \definecolor{yellow}{HTML}{F5EE9A}
  218. \definecolor{green}{HTML}{BEDB39}
  219. \definecolor{blue}{HTML}{2C7FB8}
  220. \pgfplotscreateplotcyclelist{mbarplot cycle}{%
  221. {draw=TolDarkBlue, fill=TolDarkBlue!70},
  222. {draw=TolLightBrown, fill=TolLightBrown!70},
  223. {draw=TolLightGreen, fill=TolLightGreen!70},
  224. {draw=TolDarkPink, fill=TolDarkPink!70},
  225. {draw=TolDarkPurple, fill=TolDarkPurple!70},
  226. {draw=TolDarkRed, fill=TolDarkRed!70},
  227. {draw=TolDarkBrown, fill=TolDarkBrown!70},
  228. {draw=TolLightRed, fill=TolLightRed!70},
  229. {draw=TolLightPink, fill=TolLightPink!70},
  230. {draw=TolLightPurple, fill=TolLightPurple!70},
  231. {draw=TolLightBlue, fill=TolLightBlue!70},
  232. {draw=TolDarkGreen, fill=TolDarkGreen!70},
  233. }
  234. \pgfplotscreateplotcyclelist{mlineplot cycle}{%
  235. {TolDarkBlue, mark=*, mark size=1.5pt},
  236. {TolLightBrown, mark=square*, mark size=1.3pt},
  237. {TolLightGreen, mark=triangle*, mark size=1.5pt},
  238. {TolDarkBrown, mark=diamond*, mark size=1.5pt},
  239. }
  240. \usepackage{diagbox}
  241. \usepackage{oplotsymbl}
  242. \LetLtxMacro{\oldcircletfill}{\circletfill}
  243. \LetLtxMacro{\oldcirclet}{\circlet}
  244. \LetLtxMacro{\oldcircletfillhl}{\circletfillhl}
  245. \renewcommand{\circletfill}{\raisebox{-0.9pt}{\tikzsetnextfilename{circletfill}\oldcircletfill}}
  246. \renewcommand{\circlet}{\raisebox{-0.9pt}{\tikzsetnextfilename{circlet}\oldcirclet}}
  247. \renewcommand{\circletfillhl}{\raisebox{-0.9pt}{\tikzsetnextfilename{circletfillhl}\oldcircletfillhl}}
  248. \newcommand{\cmarkfull}{\multicolumn{1}{c} {\circletfill \phantom{*}}}
  249. \newcommand{\cmarkempty}{\multicolumn{1}{c} {\circlet \phantom{*}}}
  250. \newcommand{\cmarkhalf}{\multicolumn{1}{c} {\circletfillhl \phantom{*}}}
  251. \newcommand{\cstarletfill}{\multicolumn{1}{c} {\starletfill \phantom{*}}}
  252. \newcommand{\cstarlet}{\multicolumn{1}{c} {\starlet \phantom{*}}}
  253. \newcommand{\cmarkfulls}{\multicolumn{1}{c} {\circletfill *}}
  254. \newcommand{\cmarkemptys}{\multicolumn{1}{c} {\circlet *}}
  255. \newcommand{\cmarkhalfs}{\multicolumn{1}{c} {\circletfillhl *}}
  256. \newcommand{\cmarkfulld}{\multicolumn{1}{c} {\circletfill $^\dagger$}}
  257. \newcommand{\cmarkemptyd}{\multicolumn{1}{c} {\circlet $^\dagger$}}
  258. \newcommand{\cmarkhalfd}{\multicolumn{1}{c} {\circletfillhl $^\dagger$}}
  259. \newcommand{\muop}{$\mu$OP\xspace}
  260. \newcommand{\muops}{$\mu$OPs\xspace}
  261. \lstdefinestyle{python}{
  262. language=python,
  263. % syntax higlights
  264. morekeywords={False, True},
  265. % control flow
  266. emph={if, else, return, throw, switch, case, for, repeat, import},
  267. % local vars
  268. emph={[2]cpu, self, stable_periode, STABLE, PWRSAVE, POWERSAVE},
  269. % class and structs
  270. emph={[3]SUIT_DOWN_simple, PowerState},
  271. % functions
  272. emph={[4]__init__, disabled_instruction_ex_handler, timer_interrupt_handler},
  273. }
  274. \lstdefinestyle{cppinline}{
  275. style = cpp,
  276. basicstyle=\small\bf\ttfamily\upshape\color{vswhite},
  277. }
  278. \lstdefinestyle{asminline}{
  279. style = asm,
  280. basicstyle=\small\bf\ttfamily\upshape\color{vswhite},
  281. }
  282. \lstdefinestyle{pythoninline}{
  283. style = python,
  284. basicstyle=\small\bf\ttfamily\upshape\color{vswhite},
  285. }
  286. \newcommand{\asm}[1]{\lstinline[style=asm]{#1}\xspace}
  287. \newcommand{\cpp}[1]{\lstinline[style=cpp]{#1}\xspace}
  288. \newcommand{\py}[1]{\lstinline[style=python]{#1}\xspace}
  289. \usepackage{moresize}
  290. \usepackage{pdfpages}
  291. \usepackage{enumitem}
  292. \usepackage{mdframed}
  293. \usepackage{import}
  294. \usepackage{microtype}
  295. \usepackage[breakable, theorems, skins]{tcolorbox}
  296. \usepackage[backend=biber,
  297. url=true,
  298. style=numeric,
  299. giveninits=false,
  300. maxnames=32,
  301. minnames=32,
  302. maxcitenames=2,
  303. mincitenames=1,
  304. backref=true, %
  305. ]{biblatex}
  306. \DeclareFieldFormat*{title}{#1}
  307. \DeclareFieldFormat*{booktitle}{#1}
  308. \DeclareFieldFormat*{journaltitle}{#1}
  309. \newcommand{\itemcite}[1]{\begin{itemize}\item \fullcite{#1}\end{itemize}}
  310. \renewcommand{\bf}{\bfseries}
  311. \renewcommand{\tt}{\ttfamily}
  312. \renewcommand{\and}{,\xspace}
  313. \newcommand{\CopyrightYear}{}
  314. \newcommand{\setcopyright}{}
  315. \newcommand{\conferenceinfo}{}
  316. \newcommand{\isbn}{}
  317. \newcommand{\doi}{}
  318. \newcommand{\printccsdesc}{}
  319. \newcommand{\numberofauthors}{}
  320. \newcommand{\alignauthor}{}
  321. \newcommand{\affaddr}{}
  322. \newcommand{\ccsdesc}[1]{}
  323. \newcommand{\acmPrice}{}
  324. \newcommand{\keywords}[1]{Keywords:\ #1.}
  325. \usepackage{graphicx}
  326. \usepackage[openbib,NoDate]{currvita}
  327. \preto\fullcite{\AtNextCite{\defcounter{maxnames}{99}}}
  328. \usepackage{quotchap} %
  329. \DefineBibliographyStrings{english}{%
  330. backrefpage = {p.},%
  331. backrefpages = {pp.},%
  332. }
  333. \usepackage[titles]{tocloft}
  334. \renewcommand\cftchapaftersnum{.}
  335. \setlength{\cftchapnumwidth}{2em}
  336. \usepackage{verbatim}
  337. \makeatletter
  338. \frenchspacing
  339. \widowpenalty=10000
  340. \clubpenalty=10000
  341. \setcounter{tocdepth}{1}
  342. \renewenvironment{table}
  343. {\setlength\abovecaptionskip{0\p@}%
  344. \setlength\belowcaptionskip{10\p@}%
  345. \@float{table}}
  346. {\end@float}
  347. \newenvironment{CCSXML}
  348. {\comment}
  349. {\endcomment}
  350. \makeatother
  351. \makeatletter
  352. \def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else
  353. \hbox{} \vspace*{\fill}
  354. \begin{center}
  355. \end{center}
  356. \vspace{\fill} \thispagestyle{empty}
  357. \newpage
  358. \if@twocolumn\hbox{}\newpage\fi\fi\fi}
  359. \makeatother
  360. \makeatletter
  361. \newcommand\declarecommand{\@star@or@long\@declarecommand}
  362. \newcommand\@declarecommand[1]{%
  363. \provide@command{#1}{}%
  364. \renew@command{#1}%
  365. }
  366. \def\declareenvironment{\@star@or@long\declare@environment}
  367. \def\declare@environment#1{%
  368. \@ifundefined{#1}%
  369. {\def\reserved@a{\newenvironment{#1}}}%
  370. {\def\reserved@a{\renewenvironment{dummy@environ}}}%
  371. \reserved@a
  372. }
  373. \def\dummy@environ{}
  374. \makeatother
  375. \makeatletter
  376. \DeclareRobustCommand{\rvdots}{%
  377. \vbox{
  378. \baselineskip4\p@\lineskiplimit\z@
  379. \kern-\p@
  380. \hbox{.}\hbox{.}\hbox{.}
  381. }}
  382. \makeatother
  383. \usepackage{titling}
  384. \usepackage[english]{babel}
  385. \addto{\captionsenglish}{\renewcommand*{\appendixname}{Appendix}}
  386. \renewcommand{\algorithmautorefname}{Algorithm}
  387. \renewcommand\itemautorefname{Step}
  388. \renewcommand\chapterautorefname{Chapter}
  389. \renewcommand\sectionautorefname{Section}
  390. \renewcommand\subsectionautorefname{Section}
  391. \renewcommand\subsubsectionautorefname{Section}
  392. \usepgfplotslibrary{dateplot}
  393. \usepgfplotslibrary{fillbetween}
  394. \hyphenation{}
  395. \usepackage{chngcntr}
  396. \addtokomafont{disposition}{\rmfamily}
  397. \usepackage{mypreamble}
  398. \usepackage{scrhack}