Skip to content

Instantly share code, notes, and snippets.

@prerakmody
Last active February 23, 2022 21:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prerakmody/eba3439243c2332af7b47263749d7caf to your computer and use it in GitHub Desktop.
Save prerakmody/eba3439243c2332af7b47263749d7caf to your computer and use it in GitHub Desktop.
Latex Hacks
\section{AMS-MATH PACKAGE}
\cfrac{}{}
\usepackage{listings}
\usepackage{color}
\definecolor{codegreen}{rgb}{0,0.6,0}
\definecolor{codegray}{rgb}{0.5,0.5,0.5}
\definecolor{codepurple}{rgb}{0.58,0,0.82}
\definecolor{backcolour}{rgb}{0.95,0.95,0.92}
\lstdefinestyle{mystyle}{
backgroundcolor=\color{backcolour},
commentstyle=\color{codegreen},
keywordstyle=\color{magenta},
numberstyle=\tiny\color{codegray},
stringstyle=\color{codepurple},
basicstyle=\footnotesize,
breakatwhitespace=false,
breaklines=true,
captionpos=b,
keepspaces=true,
numbers=left,
numbersep=5pt,
showspaces=false,
showstringspaces=false,
showtabs=false,
tabsize=2
}
\lstset{style=mystyle}
\section*{Appendix}
\subsection{Ex 1.a}
\lstinputlisting[language=Python]{code/Q1_a.py}
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[margin=1.0in]{geometry}
\title{IN5000 - MSc Thesis Proposal \\ \large 3D Human Pose Estimation using a Top-View Depth Camera}
\author{Prerak Pradeep Mody \\ \large (Student ID - 4777042) }
\date{30 August 2019}
\begin{document}
\maketitle
\section{Introduction}
\end{document}
\usepackage{subfigure}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{cleveref}
\section{Image - Basic}
\begin{figure}[h!]
\centering
\includegraphics[width=\textwidth]{images/myimage.png}
\caption{Caption}
\label{fig:label}
\end{figure}
\section{Image - Custom Width}
\begin{figure}[h!]
\centering
\includegraphics[height=3.5in, width=3.5in]{images/myimage.png}
\caption{Caption}
\label{fig:label}
\end{figure}
\section{Image - Aspect Ratio}
\begin{figure}[h!]
\centering
\includegraphics[keepaspectratio=true, scale=0.25]{images/myimage.png}
\caption{Caption}
\label{fig:label}
\end{figure}
\begin{figure}[h!]
\centering
\begin{subfigure}
\centering
\includegraphics[keepaspectratio=true, scale=0.27]{plots/1.png}
\end{subfigure}%
\begin{subfigure}
\centering
\includegraphics[keepaspectratio=true, scale=0.27]{plots/2.png}
\end{subfigure}
\caption{Caption}
\label{fig:subfigure1}
\end{figure}
\usepackage{subcaption}
\begin{figure}
\subcaptionbox{This 1}[.5\textwidth]{\includegraphics[width=0.45\textwidth]{assets/MICCAI22-Flips-AvU-Test-EntNorm-HiLoSurfEval-ep1000.png}}
\subcaptionbox{This 1}[.5\textwidth]{\includegraphics[width=0.45\textwidth]{assets/MICCAI22-Flips-AvU-Test-EntNorm-HiLoSurfEval-ep1000.png}}
\caption{This is big caption}
\end{figure}
import numpy as np
import matplotlib.pyplot as plt
img = np.random.random((100,100))
f,axarr = plt.subplots(2,7, figsize=(7,2+1), gridspec_kw = {'wspace':0.02, 'hspace':0.05}, dpi=200)
for id_ in range(2):
for id__ in range(7):
if id_ == 0:
axarr[id_][id__].set_title('Title')
axarr[id_][id__].imshow(tmp)
axarr[id_][id__].axis('off')
plt.savefig('plot.png', bbox_inches='tight')
######################################################################################################
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
img = np.random.random((100,100))
plt.figure(figsize = (7,2))
gs1 = gridspec.GridSpec(2, 7)
gs1.update(wspace=0.025, hspace=0.05)
for i in range(14): ax1 = plt.subplot(gs1[i]); plt.axis('off'); img.imshow(tmp);
plt.savefig('img.png', bbox_inches='tight')
\usepackage[]{algorithm2e}
\RestyleAlgo{boxruled}
\LinesNumbered
\begin{algorithm}[H]
\caption{Lawler's pseudo-polynomial algorithm}
\SetAlgoLined
\KwData{S(i,j,k) with S sorted by due-date}
\KwResult{integer representing the minimum tardiness of a schedule S}
\SetKwFunction{FMain}{getTardiness}
\SetKwProg{Fn}{Function}{:}{} %template for function
\Fn{\FMain{$S$}}{
minSchedule = getSchedule(S, 0)\;
return minSchedule.getTardiness()\;
}\;
\SetKwFunction{FSub}{getSchedule}
\SetKwProg{Fn}{Function}{:}{} %template for function
\Fn{\FSub{$S$, $t$}}{
\If{(S,t) in memory}{
return memory(S,t)
}
n=numberOfJobs=j-i\;
\If{S(i,j,k) is empty}{
return 0;
}
\If{S(i,j,k) has only 1 job j}{
return $max(0,t+p_j-d_j)$;
}
minSchedule = null\;
minTardiness = 0\;
\For{$\delta$ in range(0,n-k)}{
$scheduleBranch1 = getSchedule(S(i,k'+\delta,k'),t)$\;
$scheduleBranch2 = jobK$\;
$scheduleBranch3 = getSchedule(S(k'+\delta+1,j,k'),C_{k'}(\delta))$\;
$candidateSchedule = scheduleBranch1\cup scheduleBranch2\cup scheduleBranch3$\;
$candidateTardiness = candidateSchedule.getTardiness()$\;
\If{$candidateTardiness < minTardiness$}{
minSchedule = candidateSchedule\;
minTardiness = candidateTardiness\;
}
$memory(S,t) = minSchedule$\;
}
return minSchedule\;
}\;
\end{algorithm}
\documentclass{article}
\usepackage[margin=0.7in]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{todonotes}
\usepackage{subfigure}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{cleveref}
\begin{document}
\maketitle
\section{Task1}
\bibliographystyle{ieeetr}
\bibliography{references}
\end{document}
@manual{Senn:2009,
title = "Using {\LaTeX} for Your Thesis",
author = "Mark Senn",
note = "\url{http://engineering.purdue.edu/~mark/puthesis}",
year = "2009 (accessed February 3, 2014)"
}
\usepackage{tabularx}
\usepackage{hyperref}
\usepackage{cleveref}
\renewcommand\tabularxcolumn[1]{m{#1}}
\newcolumntype{Y}{>{\centering\arraybackslash}X}
\section{Table1}
Refer this table in \cref{table1}
\begin{table}[h!]
\centering
\begin{tabularx}{\textwidth}{ |Y|Y|Y|Y|Y|Y| }
\hline
\textbf{Training Samples per Class} & \textbf{Feature} &
\textbf{Feature Reduction} & \textbf{Classifier} &
\textbf{Train Error} & \textbf{Nist-eval Error} \\
\hline
A & B & C & D & x\% & y\% \\
\hline
\end{tabularx}
\caption{Caption}
\label{tab:table1}
\end{table}
\section{Table2}
\begin{table}[h!]
\centering
\begin{tabular}{|c|c|c|c|c|}
\hline
& $z_1$ & $z_2$ & $z_3$ & $z_4$ \\
\hline
$e_1$ & 0.33 & 1 & 1 & 0 \\
$e_2$ & 0.33 & 0 & 0 & 1 \\
$e_3$ & 0.33 & 0 & 0 & 0 \\
\hline
\end{tabular}
\caption{(Ex-1.a) Probability values for Strategy A}
\label{tab:1_a_1}
\end{table}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment