% !TEX encoding = IsoLatin

% colors

\usepackage{color, colortbl, xcolor}
\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{gray}{rgb}{0.5,0.5,0.5}
\definecolor{mauve}{rgb}{0.58,0,0.82}
\definecolor{Gray}{gray}{0.9}
\definecolor{cream}{RGB}{255, 237, 186}
\definecolor{LightCyan}{RGB}{204, 255, 204}
\definecolor{javared}{rgb}{0.6,0,0} % for strings
\definecolor{javagreen}{rgb}{0.25,0.5,0.35} % comments
\definecolor{javapurple}{rgb}{0.5,0,0.35} % keywords
\definecolor{javadocblue}{rgb}{0.25,0.35,0.75} % javadoc
\definecolor{lightbrown}{RGB}{179,69,0} % javadoc


% math letters
\usepackage{mathrsfs}
\usepackage[mathscr]{euscript}

% tikz
\usepackage{tikz}
\usepackage{tikz-qtree}
\usetikzlibrary {arrows.meta}

% better tables
\usepackage{ctable}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{boldline}
\setlength{\heavyrulewidth}{0.1em}
\setlength{\lightrulewidth}{0.05em}
\newcommand{\otoprule}{\midrule[\heavyrulewidth]}
\newcommand{\thickHline}{\specialrule{3\arrayrulewidth}{0em}{0em}}

% per utilizzare simboli matematici non di default
\usepackage{latexsym}

%Disjoint symbol
\def\disjoint{{\mkern+5mu\bowtie\mkern-17mu/\mkern+9mu}}

% per inserire uno spazio "fantasma" nella definizione di un'abbreviazione
\usepackage{xspace}

\usepackage{float}

% per inserire un DOI senza problemi coi caratteri "strani" ivi presenti
\usepackage{doi}
\renewcommand{\doitext}{DOI }% originally was "doi:"

% per inserire correttamente le unità di misura SI (incluse quelle binarie)
\usepackage[binary-units]{siunitx}
% se si desidera usare / invece che la potenza -1 per indicare "al secondo"
\sisetup{per-mode=symbol}

% per inserire codice di programmazione complesso
\usepackage{listings}% per inserire codice di programmazione complesso
\lstset{
basicstyle=\ttfamily,
columns=fullflexible,
xleftmargin=3ex,
breaklines,
breakatwhitespace,
escapechar=`
}

% modify some page parameters
\setlength{\parskip}{\medskipamount}

% riga orizzontale
\newcommand{\HRule}{\rule{\linewidth}{0.2mm}}
% esempio di creazione di semplici abbreviazioni
\newcommand{\ltx}{\LaTeX\xspace}
\newcommand{\txw}{TeXworks\xspace}
\newcommand{\mik}{MikTex\xspace}
\newcommand{\html}{HTML\xspace}
\newcommand{\xhtml}{XHTML\xspace}

% esempio di creazione di un'abbreviazione con un parametro (il cui uso è indicato da #1)
\newcommand{\cmd}[1]{\texttt{#1}\xspace}
% per citare un RFC, es. \rfc{822}
\newcommand{\rfc}[1]{RFC-#1\xspace}
% per citare un file (es. \file{autoexec.bat}) o una URI fittizia (es. \file{http://www.lioy.it/})
% per le URI vere usare \url o \href
\newcommand{\file}[1]{\texttt{#1}\xspace}
% per inserire codice di esempio in-line
\newcommand{\code}[1]{\lstinline|#1|}
% importante per i pathname Windows perché non si può usare \ essendo un carattere riservato di Latex
\newcommand{\bs}{\textbackslash}
% definizione di un termine: formattazione ed inserimento nell'indice
\newcommand{\tdef}[1]{\textit{#1}\index{#1}}
% meta-termine, usato tipicamente nelle definizioni dei tag
\newcommand{\meta}[1]{\textit{#1}}
% abbreviazioni in inglese
\newcommand{\ie}{i.e.\xspace}
\newcommand{\eg}{e.g.\xspace}


% REST requests
\newcommand{\hget}{\code{GET}\xspace}
\newcommand{\hpost}{\code{POST}\xspace}
\newcommand{\hput}{\code{PUT}\xspace}
\newcommand{\hdelete}{\code{DELETE}\xspace}
\newcommand{\hoptions}{\code{OPTIONS}\xspace}

% Colors
\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{gray}{rgb}{0.5,0.5,0.5}
\definecolor{mauve}{rgb}{0.58,0,0.82}

\usepackage{color, colortbl}
\definecolor{Gray}{gray}{0.9}
\definecolor{LightCyan}{rgb}{0,0,0}

% box for equation
\usepackage{amsmath}
\usepackage{empheq}

\usepackage[most]{tcolorbox}

\newtcbox{\myBox}[1][]{%
	nobeforeafter, math upper, tcbox raise base,
	enhanced, colframe=black!30!black,
	colback=Gray!30, boxrule=1pt,
	#1}

% pseudocode

\usepackage{amsmath}
%\usepackage{algorithm}
\usepackage[noend]{algpseudocode}

\makeatletter
\def\BState{\State\hskip-\ALG@thistlm}
\makeatother

\usepackage[ruled,vlined]{algorithm2e}
\usepackage{algorithmicx}

\algnewcommand{\algorithmicgoto}{\textbf{go to}}%
\algnewcommand{\Goto}{\algorithmicgoto\xspace}%
\algnewcommand{\Label}{\State\unskip}

% uml classes
\usepackage{tikz-uml}

% workflow
\usetikzlibrary{shapes,arrows}

% figure

\newcommand*{\figuretitle}[1]{%
	{\centering%   <--------  will only affect the title because of the grouping (by the
		\textbf{#1}%              braces before \centering and behind \medskip). If you remove
		\par\medskip}%            these braces the whole body of a {figure} env will be centered.
}


% Code
\lstdefinestyle{XML}{
	basicstyle=\ttfamily,
	columns=fullflexible,
	breaklines,
	breakatwhitespace,
	tabsize=4,
	showspaces=false,
	showstringspaces=false,
	morestring=[s][\color{blue}]{"}{"},
	morestring=[s][\color{black}]{>}{<},
	morecomment=[s]{<?}{?>},
	morecomment=[s][\color{javagreen}]{<!--}{-->},
	morekeywords={Entities,Entity,Policy,Rule,PolicyName,PolicyType,DefAction,Selector,Priority},
	commentstyle=\color{javagreen},
	stringstyle=\color{blue},
	identifierstyle=\color{lightbrown},
	keywordstyle=\color{javapurple}
}

\lstdefinestyle{Bash}{
	language=Bash,
	basicstyle=\ttfamily,
	commentstyle=\color{blue},
	keywordstyle=\color{javapurple}\bfseries,
	stringstyle=\color{javared},
	columns=fullflexible,
	breaklines,
	breakatwhitespace,
	%numbers=none,
	escapechar=`,
	showspaces=false,
	showstringspaces=false
}

\lstdefinestyle{Java}{
	xleftmargin=3ex,
	language=Java,
	basicstyle=\ttfamily,
	columns=fullflexible,
	keywordstyle=\color{javapurple}\bfseries,
	stringstyle=\color{javared},
	commentstyle=\color{javagreen},
	morecomment=[s][\color{javadocblue}]{/**}{*/},
	numbers=left,
	numbersep=6pt,
	numberstyle=\color{gray}\small,
	breaklines,
	breakatwhitespace,
	tabsize=4,
	showspaces=false,
	showstringspaces=false
}