%% jules-verne.sty 
%%   Rather than crud up the main root file with a lot of boilerplate,
%%   it's good latex style to separate that stuff out into a separate
%%   custom 'style' for your document.  Since the bells-and-whistles
%%   example is MUCH to complicated to put all the cruft in the preamble,
%%   I've pulled it into this style
%%
%%   Feel free to make a copy (renaming it to, oh, johnthesis.sty, or 
%%   something), and customize.  Don't forget to change the 
%%   'PackageProvides' line, below.  If you feel the need to modify 
%%   something in gatech-thesis.cls, DON'T.  Instead, copy the 
%%   relevant function  as a whole into your new 'johnthesis.sty', 
%%   and make the changes there.
%%
%% REQUIRES: gatech-thesis class file
%%           hyperref, graphicx, color, subfigure, fontenc
%%           helvet, mathptmx, courier, caption2, latexsym, 
%%           textcomp, amsmath, amsfonts, amssymb, listings,
%%           ifthen, thumbpdf
%% OPTIONS:
%%  'official': the default when gatech-thesis called in 'final' mode
%%  'unofficial': the default when gatech-thesis called in 'draft' mode
%%     Since drafts are never official, the 'official' option has no effect 
%%     in 'draft' mode.  However, in 'final' mode, you can create either 
%%     official copies or unofficial copies (of course, 'official'
%%     is the default).  If for some silly reason, you specify both official and
%%     unofficial, unofficial takes precedence (but (a) no warning is produced,
%%     and (b) why would you do that?)
%%     Currently, these two options affect the settings of 'strictmargins' and
%%     'signaturepage'.
%%  'printcode': always print listings, even in draft mode
%%
\NeedsTeXFormat{LaTeX2e}[1995/06/01]
\ProvidesPackage{jules-verne}
          [2002/08/08  Custom settings for a thesis]
%%%%%          here:  http://www.atscire.de/products/listings/   
%%%%%          Also, see http://www.lyx.org/help/listings/listings.php3 

%% define these here so they can be used both in the document setup, 
%% and hyperref setup.
\newcommand{\docauthor}{Frodo Baggins}
\newcommand{\doctitle}{\texorpdfstring%
{20,000 Leagues Under the Sea \\ by Jules Verne}% include formatting here
{20,000 Leagues Under the Sea by Jules Verne}}%   but not here
\newcommand{\dockeywords}{nemo, submarine, science fiction}
     
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Initial setup and options 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newif\ifhyper
\hyperfalse         % initially false by default
\newif\if@official
\if@draft           % This is an internal gatech-thesis variable!
  \@officialfalse   % false in draft mode
\else
  \@officialtrue    % true by default otherwise
\fi
\newif\if@printcode
\if@draft           % This is an internal gatech-thesis variable!
  \@printcodefalse  % false in draft mode by default
\else
  \@printcodetrue   % always true in 'final' mode
\fi
\newif\ifpdf
\pdffalse           % initially false by default

\ifx\pdfoutput\undefined
  \pdffalse         % we are not running PDFLaTeX
\else
  \pdfoutput=1      % we are running PDFLaTeX
  \pdftrue
\fi

\if@hyperref    % This is an internal gatech-thesis variable!
  \hypertrue
\else
  \hyperfalse
\fi  

\DeclareOption{official}{%
  \if@draft     % This is an internal gatech-thesis variable!
    \PackageWarn{option `official' specified, but draft mode.}
    \PackageWarn{Honoring `draft', resetting `official' to FALSE.}
    \@officialfalse
  \else
    \@officialtrue
  \fi
}
% but we need some way to turn it off in 'final' mode 
% (for "unofficial" final copies)
\DeclareOption{unofficial}{%
  \@officialfalse
}
\DeclareOption{printcode}{%
  \@printcodetrue
}
\ProcessOptions

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Load packages
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifpdf
  \PassOptionsToPackage{pdftex,final}{graphicx}
  \PassOptionsToPackage{pdftex,usenames}{color}
  \PassOptionsToPackage{pdftex,backref}{hyperref}
  \pdfcompresslevel=9
\else
  \PassOptionsToPackage{dvips,final}{graphicx}
  \PassOptionsToPackage{dvips,usenames}{color}
  \PassOptionsToPackage{dvips,backref}{hyperref}
\fi%
\PassOptionsToPackage{bf}{subfigure}
\PassOptionsToPackage{T1}{fontenc}
\PassOptionsToPackage{scaled=0.92}{helvet}% helvetica at 11 points
% looks too big when paired with other fonts at 11 points.  This way,
% if the \normalsize is 11pts, then helvetica will be printed at
% 11 * 0.92 pts.

% Setup for using (PostScript) Times fonts for \rmfamily and math, 
% (PostScript) helvetica fonts for \sffamily, and (PostScript) courier
% for \ttfamily.  It is okay to eliminate all of this and simply use
% the Computer Modern fonts that are the default for TeX; even though
% the OGS Guidelines do not mention Computer Modern, they have accepted
% theses written using that font.  Also, note that PostScript versions 
% of Computer Modern fonts are available -- and are installed and used
% by default by MikTeX(PC) and TeXshop(Mac).
%
%   You may have read that the 'times.sty' does all of this; it
% redefines the \rmfamily, the \sffamily, AND the \ttfamily, all at once,
% eliminating the need for three separate commands.  True -- but it
% handles the MATH portion very badly.  You're better off with the 
% mathptmx package, and the extra two commands.
%
%   Your only other alternative (for good Postscript-based Math fonts
% from Tex) is to use the Palatino fonts (but don't use the mathpple 
% or palatino packages to load them. Instead use `mathpazo' + `helvet' 
% + `courier'.)  Unfortunately, Palatino is not an approved font for 
% Georgia Tech theses.
%
% The choices are fairly limited in PostScript fonts with TeX, because
% most freely available PostScript fonts do not include all of the Math
% characters needed for good TeX typesetting.  If you don't have any
% math in your thesis, experiment with other fonts (within the bounds
% specified by the OGS Guidelines for theses, of course) -- but good Math
% support in alternate fonts usually costs $$$.  See MicroPress font
% foundry's website, or the Y&Y font foundry's website.
%
% The mathptmx (mathpazo) package uses Times (Palatino) for normal text,
% and creates a virtual font for math symbols, taking symbols from
% Times (palatino), Computer Modern (Euler), and rsfs (rsfs) postscript
% fonts.  Additionally, the mathpazo package comes with some additional
% "mathpazo" fonts of its own...
%
% Another alternative for Times, is to use the free Belleek postscript 
% fonts for math.  To do this you install the "mathtime" package -- which
% provides support for the $$$ MathTime fonts but not the fonts themselves.
% You then install the Belleek fonts -- and *hand-edit* the .fd files from
% the mathtime package so that they point to the Belleek fonts (blex,
% blsy, and rblmi) instead of the "real" MathTime fonts (mtex, mtsy, and rmtmi)
% (see Richard Kinch's paper: http://www.truetex.com/belleek.pdf: but print
% it out, it looks horrible onscreen).  Unfortunately, this procedure is not
% well defined.  You best bet is to download the belleek-extra.zip archive
%  (http://www.neuro.gatech.edu/users/cwilson/gatech-thesis/)
% and follow the instructions in the internal README.  That gives decent
% .ps and .pdf output, but the .dvi preview doesn't seem to work properly.
% 
% For more info on fonts, math, and postscript, see...
% http://www.ibiblio.org/pub/packages/TeX/macros/latex/required/psnfss/psnfss2e.pdf
% http://www.lyx.org/help/mathstuff/mathmode.php#mathfont`
% http://www.csit.fsu.edu/support/tex/doc/fontinst/talks/et99-font-tutorial.pdf
\RequirePackage{fontenc}
% We need this for other symbols that aren't available in Times
\RequirePackage{textcomp}
% But, since not all of the textcomp commands have actual symbols
% attached to them, load some replacements from the symbol and
% dingbats fonts
\RequirePackage{textcompsym}
\RequirePackage{mathptmx}
\RequirePackage{helvet}
\RequirePackage{courier}

% Defines the \includegraphics command, which is the normal
% LaTeX2e mechanism for incorporating figures. Don't mess around
% with epsfig or other (older, LaTeX 2.09) hacks.
\RequirePackage{graphicx}
% Yes, the OGS allows colored figures in official theses.  However,
% this package is used for changing the color of text (which is 
% a Bad Thing in official copies), and for drawing colored lines
% if you happen to use the `picture' environment for some simple
% figures.  It is used in jules-verne(bellswhistles) to enable
% colored hyperlinks in .pdf output, and the \markup commands.
\RequirePackage{color}

% caption2 docs say 'ignore subfig docs; load caption2 first'
% This package allows us to manipute that figure and title caption
% format.  Don't use it except for personal copies; the default
% caption format is the approved one.  Note that to duplicate the
% captioning style defined by gatech-thesis.cls, you must call
% caption2 with the options below (which causes the 'Figure X:' 
% part of the caption to be typeset bold, san serif).
%\RequirePackage[bf,sf]{caption2}

% subfigure allows us to create a single figure environment 
% that \includegraphics{} more than one external ``figure''.
\RequirePackage{subfigure}[1995/03/06]

% define some symbols that aren't available in the normal
% fonts (Computer Modern, Times, ...)
\RequirePackage{latexsym}
% And better math support from the American Mathematical Society
\RequirePackage{amsmath} % environments
\RequirePackage{amsfonts}% fonts (Blackboard bold, italic capital greek
\RequirePackage{amssymb} % other missing symbols

% A package for including program listings in your document
\RequirePackage{listings}
% Needs the {lstpatch.sty}[2002/08/06 1.0g (Carsten Heinz)] or newer
%  available here:  http://www.atscire.de/products/listings/   
%  Also, see http://www.lyx.org/help/listings/listings.php3 

\RequirePackage{ifthen}% used by "inputXfile{}" macros for listing sourcecode.

% thumbpdf helps in adding .png thumbnails to a pdf document.
% These load much quicker than the ones generated automatically by
% Acroreader5.0 -- and Acroreader4.0 could ONLY display .png thumbnails.
% It requires additional, external programs, including perl and ghostscript
\ifpdf% It IS okay to load "thumbpdf" after "hyperref", but...
  \RequirePackage{thumbpdf}
\fi

% When using hyperref, we use the \AtEndOfPackage command to make sure
% it is loaded last -- unless you include other packages after this
% one within your preamble.  We also set the hyperref options depending on
% whether we're using pdflatex or latex.
\ifhyper% only load hyperref if it is specified in the documentclass options
  \AtEndOfPackage{%
    \RequirePackage{hyperref}
    \ifpdf% hyperref must be last package loaded
      \hypersetup{%
        plainpages=true,
        %bookmarks=true,% default, not necessary to specify
        %breaklinks=true,% default in pdf mode
        bookmarksopen=true,
        bookmarksopenlevel=1,
        bookmarksnumbered=true,
        pdftitle={\doctitle},
        pdfauthor={\textcopyright\ \docauthor},
        pdfsubject={Dissertation},
        pdfkeywords={\dockeywords},
        pdfcreator={\LaTeX\ with package \flqq hyperref\frqq},
        pdfproducer={pdfTeX-0.\the\pdftexversion\pdftexrevision},
        pdfpagemode={UseOutlines},
        hypertexnames=false,%not ideal, but needed when pagenums duplicate (`i' vs. `1')
        pageanchor=true,
        colorlinks=true,
        linkcolor={blue},
        citecolor={green},
        urlcolor={red},
        pagecolor={cyan},
        anchorcolor={black}
      }
    \else
      \hypersetup{%
        plainpages=true,
        breaklinks=true,% not default in dvips mode, so we must specify
        hypertexnames=false,%not ideal, but needed when pagenums duplicate (`i' vs. `1')
        pageanchor=true,
        colorlinks=true,
        linkcolor={blue},
        citecolor={green},
        urlcolor={red},
        pagecolor={cyan},
        anchorcolor={black}
      }
    \fi
  }
