summaryrefslogtreecommitdiff
path: root/content/latexHeaders/code.sty
diff options
context:
space:
mode:
authormzuenni <mzuenni@users.noreply.github.com>2024-07-28 22:54:40 +0200
committerGitHub <noreply@github.com>2024-07-28 22:54:40 +0200
commit8d11c6c8213f46f0fa19826917c255edd5d43cb1 (patch)
tree96d75baff33d5a04b5a60f1a41f514a26c716874 /content/latexHeaders/code.sty
parent8c33b4e0d3030cfed17fc64b4fe41133339f6d87 (diff)
Test (#4)
* update * moved content in subdir * rename file * add test setup * add test setup * add github action * automaticly test all cpp files * timeout after 10s * setulimit and dont zero memory * test build pdf * install latexmk * update * update * ngerman * fonts * removed old code * add first test * added tests * test in sorted order * more tests * simplified test * more tests * fix suffix tree * fixes and improvements * done ust lst directly * fix swap * add links to pdf * fix constants * add primorial * add comment * various improvements * more tests * added missing stuf * more tests * fix tests * more tests * more tests * more tests * fix recursion? * test trie * more tests * only use python temporarily for listings * only use python temporarily for listings * more tests * fix longestCommonSubstring * more tests * more tests * made code more similiar * fix? * more tests * more tests * more tests * add ahoCorasick test + limit 4GB stack size * more tests * fix test * add additional test * more tests * more tests * fix? * better fix * fix virtual tree * more tests * more tests * recursive closest pair * more tests * decrease limit * new tests * more tests * fix name * more tests * add test * new test * more tests * more tests * more tests * more tests * new test and content * new code * new code * larger tests * fix and test * new test * new test * update pdf * remove comments * new test * more tests * more testcases * more tests * increased limit * more tests * more tests * more tests * new tests * more tests * shortened code * new test * add basic tests for bigint * more tests * removed old files * new test * ignore some files * more auto more ccw * fix test * more tests * fix * new tests * more tests * more tests * stronger test * actually verify delaunay... * more tests * fix header * more tests * run tests parallel? * test parralel? * add --missing * separate workflows * test * is the pdf checked? * separate workflows * fix workflow * more workflows --------- Co-authored-by: Yidi <noob999noob999@gmail.com>
Diffstat (limited to 'content/latexHeaders/code.sty')
-rw-r--r--content/latexHeaders/code.sty141
1 files changed, 141 insertions, 0 deletions
diff --git a/content/latexHeaders/code.sty b/content/latexHeaders/code.sty
new file mode 100644
index 0000000..3ebdda3
--- /dev/null
+++ b/content/latexHeaders/code.sty
@@ -0,0 +1,141 @@
+% Colors, used for syntax highlighting.
+% To print this document, set all colors to black!
+\usepackage{xcolor}
+\definecolor{safeRed}{HTML}{D7191C}
+\definecolor{safeOrange}{HTML}{FFDE71}
+\definecolor{safeYellow}{HTML}{FFFFBF}
+\definecolor{safeGreen}{HTML}{99CF8F}
+\definecolor{safeBlue}{HTML}{2B83BA}
+
+%try printer friendly colors?
+%\colorlet{keyword}{safeBlue}
+%\colorlet{string}{safeRed}
+%\colorlet{comment}{safeGreen}
+%\colorlet{identifier}{black}
+\definecolor{type}{HTML}{2750A0}
+\definecolor{string}{HTML}{7B3294}
+\definecolor{comment}{HTML}{1A9641}
+\definecolor{identifier}{HTML}{000000}
+\definecolor{keyword}{HTML}{900000}
+
+% Source code listings.
+\usepackage[scaled=0.80]{beramono}
+
+\usepackage{listings}
+\lstset{
+ language={[11]C++},
+ numbers=left,
+ stepnumber=1,
+ numbersep=6pt,
+ numberstyle=\small,
+ breaklines=true,
+ breakautoindent=true,
+ breakatwhitespace=false,
+ numberblanklines=true,
+ postbreak=\space,
+ tabsize=2,
+ upquote=true,
+ basicstyle=\ttfamily\normalsize,
+ showspaces=false,
+ showstringspaces=false,
+ extendedchars=true,
+ keywordstyle=\color{keyword}\bfseries,
+ stringstyle=\color{string}\bfseries,
+ commentstyle=\color{comment}\bfseries\itshape,
+ identifierstyle=\color{identifier},
+ directivestyle=\color{keyword}\bfseries,
+ emph={auto, int, long, long long, float, double, long double, char, bool, void, ll, ld, pt, lll, __int128, __float128, true, false, this, nullptr, INF, inf, EPS, eps},
+ emphstyle=\color{type}\bfseries,
+ frame=trbl,
+ aboveskip=3pt,
+ belowskip=3pt,
+ deletestring=[b]{'},%fix digit separator but break char highlighting (fixed again with literate)
+ escapechar=@
+ %moredelim=**[is][{\btHL[fill=green!30,draw=red,dashed,thin]}]{@}{@}
+}
+
+\newcommand{\formatChar}[1]{{\color{string}\bfseries\textquotesingle{}#1\textquotesingle{}}}
+
+% Listings doesn't support UTF8. This is just enough for German umlauts. and commonly used chars
+\lstset{literate=%
+ {'a'}{{\formatChar{a}}}3
+ {'z'}{{\formatChar{z}}}3
+ {'A'}{{\formatChar{A}}}3
+ {'Z'}{{\formatChar{Z}}}3
+ {'0'}{{\formatChar{0}}}3
+ {'1'}{{\formatChar{1}}}3
+ {'\$'}{{\formatChar{\$}}}3
+ {'\#'}{{\formatChar{\#}}}3
+ {Ö}{{\"O}}1
+ {Ä}{{\"A}}1
+ {Ü}{{\"U}}1
+ {ß}{{\ss}}1
+ {ü}{{\"u}}1
+ {ä}{{\"a}}1
+ {ö}{{\"o}}1
+ {~}{{\textasciitilde}}1
+}
+
+\makeatletter
+\let\orig@lstnumber=\thelstnumber
+\newcommand\lstresetnumber{\global\let\thelstnumber=\orig@lstnumber}
+\let\orig@placelstnumber=\lst@PlaceNumber
+\gdef\lst@PlaceNumber{\orig@placelstnumber\lstresetnumber}
+\newcommand\lstsettmpnumber[1]{\gdef\thelstnumber{#1}}
+
+\lst@AddToHook{OnEmptyLine}{%
+ \ifnum\value{lstnumber}>99
+ \lstsettmpnumber{\_\_\_}
+ \else\ifnum\value{lstnumber}>9
+ \lstsettmpnumber{\_\_}
+ \else
+ \lstsettmpnumber{\_}
+ \fi\fi
+% \lstsettmpnumber{\_\_\kern-6pt}%
+ \vspace{-1.75ex}%
+ \addtocounter{lstnumber}{-1}%
+}
+% old: (change numberblanklines=false!)
+%\lst@AddToHook{OnEmptyLine}{%
+% \vspace{\dimexpr\baselineskip+0.5em}%
+% \addtocounter{lstnumber}{-1}%
+%}
+
+\newenvironment{btHighlight}[1][]
+{\begingroup\tikzset{bt@Highlight@par/.style={#1}}\begin{lrbox}{\@tempboxa}}
+{\end{lrbox}\bt@HL@box[bt@Highlight@par]{\@tempboxa}\endgroup}
+
+\newcommand\btHL[1][]{%
+ \begin{btHighlight}[#1]\bgroup\aftergroup\bt@HL@endenv%
+ }
+ \def\bt@HL@endenv{%
+ \end{btHighlight}%
+ \egroup%
+}
+\newcommand{\bt@HL@box}[2][]{%
+ \tikz[#1]{%
+ \pgfpathrectangle{\pgfpoint{1pt}{0pt}}{\pgfpoint{\wd #2}{\ht #2}}%
+ \pgfusepath{use as bounding box}%
+ \node[anchor=base west, fill=orange!30,outer sep=0pt,inner xsep=2.2pt, inner ysep=0pt, rounded corners=3pt, minimum height=\ht\strutbox+1pt,#1]{\raisebox{1pt}{\strut}\strut\usebox{#2}};
+ }%
+}
+
+\newcommand{\hl}[1]{\btHL[fill=safeOrange,draw=black,thin]{#1}}
+
+\ifthenelse{\isundefined{\gitorigin}}{}{
+ \usepackage{ocgx2}
+ \usepackage{fontawesome}
+ \lst@AddToHook{Init}{%
+ \ifthenelse{\equal{\lst@name}{}}{}{%
+ \begin{minipage}[t][0pt]{\linewidth}%
+ \vspace{0pt}%
+ \hfill%
+ \begin{ocg}[printocg=never]{Source links}{srclinks}{1}%
+ \hfill\href{\gitorigin\lst@name}{\faExternalLink}%
+ \end{ocg}%
+ \end{minipage}%
+ }%
+ }
+}
+\makeatother
+