summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/lectures
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-02-03 03:02:01 +0000
committerNorbert Preining <norbert@preining.info>2020-02-03 03:02:01 +0000
commit34897eebd22c3de968b64f09bb4a371d96cb0b89 (patch)
tree19a50e54fca63f1f6482d6cb4c2fdee676fd97b1 /macros/latex/contrib/lectures
parente05dc0bb38b16bfb9ba35591285e40af0adaadc4 (diff)
CTAN sync 202002030302
Diffstat (limited to 'macros/latex/contrib/lectures')
-rw-r--r--macros/latex/contrib/lectures/lectures.cls192
1 files changed, 121 insertions, 71 deletions
diff --git a/macros/latex/contrib/lectures/lectures.cls b/macros/latex/contrib/lectures/lectures.cls
index 26ffcdc037..893cc6799a 100644
--- a/macros/latex/contrib/lectures/lectures.cls
+++ b/macros/latex/contrib/lectures/lectures.cls
@@ -1,5 +1,5 @@
%
-% Copyright 2018 Luca Cappelletti
+% Copyright 2020 Luca Cappelletti
%
% Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
%
@@ -7,7 +7,7 @@
%
% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
%
-\def\LectureNotesVersion{v1.0.2}
+\def\LectureNotesVersion{v1.0.5}
\newcommand{\defaultlanguage}{italian}
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{lectures}[2019/01/27 LaTeX document class for lectures notes.]
@@ -27,6 +27,10 @@
top=20mm,
}
+\RequirePackage[utf8]{inputenc}
+\RequirePackage[T1]{fontenc}
+\renewcommand{\familydefault}{\sfdefault}
+
% Disabling useless warnings.
\RequirePackage{silence}
\WarningFilter{latex}{You have requested package}
@@ -49,7 +53,11 @@
\RequirePackage{centernot}
\RequirePackage{framed}
\RequirePackage{float}
+\RequirePackage{stmaryrd}
+\RequirePackage{verbatim}
+\RequirePackage{gensymb}
\RequirePackage[colorlinks=true,urlcolor=blue,pdfpagelabels,hyperindex=false]{hyperref} % Enable table of contents and links.
+\RequirePackage{diagbox}% To make split cellboxes
\RequirePackage[x11names,table,dvipsnames]{xcolor}
\RequirePackage{subfiles} % To use subfiles without cruxifying saints
@@ -67,6 +75,11 @@
\RequirePackage{sectsty} % Styles sectional headers
\RequirePackage{fancyhdr} % This allows for the headings in the chapters
\pagestyle{fancy} % This activates it
+
+% Reset the page number position
+\cfoot{} % Make the center of the footer blank
+\rfoot{\thepage} % Add the page number to the right corner of the page
+
\RequirePackage[avantgarde]{quotchap} % Custom style for chapters
% Reduce chapter name size and reserved blank space.
@@ -76,11 +89,11 @@
{\size@chapter{\sectfont\raggedleft
{\chapnumfont
\ifnum \c@secnumdepth >\m@ne%
- \if@mainmatter\thechapter\else\phantom{\thechapter}%
+ \if@mainmatter\Huge\thechapter\else\phantom{\thechapter}%
\fi\else\phantom{\thechapter}\fi
\par\nobreak}%
{\raggedleft\advance\leftmargin10em\interlinepenalty\@M #1\par}}
- \nobreak\chapterheadendvskip}}
+ \nobreak}}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -142,20 +155,12 @@
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\DeclareMathOperator{\var}{Var}
-\DeclareMathOperator{\conv}{conv}
-\DeclareMathOperator*{\argmin}{argmin}
-\DeclareMathOperator*{\argmax}{argmax}
-\DeclareMathOperator*{\mcd}{mcd}
-\DeclareMathOperator*{\mcp}{mcp}
-\DeclareMathOperator*{\Gr}{G=\rnd{V, E}}
-%\DeclareMathOperator* this one allows to create environment that behave like sum or min
-
\newcommand{\crs}{\text{\Cross}}
\newcommand*{\QED}{\hfill\ensuremath{\square}}%
\newcommand{\bra}[1]{\left\langle#1\right\rvert}
\newcommand{\ket}[1]{\left\lvert#1\right\rangle}
+\newcommand{\ngle}[1]{\left\langle#1\right\rangle}
\newcommand{\braket}[2]{\left\langle#1\delimsize\vert#2\right\rangle}
\newcommand{\ceil}[1]{\left\lceil#1\right\rceil}
@@ -165,9 +170,11 @@
\newcommand{\norm}[1]{\left\lVert#1\right\rVert}
\newcommand{\rnd}[1]{\left(#1\right)}
\newcommand{\sqr}[1]{\left[#1\right]}
+\newcommand{\ssqr}[1]{\llbracket#1\rrbracket}
\newcommand{\crl}[1]{\left\{#1\right\}}
\newcommand{\arity}[1]{\#\crl{#1}}
-
+\renewcommand{\hat}{\widehat}
+\renewcommand{\tilde}{\widetilde}
\let\oldbm\bm
\renewcommand{\bar}{\overline}
\renewcommand{\bm}[1]{\oldbm{\underline{#1}}}
@@ -176,17 +183,29 @@
\renewcommand{\geq}{\geqslant}
\renewcommand{\leq}{\leqslant}
+\DeclareMathOperator{\var}{Var}
+\DeclareMathOperator{\conv}{conv}
+\DeclareMathOperator*{\argmin}{argmin}
+\DeclareMathOperator*{\argmax}{argmax}
+\DeclareMathOperator*{\mcd}{mcd}
+\DeclareMathOperator*{\mcp}{mcp}
+\DeclareMathOperator*{\Gr}{G=\rnd{V, E}}
+%\DeclareMathOperator* this one allows to create environment that behave like sum or min
+
\def\zero{0}
\def\one{1}
\def\negative{-}
\def\positive{+}
\def\false{\zero}
\def\true{\one}
+\newcommand{\C}{\mathbb{C}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\D}{\mathbb{D}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\bs}{\backslash}
+\newcommand{\funcdef}[3]{#1:#2\longrightarrow #3}
+\newcommand{\fdef}[2]{\funcdef{f}{#1}{#2}}
\renewcommand{\O}[1]{\mathcal{O}\rnd{#1}}
@@ -212,7 +231,7 @@
\renewcommand{\a}{\alpha}
\newcommand{\w}{\omega}
-\newcommand{\e}{\epsilon}
+\newcommand{\e}{\varepsilon}
\buildVectorAliases{a}[\a]
\buildVectorAliases{w}[\w]
@@ -229,6 +248,18 @@
\buildVectorAliases{y}
\buildVectorAliases{z}
+% Derivates
+\NewDocumentCommand{\derivative}{m m}{
+ \frac{d #1}{d #2}
+}
+\NewDocumentCommand{\pderivative}{m m}{
+ \frac{\partial #1}{\partial #2}
+}
+% Matrix
+\NewDocumentCommand{\Matrix}{m}{
+ \begin{bmatrix}#1\end{bmatrix}
+}
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% CUSTOM PROBABILITY COMMANDS AND MACROS %
@@ -267,12 +298,12 @@
% #5 (optional) -> upscript
%
\ifblank{#3}{%
- \mathbb{E}_{#4}^{#5}\rnd{#1}
+ \mathbb{E}_{#4}^{#5}\sqr{#1}
}{%
\IfNoValueTF{#2}{%
- \mathbb{E}_{#4}^{#5}\rnd{\left. #1 \;\right\rvert\; #3}
+ \mathbb{E}_{#4}^{#5}\sqr{\left. #1 \;\right\rvert\; #3}
}{%
- \mathbb{E}_{#4}^{#5}\rnd{#1\;#2\;#3}
+ \mathbb{E}_{#4}^{#5}\sqr{#1\;#2\;#3}
}
}
}
@@ -394,6 +425,27 @@
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Units macro to be able to do \unit{m} to get \leftm\right] and \unit{m}{s} to get \left[\frac{m}{s}\right]
+\NewDocumentCommand{\unit}{m G{}}{
+ \ifblank{#2}{
+ \sqr{#1}
+ }{
+ \sqr{\frac{#1}{#2}}
+ }
+}
+
+\def\celsius{
+ ^\circ C
+}
+
+\def\kelvin{
+ ^\circ K
+}
+
+\def\fahrenheit{
+ ^\circ F
+}
+
\def\hz{
Hz
}
@@ -409,6 +461,8 @@
% automaticall apply mathmode to column
\newcolumntype{L}{>{$}l<{$}}
+\newcolumntype{C}{>{$}c<{$}}
+\newcolumntype{R}{>{$}r<{$}}
\renewcommand*{\arraystretch}{1.25} % Stretching arrays
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -470,7 +524,6 @@
\ctikzset{tripoles/mos style/arrows}
\ctikzset{tripoles/pmos style/emptycircle}
\usetikzlibrary{shapes,arrows,calc,positioning,matrix}
-\usepgfplotslibrary{external}
\pgfplotsset{samples=60,shader=interp,grid=both}
@@ -495,68 +548,46 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\theoremstyle{definition} % Sets the theorem style without italic
-
-\IfEq{\defaultlanguage}{italian}{
- \newtheorem{theorem}{Teorema}[section]
- \newtheorem{corollary}{Corollario}[theorem]
- \newtheorem{lemma}[theorem]{Lemma}
- \newtheorem{proposition}[theorem]{Proposizione}
- \newtheorem{observation}[theorem]{Osservazione}
- \newtheorem{definition}[theorem]{Definizione}
- \newtheorem{complexity}[theorem]{Complessità computazionale}
- \newtheorem{property}[theorem]{Proprietà}
- \newtheorem{problem}[theorem]{Problema}
- \newtheorem{customProof}[theorem]{Dimostrazione}
-}{
- \IfEq{\defaultlanguage}{italian}{
- \newtheorem{theorem}{Theorem}[section]
- \newtheorem{corollary}{Corollary}[theorem]
- \newtheorem{lemma}[theorem]{Lemma}
- \newtheorem{proposition}[theorem]{Proposition}
- \newtheorem{observation}[theorem]{Observation}
- \newtheorem{definition}[theorem]{Definition}
- \newtheorem{complexity}[theorem]{Computational complexity}
- \newtheorem{property}[theorem]{Property}
- \newtheorem{problem}[theorem]{Problem}
- \newtheorem{customProof}[theorem]{Proof}
- }{
- \PackageError{lectures}{%
- Given language option is unknown.
- }{%
- Use either italian or english.
- }
- }
+\usepackage{tcolorbox}
+\NewDocumentCommand{\createtheorem}{m m m m m}{%
+ % #1 -> environment name
+ % #2 -> italian name
+ % #3 -> background color
+ % #4 -> border color
+ % #5 -> title color
+
+ \newtcolorbox[auto counter,number within=chapter]{#1}[1][]{colback=#3,colframe=#4,coltitle=#5,fonttitle=\bfseries,parbox=false,title=#2~\thetcbcounter~|~##1}
}
+\createtheorem{axiom}{Assioma}{Gold1!10}{Gold1!60}{black}
+\createtheorem{goal}{Obbiettivo}{Goldenrod1!10}{Goldenrod1!50}{black}
-\let\oldTheorem\theorem
-\renewenvironment{theorem}{\colorlet{shadecolor}{Green!15}\begin{shaded}\begin{oldTheorem}}{\end{oldTheorem}\end{shaded}\ignorespacesafterend}
+\createtheorem{definition}{Definizione}{Red2!10}{Red2!40}{black}
-\let\oldDefinition\definition
-\renewenvironment{definition}{\colorlet{shadecolor}{Red!10}\begin{shaded}\begin{oldDefinition}}{\end{oldDefinition}\end{shaded}\ignorespacesafterend}
+\createtheorem{fact}{Fatto}{Green3!10}{Green3!30}{black}
+\createtheorem{theorem}{Teorema}{Chartreuse2!10}{Chartreuse3!30}{black}
+\createtheorem{lemma}{Lemma}{Chartreuse3!10}{Chartreuse3!40}{black}
-\let\oldCorollary\corollary
-\renewenvironment{corollary}{\colorlet{shadecolor}{Brown!10}\begin{shaded}\begin{oldCorollary}}{\end{oldCorollary}\end{shaded}\ignorespacesafterend
-}
+\createtheorem{claim}{Affermazione}{Chartreuse3!10}{Chartreuse3!40}{black}
-\let\oldProposition\proposition
-\renewenvironment{proposition}{\colorlet{shadecolor}{Green!5}\begin{shaded}\begin{oldProposition}}{\end{oldProposition}\end{shaded}\ignorespacesafterend
-}
+\createtheorem{corollary}{Corollario}{Sienna2!10}{Sienna2!60}{black}
+\createtheorem{property}{Proprietà}{Sienna2!10}{Sienna2!90}{white}
-\let\oldLemma\lemma
-\renewenvironment{lemma}{\colorlet{shadecolor}{Green!10}\begin{shaded}\begin{oldLemma}}{\end{oldLemma}\end{shaded}\ignorespacesafterend
-}
+\createtheorem{proposition}{Proposizione}{SpringGreen3!10}{SpringGreen3!30}{black}
+\createtheorem{observation}{Osservazione}{Firebrick2!10}{Firebrick2!40}{black}
-\let\oldComplexity\complexity
-\renewenvironment{complexity}{\colorlet{shadecolor}{Melon!10}\begin{shaded}\begin{oldComplexity}}{\end{oldComplexity}\end{shaded}\ignorespacesafterend}
+\createtheorem{conclusion}{Conclusione}{SteelBlue3!10}{SteelBlue3!90}{black}
+\createtheorem{generalization}{Generalizzazione}{LavenderBlush3!10}{LavenderBlush3}{black}
-\let\oldProperty\property
-\renewenvironment{property}{\colorlet{shadecolor}{Red!10}\begin{shaded}\begin{oldProperty}}{\end{oldProperty}\end{shaded}\ignorespacesafterend}
+\createtheorem{problem}{Problema}{Red1!10}{Red1!60}{white}
+\createtheorem{example}{Esempio}{MediumPurple3!10}{MediumPurple3!40}{black}
-\let\oldProblem\problem
-\renewenvironment{problem}{\colorlet{shadecolor}{Red!15}\begin{shaded}\begin{oldProblem}}{\end{oldProblem}\end{shaded}\ignorespacesafterend}
+\createtheorem{solution}{Soluzione}{DodgerBlue3!10}{DodgerBlue3!30}{black}
+\createtheorem{analysis}{Analisi}{DeepPink2!10}{DeepPink2!30}{black}
+\createtheorem{complexity}{Complessità}{Turquoise4!10}{Turquoise4}{black}
-\renewenvironment{proof}{\colorlet{shadecolor}{Violet!10}\begin{shaded}\begin{customProof}}{\QED\end{customProof}\end{shaded}\ignorespacesafterend}
+\createtheorem{proofWrapper}{Dimostrazione}{DarkOrchid4!10}{DarkOrchid4!30}{black}
+\renewenvironment{proof}{\begin{proofWrapper}}{\end{proofWrapper}}
%
% THE FOLLOWING CODE ADDS BOLD TO THE THEOREM NAME
@@ -694,4 +725,23 @@
\RenewDocumentCommand{\tableofcontents}{}{
{\hypersetup{hidelinks}\oldtableofcontents}
-} \ No newline at end of file
+}
+
+\NewDocumentCommand{\DisableTikz}{}{%
+ \newif\ifshowtikz
+ \showtikztrue
+ \showtikzfalse % <---- comment/uncomment that line
+
+ \let\oldtikzpicture\tikzpicture
+ \let\oldendtikzpicture\endtikzpicture
+
+ \renewenvironment{tikzpicture}{%
+ \ifshowtikz\expandafter\oldtikzpicture%
+ \else\comment%
+ \fi
+ }{%
+ \ifshowtikz\oldendtikzpicture%
+ \else\endcomment%
+ \fi
+ }
+}