\fi

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Set up graphics
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% shouldn't be necessary, but we want to prefer .pdf figs
% over .png when doing pdftex.  Default is opposite.
\ifpdf%
  \DeclareGraphicsExtensions{.pdf,.png,.jpg,.mps,.gif}%
\else%
  \DeclareGraphicsExtensions{.eps}%
\fi

% if your figures are all in a subdirectory, do this and you
% won't have to specify the subdir in the \includegraphics{}
% command:
%
\graphicspath{{fig/}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Useful macros
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\figref}[1]{Figure~\ref{#1}}
\newcommand{\secref}[1]{Section~\ref{#1}}
\newcommand{\chpref}[1]{Chapter~\ref{#1}}
\newcommand{\appref}[1]{Appendix~\ref{#1}}
\newcommand{\eqnref}[1]{Eq.~(\ref{#1})}
\newcommand{\markup}[1]{\textcolor{Blue}{#1}}
\newcommand{\attention}[1]{\textcolor{Red}{#1}}
\newcommand{\goodgap}{%
  \hspace{\subfigtopskip}%
  \hspace{\subfigbottomskip}%
}
%\newcommand\degrees[1]{\ensuremath{#1^\circ}}
\newcommand\degrees[1]{#1\textdegree}
\newcommand\matlab{\textrm{\textsc{Matlab}}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Code Listings
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  As follows:
% \inputmatlabfile[captionpos=b,caption={[mymacro.m]{mymacro.m caption  
% text.}},label={lst:mymacro.m}]{code/mymacro.m}

\if@printcode
  \lstdefinestyle{base}{print=true,breaklines,prebreak=\textdownarrow,
  postbreak=\llap{\rlap{\textrightarrow}\kern\lst@breakcurrindent}}
\else
  \lstdefinestyle{base}{print=false,breaklines,prebreak=\textdownarrow,
  postbreak=\llap{\rlap{\textrightarrow}\kern\lst@breakcurrindent}}
\fi  
\lstdefinestyle{numbers}{style=base,numbers=left,stepnumber=5,%
  numberstyle=\tiny,numbersep=10pt,numberfirstline,numberblanklines,%
  xleftmargin=22pt}% 20pt indent should be sufficient to insure that
  % the linenumbers remain completely inside the "real" margins, even
  % if the linenumbers grow to four digits...
\lstdefinestyle{full}{columns=fixed,fontadjust=true,%
  showspaces=false,showtabs=true,tab=\rightarrowfill,%
  basicstyle=\rmfamily,commentstyle=\scriptsize,
  frame=lines,style=numbers}%
\lstdefinestyle{matlabfull}{language=matlab,style=full}
\lstdefinestyle{cfull}{language={[ANSI]C},style=full}
\lstdefinestyle{cxxfull}{language={[GNU]C++},style=full}

%%
% \inputcodefile[args]{style}{filename}
%    where args = other arguments for \lstinputlisting
%          style = defined style to use for \lstinputlisting}
%                  e.g. {matlabfull} or {cfull}
\newcommand{\inputcodefile}[3][none]{%
  \begin{singlespaced}
    \par\vskip\parskip\vskip\baselineskip
    \ifthenelse{\equal{#1}{none}}
      {\lstinputlisting[style=#2]{#3}}
      {\lstinputlisting[style=#2,#1]{#3}}
    \par\vskip\parskip\vskip\baselineskip
  \end{singlespaced}
}
%%
% \inputmatlabfile[args]{filename}
%    where args = other arguments for \lstinputlisting
\newcommand{\inputmatlabfile}[2][none]{%
  \ifthenelse{\equal{#1}{none}}
    {\inputcodefile{matlabfull}{#2}}
    {\inputcodefile[#1]{matlabfull}{#2}}
}
%%
% \inputcfile[args]{filename}
%    where args = other arguments for \lstinputlisting
\newcommand{\inputcfile}[2][none]{%
  \ifthenelse{\equal{#1}{none}}
    {\inputcodefile{cfull}{#2}}
    {\inputcodefile[#1]{cfull}{#2}}
}
%%
% \inputcxxfile[args]{filename}
%    where args = other arguments for \lstinputlisting
\newcommand{\inputcxxfile}[2][none]{%
  \ifthenelse{\equal{#1}{none}}
    {\inputcodefile{cxxfull}{#2}}
    {\inputcodefile[#1]{cxxfull}{#2}}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Settings for gatech-thesis class
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\if@official
\else
  % for unofficial copies, I like the running headers
  % and pagenums at upper corners.   Footers are for
  % footnotes, dadgumit.
  \setfrontpagestyle{tcplain}
  \setbodypagestyle{gtthesis}
  \setbackpagestyle{gtthesis}
  \pagestyle{gtthesis}
  % Nice monospace font WITH a true bold version
  %   ftp://ftp.dante.de/tex-archive/fonts/LuxiMono/
  % but follow the instructions to install...
  % \usepackage[scaled]{luximono}
\fi
\degree{Doctor of Philosophy}%
\department{School of Electrical and Computer Engineering}%
\title{\doctitle}
\author{\docauthor}%
\principaladvisor{Elrond Halfelven}
\committeechair{Gandalf Ol\'orin}
\firstreader{Samwise Gamgee}
\secondreader{Peregrin Took}
\thirdreader{Meriadoc Brandybuck}
\submitdate{August 2002}%
\copyrightyear{2002}%add one if thesis submitted in Dec.

\copyrighttrue               % NOT default
\if@official
\else
  \strictmarginsfalse        % NOT default
  \signaturepagefalse        % NOT default
\fi

% \thesisproposalfalse       % default
% \titlepagetrue             % default
% \signaturepagetrue         % default
% \copyrightfalse            % default
% \figurespagetrue           % default
% \tablespagetrue            % default
% \contentspagetrue          % default
% \dedicationheadingfalse    % default
% \multivolumefalse          % default
% \bibpagetrue               % default
% \strictmarginstrue         % default  (needed for official copies, but looks bad)
\multivolumetrue

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Miscellaneous special settings
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\bibfiles{jules-verne-bib}

% to teach latex how to hyphenate strange words, include them here:
%\hyphenation{neuro-science photo-receptors parvo-cellular}

\setchaptertocdepth{2}
\setcounter{page}{1}
\special{papersize=8.5in,11in}

%%%%%%
% listings.sty customizations
%%%%%%
\lstset{MoreSelectCharTable=%
  \lst@ReplaceInput{>}{\hspace{0.2em}\lst@ProcessOther{\hspace{-0.2em}>}}%
  \lst@ReplaceInput{<}{\hspace{0.2em}\lst@ProcessOther{\hspace{-0.2em}<}}%
}
\lstset{escapeinside={/*@}{@*/}}
% inside a listing, you can do this 'int x;  /*@\label{x-lbl}@*/'
% and then \ref{x-lbl}

\renewcommand{\lstlistingname}{Program}%                    default is Listing
\renewcommand{\lstlistlistingname}{List of Programs}%       default is Listings
\renewcommand{\thelstlisting}{\@arabic\c@lstlisting}%       captionstyle
\@removefromreset{lstlisting}{chapter}

%%%%% Here's how to add an additional "List of..." page to the 
%%%%% frontmatter.  (Don't do this, the Georgia Tech OGS is 
%%%%% very specific about what can and cannot go there)
%%%%% Also, it doesn't work if you use the hyperref package...
%%% First, create the command that will do the work -- adding it
%%% to the TOC, setting up the hyperref bookmarks, dealing with
%%% twoside printing, etc.
%\newcommand{\do@listingspage}{%
%  \if@openright\cleardoublepage\else\clearpage\fi%
%  % must clear page here, so that phantomsection\addcontentsline is on the correct page
%  \phantomsection%
%  \addcontentsline{toc}{chapter}{\MakeUppercase{\lstlistlistingname}}
%  \settoheight{\gt@tmpa}{A}
%  \set@gttocskip{\gt@tmpa}
%  {\newlinestretch{1}
%   \lstlistoflistings
%  }%
%  \newpage
%}
%%% Then, fix up the lstlistoflistings command (the "real" one is a 
%%% true piece of work....
%\renewcommand\lstlistoflistings{%
%  \if@twocolumn
%    \@restonecoltrue\onecolumn
%  \else
%    \@restonecolfalse
%  \fi
%  \chapter*{\lstlistlistingname}%
%  \@mkboth{\MakeUppercase\lstlistlistingname}%
%          {\MakeUppercase\lstlistlistingname}%
%  \@starttoc{lol}%
%  \if@restonecol\twocolumn\fi
%}
%%% Finally, override the \contents command in gatech-thesis.cls
%%% (just copy it and add your \do@X function):
%\renewcommand{\contents}{%
%  \newpage
%  \newlinestretch{\@spacing}
%  \do@contentspage
%  \do@tablespage
%  \do@figurespage
%  \do@losapage  
%  \do@glossarypage
%  \ifhyper
%    \NoHyper
%    \do@listingspage
%    \endNoHyper
%  \else
%    \do@listingspage
%  \fi
%}


