init commit

This commit is contained in:
Oystein Kristoffer Tveit 2021-03-24 13:03:50 +01:00
parent f5af8251e5
commit d343421892
6 changed files with 3694 additions and 0 deletions

View File

@ -0,0 +1,27 @@
(TeX-add-style-hook
"ntnu-math"
(lambda ()
(TeX-run-style-hooks
"cancel"
"tikz"
"pgfplots"
"amssymb"
"tcolorbox"
"colortbl")
(TeX-add-symbols
'("thickline" 1)
'("mcom" 1)
"erow"
"T"
"F")
(LaTeX-add-environments
'("truthtable" 2)
"mgraphbox")
(LaTeX-add-lengths
"oldarrayrulewidth")
(LaTeX-add-tcolorbox-newtcolorboxes
'("coloredgraphbox" "" "" ""))
(LaTeX-add-array-newcolumntypes
"e"))
:latex)

View File

@ -0,0 +1,30 @@
(TeX-add-style-hook
"ntnu"
(lambda ()
(TeX-add-to-alist 'LaTeX-provided-package-options
'(("xcolor" "dvipsnames") ("inputenc" "utf8") ("tcolorbox" "many") ("adjustbox" "export") ("babel" "norsk" "english")))
(TeX-run-style-hooks
"xcolor"
"graphicx"
"inputenc"
"hyperref"
"geometry"
"titling"
"tcolorbox"
"fancyhdr"
"enumitem"
"float"
"adjustbox"
"babel")
(TeX-add-symbols
'("pic" 1)
'("setsubexc" 1)
'("setexc" 1)
"ntnuTitle"
"exc"
"subexc")
(LaTeX-add-environments
"excs"
"subexcs"))
:latex)

View File

@ -0,0 +1,84 @@
\RequirePackage{ntnu}
\RequirePackage{xcolor}
\RequirePackage{listings}
\RequirePackage{tcolorbox}
\definecolor{code-foreground}{RGB}{248, 248, 242} % Monokai fg
\definecolor{code-background}{RGB}{39, 40, 34} % Monokai bg
\definecolor{code-keyword}{RGB}{249, 38, 144} % Monokai Red
\definecolor{code-string}{RGB}{230, 219, 116} % Monokai Yellow
\definecolor{code-comment}{RGB}{117, 113, 94} % Monokai Grey
\definecolor{code-identifier}{RGB}{166, 226, 46} % Monokai Green
\tcbuselibrary{
breakable,
listings
}
% TODO: Add stuff like box chars and maybe chess pieces
\lstset{literate=
{á}{{\'a}}1 {é}{{\'e}}1 {í}{{\'i}}1 {ó}{{\'o}}1 {ú}{{\'u}}1
{Á}{{\'A}}1 {É}{{\'E}}1 {Í}{{\'I}}1 {Ó}{{\'O}}1 {Ú}{{\'U}}1
{à}{{\`a}}1 {è}{{\`e}}1 {ì}{{\`i}}1 {ò}{{\`o}}1 {ù}{{\`u}}1
{À}{{\`A}}1 {È}{{\'E}}1 {Ì}{{\`I}}1 {Ò}{{\`O}}1 {Ù}{{\`U}}1
{ä}{{\"a}}1 {ë}{{\"e}}1 {ï}{{\"i}}1 {ö}{{\"o}}1 {ü}{{\"u}}1
{Ä}{{\"A}}1 {Ë}{{\"E}}1 {Ï}{{\"I}}1 {Ö}{{\"O}}1 {Ü}{{\"U}}1
{â}{{\^a}}1 {ê}{{\^e}}1 {î}{{\^i}}1 {ô}{{\^o}}1 {û}{{\^u}}1
{Â}{{\^A}}1 {Ê}{{\^E}}1 {Î}{{\^I}}1 {Ô}{{\^O}}1 {Û}{{\^U}}1
{Ã}{{\~A}}1 {ã}{{\~a}}1 {Õ}{{\~O}}1 {õ}{{\~o}}1 {Ø}{{\O}}1
{œ}{{\oe}}1 {Œ}{{\OE}}1 {æ}{{\ae}}1 {Æ}{{\AE}}1 {ß}{{\ss}}1
{ű}{{\H{u}}}1 {Ű}{{\H{U}}}1 {ő}{{\H{o}}}1 {Ő}{{\H{O}}}1
{ç}{{\c c}}1 {Ç}{{\c C}}1 {ø}{{\o}}1 {å}{{\r a}}1 {Å}{{\r A}}1
{€}{{\euro}}1 {£}{{\pounds}}1 {«}{{\guillemotleft}}1
{»}{{\guillemotright}}1 {ñ}{{\~n}}1 {Ñ}{{\~N}}1 {¿}{{?`}}1
}
\lstdefinestyle{monokai}{
frame=none,
xleftmargin=5mm,
numbers=left,
stepnumber=1, % the step between two line-numbers.
numbersep=5pt, % how far the line-numbers are from the code
showspaces=false, % show spaces adding particular underscores
showstringspaces=false, % underline spaces within strings
showtabs=false, % show tabs within strings adding particular underscores
tabsize=2, % default tabsize
captionpos=b, % caption-position
breaklines=true, % sets automatic line breaking
breakatwhitespace=true, % sets if automatic breaks should only happen at whitespace
numberstyle=\color{white!60!black}\ttfamily,
backgroundcolor=\color{code-background},
basicstyle=\color{code-foreground}\ttfamily,
keywordstyle=\color{code-keyword}\ttfamily,
stringstyle=\color{code-string}\ttfamily,
commentstyle=\color{code-comment}\ttfamily,
identifierstyle=\color{code-identifier},
emph={format_string, eff_ana_bf, permute, eff_ana_btr},
emphstyle=\color{identifier}\ttfamily
}
\newtcbinputlisting{\codeFile}[3][]{
title={\Large\color{white} #2},
listing file=#2, % file path
listing inputencoding=utf8,
colback=code-background,
boxrule=3pt,
arc=0pt,
outer arc=0pt,
top=0pt,
bottom=0pt,
enlarge top by=0pt,
enlarge bottom by=0pt,
colframe=ntnublue,
coltext=code-foreground,
listing only,
left=10pt,
enhanced,
breakable,
listing options={
style=monokai,
language=#3
},
#1 % temp file
}

View File

@ -0,0 +1,85 @@
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{ntnu-math}[Personal styles for NTNU math exercises]
\RequirePackage{cancel}
\RequirePackage{tikz}
\RequirePackage{pgfplots}
\RequirePackage{amssymb}
\RequirePackage{amsthm}
% ░█▀▀░▄▀▄░█░█░█▀█░▀█▀░▀█▀░█▀█░█▀█░█▀▀
% ░█▀▀░█\█░█░█░█▀█░░█░░░█░░█░█░█░█░▀▀█
% ░▀▀▀░░▀\░▀▀▀░▀░▀░░▀░░▀▀▀░▀▀▀░▀░▀░▀▀▀
\newcommand{\mcom}[1]{&& \text{#1}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\Z}{\mathbb{Z}}
% ░█▀▀░█▀▄░█▀█░█▀█░█░█░█▀▀
% ░█░█░█▀▄░█▀█░█▀▀░█▀█░▀▀█
% ░▀▀▀░▀░▀░▀░▀░▀░░░▀░▀░▀▀▀
\RequirePackage{tcolorbox}
\newtcolorbox{coloredgraphbox}[1][]{
colframe=ntnublue,
arc=0pt,
outer arc=0pt
colback=white,
boxrule=3pt,
#1
}
%TODO: Make resizable and float
\newenvironment{mgraphbox}[1][]{
\begin{center}
\begin{coloredgraphbox}[#1]
}{
\end{coloredgraphbox}
\end{center}
}
%TODO: Directed graphs, trees
% ░▀█▀░█▀█░█▀▄░█░░░█▀▀░█▀▀
% ░░█░░█▀█░█▀▄░█░░░█▀▀░▀▀█
% ░░▀░░▀░▀░▀▀░░▀▀▀░▀▀▀░▀▀▀
\RequirePackage{colortbl}
\newlength{\oldarrayrulewidth}
\newcommand{\thickline}[1]{%
\noalign{\global\setlength{\oldarrayrulewidth}{\arrayrulewidth}}%
\noalign{\global\setlength{\arrayrulewidth}{#1}}%
\arrayrulecolor{ntnublue}\hline%
\arrayrulecolor{black}%
\noalign{\global\setlength{\arrayrulewidth}{\oldarrayrulewidth}}}
\newcolumntype{e}{>{\columncolor{ntnublue!10}}c}
\newcommand{\erow}{\rowcolor{ntnublue!10}}
%TODO: Fix First bit which is placed a little off
\newcommand{\T}{{\color{ForestGreen}T}}
\newcommand{\F}{{\color{red}F}}
\newenvironment{truthtable}[2]
{
\begin{figure}[H]
\centering
\begin{tabular}{#1}
\renewcommand{\arraystretch}{1.5}
#2 \\
\thickline{1pt}
\renewcommand{\arraystretch}{1}
}
{
\end{tabular}
\end{figure}
}

207
tex/latex/local/ntnu.sty Normal file
View File

@ -0,0 +1,207 @@
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{ntnu}[Personal styles for NTNU exercises]
\RequirePackage[dvipsnames]{xcolor}
\definecolor{ntnublue}{RGB}{0,80,158}
\RequirePackage{graphicx}
\RequirePackage[utf8]{inputenc}
% ░█░█░█░█░█▀█░█▀▀░█▀▄░█░░░▀█▀░█▀█░█░█░█▀▀
% ░█▀█░░█░░█▀▀░█▀▀░█▀▄░█░░░░█░░█░█░█▀▄░▀▀█
% ░▀░▀░░▀░░▀░░░▀▀▀░▀░▀░▀▀▀░▀▀▀░▀░▀░▀░▀░▀▀▀
\RequirePackage{hyperref}
\hypersetup{
colorlinks=true,
linkcolor=blue,
filecolor=magenta,
urlcolor=blue,
}
% ░█▀▀░█▀▀░█▀█░█▄█░█▀▀░▀█▀░█▀▄░█░█
% ░█░█░█▀▀░█░█░█░█░█▀▀░░█░░█▀▄░░█░
% ░▀▀▀░▀▀▀░▀▀▀░▀░▀░▀▀▀░░▀░░▀░▀░░▀░
\RequirePackage{geometry}
\geometry{
a4paper,
left=15mm,
right=15mm,
top=30mm,
bottom=20mm,
}
% ░▀█▀░▀█▀░▀█▀░█░░░▀█▀░█▀█░█▀▀
% ░░█░░░█░░░█░░█░░░░█░░█░█░█░█
% ░░▀░░▀▀▀░░▀░░▀▀▀░▀▀▀░▀░▀░▀▀▀
\RequirePackage{titling}
\RequirePackage[many]{tcolorbox}
% \author{\theAuthor}
% \title{\theTitle}
\pretitle{
\begin{flushleft}
\LARGE
}
\posttitle{
\par
\end{flushleft}
}
\preauthor{
\begin{flushleft}
\large
}
\postauthor{
\par
\end{flushleft}
}
\predate{
\begin{flushleft}
\large
}
\postdate{
\par
\end{flushleft}
}
\newtcolorbox{@ntnutitlebox}{
% tikznode,
% tcbox width=auto limited,
% capture=hbox,
enhanced,
colback=ntnublue,
coltext=white,
arc=0pt,
boxrule=0pt,
parbox=false,
top=5mm,
bottom=5mm
}
\newcommand{\ntnuTitle}{
\begin{minipage}{0.80\textwidth}
\begin{@ntnutitlebox}
\Huge\thetitle
\LARGE\theauthor
\end{@ntnutitlebox}
\end{minipage}
\hfill
\begin{minipage}{0.10\textwidth}
\vspace*{2mm}
\centering
\includegraphics[scale=1.2]{$HOME/texmf/tex/latex/local/ntnu/ntnu_logo.pdf}
\end{minipage}
\vspace*{2cm}
}
% ░█░█░█▀▀░█▀█░█▀▄░░░█░█▀▀░█▀█░█▀█░▀█▀
% ░█▀█░█▀▀░█▀█░█░█░▄▀░░█▀▀░█░█░█░█░░█░
% ░▀░▀░▀▀▀░▀░▀░▀▀░░▀░░░▀░░░▀▀▀░▀▀▀░░▀░
\RequirePackage{fancyhdr}
\newcommand{\ntnu@pageword}{Page}
\pagestyle{fancy}
\fancyhf{}
\rhead{\theauthor}
\lhead{\thetitle}
\rfoot{\ntnu@pageword\ \thepage}
\renewcommand{\headrulewidth}{1pt}
\renewcommand{\footrulewidth}{1pt}
% ░█▀▀░█░█░█▀▀░█▀▄░█▀▀░▀█▀░█▀▀░█▀▀░█▀▀
% ░█▀▀░▄▀▄░█▀▀░█▀▄░█░░░░█░░▀▀█░█▀▀░▀▀█
% ░▀▀▀░▀░▀░▀▀▀░▀░▀░▀▀▀░▀▀▀░▀▀▀░▀▀▀░▀▀▀
\RequirePackage{enumitem}
\renewcommand{\theenumi}{\arabic{enumi}}
\renewcommand{\labelenumi}{\Large\fbox{\theenumi}}
\newenvironment{excs}{
\begin{enumerate}
}
{
\end{enumerate}
}
\newcommand{\setexc}[1]{\setcounter{enumi}{#1}}
\newcommand{\exc}{
\item\
\addcontentsline{toc}{subsection}{Oppgave \theenumi}
}
%--------------------------%
\renewcommand{\theenumii}{\alph{enumii})}
\renewcommand{\labelenumii}{\textbf{\theenumii}}
\newenvironment{subexcs}{
\begin{enumerate}
}{
\end{enumerate}
}
\newcommand{\setsubexc}[1]{\setcounter{enumii}{#1}}
\newcommand{\subexc}{
\vspace*{0.5cm}
\item\
\addcontentsline{toc}{subsubsection}{\theenumii}
}
% ░█▄█░▀█▀░█▀▀░█▀▀
% ░█░█░░█░░▀▀█░█░░
% ░▀░▀░▀▀▀░▀▀▀░▀▀▀
\RequirePackage{float}
\RequirePackage[export]{adjustbox}
\newcommand{\pic}[1]{
\begin{figure}[H]
\includegraphics[width=\linewidth, cfbox=ntnublue 3pt 3pt]{#1}
\end{figure}
}
\ProcessOptions\relax
\setlength{\parindent}{0cm}
\RequirePackage{pifont}
\newcommand{\cmark}{\ding{51}}%
\newcommand{\xmark}{\ding{55}}%
\newcommand{\vcheck} {{\color{ForestGreen}\cmark}}
\newcommand{\xcheck} {{\color{red}\xmark}}
% ░█▀█░█▀█░▀█▀░▀█▀░█▀█░█▀█░█▀▀
% ░█░█░█▀▀░░█░░░█░░█░█░█░█░▀▀█
% ░▀▀▀░▀░░░░▀░░▀▀▀░▀▀▀░▀░▀░▀▀▀
\newif\ifntnu@mylang\ntnu@mylangfalse
\DeclareOption{norsk}{\ntnu@mylangtrue}
\DeclareOption*{\OptionNotUsed} % discard any undeclared option
\ProcessOptions\relax
\ifntnu@mylang
\RequirePackage[norsk, english]{babel}
\renewcommand{\ntnu@pageword}{Side}
\else
\RequirePackage[english, norsk]{babel} %% the default
\fi

File diff suppressed because one or more lines are too long