% Created 2023-01-26 Thu 09:33
% Intended LaTeX compiler: pdflatex
\documentclass[a4paper, twoside, 11pt, onecolumn, bibliography=totoc, openright, appendixprefix=true]{scrreprt}

\input{config.tex}
\newacronym{mimo}{MIMO}{Multiple-Inputs Multiple-Outputs}
\newacronym{siso}{SISO}{Single-Input Single-Output}
\newacronym{nass}{NASS}{Nano Active Stabilization System}
\newacronym{lti}{LTI}{Linear Time Invariant}
\newglossaryentry{ka}{name=\ensuremath{k_a},description={{Actuator Stiffness in}}}
\newglossaryentry{phi}{name=\ensuremath{\phi},description={{A woody bush}}}
\input{config_extra.tex}
\addbibresource{ref.bib}
\author{Dehaeze Thomas}
\date{2023-01-26}
\title{PhD Thesis}
\subtitle{My subtitle}
\hypersetup{
 pdfauthor={Dehaeze Thomas},
 pdftitle={PhD Thesis},
 pdfkeywords={},
 pdfsubject={},
 pdfcreator={Emacs 28.2 (Org mode 9.5.2)}, 
 pdflang={English}}
\usepackage{biblatex}
\addbibresource{~/Cloud/brain/biblio/references.bib}
\begin{document}


\begin{titlepage}
  \vspace*{5cm}
  \makeatletter
  \begin{center}
    \begin{Huge}
      \@title
    \end{Huge}\\[0.1cm]
    %
    \begin{Large}
      \@subtitle
    \end{Large}\\
    %
    \emph{by}\\
    \@author
    %
    \vfill
    A document submitted in partial fulfillment
    of the requirements for the degree of\\
    \emph{Technical Report}\\
    at\\
    \textsc{Miskatonic University}
  \end{center}
  \makeatother
\end{titlepage}

\newpage
\null
\thispagestyle{empty}
\newpage

\chapter*{Abstract}

\chapter*{Résumé}

\chapter*{Acknowledgments}

\dominitoc
\tableofcontents

\listoftables
\listoffigures

\chapter{Introduction}
\chapter{Test}
\minitoc
\paragraph{Abstract}

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

\section{Test}
A list:
\begin{itemize}
\item acronyms \acrshort{nass} \acrshort{mimo} \acrshort{lti} \acrfull{siso}
\item glossary terms \gls{ka}, \gls{phi}.
\item Bibliography citations: \cite{dehaeze21_activ_dampin_rotat_platf_using,dehaeze21_mechat_approac_devel_nano_activ_stabil_system}.
\end{itemize}

A definition list:
\begin{description}
\item[{this}] means that
\item[{that}] means this
\end{description}

Some Footnote\footnote{this is a footnote with citation \cite{dehaeze21_mechat_approac_devel_nano_activ_stabil_system}.}

\section{Section}
\subsection{Sub section}

This is a sub section.

\subsection{Sub section}
Start of the sub section
\paragraph{Paragraph}
This is a paragraph
\paragraph{lksdfjasd}

\paragraph{lksdfjasd}

\section{blabla}
\chapter{Source Blocks}
\minitoc
\section{Figures}
\begin{minted}[]{matlab}
t = 0:0.01:5; % Time [s]
x = sin(2*pi*t); % Output Voltage [V]
\end{minted}

\begin{minted}[]{matlab}
figure;
plot(t, x);
xlabel('Time [s]'); ylabel('Voltage [V]');
\end{minted}

\begin{figure}[htbp]
\centering
\includegraphics[scale=1]{figs/matlab_fig_example.png}
\caption{\label{fig:matlab_fig_example}Matlab Figure}
\end{figure}

\section{Table Result}

\begin{minted}[]{matlab}
x = 1:10;
y = x.^2;
\end{minted}

\begin{table}[htbp]
\caption{\label{tab:table_name}Table caption}
\centering
\begin{tabular}{rr}
\(x\) & \(y = x^2\)\\
\hline
1 & 1\\
2 & 4\\
3 & 9\\
4 & 16\\
5 & 25\\
6 & 36\\
7 & 49\\
8 & 64\\
9 & 81\\
10 & 100\\
\end{tabular}
\end{table}

