Added booktabs and a demonstration

This commit is contained in:
Bjornar Orjansen Kaarevik 2025-02-13 00:11:58 +01:00
parent 11675375cb
commit 7bd071e708
2 changed files with 40 additions and 8 deletions

View File

@ -4,7 +4,7 @@
\begin{figure}[!h]
\centering
\includegraphics[width=\linewidth]{figures/abc.png}
\includegraphics[width=\textwidth]{figures/abc.png}
% \linewidth refers to the "current line" which may be different from \textwidth which is the text area in general
% \includegraphics{figures/abc.png}
\caption{The caption of the figure}
@ -28,13 +28,13 @@ A reference to figure \ref{fig:abc_figure}.
% outer and inner are applicable for books
% Second argument for wrapfigure is figure width
% redefines linewidth within the environment
\begin{wrapfigure}{l}{0.33\textwidth} % .33\textwidth defines a new linewidth for this env
% \centering % Centering is done within the environment and overrides the l justification
\includegraphics[width=0.5\linewidth]{figures/abc.png}
% .5\linewidth uses only half of the space available
\caption{A third figure, but still the same picture. I }
\label{fig:third_figure}
\end{wrapfigure}
% \begin{wrapfigure}{l}{0.33\textwidth} % .33\textwidth defines a new linewidth for this env
% % \centering % Centering is done within the environment and overrides the l justification
% \includegraphics[width=0.5\linewidth]{figures/abc.png}
% % .5\linewidth uses only half of the space available
% \caption{A third figure, but still the same picture. I }
% \label{fig:third_figure}
% \end{wrapfigure}
\newpage
\subsection{Tables}
@ -68,4 +68,33 @@ A reference to figure \ref{fig:abc_figure}.
% The {fig:...}, {tab:...} and {eq:...} aren't required, but will help differentiating what is being references. Maybe a figure and a table have very similar names, then the fig: and tab: prefixes allow you to separate them.
Referencing the table as table \ref{tab:eq_fn_lookup_table}.
\begin{table}[!htbp]
\setstretch{0.5} % Huddles lines closer together; it's cold outside
\centering % Centers on the page
\caption{\emph{Better: }Linking equations with desired functionality and proper function name in python.} % The caption may be put above instead of below
\vspace{2mm}
\begin{tabular}{clr} % c: center; l: left; r: right; |: v-line
\toprule
Equation & Action & Function name \\
\midrule
\ref{eq:forward_sweep} & Forward sweep & \verb|getZ| \\
\ref{eq:forward_sweep} & Approximate values from the ANN & \verb|getUpsilon| \\
&&\\
\ref{eq:first_back_prop} & Start back propagation & \verb|getPK| \\
\ref{eq:back_prop} & Rest of the back propagation & \verb|getP| \\
\\
\ref{eq:Yc} & $Y_c$ simplification & \verb|getYc| \\
\ref{eq:nu} & $\nu$ simplification & \verb|getNu| \\
\ref{eq:Hk} & $H^{(k)}$ simplification & \verb|getHk| \\
\\
\ref{eq:my_del_J} & Computation of $\nabla_\theta J$ & \verb|getdelJ| \\
\ref{eq:update_theta} & Updating \(\theta\) & \verb|updateTheta| \\
\bottomrule
\end{tabular}
\label{tab:eq_fn_lookup_table_but_better}
\end{table}
We can also reference the better lookup table, table \ref{tab:eq_fn_lookup_table_but_better}
which uses horizontal rules from the \verb|booktabs| package.
\lipsum[1-2]

View File

@ -23,6 +23,9 @@
\usepackage{graphicx} % Allows us to \includegraphics{} for figures
\usepackage{wrapfig} % Allows us to wrap text around a figure
% Table package
\usepackage{booktabs} % Provides better top/mid/bottom-rules for making beautiful tables
% Referencing
\usepackage{hyperref} % Enables hyper-referencing of all \ref{}'s