feat(dissertation): change Figure to Listing for code

This commit is contained in:
Anthony Berg 2024-05-14 12:07:20 +01:00
parent bbb3635736
commit fe390689a6
3 changed files with 18 additions and 12 deletions

View File

@ -105,7 +105,7 @@ Brief overview of what it is supposed to do... % TODO
components, otherwise a nested mess would occur as Compose is designed to have components, otherwise a nested mess would occur as Compose is designed to have
Composable functions passed in to a Composable function and therefore by design Composable functions passed in to a Composable function and therefore by design
function nests will occur and the code will be harder to read if not managed correctly. function nests will occur and the code will be harder to read if not managed correctly.
Figure~\ref{fig:compose-modular} shows example of using modular code Listing~\ref{list:compose-modular} shows example of using modular code
from the Actions screen in project (with code omissions shown in comments) from the Actions screen in project (with code omissions shown in comments)
\item Used Voyager~\cite{voyager} to handle screens \item Used Voyager~\cite{voyager} to handle screens
\item Used Koin~\cite{koin} for dependency injection, to be able to get data from the \item Used Koin~\cite{koin} for dependency injection, to be able to get data from the
@ -118,15 +118,14 @@ Brief overview of what it is supposed to do... % TODO
\end{itemize} \end{itemize}
\end{itemize} \end{itemize}
\begin{figure} \begin{listing}
\centering \inputminted[
\inputminted[
linenos, linenos,
breaklines, breaklines,
]{kotlin}{code/compose-modular.kt} ]{kotlin}{code/compose-modular.kt}
\caption[Compose Modular Example]{Example of modular code in Compose} \caption{Example of modular code in Compose}
\label{fig:compose-modular} \label{list:compose-modular}
\end{figure} \end{listing}
\subsection{Storing Data} \subsection{Storing Data}
\begin{itemize} \begin{itemize}
@ -251,14 +250,14 @@ Brief overview of what it is supposed to do... % TODO
\begin{itemize} \begin{itemize}
\item There was not a lot of documentation \item There was not a lot of documentation
\item Ambiguous on how to define directory for where the Java library is located in the Git repository \item Ambiguous on how to define directory for where the Java library is located in the Git repository
\item However, as XPC was only built with Maven, Gradle was not able add the dependency as \verb|gitRepository()| \item However, as XPC was only built with Maven, Gradle was not able add the dependency as \lstinline|gitRepository()|
only works with Gradle builds~\cite{gradle:gitRepoGradleOnly} only works with Gradle builds~\cite{gradle:gitRepoGradleOnly}
\end{itemize} \end{itemize}
\item Resorted to using a compiled Jar file and adding the dependency to Gradle \item Resorted to using a compiled Jar file and adding the dependency to Gradle
\item Not happy about that because it means maintaining it will be more difficult as \item Not happy about that because it means maintaining it will be more difficult as
it is not as simple as just changing the version number it is not as simple as just changing the version number
\item Later, resorted to adding Gradle build files to XPC \item Later, resorted to adding Gradle build files to XPC
\item Used automatic conversion from Maven to Gradle using \verb|gradle init| command~\cite{gradle:migratePOM} \item Used automatic conversion from Maven to Gradle using \lstinline|gradle init| command~\cite{gradle:migratePOM}
\item Had to add local dependencies due to how Gradle works differently \item Had to add local dependencies due to how Gradle works differently
\item Had to fix previous structure of Maven POM as the grouping as not good \item Had to fix previous structure of Maven POM as the grouping as not good
\end{itemize} \end{itemize}

Binary file not shown.

View File

@ -14,6 +14,13 @@
%\usepackage{vdmlisting} %\usepackage{vdmlisting}
\usepackage{listings} \usepackage{listings}
\usepackage{minted} \usepackage{minted}
\AtBeginDocument{%
\renewcommand{\thelisting}{%
\thechapter.\arabic{listing}%
}
}
% Taken from vdmlisting % Taken from vdmlisting
\lstdefinelanguage{VDM_SL} \lstdefinelanguage{VDM_SL}
{morekeywords={RESULT,\#else,\#endif,\#ifdef,\#ifndef,abs,all,always,and,as,atomic,be,be st,bool,by,card,cases,char,comp,compose,conc,dcl,def,definitions,dinter,div,dlmodule,do,dom,dunion, {morekeywords={RESULT,\#else,\#endif,\#ifdef,\#ifndef,abs,all,always,and,as,atomic,be,be st,bool,by,card,cases,char,comp,compose,conc,dcl,def,definitions,dinter,div,dlmodule,do,dom,dunion,