\section{Inline Results}

Results can be automatically outputed as shown below.

\begin{minted}[]{matlab}
sqrt(2)
\end{minted}

\begin{verbatim}
1.4142
\end{verbatim}



\begin{minted}[]{matlab}
y
\end{minted}

\begin{verbatim}
y =
     1     4     9    16    25    36    49    64    81   100
\end{verbatim}

\section{Caption and Reference}

Captions can be added to code blocks.
Moreover, we can link to specific bode blocks (Listing \ref{lst:matlab_figure} or \ref{lst:matlab_svd}).

\begin{listing}[htbp]
\begin{minted}[]{matlab}
figure;
[X,Y,Z] = peaks;
contour(X,Y,Z,20)
\end{minted}
\caption{\label{lst:matlab_figure}Code to produce a nice contour plot}
\end{listing}

\begin{figure}[htbp]
\centering
\includegraphics[scale=1]{figs/matlab_logo.png}
\caption{\label{fig:matlab_logo}Obtained Contour Plot}
\end{figure}

\begin{listing}[htbp]
\begin{minted}[]{matlab}
A = [1 2; 3 4; 5 6; 7 8]
[U,S,V] = svd(A)
\end{minted}
\caption{\label{lst:matlab_svd}Code to compute the Singular Value Decomposition}
\end{listing}

\begin{verbatim}
A = [1 2; 3 4; 5 6; 7 8]
A =
     1     2
     3     4
     5     6
     7     8
[U,S,V] = svd(A)
U =
        -0.152483233310201         -0.82264747222566        -0.394501022283829        -0.379959133877596
        -0.349918371807964         -0.42137528768458         0.242796545704357         0.800655879510063
        -0.547353510305727       -0.0201031031435029         0.697909975442776        -0.461434357387336
         -0.74478864880349         0.381169081397575        -0.546205498863303        0.0407376117548695
S =
          14.2690954992615                         0
                         0         0.626828232417541
                         0                         0
                         0                         0
V =
        -0.641423027995072         0.767187395072177
        -0.767187395072177        -0.641423027995072
\end{verbatim}

\section{Source Blocks with Line Numbers}

Citation \cite{taghirad13_paral,dehaeze21_activ_dampin_rotat_platf_using}

The Listing \ref{lst:matlab_line_numbers} has line numbers as the \texttt{-n} option was used.

Specific lines of codes can be referenced.
For instance, the code used to specify the wanted the vertical label is on line 4.

\begin{listing}[htbp]
\begin{minted}[linenos,firstnumber=1]{matlab}
figure;
plot(t, x)
xlabel('Time [s]');
ylabel('Output [V]');
\end{minted}
\caption{\label{lst:matlab_line_numbers}Specify Labels}
\end{listing}

Numbering can be continued by using \texttt{+n} option as shown below.
\begin{minted}[linenos,firstnumber=5]{matlab}
figure;
plot(t, u)
xlabel('Time [s]');
ylabel('Input [V]');
\end{minted}

\chapter{Images}
\minitoc
\section{Normal Image}

Figure \ref{fig:general_control_names} shows the results of the Tikz code of listing \ref{lst:tikz_test}.

\begin{listing}[htbp]
\begin{minted}[]{latex}
  \begin{tikzpicture}

    % Blocs
    \node[block={2.0cm}{2.0cm}] (P) {$P$};
    \node[block={1.5cm}{1.5cm}, below=0.7 of P] (K) {$K$};

    % Input and outputs coordinates
    \coordinate[] (inputw)  at ($(P.south west)!0.75!(P.north west)$);
    \coordinate[] (inputu)  at ($(P.south west)!0.25!(P.north west)$);
    \coordinate[] (outputz) at ($(P.south east)!0.75!(P.north east)$);
    \coordinate[] (outputv) at ($(P.south east)!0.25!(P.north east)$);

    % Connections and labels
    \draw[<-] (inputw) -- ++(-1.5, 0);
    \draw[<-] (inputu) -- ++(-0.8, 0) |- (K.west);

    \draw[->] (outputz) -- ++(1.5, 0);
    \draw[->] (outputv) -- ++(0.8, 0) |- (K.east);
  \end{tikzpicture}
