latex-course/example-document/doc/figs-and-tables.tex

72 lines
3.2 KiB
TeX

\section{Figures and tables}
\subsection{Figures}
\begin{figure}[!h]
\centering
\includegraphics[width=\linewidth]{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}
\label{fig:abc_figure} % Tells the compiler that this environment can be referenced and pointed to
\end{figure}
% The \ref{} command fetches the relevant number and makes it show up in the outputted pdf.
A reference to figure \ref{fig:abc_figure}.
\begin{figure}[!htbp]
\centering % Centering is done within the text area
% pdf's may be shown as graphics, especially nice if the pdf is vector based and therefore scalable
\includegraphics[width=1.05\textwidth]{figures/p2b-real-zt.pdf} % It is too wide to be contained in the text area
\caption{The caption of the other figure, we can show pdf's which may or may not be vector graphics.}
\label{fig:other_figure}
\end{figure}
% \begin{env_name}{first_arg}{second_arg}
% First argument for wrapfigure is figure justification
% l: left, r: right, c: center, o: outer, i: inner
% 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}
\newpage
\subsection{Tables}
\begin{table}[!htbp]
\setstretch{0.5} % Huddles lines closer together; it's cold outside
\centering % Centers on the page
\caption{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
\hline % Inserts a horizontal line
Equation & Action & Function name \\
\hline
\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| \\
\hline
\end{tabular}
\label{tab:eq_fn_lookup_table}
\end{table}
% 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}.
\lipsum[1-2]