summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/sphdthesis
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/sphdthesis
Initial commit
Diffstat (limited to 'macros/latex/contrib/sphdthesis')
-rw-r--r--macros/latex/contrib/sphdthesis/LICENSE1
-rw-r--r--macros/latex/contrib/sphdthesis/README31
-rw-r--r--macros/latex/contrib/sphdthesis/SPhdThesis.cls625
-rw-r--r--macros/latex/contrib/sphdthesis/SPhdThesis.pdfbin0 -> 294089 bytes
-rw-r--r--macros/latex/contrib/sphdthesis/SPhdThesis.tex190
-rw-r--r--macros/latex/contrib/sphdthesis/example/SPhdThesis.cls625
-rw-r--r--macros/latex/contrib/sphdthesis/example/abstract.tex5
-rw-r--r--macros/latex/contrib/sphdthesis/example/acknowledgments.tex3
-rw-r--r--macros/latex/contrib/sphdthesis/example/algorithm.tex49
-rw-r--r--macros/latex/contrib/sphdthesis/example/biblio.bib199
-rw-r--r--macros/latex/contrib/sphdthesis/example/border.pdfbin0 -> 15222 bytes
-rw-r--r--macros/latex/contrib/sphdthesis/example/chapter1.tex11
-rw-r--r--macros/latex/contrib/sphdthesis/example/figure.tex6
-rw-r--r--macros/latex/contrib/sphdthesis/example/table.tex16
-rw-r--r--macros/latex/contrib/sphdthesis/example/thesis.pdfbin0 -> 290070 bytes
-rw-r--r--macros/latex/contrib/sphdthesis/example/thesis.tex29
16 files changed, 1790 insertions, 0 deletions
diff --git a/macros/latex/contrib/sphdthesis/LICENSE b/macros/latex/contrib/sphdthesis/LICENSE
new file mode 100644
index 0000000000..4e6d2343de
--- /dev/null
+++ b/macros/latex/contrib/sphdthesis/LICENSE
@@ -0,0 +1 @@
+SPhdThesis is released under public domain. You are free to use, modify, and distribute it as you wish. \ No newline at end of file
diff --git a/macros/latex/contrib/sphdthesis/README b/macros/latex/contrib/sphdthesis/README
new file mode 100644
index 0000000000..ee5300910e
--- /dev/null
+++ b/macros/latex/contrib/sphdthesis/README
@@ -0,0 +1,31 @@
+SPhdThesis: A Latex template for writing Phd Thesis
+===================================================
+
+SPhdThesis is a latex template (document class) for writing PhD thesis. I developed it while writing my PhD thesis in School of Computing (SoC), National University of Singapore (NUS). By default, it adheres to the [NUS Guidelines on Format of Research Thesis Submitted For Examination](http://www.nus.edu.sg/registrar/event/gdthesisexam.html "NUS Guidelines on Format of Research Thesis Submitted For Examination") (Link updated on 31/05/2014). However, it is quite easy to change it for a different guideline.
+
+
+Downloading
+===========
+You can download the latest version from ctan or fork it at Github: https://github.com/saurabhg17/SPhdThesis/archive/master.zip.
+
+
+Getting started
+===============
+The easiest way to start using SPhdThesis is to copy the example folder and start by inspecting and modifying thesis.tex. figure.tex, table.tex, algorithm.tex files show how to format figures, tables, and algorithms, respectively. example\thesis.pdf is an example of how a thesis looks like using SPhdThesis document class.
+
+For more details read SPhdThesis.pdf. It describes in detail how to use the document class and provide some hints on how to customize it. It also lists some useful tools for working with latex.
+
+
+Getting Help
+============
+The best place is to raise an issue on Github: https://github.com/saurabhg17/SPhdThesis/issues. Alternatively, you can use the comment form on this page: http://saurabhg.com/latex/sphdthesis.
+
+
+Author/Maintainer
+=================
+Saurabh Garg
+
+
+Screenshots
+===========
+There are some screenshots of the thesis produces in the example folder. \ No newline at end of file
diff --git a/macros/latex/contrib/sphdthesis/SPhdThesis.cls b/macros/latex/contrib/sphdthesis/SPhdThesis.cls
new file mode 100644
index 0000000000..069b2abc1c
--- /dev/null
+++ b/macros/latex/contrib/sphdthesis/SPhdThesis.cls
@@ -0,0 +1,625 @@
+
+% SPhdThesis v1.0
+% By Saurabh Garg (saurabhgarg@mysoc.net)
+% Version 1.0 released 11.06.2013
+
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesClass{SPhdThesis}[2013/06/11 v1.0 SPhdThesis class]
+
+\RequirePackage{xkeyval}
+
+% -----------------------------------------------------------------------------
+% Define option for formatting for [screen] and print.
+% When formatting for screen colors are used for links, tables, and algorithms.
+% When formatting for print black color is used for links, tables, and algorithms.
+\define@choicekey*[Sg]{PhDThesis}{media}{screen,print}[screen]{\def \SgIntMedia{#1}}
+\setkeys[Sg]{PhDThesis}{media}
+
+% -----------------------------------------------------------------------------
+% Define option for formatting title page in lower or [upper] case.
+\define@choicekey*[Sg]{PhDThesis}{titlecase}{upper,lower}[upper]{\def \SgIntTitleCase{#1}}
+\setkeys[Sg]{PhDThesis}{titlecase}
+
+% -----------------------------------------------------------------------------
+% Define line spacing. The valid values are [onehalf] and double.
+% Note that before using \SgLineSpacing setspace package must be loaded.
+\define@choicekey*[Sg]{PhDThesis}{linespacing}[\val\nr]{onehalf,double}[onehalf]{%
+ \ifcase\nr\relax
+ \def \SgIntLineSpacing{\onehalfspacing}
+ \or
+ \def \SgIntLineSpacing{\doublespacing}
+ \fi
+}
+\setkeys[Sg]{PhDThesis}{linespacing}
+
+% -----------------------------------------------------------------------------
+% Define font size. The valid values are [11pt] and 12pt.
+\define@choicekey*[Sg]{PhDThesis}{fontsize}{11pt,12pt}[11pt]{\def \SgIntFontSize{#1}}
+\setkeys[Sg]{PhDThesis}{fontsize}
+
+% -----------------------------------------------------------------------------
+% Define font family to be used. Default is cm.
+\define@choicekey*[Sg]{PhDThesis}{font}{cm,times,helvet,palatino}[cm]{\def \SgIntFont{#1}}
+\setkeys[Sg]{PhDThesis}{font}
+
+% -----------------------------------------------------------------------------
+% Define open. The valid values are right and [any].
+% Right makes chapters and entries in frontmatter begin only on right hand pages
+% or on the next page available. Any puts them on the next available page.
+\define@choicekey*[Sg]{PhDThesis}{open}[\val\nr]{right,any}[any]{%
+ \ifcase\nr\relax
+ \def \SgIntOpen {openright}
+ \or
+ \def \SgIntOpen {openany}
+ \fi
+}
+\setkeys[Sg]{PhDThesis}{open}
+
+% -----------------------------------------------------------------------------
+% Define pageside. The valid values are oneside and [twoside].
+% Specifies whether double or single sided output should be generated.
+\define@choicekey*[Sg]{PhDThesis}{pageside}{oneside,twoside}[twoside]{\def \SgIntPageSide{#1}}
+\setkeys[Sg]{PhDThesis}{pageside}
+
+
+% Process all options defined above with default values.
+\ProcessOptionsX[Sg]<PhDThesis>
+
+% Finally load the report class.
+\LoadClass[a4paper, \SgIntFontSize, \SgIntOpen, \SgIntPageSide]{report}
+
+
+
+% -----------------------------------------------------------------------
+% F O N T S.
+
+\RequirePackage[T1]{fontenc} % Use T1 encoded cm-super fonts.
+\RequirePackage{microtype} % Improve typesetting.
+\RequirePackage{fix-cm} % Support for arbitrary font size for cm.
+
+% Specify the format for the section titles in toc.
+\newcommand{\SgIntTocSectionFormat}{\bfseries}
+
+% Specify the format for chapter name and number in chapter headings.
+\newcommand{\SgIntChapNameFormat}{\fontsize{20}{50}\fontshape{sc}\selectfont}
+\newcommand{\SgIntChapNumberFormat}{\fontsize{76}{80}\selectfont}
+
+% Specify the format for chapter, section, and subsection titles.
+\newcommand{\SgIntChapTitleFormat}{\LARGE\bfseries}
+\newcommand{\SgIntSecTitleFormat}{\Large\bfseries}
+\newcommand{\SgIntSubsecTitleFormat}{\large\bfseries}
+
+% Specify the format for displaying chapter in fancy header.
+\newcommand{\SgIntHeaderFormat}{\large\bfseries}
+\newcommand{\SgIntPageNumFormat}{\bfseries}
+
+
+
+% -----------------------------------------------------------------------------
+% C A P T I O N S
+%
+% Nicer captions for figures and tables.
+% caption package must be included before subfig and hyperref.
+
+% Change the font of the caption to sans serif and make label bold.
+\RequirePackage[labelfont=bf]{caption}
+
+
+
+% -----------------------------------------------------------------------
+% P A C K A G E S
+%
+% Include important packages.
+
+\RequirePackage{graphicx, subfig} % Figures.
+\RequirePackage{amsmath, amssymb, amsthm} % Math symbols and fonts.
+\RequirePackage{float} % Must be done before hyperref.
+\RequirePackage[usenames,dvipsnames,hyperref]{xcolor} % For defining colors.
+\RequirePackage{ifthen} % For comparison.
+
+
+
+% -----------------------------------------------------------------------
+% P A G E L A Y O U T.
+
+% Use geometry package to set up margins.
+% A4 paper is 8.27 x 11.69 inch.
+\RequirePackage[a4paper, left=1.25in, right=1in, top=1in, bottom=1in, includehead, \SgIntPageSide]{geometry}
+
+\ifthenelse{\equal{\SgIntOpen}{openright}}
+{
+ % For adding extra blank page, if necessary, after chapter.
+ \RequirePackage{emptypage}
+
+ % Define a command to leave a blank page. This is used in frontmatter to add
+ % an empty page between ack, abstract, toc, lof and lot.
+ \newcommand{\SgIntClearDoublePage}{\clearpage{\pagestyle{empty}\cleardoublepage}}
+}
+{
+ \newcommand{\SgIntClearDoublePage}{\clearpage}
+}
+
+% For disabling paragraph indenting and using a blank line between paragraphs.
+\RequirePackage{parskip}
+
+% Set line spacing.
+\RequirePackage{setspace}
+\SgIntLineSpacing
+
+% Fix footnote spacing
+\setlength{\footnotesep}{0.5cm} % Distance between two footnotes.
+\setlength{\skip\footins}{0.5cm} % Distance between last line of text and first footnote.
+
+% By default Latex centers images vertically on a float page.
+% Modify Latex internal variables so that figures are placed from top.
+\makeatletter
+ \setlength{\@fptop}{0.25cm}
+ \setlength{\@fpsep}{1.00cm}
+\makeatother
+
+\setlength{\textfloatsep}{1.5cm} % Set the distance between a float and text.
+\setlength{\floatsep}{1.0cm} % Set the distance between two floats.
+
+% Prevent latex from adding extra space between paragraphs so that
+% the last line is at the bottom margin on each page.
+\raggedbottom
+
+% Define horizontal spacing between subfigures.
+\newcommand{\SgIntHSpaceBetweenSubfloats}{\hspace{0.5cm}}
+
+
+
+% -----------------------------------------------------------------------
+% T A B L E
+%
+% Set table layout and design.
+
+\RequirePackage{booktabs, colortbl} % Tables.
+\RequirePackage{tabularx} % Auto column sizing.
+
+\renewcommand{\arraystretch}{1.5} % Set space between rows in a table.
+\renewcommand{\tabcolsep}{0.20cm} % Set space between columns in a table.
+\heavyrulewidth = 0.15em % Set width of heavy rules.
+\lightrulewidth = 0.07em % Set width of light rules.
+\abovetopsep = 0.1cm % Set separation between caption and top rule.
+\aboverulesep = 0.4ex % Set separation to use above a rule.
+\belowrulesep = 0.4ex % Set separation to use below a rule.
+
+% Set color for table rules.
+\ifthenelse{\equal{\SgIntMedia}{screen}}{\arrayrulecolor[rgb]{0.0, 0.6, 0.9}}{}
+\ifthenelse{\equal{\SgIntMedia}{print}}{\arrayrulecolor[rgb]{0.0, 0.0, 0.0}}{}
+
+
+
+% -----------------------------------------------------------------------
+% A L G O R I T H M
+
+\RequirePackage[algo2e, ruled, linesnumbered, algochapter]{algorithm2e}
+\DontPrintSemicolon % Dont print semicolons at end of lines.
+\algoheightrule = \heavyrulewidth % Set the width of the top and bottom rules.
+\algotitleheightrule = \lightrulewidth % Set the width of the middle rule.
+\SetAlgoInsideSkip{medskip} % Set distance between middle rule and algorithm.
+\interspacetitleruled = 0.2cm % Set distance between caption and rules.
+\setlength{\algomargin}{2.25em} % Set the margin of the algorithm text.
+\SetNlSkip{1.25em} % Set the spacing between line numbers and text.
+
+\newenvironment{SgAlgorithm}[1][t]
+{%
+ \begin{algorithm2e}[#1]
+ \linespread{1.3} % Set the line spacing to one and half.
+ \selectfont % The linespread is effective only after selectfont.%
+}
+{%
+ \end{algorithm2e}
+}
+
+
+
+% -----------------------------------------------------------------------
+% B I B L I O G R A P H Y
+
+% Rename bibliography to references.
+\renewcommand{\bibname}{References}
+
+% Define a new command to include the bibliography file and
+% set the formatting options.
+\newcommand{\SgIncludeBib}[1]
+{%
+ \clearpage % Fix the page number in TOC.
+ \phantomsection % Fix the link in PDF.
+ \addcontentsline{toc}{chapter}{References} % Add the bibliography to TOC.
+ \bibliographystyle{alpha} % Set the bibliography style.
+ \bibliography{#1} % Include the bibliography file.
+}
+
+
+
+% -----------------------------------------------------------------------
+% F A N C Y H E A D E R
+
+\RequirePackage{fancyhdr}
+
+% Set page style to fancy.
+\pagestyle{fancy}
+
+% By default fancyhdr converts the chapter headings to uppercase,
+% so restore the chapter casing.
+\renewcommand{\chaptermark}[1]{\markboth{\chaptername\ \thechapter.\ #1}{}}
+
+% Define header consisting of Chapter #. Chapter_Name on left side and
+% page number on right side.
+% \nouppercase is used on left header to force bibliography in lowercase.
+\fancyhead{}
+\fancyhead[L]{\nouppercase{\SgIntHeaderFormat\leftmark}}
+\fancyhead[R]{\SgIntPageNumFormat\thepage}
+\renewcommand{\headrulewidth}{1pt}
+\addtolength{\headheight}{10pt}
+
+% Disable footer.
+\fancyfoot{}
+\renewcommand{\footrulewidth}{0pt}
+
+% Define header and footer for plain pages.
+\fancypagestyle{plain}
+{%
+ % Disable header.
+ \fancyhead{}
+ \renewcommand{\headrulewidth}{0pt}
+
+ % Footer contains the page number on right side.
+ \fancyfoot{}
+ \fancyfoot[R]{\SgIntPageNumFormat\thepage}
+ \renewcommand{\footrulewidth}{0pt}
+}
+
+
+
+% -----------------------------------------------------------------------
+% T O C L O F L O T L O A
+%
+% Change the appearance of toc, lof, lot, etc.
+
+% Using tocloft, the toc can be formatted easily.
+\RequirePackage[titles, subfigure]{tocloft}
+
+% Remove dots.
+\renewcommand{\cftdotsep}{\cftnodots}
+
+% Remove dots from list of algorithms.
+% This is necessary because we use algorithm2e which mananges its own list of algorithms.
+\makeatletter
+ \renewcommand{\@dotsep}{5000}
+\makeatother
+
+% Format chapter entries differently in toc.
+\renewcommand{\cftchapfont}{\SgIntTocSectionFormat}
+
+% Fix the indentation of figure and table entries in the lof, lot, and loa.
+\setlength{\cftfigindent}{0in}
+\setlength{\cfttabindent}{0in}
+
+\newcommand{\SgAddToc}{\tableofcontents\SgIntClearDoublePage}
+\newcommand{\SgAddLof}{%
+ \newpage
+ \phantomsection % Requires hyperref; this is to fix the link.
+ \addcontentsline{toc}{section}{\numberline{}\hspace{-.35in}{\SgIntTocSectionFormat{}List of Figures}}
+ \listoffigures
+ \SgIntClearDoublePage
+}
+\newcommand{\SgAddLot}{%
+ \newpage
+ \phantomsection % Requires hyperref; this is to fix the link.
+ \addcontentsline{toc}{section}{\numberline{}\hspace{-.35in}{\SgIntTocSectionFormat{}List of Tables}}
+ \listoftables
+ \SgIntClearDoublePage
+}
+\newcommand{\SgAddLoa}{%
+ \newpage
+ \phantomsection % Requires hyperref; this is to fix the link.
+ \addcontentsline{toc}{section}{\numberline{}\hspace{-.35in}{\SgIntTocSectionFormat{}List of Algorithms}}
+ \listofalgorithmes % Note an extra e, it is required because we use algorithm2e.
+ \SgIntClearDoublePage
+}
+
+
+
+% -------------------------------------------------------------------------------------
+% C H A P T E R H E A D I N G
+%
+% Change the appearance of chapter headers and section titles.
+
+% Change the fonts for chapter heading.
+\RequirePackage[Lenny]{fncychap}
+\ChNameVar{\SgIntChapNameFormat}
+\ChNumVar{\SgIntChapNumberFormat}
+\ChTitleVar{\SgIntChapTitleFormat}
+
+% Set the format of the section and subsection titles.
+\RequirePackage{sectsty}
+\sectionfont{\SgIntSecTitleFormat}
+\subsectionfont{\SgIntSubsecTitleFormat}
+
+% Adjust the spacing between titles and surrounding matter.
+\RequirePackage{etoolbox}
+\makeatletter
+ % Reduce the space between chapter title and text.
+ \patchcmd{\DOTI}{\vskip 40\p@}{\vskip 20\p@}{}{}
+ \patchcmd{\DOTIS}{\vskip 40\p@}{\vskip 20\p@}{}{}% for unnumbered chapters
+
+ % http://tex.stackexchange.com/questions/13357/fncychap-package-reduce-vertical-gap-space-between-header-and-chapter-heading
+ % Reduce the spacing between top margin and chapter title.
+ \renewcommand*{\@makechapterhead}[1]
+ {%
+ \vspace*{10\p@}
+ {%
+ \parindent \z@ \raggedright \normalfont
+ \ifnum \c@secnumdepth >\m@ne
+ \if@mainmatter % Fix for frontmatter, mainmatter, and backmatter 040920
+ \DOCH
+ \fi
+ \fi
+ \interlinepenalty\@M
+ \if@mainmatter % Fix for frontmatter, mainmatter, and backmatter 060424
+ \DOTI{#1}%
+ \else%
+ \DOTIS{#1}%
+ \fi
+ }
+ }
+
+ % For the case \chapter*:
+ \renewcommand*{\@makeschapterhead}[1]
+ {%
+ \vspace*{10\p@}%
+ {%
+ \parindent \z@ \raggedright \normalfont
+ \interlinepenalty\@M \DOTIS{#1} \vskip 10\p@
+ }
+ }
+\makeatother
+
+
+
+% -----------------------------------------------------------------------
+% H Y P E R E F
+%
+% Set hyperlink settings.
+
+\RequirePackage[hyphens]{url} % Embedding URL's in document.
+
+% Enable hyperlinks only in the PDF.
+\RequirePackage[bookmarks=true, pdfstartview=Fit, linktoc=page, pdfpagemode=UseNone]{hyperref}
+
+% Define the colors of the hyperlink.
+\ifthenelse{\equal{\SgIntMedia}{screen}}
+{%
+ \definecolor{webgreen}{rgb}{0,.5,0} % previously used magenta.
+ \definecolor{webblue}{rgb}{0,0,1} % previously used orange.
+
+ \hypersetup
+ {%
+ colorlinks = true,
+ linkcolor = webgreen,
+ citecolor = cyan,
+ urlcolor = webblue
+ }
+}{}
+\ifthenelse{\equal{\SgIntMedia}{print}}
+{%
+ \hypersetup{colorlinks=false,pdfborder={0 0 0}}
+}{}
+
+% Define the proerties describing PDF.
+\newcommand{\SgIntSetupPdfProps}%
+{%
+ \hypersetup
+ {%
+ pdfauthor = \SgIntAuthor,
+ pdftitle = \SgIntTitle,
+ pdfsubject = \SgIntSubject,
+ pdfkeywords = \SgIntKeywords
+ }
+}
+
+
+
+% -----------------------------------------------------------------------
+% D O C U M E N T P R O P E R T I E S
+%
+% Important variables used for creating PDF properties and the title page.
+
+% Define empty variables for creating title and setting PDF properties.
+\newcommand{\SgIntTitle}{}
+\newcommand{\SgIntAuthor}{}
+\newcommand{\SgIntAuthorDegrees}{}
+\newcommand{\SgIntYear}{}
+\newcommand{\SgIntSubject}{}
+\newcommand{\SgIntKeywords}{}
+\newcommand{\SgIntDegree}{}
+\newcommand{\SgIntDepartment}{}
+\newcommand{\SgIntUniversity}{}
+\newcommand{\SgIntDeclarationDate}{}
+
+% Define commands for setting the above variables.
+\newcommand{\SgSetTitle}[1]{\renewcommand{\SgIntTitle}{#1}\SgIntSetupPdfProps}
+\newcommand{\SgSetAuthor}[1]{\renewcommand{\SgIntAuthor}{#1}\SgIntSetupPdfProps}
+\newcommand{\SgSetAuthorDegrees}[1]{\renewcommand{\SgIntAuthorDegrees}{#1}}
+\newcommand{\SgSetYear}[1]{\renewcommand{\SgIntYear}{#1}}
+\newcommand{\SgSetSubject}[1]{\renewcommand{\SgIntSubject}{#1}\SgIntSetupPdfProps}
+\newcommand{\SgSetKeywords}[1]{\renewcommand{\SgIntKeywords}{#1}\SgIntSetupPdfProps}
+\newcommand{\SgSetDegree}[1]{\renewcommand{\SgIntDegree}{#1}}
+\newcommand{\SgSetDepartment}[1]{\renewcommand{\SgIntDepartment}{#1}}
+\newcommand{\SgSetUniversity}[1]{\renewcommand{\SgIntUniversity}{#1}}
+\newcommand{\SgSetDeclarationDate}[1]{\renewcommand{\SgIntDeclarationDate}{#1}}
+
+
+
+% -----------------------------------------------------------------------
+% C L E V E R E F
+%
+% Must come as late as possible, especially after hyperref.
+\RequirePackage[capitalize]{cleveref}
+
+% Disable the automatic abbreviations of equations and figures.
+\crefname{equation}{Equation}{Equations}
+\crefname{figure}{Figure}{Figures}
+\Crefname{equation}{Equation}{Equations}
+\Crefname{figure}{Figure}{Figures}
+
+% Change the way links are produced in PDF documents.
+\crefformat{chapter}{#2Chapter~#1#3}
+\crefformat{section}{#2Section~#1#3}
+\crefformat{figure}{#2Figure~#1#3}
+\crefformat{equation}{#2Equation~#1#3}
+\crefformat{table}{#2Table~#1#3}
+\Crefformat{chapter}{#2Chapter~#1#3}
+\Crefformat{section}{#2Section~#1#3}
+\Crefformat{figure}{#2Figure~#1#3}
+\Crefformat{equation}{#2Equation~#1#3}
+\Crefformat{table}{#2Table~#1#3}
+\creflabelformat{equation}{#2#1#3}
+
+
+
+% -----------------------------------------------------------------------
+% T I T L E P A G E
+\ifthenelse{\equal{\SgIntTitleCase}{upper}}
+{
+ \newcommand{\SgIntMakeUpperCase}[1]{\MakeUppercase{#1}}
+}
+{
+ \newcommand{\SgIntMakeUpperCase}[1]{#1}
+}
+\newcommand{\SgAddTitle}{%
+ \thispagestyle{empty}
+ \begin{center}
+ \vspace*{0.5in}
+ \Large{\bf{\SgIntMakeUpperCase{\SgIntTitle}}}
+ \\
+ \vspace{2.5in}
+
+ \large{\SgIntMakeUpperCase{\SgIntAuthor}} \\
+ \large{\emph{\SgIntAuthorDegrees}} \\
+ \vspace{2.5in}
+
+ \large{\SgIntMakeUpperCase{A Thesis Submitted for the Degree of \SgIntDegree}}
+ \vspace{0.2in}
+
+ \large{\SgIntMakeUpperCase{\SgIntDepartment}} \\
+ \large{\SgIntMakeUpperCase{\SgIntUniversity}} \\
+ \vspace{0.2in}
+
+ \large{\SgIntYear}
+ \end{center}
+ \SgIntClearDoublePage
+}
+
+
+
+% -----------------------------------------------------------------------
+% D E C L A R A T I O N P A G E
+\newcommand{\SgAddDeclaration}[1][nosignimage]{%
+ \newpage
+ \thispagestyle{plain}
+ \begin{center}
+ \vspace*{1.5cm}
+ {
+ \Large \bfseries Declaration
+ }
+ \end{center}
+
+ \vspace{0.5cm}
+
+ \begin{quote}
+ I hereby declare that this thesis is my original work and it has been written by me in its entirety. I have duly acknowledged all the sources of information which have been used in the thesis. \newline
+
+ This thesis has also not been submitted for any degree in any university previously.
+ \end{quote}
+
+ \ifthenelse{\equal{#1}{nosignimage}}
+ {
+ \vspace{2.0cm}
+ }
+ {
+ \vspace{0.5cm}
+ }
+
+ \begin{center}
+ \ifthenelse{\equal{#1}{nosignimage}}
+ {}{\includegraphics{#1}\\[-0.5cm]}
+ \rule{5cm}{0.2mm} \\
+ \SgIntAuthor \\
+ \SgIntDeclarationDate
+ \end{center}
+
+ \SgIntClearDoublePage
+}
+
+
+
+% -----------------------------------------------------------------------
+% A C K N O W L E D G M E N T S
+%
+% The acknowledgments environment puts a large, bold, centered
+% "Acknowledgments" label at the top of the page. The acknowledgments
+% themselves appear in a quote environment, i.e. tabbed in at both
+% sides, and on its own page.
+\newenvironment{acknowledgments}%
+{%
+ \thispagestyle{plain}
+ \begin{center}
+ \vspace*{1.5cm}
+ {%
+ \Large \bfseries Acknowledgments
+ }
+ \end{center}
+ \vspace{0.5cm}
+ \begin{quote}
+}
+{%
+ \end{quote}
+ \SgIntClearDoublePage
+}
+
+
+
+% -----------------------------------------------------------------------
+% A B S T R A C T
+%
+% The abstract environment puts a large, bold, centered "Abstract" label at
+% the top of the page. The abstract itself appears in a quote environment,
+% i.e. tabbed in at both sides, and on its own page.
+\renewenvironment{abstract}
+{%
+ \thispagestyle{plain}
+ \begin{center}
+ \vspace*{1.5cm}
+ {\Large\bfseries Abstract}
+ \end{center}
+ \vspace{0.5cm}
+ \begin{quote}
+}
+{%
+ \end{quote}
+ \SgIntClearDoublePage
+}
+
+
+
+% -----------------------------------------------------------------------
+% F R O N T M A T T E R
+%
+% The frontmatter environment set the page numbering to lowercase roman for
+% ack, abstract, toc, lof, lot, loa, etc. It also resets page numbering for the
+% remainder of thesis (arabic, starting at 1).
+\newenvironment{frontmatter}
+{%
+ \setcounter{page}{1}
+ \renewcommand{\thepage}{\roman{page}}
+}
+{%
+ \clearpage
+ \renewcommand{\thepage}{\arabic{page}}
+ \setcounter{page}{1}
+ \SgIntClearDoublePage
+} \ No newline at end of file
diff --git a/macros/latex/contrib/sphdthesis/SPhdThesis.pdf b/macros/latex/contrib/sphdthesis/SPhdThesis.pdf
new file mode 100644
index 0000000000..20f278a8ef
--- /dev/null
+++ b/macros/latex/contrib/sphdthesis/SPhdThesis.pdf
Binary files differ
diff --git a/macros/latex/contrib/sphdthesis/SPhdThesis.tex b/macros/latex/contrib/sphdthesis/SPhdThesis.tex
new file mode 100644
index 0000000000..213f642428
--- /dev/null
+++ b/macros/latex/contrib/sphdthesis/SPhdThesis.tex
@@ -0,0 +1,190 @@
+
+\documentclass[a4paper]{article}
+
+% F O N T S
+\usepackage[T1]{fontenc} % Use T1 encoded cm-super fonts.
+\usepackage{microtype} % Improve typesetting.
+\usepackage{fix-cm} % Support for arbitrary font size for cm.
+\usepackage{xspace}
+\usepackage{listings}
+\lstset{numbers=left,basicstyle=\small,language=Tex}
+
+% P A G E L A Y O U T
+% Use geometry package to set up margins.
+% A4 paper is 8.27 × 11.69 inch.
+\RequirePackage[a4paper, width=6.27in, height=9.69in, includehead]{geometry}
+
+% Set line spacing.
+\RequirePackage{setspace}
+\onehalfspacing
+
+% Setup the hyperref package for enabling links, bookmarks, and PDF properties.
+\RequirePackage[hyphens]{url} % Embedding URL's in document.
+\RequirePackage[bookmarks=true]{hyperref}
+\hypersetup
+{
+ pdfstartview = {FitV},
+ pdfpagemode = UseNone,
+ colorlinks = true,
+ linkcolor = red,
+ citecolor = blue,
+ filecolor = magenta,
+ urlcolor = cyan
+}
+
+% C L E V E R E F
+%
+% Must come as late as possible, especially after hyperref.
+\RequirePackage[capitalize]{cleveref}
+
+% Disable the automatic abbreviations of equations and figures.
+\crefname{equation}{Equation}{Equations}
+\crefname{figure}{Figure}{Figures}
+\Crefname{equation}{Equation}{Equations}
+\Crefname{figure}{Figure}{Figures}
+
+% Change the way links are produced in PDF documents.
+\crefformat{chapter}{#2Chapter~#1#3}
+\crefformat{section}{#2Section~#1#3}
+\crefformat{figure}{#2Figure~#1#3}
+\crefformat{equation}{#2Equation~#1#3}
+\crefformat{table}{#2Table~#1#3}
+\Crefformat{chapter}{#2Chapter~#1#3}
+\Crefformat{section}{#2Section~#1#3}
+\Crefformat{figure}{#2Figure~#1#3}
+\Crefformat{equation}{#2Equation~#1#3}
+\Crefformat{table}{#2Table~#1#3}
+\creflabelformat{equation}{#2#1#3}
+
+% Set the front page matter.
+
+\newcommand{\SgTitle}[1]{\hypersetup{pdftitle={#1}}\title{#1}}
+\newcommand{\SgAuthor}[1]{\hypersetup{pdfauthor={#1}}}
+\newcommand{\SgSubject}[1]{\hypersetup{pdfsubject={#1}}}
+\newcommand{\SgKeywords}[1]{\hypersetup{pdfkeywords={#1}}}
+
+\newcommand{\SgFrontMatter}[3]%
+{%
+ \SgTitle{#1}%
+ \SgAuthor{#2}%
+ \author{#2 (#3)}
+ \maketitle%
+ \tableofcontents%
+}
+
+\newcommand{\SPhdThesis}{\textbf{SPhdThesis}\xspace}
+\newcommand{\Code}[1]{\texttt{#1}\xspace}
+
+\begin{document}
+\SgFrontMatter{SPhdThesis class documentation}{Saurabh Garg}{\url{saurabhgarg@mysoc.net}}
+\SgKeywords{PhD thesis; latex template; SoC; NUS}
+
+\section{Introduction}
+I developed \SPhdThesis document class while writing my PhD thesis in School of Computing (SoC), National University of Singapore (NUS). By default, it adheres to the ``NUS Guidelines on Format of Research Thesis Submitted For Examination'' located at \url{http://www.nus.edu.sg/registrar/event/gd-thesisexam.html}\footnote{You need NUSNET username and password to access the document.}. However, it is quite easy to change it for different guidelines. Section~\ref{sec:GettingStarted} (Getting started) describes how to quickly start using \SPhdThesis with default options. The class options used to customize the formatting of the thesis are described in Section~\ref{sec:ClassOptions}. Section~\ref{sec:Tweaking} gives some hints for tweaking the class file and Section~\ref{sec:Issues} list the currently know issues. Although, not related to this document class, Section~\ref{sec:Tools} lists some tools I find useful for working with \LaTeX. \\
+
+An important point to consider before using this document class is that it only supports using \texttt{pdflatex}. It cannot be used with \texttt{latex} to create a dvi file. The implication of using pdflatex is that all your figures have to be in pdf, png or jpg. You cannot use eps figures. However, there are tools to convert eps files to pdf on all platforms.
+
+\section{Getting started}\label{sec:GettingStarted}
+The easiest way to start using \SPhdThesis document class is to copy \texttt{SPhdThesis.cls} and \texttt{example\textbackslash{}} \texttt{thesis.tex} to your thesis folder and modify \texttt{thesis.tex}. The following is the complete listing of \texttt{thesis.tex}:
+
+\begin{lstlisting}
+\documentclass{SPhdThesis}
+
+% Title page and PDF properties.
+\SgSetTitle{A Robust Mesh-based Surface Integration Algorithm}
+\SgSetAuthor{Saurabh Garg}
+\SgSetAuthorDegrees{List your previous degrees here}
+\SgSetYear{2013}
+\SgSetDegree{Doctor of Philosophy}
+\SgSetDepartment{Department of Computer Science}
+\SgSetUniversity{National University of Singapore}
+\SgSetDeclarationDate{June 2013}
+
+% The document.
+\begin{document}
+ \begin{frontmatter}
+ \SgAddTitle%
+ \SgAddDeclaration%
+ \input{acknowledgments}%
+ \input{abstract}%
+ \SgAddToc% Add table of contents.
+ \SgAddLof% Add list of figures.
+ \SgAddLot% Add list of tables.
+ \SgAddLoa% Add list of algorithms.
+ \end{frontmatter}
+
+ \input{chapter1}
+ \SgIncludeBib{biblio}
+\end{document}
+\end{lstlisting}
+
+Line 1 simply defines the document class with default options. \\
+
+Lines 4--11 define the variables for automatically creating the title page and setting the PDF document properties. \\
+
+Lines 15--24 defines the front matter of the thesis. \verb|\SgAddTitle| creates the title page using the values of variables defined above. \verb|\SgAddDeclaration| adds the declaration page. Declaration page must be signed. You can either sign after printing or give the path to the signature image as an argument to \verb|\SgAddDeclaration| like this \verb|\SgAddDeclaration[sign-image]|. \verb|\input{acknowledgments}| includes a file containing the acknowledgments. The acknowledgments must be enclosed in \verb|\begin{acknowledgments}| \verb|...| \verb|\end{acknowledgments}|. Similarly, \verb|\input{abstract}| includes a file containing the abstract. The abstract must be enclosed in \verb|\begin{abstract}| \verb|...| \verb|\end{abstract}|. Note that it is not necessary to create separate files for acknowledgments and abstract and they can be inserted inline. \\
+
+Lines 20--23 inserts the table of contents, list of figures, list of tables, and list of algorithms. The order of list of figures, list of tables, and list of algorithms can be changed and not all of the them are necessary. \\
+
+After the front matter is specified, you are free to add main content of the thesis. You can either create one tex file per chapter and include them using \verb|\input{}| or simply include everything in the main file. You can see example\textbackslash{}figure.tex, example\textbackslash{}table.tex, example\textbackslash{}algorithm.tex for examples of how to include figures, tables, and algorithms, respectively. \\
+
+Finally, the bibliography should be included using \verb|\SgIncludeBib{}|. If your bibliography is divided in multiple files, than they can be separated by comma (,).
+
+\section{Class options}\label{sec:ClassOptions}
+\SPhdThesis document class uses key=value format for specifying options. Two options are separated by a comma (,). For example \verb|\documentclass[media=print,title=upper]{SPhdThesis}|. The following options are provided:\\
+
+\noindent\textbf{Media type}\\
+\Code{media} = \Code{screen} or \Code{print} (default value is \Code{screen}). \Code{media} internally defines the formatting settings for viewing document on screen or printing. When formatting for screen, colors are used for links, tables, and algorithms whereas only black color is used for them in the print mode.\\
+
+\noindent\textbf{Title page casing:}\\
+\Code{titlecase} = \Code{lower} or \Code{upper} (default is \Code{upper}). NUS requires the title page to be formatted in uppercase but I don't like uppercase. So, I used this option to format the title page in the lowercase everywhere expect the final submission.\\
+
+\noindent\textbf{Line spacing:}\\
+\Code{linespacing} = \Code{onehalf} or \Code{double} (default is \Code{onehalf}). NUS requires the thesis to be formatted with double line spacing which in my opinion doesn’t look very good. So, I used this option to format the thesis with one half line spacing everywhere expect the final submission.\\
+
+\noindent\textbf{Font size:}\\
+\Code{fontsize} = \Code{11pt} or \Code{12pt} (default is \Code{11pt}). NUS recommends font size to be 11 or 12 points. This option can be used to format the thesis in either 11 or 12 points. \\
+
+\noindent\textbf{Open type:}\\
+\Code{open} = \Code{right} or \Code{any} (default value is \Code{any}). This option defines which page a new chapter will start from: for \Code{open}{}=\Code{any} a new chapter will start from the next new page. However, for \Code{open}{}=\Code{right} a new chapter will only start from next right hand side (odd) page.
+
+\section{Tweaking the document class}\label{sec:Tweaking}
+The \verb|SPhdThesis.cls| file is heavily commented and should be mostly easy to understand. It is divided into sections and the order of some sections are important. For example, captions section should come before packages and hyperref section. All these dependencies are documented in the \verb|SPhdThesis.cls| file. \\
+
+Here are some hints to customize the formatting of the thesis:
+\begin{itemize}
+ \item Chapter and section title formatting: The appearance of chapter and section title in various places in the thesis is defined in the fonts section. The variables defined in the font section are used by TOC (for formatting table of contents), chapter heading (for formatting the chapter heading), and fancy header (for formatting the headers and footers) sections.
+ \item Chapter heading: The chapter heading is formatted using Lenny style of the fncychap package. If you like to change to another style supported by fncychap package you can do so in chapter heading section.
+ \item Page layout: The paper size and margins are defined in the page layout section. Some other important properties defined is the page layout section are: paragraph indenting, footnote spacing, forcing image to be on the top on blank pages, distance between a float and text, and distance between two floats.
+ \item Fancy header: The appearance of header is changed using fancyhdr package in the fancy header section. There are three parts in the header: left, center, and right. In SPhdThesis class, Chapter \#. Chapter\_Name appears on the left part and page number appears on the right part.
+ \item TOC. The appearance of the table of contents is changed using tocloft package in the TOC section. Dots separating chapter titles and page numbers are removed and the appearance of the chapter title and page number is defined.
+ \item Table: The appearance of tables is defined in the table section. Apart from various distance used for format table you can change the color of horizontal rules.
+ \item Algorithm: The appearance of algorithms is defined in the algorithm section.
+\end{itemize}
+
+\section{Known Issues}\label{sec:Issues}
+\begin{itemize}
+ \item Color of rules in algorithms, unlike tables, are black in both print and screen mode.
+\end{itemize}
+
+\section{Tools}\label{sec:Tools}
+Some tools which are useful for working with \LaTeX:
+\begin{itemize}
+ \item \textbf{The Ipe extensible drawing editor}\\
+ Ipe is a drawing editor for creating figures in PDF or (encapsulated) Postscript format. It supports making small figures for inclusion into LaTeX-documents as well as making multi-page PDF presentations that can be shown on-line with Acrobat Reader.\\
+Website: \url{http://ipe7.sourceforge.net/}
+ \item \textbf{Jabref reference manager}\\
+ JabRef is an open source bibliography reference manager. The native file format used by JabRef is BibTeX, the standard LaTeX bibliography format. JabRef runs on the Java VM (version 1.6 or newer), and should work equally well on Windows, Linux and Mac OS X.\\
+ Website: \url{http://jabref.sourceforge.net/}
+ \item \textbf{Gle - Graphics Layout Engine}\\
+ GLE (Graphics Layout Engine) is a graphics scripting language designed for creating publication quality figures (e.g., a chart, plot, graph, or diagram). It supports various chart types (including function plot, histogram, bar chart, scatter plot, contour plot, color map, and surface plot) through a simple but flexible set of graphing commands. More complex output can be created by relying on GLE's scripting language, which is full featured with subroutines, variables, and logic control. GLE relies on LaTeX for text output and supports mathematical formulae in graphs and figures. GLE's output formats include EPS, PS, PDF, JPEG, and PNG.\\
+ Website: \url{http://glx.sourceforge.net/}
+ \item \textbf{Chktex - \LaTeX semantic checker}\\
+ Chktex is a tool for catching typographic errors in a latex document.\\
+ Website: \url{http://baruch.ev-en.org/proj/chktex/}
+ \item \textbf{lacheck - \LaTeX checker}\\
+ Lacheck is a tool for finding common mistakes in \LaTeX documents.\\
+ Website: \url{http://www.ctan.org/tex-archive/support/lacheck}
+\end{itemize}
+
+\end{document}
diff --git a/macros/latex/contrib/sphdthesis/example/SPhdThesis.cls b/macros/latex/contrib/sphdthesis/example/SPhdThesis.cls
new file mode 100644
index 0000000000..069b2abc1c
--- /dev/null
+++ b/macros/latex/contrib/sphdthesis/example/SPhdThesis.cls
@@ -0,0 +1,625 @@
+
+% SPhdThesis v1.0
+% By Saurabh Garg (saurabhgarg@mysoc.net)
+% Version 1.0 released 11.06.2013
+
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesClass{SPhdThesis}[2013/06/11 v1.0 SPhdThesis class]
+
+\RequirePackage{xkeyval}
+
+% -----------------------------------------------------------------------------
+% Define option for formatting for [screen] and print.
+% When formatting for screen colors are used for links, tables, and algorithms.
+% When formatting for print black color is used for links, tables, and algorithms.
+\define@choicekey*[Sg]{PhDThesis}{media}{screen,print}[screen]{\def \SgIntMedia{#1}}
+\setkeys[Sg]{PhDThesis}{media}
+
+% -----------------------------------------------------------------------------
+% Define option for formatting title page in lower or [upper] case.
+\define@choicekey*[Sg]{PhDThesis}{titlecase}{upper,lower}[upper]{\def \SgIntTitleCase{#1}}
+\setkeys[Sg]{PhDThesis}{titlecase}
+
+% -----------------------------------------------------------------------------
+% Define line spacing. The valid values are [onehalf] and double.
+% Note that before using \SgLineSpacing setspace package must be loaded.
+\define@choicekey*[Sg]{PhDThesis}{linespacing}[\val\nr]{onehalf,double}[onehalf]{%
+ \ifcase\nr\relax
+ \def \SgIntLineSpacing{\onehalfspacing}
+ \or
+ \def \SgIntLineSpacing{\doublespacing}
+ \fi
+}
+\setkeys[Sg]{PhDThesis}{linespacing}
+
+% -----------------------------------------------------------------------------
+% Define font size. The valid values are [11pt] and 12pt.
+\define@choicekey*[Sg]{PhDThesis}{fontsize}{11pt,12pt}[11pt]{\def \SgIntFontSize{#1}}
+\setkeys[Sg]{PhDThesis}{fontsize}
+
+% -----------------------------------------------------------------------------
+% Define font family to be used. Default is cm.
+\define@choicekey*[Sg]{PhDThesis}{font}{cm,times,helvet,palatino}[cm]{\def \SgIntFont{#1}}
+\setkeys[Sg]{PhDThesis}{font}
+
+% -----------------------------------------------------------------------------
+% Define open. The valid values are right and [any].
+% Right makes chapters and entries in frontmatter begin only on right hand pages
+% or on the next page available. Any puts them on the next available page.
+\define@choicekey*[Sg]{PhDThesis}{open}[\val\nr]{right,any}[any]{%
+ \ifcase\nr\relax
+ \def \SgIntOpen {openright}
+ \or
+ \def \SgIntOpen {openany}
+ \fi
+}
+\setkeys[Sg]{PhDThesis}{open}
+
+% -----------------------------------------------------------------------------
+% Define pageside. The valid values are oneside and [twoside].
+% Specifies whether double or single sided output should be generated.
+\define@choicekey*[Sg]{PhDThesis}{pageside}{oneside,twoside}[twoside]{\def \SgIntPageSide{#1}}
+\setkeys[Sg]{PhDThesis}{pageside}
+
+
+% Process all options defined above with default values.
+\ProcessOptionsX[Sg]<PhDThesis>
+
+% Finally load the report class.
+\LoadClass[a4paper, \SgIntFontSize, \SgIntOpen, \SgIntPageSide]{report}
+
+
+
+% -----------------------------------------------------------------------
+% F O N T S.
+
+\RequirePackage[T1]{fontenc} % Use T1 encoded cm-super fonts.
+\RequirePackage{microtype} % Improve typesetting.
+\RequirePackage{fix-cm} % Support for arbitrary font size for cm.
+
+% Specify the format for the section titles in toc.
+\newcommand{\SgIntTocSectionFormat}{\bfseries}
+
+% Specify the format for chapter name and number in chapter headings.
+\newcommand{\SgIntChapNameFormat}{\fontsize{20}{50}\fontshape{sc}\selectfont}
+\newcommand{\SgIntChapNumberFormat}{\fontsize{76}{80}\selectfont}
+
+% Specify the format for chapter, section, and subsection titles.
+\newcommand{\SgIntChapTitleFormat}{\LARGE\bfseries}
+\newcommand{\SgIntSecTitleFormat}{\Large\bfseries}
+\newcommand{\SgIntSubsecTitleFormat}{\large\bfseries}
+
+% Specify the format for displaying chapter in fancy header.
+\newcommand{\SgIntHeaderFormat}{\large\bfseries}
+\newcommand{\SgIntPageNumFormat}{\bfseries}
+
+
+
+% -----------------------------------------------------------------------------
+% C A P T I O N S
+%
+% Nicer captions for figures and tables.
+% caption package must be included before subfig and hyperref.
+
+% Change the font of the caption to sans serif and make label bold.
+\RequirePackage[labelfont=bf]{caption}
+
+
+
+% -----------------------------------------------------------------------
+% P A C K A G E S
+%
+% Include important packages.
+
+\RequirePackage{graphicx, subfig} % Figures.
+\RequirePackage{amsmath, amssymb, amsthm} % Math symbols and fonts.
+\RequirePackage{float} % Must be done before hyperref.
+\RequirePackage[usenames,dvipsnames,hyperref]{xcolor} % For defining colors.
+\RequirePackage{ifthen} % For comparison.
+
+
+
+% -----------------------------------------------------------------------
+% P A G E L A Y O U T.
+
+% Use geometry package to set up margins.
+% A4 paper is 8.27 x 11.69 inch.
+\RequirePackage[a4paper, left=1.25in, right=1in, top=1in, bottom=1in, includehead, \SgIntPageSide]{geometry}
+
+\ifthenelse{\equal{\SgIntOpen}{openright}}
+{
+ % For adding extra blank page, if necessary, after chapter.
+ \RequirePackage{emptypage}
+
+ % Define a command to leave a blank page. This is used in frontmatter to add
+ % an empty page between ack, abstract, toc, lof and lot.
+ \newcommand{\SgIntClearDoublePage}{\clearpage{\pagestyle{empty}\cleardoublepage}}
+}
+{
+ \newcommand{\SgIntClearDoublePage}{\clearpage}
+}
+
+% For disabling paragraph indenting and using a blank line between paragraphs.
+\RequirePackage{parskip}
+
+% Set line spacing.
+\RequirePackage{setspace}
+\SgIntLineSpacing
+
+% Fix footnote spacing
+\setlength{\footnotesep}{0.5cm} % Distance between two footnotes.
+\setlength{\skip\footins}{0.5cm} % Distance between last line of text and first footnote.
+
+% By default Latex centers images vertically on a float page.
+% Modify Latex internal variables so that figures are placed from top.
+\makeatletter
+ \setlength{\@fptop}{0.25cm}
+ \setlength{\@fpsep}{1.00cm}
+\makeatother
+
+\setlength{\textfloatsep}{1.5cm} % Set the distance between a float and text.
+\setlength{\floatsep}{1.0cm} % Set the distance between two floats.
+
+% Prevent latex from adding extra space between paragraphs so that
+% the last line is at the bottom margin on each page.
+\raggedbottom
+
+% Define horizontal spacing between subfigures.
+\newcommand{\SgIntHSpaceBetweenSubfloats}{\hspace{0.5cm}}
+
+
+
+% -----------------------------------------------------------------------
+% T A B L E
+%
+% Set table layout and design.
+
+\RequirePackage{booktabs, colortbl} % Tables.
+\RequirePackage{tabularx} % Auto column sizing.
+
+\renewcommand{\arraystretch}{1.5} % Set space between rows in a table.
+\renewcommand{\tabcolsep}{0.20cm} % Set space between columns in a table.
+\heavyrulewidth = 0.15em % Set width of heavy rules.
+\lightrulewidth = 0.07em % Set width of light rules.
+\abovetopsep = 0.1cm % Set separation between caption and top rule.
+\aboverulesep = 0.4ex % Set separation to use above a rule.
+\belowrulesep = 0.4ex % Set separation to use below a rule.
+
+% Set color for table rules.
+\ifthenelse{\equal{\SgIntMedia}{screen}}{\arrayrulecolor[rgb]{0.0, 0.6, 0.9}}{}
+\ifthenelse{\equal{\SgIntMedia}{print}}{\arrayrulecolor[rgb]{0.0, 0.0, 0.0}}{}
+
+
+
+% -----------------------------------------------------------------------
+% A L G O R I T H M
+
+\RequirePackage[algo2e, ruled, linesnumbered, algochapter]{algorithm2e}
+\DontPrintSemicolon % Dont print semicolons at end of lines.
+\algoheightrule = \heavyrulewidth % Set the width of the top and bottom rules.
+\algotitleheightrule = \lightrulewidth % Set the width of the middle rule.
+\SetAlgoInsideSkip{medskip} % Set distance between middle rule and algorithm.
+\interspacetitleruled = 0.2cm % Set distance between caption and rules.
+\setlength{\algomargin}{2.25em} % Set the margin of the algorithm text.
+\SetNlSkip{1.25em} % Set the spacing between line numbers and text.
+
+\newenvironment{SgAlgorithm}[1][t]
+{%
+ \begin{algorithm2e}[#1]
+ \linespread{1.3} % Set the line spacing to one and half.
+ \selectfont % The linespread is effective only after selectfont.%
+}
+{%
+ \end{algorithm2e}
+}
+
+
+
+% -----------------------------------------------------------------------
+% B I B L I O G R A P H Y
+
+% Rename bibliography to references.
+\renewcommand{\bibname}{References}
+
+% Define a new command to include the bibliography file and
+% set the formatting options.
+\newcommand{\SgIncludeBib}[1]
+{%
+ \clearpage % Fix the page number in TOC.
+ \phantomsection % Fix the link in PDF.
+ \addcontentsline{toc}{chapter}{References} % Add the bibliography to TOC.
+ \bibliographystyle{alpha} % Set the bibliography style.
+ \bibliography{#1} % Include the bibliography file.
+}
+
+
+
+% -----------------------------------------------------------------------
+% F A N C Y H E A D E R
+
+\RequirePackage{fancyhdr}
+
+% Set page style to fancy.
+\pagestyle{fancy}
+
+% By default fancyhdr converts the chapter headings to uppercase,
+% so restore the chapter casing.
+\renewcommand{\chaptermark}[1]{\markboth{\chaptername\ \thechapter.\ #1}{}}
+
+% Define header consisting of Chapter #. Chapter_Name on left side and
+% page number on right side.
+% \nouppercase is used on left header to force bibliography in lowercase.
+\fancyhead{}
+\fancyhead[L]{\nouppercase{\SgIntHeaderFormat\leftmark}}
+\fancyhead[R]{\SgIntPageNumFormat\thepage}
+\renewcommand{\headrulewidth}{1pt}
+\addtolength{\headheight}{10pt}
+
+% Disable footer.
+\fancyfoot{}
+\renewcommand{\footrulewidth}{0pt}
+
+% Define header and footer for plain pages.
+\fancypagestyle{plain}
+{%
+ % Disable header.
+ \fancyhead{}
+ \renewcommand{\headrulewidth}{0pt}
+
+ % Footer contains the page number on right side.
+ \fancyfoot{}
+ \fancyfoot[R]{\SgIntPageNumFormat\thepage}
+ \renewcommand{\footrulewidth}{0pt}
+}
+
+
+
+% -----------------------------------------------------------------------
+% T O C L O F L O T L O A
+%
+% Change the appearance of toc, lof, lot, etc.
+
+% Using tocloft, the toc can be formatted easily.
+\RequirePackage[titles, subfigure]{tocloft}
+
+% Remove dots.
+\renewcommand{\cftdotsep}{\cftnodots}
+
+% Remove dots from list of algorithms.
+% This is necessary because we use algorithm2e which mananges its own list of algorithms.
+\makeatletter
+ \renewcommand{\@dotsep}{5000}
+\makeatother
+
+% Format chapter entries differently in toc.
+\renewcommand{\cftchapfont}{\SgIntTocSectionFormat}
+
+% Fix the indentation of figure and table entries in the lof, lot, and loa.
+\setlength{\cftfigindent}{0in}
+\setlength{\cfttabindent}{0in}
+
+\newcommand{\SgAddToc}{\tableofcontents\SgIntClearDoublePage}
+\newcommand{\SgAddLof}{%
+ \newpage
+ \phantomsection % Requires hyperref; this is to fix the link.
+ \addcontentsline{toc}{section}{\numberline{}\hspace{-.35in}{\SgIntTocSectionFormat{}List of Figures}}
+ \listoffigures
+ \SgIntClearDoublePage
+}
+\newcommand{\SgAddLot}{%
+ \newpage
+ \phantomsection % Requires hyperref; this is to fix the link.
+ \addcontentsline{toc}{section}{\numberline{}\hspace{-.35in}{\SgIntTocSectionFormat{}List of Tables}}
+ \listoftables
+ \SgIntClearDoublePage
+}
+\newcommand{\SgAddLoa}{%
+ \newpage
+ \phantomsection % Requires hyperref; this is to fix the link.
+ \addcontentsline{toc}{section}{\numberline{}\hspace{-.35in}{\SgIntTocSectionFormat{}List of Algorithms}}
+ \listofalgorithmes % Note an extra e, it is required because we use algorithm2e.
+ \SgIntClearDoublePage
+}
+
+
+
+% -------------------------------------------------------------------------------------
+% C H A P T E R H E A D I N G
+%
+% Change the appearance of chapter headers and section titles.
+
+% Change the fonts for chapter heading.
+\RequirePackage[Lenny]{fncychap}
+\ChNameVar{\SgIntChapNameFormat}
+\ChNumVar{\SgIntChapNumberFormat}
+\ChTitleVar{\SgIntChapTitleFormat}
+
+% Set the format of the section and subsection titles.
+\RequirePackage{sectsty}
+\sectionfont{\SgIntSecTitleFormat}
+\subsectionfont{\SgIntSubsecTitleFormat}
+
+% Adjust the spacing between titles and surrounding matter.
+\RequirePackage{etoolbox}
+\makeatletter
+ % Reduce the space between chapter title and text.
+ \patchcmd{\DOTI}{\vskip 40\p@}{\vskip 20\p@}{}{}
+ \patchcmd{\DOTIS}{\vskip 40\p@}{\vskip 20\p@}{}{}% for unnumbered chapters
+
+ % http://tex.stackexchange.com/questions/13357/fncychap-package-reduce-vertical-gap-space-between-header-and-chapter-heading
+ % Reduce the spacing between top margin and chapter title.
+ \renewcommand*{\@makechapterhead}[1]
+ {%
+ \vspace*{10\p@}
+ {%
+ \parindent \z@ \raggedright \normalfont
+ \ifnum \c@secnumdepth >\m@ne
+ \if@mainmatter % Fix for frontmatter, mainmatter, and backmatter 040920
+ \DOCH
+ \fi
+ \fi
+ \interlinepenalty\@M
+ \if@mainmatter % Fix for frontmatter, mainmatter, and backmatter 060424
+ \DOTI{#1}%
+ \else%
+ \DOTIS{#1}%
+ \fi
+ }
+ }
+
+ % For the case \chapter*:
+ \renewcommand*{\@makeschapterhead}[1]
+ {%
+ \vspace*{10\p@}%
+ {%
+ \parindent \z@ \raggedright \normalfont
+ \interlinepenalty\@M \DOTIS{#1} \vskip 10\p@
+ }
+ }
+\makeatother
+
+
+
+% -----------------------------------------------------------------------
+% H Y P E R E F
+%
+% Set hyperlink settings.
+
+\RequirePackage[hyphens]{url} % Embedding URL's in document.
+
+% Enable hyperlinks only in the PDF.
+\RequirePackage[bookmarks=true, pdfstartview=Fit, linktoc=page, pdfpagemode=UseNone]{hyperref}
+
+% Define the colors of the hyperlink.
+\ifthenelse{\equal{\SgIntMedia}{screen}}
+{%
+ \definecolor{webgreen}{rgb}{0,.5,0} % previously used magenta.
+ \definecolor{webblue}{rgb}{0,0,1} % previously used orange.
+
+ \hypersetup
+ {%
+ colorlinks = true,
+ linkcolor = webgreen,
+ citecolor = cyan,
+ urlcolor = webblue
+ }
+}{}
+\ifthenelse{\equal{\SgIntMedia}{print}}
+{%
+ \hypersetup{colorlinks=false,pdfborder={0 0 0}}
+}{}
+
+% Define the proerties describing PDF.
+\newcommand{\SgIntSetupPdfProps}%
+{%
+ \hypersetup
+ {%
+ pdfauthor = \SgIntAuthor,
+ pdftitle = \SgIntTitle,
+ pdfsubject = \SgIntSubject,
+ pdfkeywords = \SgIntKeywords
+ }
+}
+
+
+
+% -----------------------------------------------------------------------
+% D O C U M E N T P R O P E R T I E S
+%
+% Important variables used for creating PDF properties and the title page.
+
+% Define empty variables for creating title and setting PDF properties.
+\newcommand{\SgIntTitle}{}
+\newcommand{\SgIntAuthor}{}
+\newcommand{\SgIntAuthorDegrees}{}
+\newcommand{\SgIntYear}{}
+\newcommand{\SgIntSubject}{}
+\newcommand{\SgIntKeywords}{}
+\newcommand{\SgIntDegree}{}
+\newcommand{\SgIntDepartment}{}
+\newcommand{\SgIntUniversity}{}
+\newcommand{\SgIntDeclarationDate}{}
+
+% Define commands for setting the above variables.
+\newcommand{\SgSetTitle}[1]{\renewcommand{\SgIntTitle}{#1}\SgIntSetupPdfProps}
+\newcommand{\SgSetAuthor}[1]{\renewcommand{\SgIntAuthor}{#1}\SgIntSetupPdfProps}
+\newcommand{\SgSetAuthorDegrees}[1]{\renewcommand{\SgIntAuthorDegrees}{#1}}
+\newcommand{\SgSetYear}[1]{\renewcommand{\SgIntYear}{#1}}
+\newcommand{\SgSetSubject}[1]{\renewcommand{\SgIntSubject}{#1}\SgIntSetupPdfProps}
+\newcommand{\SgSetKeywords}[1]{\renewcommand{\SgIntKeywords}{#1}\SgIntSetupPdfProps}
+\newcommand{\SgSetDegree}[1]{\renewcommand{\SgIntDegree}{#1}}
+\newcommand{\SgSetDepartment}[1]{\renewcommand{\SgIntDepartment}{#1}}
+\newcommand{\SgSetUniversity}[1]{\renewcommand{\SgIntUniversity}{#1}}
+\newcommand{\SgSetDeclarationDate}[1]{\renewcommand{\SgIntDeclarationDate}{#1}}
+
+
+
+% -----------------------------------------------------------------------
+% C L E V E R E F
+%
+% Must come as late as possible, especially after hyperref.
+\RequirePackage[capitalize]{cleveref}
+
+% Disable the automatic abbreviations of equations and figures.
+\crefname{equation}{Equation}{Equations}
+\crefname{figure}{Figure}{Figures}
+\Crefname{equation}{Equation}{Equations}
+\Crefname{figure}{Figure}{Figures}
+
+% Change the way links are produced in PDF documents.
+\crefformat{chapter}{#2Chapter~#1#3}
+\crefformat{section}{#2Section~#1#3}
+\crefformat{figure}{#2Figure~#1#3}
+\crefformat{equation}{#2Equation~#1#3}
+\crefformat{table}{#2Table~#1#3}
+\Crefformat{chapter}{#2Chapter~#1#3}
+\Crefformat{section}{#2Section~#1#3}
+\Crefformat{figure}{#2Figure~#1#3}
+\Crefformat{equation}{#2Equation~#1#3}
+\Crefformat{table}{#2Table~#1#3}
+\creflabelformat{equation}{#2#1#3}
+
+
+
+% -----------------------------------------------------------------------
+% T I T L E P A G E
+\ifthenelse{\equal{\SgIntTitleCase}{upper}}
+{
+ \newcommand{\SgIntMakeUpperCase}[1]{\MakeUppercase{#1}}
+}
+{
+ \newcommand{\SgIntMakeUpperCase}[1]{#1}
+}
+\newcommand{\SgAddTitle}{%
+ \thispagestyle{empty}
+ \begin{center}
+ \vspace*{0.5in}
+ \Large{\bf{\SgIntMakeUpperCase{\SgIntTitle}}}
+ \\
+ \vspace{2.5in}
+
+ \large{\SgIntMakeUpperCase{\SgIntAuthor}} \\
+ \large{\emph{\SgIntAuthorDegrees}} \\
+ \vspace{2.5in}
+
+ \large{\SgIntMakeUpperCase{A Thesis Submitted for the Degree of \SgIntDegree}}
+ \vspace{0.2in}
+
+ \large{\SgIntMakeUpperCase{\SgIntDepartment}} \\
+ \large{\SgIntMakeUpperCase{\SgIntUniversity}} \\
+ \vspace{0.2in}
+
+ \large{\SgIntYear}
+ \end{center}
+ \SgIntClearDoublePage
+}
+
+
+
+% -----------------------------------------------------------------------
+% D E C L A R A T I O N P A G E
+\newcommand{\SgAddDeclaration}[1][nosignimage]{%
+ \newpage
+ \thispagestyle{plain}
+ \begin{center}
+ \vspace*{1.5cm}
+ {
+ \Large \bfseries Declaration
+ }
+ \end{center}
+
+ \vspace{0.5cm}
+
+ \begin{quote}
+ I hereby declare that this thesis is my original work and it has been written by me in its entirety. I have duly acknowledged all the sources of information which have been used in the thesis. \newline
+
+ This thesis has also not been submitted for any degree in any university previously.
+ \end{quote}
+
+ \ifthenelse{\equal{#1}{nosignimage}}
+ {
+ \vspace{2.0cm}
+ }
+ {
+ \vspace{0.5cm}
+ }
+
+ \begin{center}
+ \ifthenelse{\equal{#1}{nosignimage}}
+ {}{\includegraphics{#1}\\[-0.5cm]}
+ \rule{5cm}{0.2mm} \\
+ \SgIntAuthor \\
+ \SgIntDeclarationDate
+ \end{center}
+
+ \SgIntClearDoublePage
+}
+
+
+
+% -----------------------------------------------------------------------
+% A C K N O W L E D G M E N T S
+%
+% The acknowledgments environment puts a large, bold, centered
+% "Acknowledgments" label at the top of the page. The acknowledgments
+% themselves appear in a quote environment, i.e. tabbed in at both
+% sides, and on its own page.
+\newenvironment{acknowledgments}%
+{%
+ \thispagestyle{plain}
+ \begin{center}
+ \vspace*{1.5cm}
+ {%
+ \Large \bfseries Acknowledgments
+ }
+ \end{center}
+ \vspace{0.5cm}
+ \begin{quote}
+}
+{%
+ \end{quote}
+ \SgIntClearDoublePage
+}
+
+
+
+% -----------------------------------------------------------------------
+% A B S T R A C T
+%
+% The abstract environment puts a large, bold, centered "Abstract" label at
+% the top of the page. The abstract itself appears in a quote environment,
+% i.e. tabbed in at both sides, and on its own page.
+\renewenvironment{abstract}
+{%
+ \thispagestyle{plain}
+ \begin{center}
+ \vspace*{1.5cm}
+ {\Large\bfseries Abstract}
+ \end{center}
+ \vspace{0.5cm}
+ \begin{quote}
+}
+{%
+ \end{quote}
+ \SgIntClearDoublePage
+}
+
+
+
+% -----------------------------------------------------------------------
+% F R O N T M A T T E R
+%
+% The frontmatter environment set the page numbering to lowercase roman for
+% ack, abstract, toc, lof, lot, loa, etc. It also resets page numbering for the
+% remainder of thesis (arabic, starting at 1).
+\newenvironment{frontmatter}
+{%
+ \setcounter{page}{1}
+ \renewcommand{\thepage}{\roman{page}}
+}
+{%
+ \clearpage
+ \renewcommand{\thepage}{\arabic{page}}
+ \setcounter{page}{1}
+ \SgIntClearDoublePage
+} \ No newline at end of file
diff --git a/macros/latex/contrib/sphdthesis/example/abstract.tex b/macros/latex/contrib/sphdthesis/example/abstract.tex
new file mode 100644
index 0000000000..f77311f073
--- /dev/null
+++ b/macros/latex/contrib/sphdthesis/example/abstract.tex
@@ -0,0 +1,5 @@
+\begin{abstract}
+Surface integration is an important step for automatic 3D reconstruction of real objects. The goal of a surface integration algorithm is to reconstruct a surface from a set of range images registered in a common coordinate system. Based on the surface representation used, existing algorithms can be divided into two categories: volume-based and mesh-based. Volume-based methods have been shown to be robust to scanner noise and small features (regions of high curvature) and can build water tight models of high quality. It is, however, difficult to choose the appropriate voxel size when the input range images have both small features and large registration errors compared to the sampling density of range images. Mesh-based methods are more efficient and need less memory compared to volume-based methods but these methods fail in the presence of small features and are not robust to scanning noise. \\
+
+This paper presents a robust algorithm for mesh-based surface integration of a set of range images. The algorithm is incremental and operates on a range image and the model reconstructed so far. Our algorithm first, transform the model in the coordinate system of the range image. Then, it finds the regions of model overlapping with the range image. This is done by shooting rays from the scanner, through the vertices in the range image and intersecting them with the model. Finally, the algorithm integrates the overlapping regions by using weighted average of points in the model and the range image. The weights are computed using the scanner uncertainty and helps in reducing the effects of scanning noise. To handle small features robustly the integration of overlapping regions is done by computing the position of vertices in the range image along the scanner's line of sight. Since for every point in a range image there is exactly one depth value, the reconstructed surface in the regions of high curvature will not have self-intersections.
+\end{abstract} \ No newline at end of file
diff --git a/macros/latex/contrib/sphdthesis/example/acknowledgments.tex b/macros/latex/contrib/sphdthesis/example/acknowledgments.tex
new file mode 100644
index 0000000000..d2cc96969a
--- /dev/null
+++ b/macros/latex/contrib/sphdthesis/example/acknowledgments.tex
@@ -0,0 +1,3 @@
+\begin{acknowledgments}
+Write your acknowledgments here.
+\end{acknowledgments} \ No newline at end of file
diff --git a/macros/latex/contrib/sphdthesis/example/algorithm.tex b/macros/latex/contrib/sphdthesis/example/algorithm.tex
new file mode 100644
index 0000000000..cab0e632b2
--- /dev/null
+++ b/macros/latex/contrib/sphdthesis/example/algorithm.tex
@@ -0,0 +1,49 @@
+\begin{SgAlgorithm}[t]
+ \SetKwInOut{Input}{Input}
+ \SetKwInOut{Output}{Output}
+ \SetKwFunction{GenerateAlphaVeins}{GenerateAlphaVeins}
+ \SetKwFunction{GenerateUniLeaf}{GenerateUnilobedLeaf}
+ \SetKwFunction{IntersectLobes}{IntersectLobes}
+ \SetKwFunction{FitBSpline}{FitBSpline}
+ \SetKwFunction{GenerateLaminarMargin}{GenerateLaminarMargin}
+ \SetKwFunction{Index}{Index}
+ \BlankLine
+ \Input{Parameters of the leaf model.}
+ \Output{Laminar shape $M$ as a triangle mesh.}
+ \BlankLine
+ $\{\alpha_i\} \leftarrow \GenerateAlphaVeins(s_0^l, s_0^r, \Delta s)$ \;
+ $L\leftarrow \GenerateUniLeaf(\theta(B^l), \theta(B^r), \theta(A^l), \theta(A^r), \vect{W}^l, \vect{W}^r)$ \;
+ \BlankLine
+ \ForEach{$\alpha$-vein $\alpha_i$}
+ {%
+ $L_i \leftarrow L$ \;
+ $L_i \leftarrow T_i\cdot L_i$ \;
+ }
+ \BlankLine
+ \For{$i=1$ \KwTo $n-1$}
+ {%
+ $\vect{p}^I(v_i) \leftarrow$ \IntersectLobes{$L_i$, $L_{i+1}$} \;
+ $\vect{d}(v_i) \leftarrow \dfrac{\vect{d}(\alpha_i) + \vect{d}(\alpha_{i+1})}{2}$ \;
+ \If{$p(v)$ or $\theta(v)$ is specified}
+ {%
+ $\vect{p}(v_i) \leftarrow \vect{p}^I(v_i) + p(v) l(\alpha_i) \vect{d}(v_i)$ \;
+ }
+ }
+ \BlankLine
+ \For{$i=1$ \KwTo $n-1$}
+ {%
+ \eIf{$p(v)$ or $\theta(v)$ is not specified}
+ {%
+ $M \leftarrow M \cup \left\{\vect{p}_j \mid j \in L_i \wedge \Index(\vect{q}(\alpha_i), L_i) \leq j \leq \Index(\vect{p}^I(v_i), L_i) \right\}$ \;
+ $M \leftarrow M \cup \left\{\vect{p}_j \mid j \in L_{i+1} \wedge \Index(\vect{p}^I(v_i), L_{i+1}) < j \leq \Index(\vect{q}(\alpha_{i+1}), L_{i+1})\right\}$ \;
+ }
+ {%
+ $b_1 \leftarrow \FitBSpline(\vect{q}(\alpha_i), \theta(\vect{q}(\alpha_i)), \vect{W}^l(\alpha_i), \vect{r}(v_i), \theta(v_i))$ \;
+ $b_2 \leftarrow \FitBSpline(\vect{r}(v_i), \theta(v_i), \vect{W}^r(\alpha_{i+1}), \vect{q}(\alpha_{i+1}), \theta(\vect{q}(\alpha_{i+1})))$ \;
+ Discretize $b_1$ and append the points to $M$ \;
+ Discretize $b_2$ and append the points to $M$ \;
+ }
+ }
+ \caption[Laminar shape generation algorithm for multilobed leaves]{Laminar shape generation algorithm for multilobed leaves.}
+ \label{algo:Ch6-ShapeGen}
+\end{SgAlgorithm} \ No newline at end of file
diff --git a/macros/latex/contrib/sphdthesis/example/biblio.bib b/macros/latex/contrib/sphdthesis/example/biblio.bib
new file mode 100644
index 0000000000..b53ed07ae6
--- /dev/null
+++ b/macros/latex/contrib/sphdthesis/example/biblio.bib
@@ -0,0 +1,199 @@
+% -------------------------------------------------------------------------->
+% -------------------------------------------------------------------------->
+% Point base merging papers.
+
+@article{Boiss:Delaunay84,
+ author = {Jean-Daniel Boissonnat},
+ title = {Geometric structures for three-dimensional shape representation},
+ journal = {ACM Transactions on Graphics},
+ volume = {3},
+ year = {1984},
+ pages = {266--286},
+ month = {October},
+ number = {4}
+}
+
+@inproceedings{Hoppe:UnStr92,
+ author = {H. Hoppe and T. DeRose and T. Duchamp and J. McDonald and W. Stuetzle},
+ title = {Surface reconstruction from unorganized points},
+ booktitle = {In Proc. of SIGGRAPH},
+ year = {1992},
+ pages = {71--78}
+}
+
+@article{Boris:UnStr04,
+ author = {B. Mederos and L. Velho and L. Henrique de Figueiredo},
+ title = {Smooth Surface Reconstruction from Noisy Clouds},
+ journal = {Journal of the Brazilian Computing Society},
+ year={2004}
+}
+
+@inproceedings{Kolluri:SSR04,
+ author = {R. Kolluri and J. R. Shewchuk and J. F. O'Brien},
+ title = {Spectral Surface Reconstruction from Noisy Point Clouds},
+ booktitle = {Symposium on Geometry Processing},
+ year = {2004},
+ month = {July},
+ pages = {11--21}
+}
+
+@inproceedings{Curless:VolM96,
+ author = {B. Curless and M. Levoy},
+ title = {A volumetric method for building complex models from range images},
+ booktitle = {Proc. of SIGGRAPH},
+ year = {1996},
+ pages = {303--312}
+}
+
+@article{Hilton:MeshM96,
+ author = {A. Hilton and A. J. Stoddart and J. Illingworth and T. Windeatt},
+ title = {Reliable surface reconstruction from multiple range images},
+ journal = {Proceedings of European Conference on Computer Vision},
+ volume = {1064},
+ year = {1996},
+ pages = {117--126}
+}
+
+@inproceedings{Sato:VolM97,
+ author = {Y. Sato and M. D. Wheeler and K. Ikeuchi},
+ title = {Object shape and reflectance modeling from observation},
+ booktitle = {Proceedings of SIGGRAPH},
+ year = {1997},
+ pages = {379--387}
+}
+
+@inproceedings{Hoppe:VolM97,
+ author = {K. Pulli and T. Duchamp and H. Hoppe and J. A. McDonald and L. G. Shapiro and W. Stuetzle},
+ title = {Robust Meshes from Multiple Range Maps},
+ booktitle = {Proceedings of 3DIM},
+ year = {1997},
+ pages = {205--212}
+}
+
+@article{Hilton:VolM00,
+ author = {A. Hilton and J. Illingworth},
+ title = {Geometric fusion for a hand-held 3D sensor},
+ journal = {Machine Vision and Applications},
+ volume = {12},
+ year = {2000},
+ pages = {44--51},
+ number = {1}
+}
+
+@article{Masuda:VolM02,
+ author = {T. Masuda},
+ title = {Registration and integration of multiple range images by matching signed distance fields for object shape modeling},
+ journal = {Computer Vision and Image Understanding},
+ volume = {87},
+ year = {2002},
+ pages = {51--65},
+ number = {1-3}
+}
+
+@inproceedings{Sun:VolM02,
+ author = {Y. Sun and D. L. Page and J. K. Paik and A. K. and M. A. Abidi},
+ title = {Triangle Mesh-Based Surface Modeling Using Adaptive Smoothing and Implicit Surface Texture Integration},
+ booktitle = {Proceedings of 3DPVT},
+ year = {2002},
+ pages = {588--599}
+}
+
+@inproceedings{Sun:VolM03,
+ author = {Y. Sun and J. Paik and A. Koschan and M. Abidi},
+ title = {Surface modeling using multi-view range and color images},
+ booktitle = {Integrated Computer-Aided Engineering},
+ year = {2003},
+ pages = {37--50},
+ volume = {10:1},
+}
+
+@inproceedings{Claes:VolM05,
+ author = {P. Claes and D. Vandermeulen and L. Van Gool and P. Suetens},
+ title = {Partial Surface Integration Based on Variational Implicit Functions and Surfaces for 3D Model Building},
+ booktitle = {Proceedings of 3DIM},
+ year = {2005},
+ pages = {31--38}
+}
+
+@inproceedings{Soucy:MeshM92,
+ author = {M. Soucy and D. Laurendeau},
+ title = {Multi-resolution surface modeling from multiple range views},
+ booktitle = {Proceedings of Computer Vision and Pattern Recognition},
+ year = {1992},
+ pages = {348--353}
+}
+
+@inproceedings{Rutishauser:MeshM94,
+ author = {M. Rutishauser and M. Stricker and M. Trobina},
+ title = {Merging Range Images of Arbitrarily Shaped Objects},
+ booktitle = {Proceedings of Computer Vision and Pattern Recognition},
+ year = {1994},
+ pages = {573--580}
+}
+
+@inproceedings{Turk:MeshM94,
+ author = {Greg Turk and Marc Levoy},
+ title = {Zippered polygon meshes from range images},
+ booktitle = {Proceedings of SIGGRAPH},
+ year = {1994},
+ pages = {311--318}
+}
+
+@article{Soucy:MeshM95,
+ author = {M. Soucy and D. Laurendeau},
+ title = {A General Surface Approach to the Integration of a Set of Range Views},
+ journal = {IEEE Trans. on PAMI},
+ volume = {17},
+ year = {1995},
+ pages = {344--358},
+ number = {4}
+}
+
+@inproceedings{Pito:MeshM96,
+ author = {R. Pito},
+ title = {Mesh integration based on co-measurements},
+ booktitle = {Proceedings on Image Processing, Special Session on Range Image Analysis.},
+ year = {1996},
+ pages = {397--400},
+ volume = {2}
+}
+
+@inproceedings{Sappa:MeshM00,
+ author = {A. D. Sappa and M. A. Garc\'{\i}a},
+ title = {Incremental Multiview Integration of Range Images.},
+ booktitle = {Proceedings of ICPR},
+ year = {2000},
+ pages = {1546--1549}
+}
+
+@inproceedings{Sun:MeshM00,
+ author = {Y. Sun and C. Dumont and M. Abidi},
+ title = {Mesh-based Integration of Range and Color Images},
+ booktitle = {AeroSense: Aerospace/Defense Sensing and Controls, Sensor Fusion: Architectures, Algorithms, and Applications},
+ year = {2000},
+ pages = {24--28}
+}
+
+@inproceedings{Zhou:MeshM06,
+ author = {H. Zhou and Y. Lio and L. Li},
+ title = {Incremental Mesh-Based Integration of Registered Range Images: Robust to Registration Error and Scanning Noise},
+ booktitle = {Asian Conference on Computer Vision},
+ year = {2006},
+ pages = {958--968}
+}
+
+@inproceedings{Cline:MCubes87,
+ author = {William E. Lorensen and Harvey E. Cline},
+ title = {Marching cubes: A high resolution 3D surface construction algorithm},
+ booktitle = {Proceedings of SIGGRAPH},
+ year = {1987},
+ pages = {163--169}
+}
+
+@inproceedings{Gagnon94:registration,
+ author = {H. Gagnon and M. Soucy and R. Bergevin and D. Laurendeau},
+ title = {Registration of Multiple Range views for Automatic 3D Model Building},
+ booktitle = {Proceedings of Computer Vision and Pattern Recognition},
+ year = {1994},
+ pages = {581--586}
+}
diff --git a/macros/latex/contrib/sphdthesis/example/border.pdf b/macros/latex/contrib/sphdthesis/example/border.pdf
new file mode 100644
index 0000000000..802782e5ef
--- /dev/null
+++ b/macros/latex/contrib/sphdthesis/example/border.pdf
Binary files differ
diff --git a/macros/latex/contrib/sphdthesis/example/chapter1.tex b/macros/latex/contrib/sphdthesis/example/chapter1.tex
new file mode 100644
index 0000000000..cb291b1f3e
--- /dev/null
+++ b/macros/latex/contrib/sphdthesis/example/chapter1.tex
@@ -0,0 +1,11 @@
+\chapter{Introduction}
+Automatic 3D reconstruction of real objects plays an important role in many applications such as animation, virtual reality, and gaming. A widely used approach to reconstruct an object is by using a 3D laser range scanner. Since range scanners have limited field of view, acquisition of 3D geometry of an object requires taking several scans from different viewpoints. The main difficulty with this method is to combine these scans into a unique surface representing the object. This typically involves two steps. First, all the scans must be transformed into the same coordinate system by a process known as surface registration. Second, the registered scans must be integrated into a single model by a process known as surface integration. In this paper we focus on surface integration, assuming the scans have been acquired and registered in a common coordinate system.
+
+\section{First section}
+Existing surface integration methods for range images can be classified into two categories: volume-based and mesh-based. Volume-based methods \cite{Claes:VolM05,Curless:VolM96,Masuda:VolM02,Hoppe:VolM97,Sato:VolM97,Sun:VolM03} convert range images into an intermediate volumetric representation using a signed distance function and extract the final surface using a polygonizing algorithm. These methods can handle objects of arbitrary topology and are considered to be robust with respect to scanning noise, outliers and registration errors. The choice of appropriate voxel size is important for these methods \cite{Claes:VolM05,Curless:VolM96}. If the voxel size is too large, then features smaller than the voxel size are missed and opposite surfaces of a narrow region will be merged. If the voxel size is too small, then in the presence of scanning noise or registration errors, corresponding surfaces will be reconstructed as separate surfaces. It still remains unanswered as to what extent the signed distance function computed on the discretized space is sensitive to the presence of noisy data. It is also not clear how to choose an appropriate voxel size when the input range images have both small features and registration errors. \\
+
+Mesh-based methods \cite{Pito:MeshM96,Rutishauser:MeshM94,Sappa:MeshM00,Soucy:MeshM92,Soucy:MeshM95,Sun:MeshM00,Turk:MeshM94,Zhou:MeshM06} directly integrate range images into a single mesh. These methods do not need an intermediate representation. Hence, they are faster and require less memory compared to volumetric methods. In addition, they are more amenable to data reduction during processing which makes them more feasible for use with very large meshes. Existing methods are, however, sensitive to scanning errors and do not work well on objects with large surface curvature \cite{Curless:VolM96}.
+
+\input{figure}
+\input{table}
+\input{algorithm} \ No newline at end of file
diff --git a/macros/latex/contrib/sphdthesis/example/figure.tex b/macros/latex/contrib/sphdthesis/example/figure.tex
new file mode 100644
index 0000000000..d8667a1b34
--- /dev/null
+++ b/macros/latex/contrib/sphdthesis/example/figure.tex
@@ -0,0 +1,6 @@
+\begin{figure}[t]
+ \centering
+ \includegraphics[width=5in]{border}
+ \caption[Boundary edges]{Boundary edges.}
+ \label{fig:Ch1-border}
+\end{figure} \ No newline at end of file
diff --git a/macros/latex/contrib/sphdthesis/example/table.tex b/macros/latex/contrib/sphdthesis/example/table.tex
new file mode 100644
index 0000000000..88ab7fd2c6
--- /dev/null
+++ b/macros/latex/contrib/sphdthesis/example/table.tex
@@ -0,0 +1,16 @@
+\begin{table}[t]
+\caption{Statistics for the time taken to merge various models}
+\label{table:Ch1-Stats}
+\centering
+\begin{tabular}{lcccc}
+ \toprule
+ \textbf{Model} & \textbf{Num. Scans} & \textbf{Input Triangles} & \textbf{Output Triangles} & \textbf{Time Taken (secs)} \\
+ \midrule
+ Drill & 14 & 102284 & 19152 & 159 \\
+ Hello Kitty & 9 & 83627 & 27856 & 237 \\
+ Warrior & 10 & 133927 & 34613 & 315 \\
+ Doll & 9 & 146080 & 54022 & 479 \\
+ Mug & 6 & 114347 & 68129 & 613 \\
+ \bottomrule
+\end{tabular}
+\end{table} \ No newline at end of file
diff --git a/macros/latex/contrib/sphdthesis/example/thesis.pdf b/macros/latex/contrib/sphdthesis/example/thesis.pdf
new file mode 100644
index 0000000000..f7af92a4b0
--- /dev/null
+++ b/macros/latex/contrib/sphdthesis/example/thesis.pdf
Binary files differ
diff --git a/macros/latex/contrib/sphdthesis/example/thesis.tex b/macros/latex/contrib/sphdthesis/example/thesis.tex
new file mode 100644
index 0000000000..59427f9620
--- /dev/null
+++ b/macros/latex/contrib/sphdthesis/example/thesis.tex
@@ -0,0 +1,29 @@
+
+\documentclass{SPhdThesis}
+
+% PDF and title properties.
+\SgSetTitle{A Robust Mesh-based Surface Integration Algorithm}
+\SgSetAuthor{Saurabh Garg}
+\SgSetAuthorDegrees{List your previous degrees here}
+\SgSetYear{2013}
+\SgSetDegree{Doctor of Philosophy}
+\SgSetDepartment{Department of Computer Science}
+\SgSetUniversity{National University of Singapore}
+\SgSetDeclarationDate{June 2013}
+
+% The document.
+\begin{document}
+ \begin{frontmatter}
+ \SgAddTitle%
+ \SgAddDeclaration%
+ \input{acknowledgments}%
+ \input{abstract}%
+ \SgAddToc% Table of contents.
+ \SgAddLof% List of figures.
+ \SgAddLot% List of tables.
+ \SgAddLoa% List of algorithms.
+ \end{frontmatter}
+
+ \input{chapter1}
+ \SgIncludeBib{biblio}
+\end{document} \ No newline at end of file