\end{minted}
\caption{\label{lst:tikz_test}Tikz code that is used to generate Figure \ref{fig:general_control_names}}
\end{listing}

\begin{figure}[htbp]
\centering
\includegraphics[scale=1]{figs/general_control_names.png}
\caption{\label{fig:general_control_names}General Control Configuration}
\end{figure}

\section{Sub Images}

Link to subfigure \ref{fig:general_control_names_1}.

\begin{figure}[htbp]
\begin{subfigure}[c]{0.49\linewidth}
\centering
\includegraphics[scale=1]{figs/general_control_names.png}
\caption{\label{fig:general_control_names_1} sub figure caption}
\end{subfigure}
\hfill
\begin{subfigure}[c]{0.49\linewidth}
\centering
\includegraphics[scale=1]{figs/general_control_names.png}
\caption{\label{fig:general_control_names_2} sub figure caption}
\end{subfigure}
\hfill
\caption{\label{fig:subfigure}Subfigure Caption}
\centering
\end{figure}

\chapter{Tables}
\minitoc

Table \ref{tab:table_with_equations} shows a table with some mathematics inside.

\begin{table}[htbp]
\caption{\label{tab:table_with_equations}A Simple table with included math}
\centering
\begin{tabular}{rrrrrr}
\(N\) & \(N^2\) & \(N^3\) & \(N^4\) & \(\sqrt n\) & \(\sqrt[4]N\)\\
\hline
1 & 1 & 1 & 1 & 1 & 1\\
2 & 4 & 8 & 16 & 1.4142136 & 1.1892071\\
3 & 9 & 27 & 81 & 1.7320508 & 1.3160740\\
\end{tabular}
\end{table}

\begin{table}[htbp]
\caption{\label{tab:table_without_head}Table without Head}
\centering
\begin{tabular}{lrrrrr}
 & \textbf{1} & \textbf{2} & \textbf{3} & \textbf{4} & \textbf{5}\\
\textbf{1} & 1 & 2 & 3 & 4 & 5\\
\textbf{2} & 2 & 4 & 6 & 8 & 10\\
\textbf{3} & 3 & 6 & 9 & 12 & 15\\
\textbf{4} & 4 & 8 & 12 & 16 & 20\\
\textbf{5} & 5 & 10 & 15 & 20 & 25\\
\end{tabular}
\end{table}

\begin{table}[htbp]
\caption{\label{tab:table_multiple_heads}Table with multiples groups}
\centering
\footnotesize
\begin{tabular}{lcc}
 & \textbf{Classical Control} & \textbf{Modern Control}\\
\hline
\textbf{Date} & 1930- & 1960-\\
\hline
\textbf{Tools} & Transfer Functions & State Space formulation\\
 & Nyquist Plots & Riccati Equations\\
 & Bode Plots & \\
 & Phase and Gain margins & \\
\hline
\textbf{Control Architectures} & Proportional, Integral, Derivative & Full State Feedback\\
 & Leads, Lags & LQR, LQG\\
 &  & Kalman Filters\\
\hline
\textbf{Advantages} & Study Stability & Automatic Synthesis\\
 & Simple & MIMO\\
 & Natural & Optimization Problem\\
 &  & \\
 &  & \\
\hline
\textbf{Disadvantages} & Manual Method & No Guaranteed Robustness\\
 & Only SISO & Difficult Rejection of Perturbations\\
\end{tabular}
\end{table}


\appendix

\chapter{Mathematical formulas}
\chapter{Comments on something}
\printbibliography[heading=bibintoc,title={Bibliography}]

\chapter*{List of Publications}
\begin{refsection}[ref.bib]
  % List all papers even if not cited
  \nocite{*}
  % Sort by year
  \newrefcontext[sorting=ynt]
  % Articles
  \printbibliography[keyword={publication},heading={subbibliography},title={Articles},env=mypubs,type={article}]
  % Proceedings
  \printbibliography[keyword={publication},heading={subbibliography},title={In Proceedings},env=mypubs,type={inproceedings}]
\end{refsection}

\printglossary[type=\acronymtype]
\printglossary
\end{document}
