%% Holy Cross Math/CS honors thesis template
%%
%% Version 1.2,  September 01, 2018 
%% Andrew D. Hwang <ahwang -at- holycross -dot- edu>
%%
%% This file contains several useful macros and stylistic suggestions
%% for writing a medium-length scholarly document containing lots of
%% mathematics, such as a department honors thesis. 
%%
%% The primary purpose of expository writing is to convey ideas
%% clearly. LaTeX provides features that simplify the task of writing,
%% and that facilitate creation of flexible, long-lived files. These
%% include:
%% * A plain-text (human- and machine-readable) file format
%% * High-level formating and cross-referencing capabilities
%% * High-quality, easy-to-use mathematical fonts
%%
%% A well-written LaTeX document can be translated into multiple
%% formats, such as HTML, Postscript, or PDF, without loss of quality,
%% for years into the future, using commonly-available software. The
%% same cannot be said of word-processor files, which become obsolete
%% at each software release (often 1-3 years) and are subject to data
%% corruption, which can make a file unreadable.
%%
%% Ideally, a LaTeX file reflects the logical structure of your
%% document; the appearance of the printed version will be handled in
%% software, and can be changed easily. For the most part, you should
%% not think about how the finished product looks while you're
%% writing.
%%
%% LaTeX accomplishes these tasks by acting as a ``markup language'',
%% using mnemonic, human-readable tags to control the document
%% structure. You may add tags of your own, called ``macros'', that
%% are used to represent concepts that recur frequently in your
%% document. For maximum flexibility and consistency, you should
%% create high-level macros early in the writing process and use them
%% assiduously.
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% The ``preamble'' contains commands that determine the appearance of
%% the document, ranging from package inclusion to macro definitions. 
%%
\documentclass[12pt]{article}
\usepackage[leqno]{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}

%% Some graphics inclusion facilities
%% \usepackage{tikz}
%% \usepackage{graphicx} % [sic]

% Specify the size of the text block
\usepackage[body={5.5in,8.8in}]{geometry}

%%%%%%%%%%%%%%%%%%%%%% Item numbering %%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% LaTeX can automatically generate numbers for definitions, theorems,
%% equations, etc. Numbering serves a dual purpose: To allow you (the
%% author) to refer back and forward to parts of your document, and to
%% assist the reader in locating said references. However, the default
%% numbering scheme in LaTeX is for each type of ``environment'' to be
%% numbered separately. Experience reveals that separate numbering is
%% unhelpful to the reader. Instead, it's better to number theorems,
%% definitions, lemmas (``lemmata'' for you Latin sticklers), etc.,
%% consecutively within a section.
%%
%% LaTeX also allows equations and ``floating'' environments (tables
%% and figures) to be numbered. A floating environment will be placed
%% according to criteria depending on page composition, rather than
%% the environment's location in the source file. For this reason,
%% tables and figures should be numbered separately. Equations should
%% be numbered separately as well, since gaps in the sequence of
%% equation numbers are jarring to the reader.
%%
%% The next sets of commands cause LaTeX to number environments
%% according to the criteria above.

%% Make LaTeX number equations, figures, and tables consecutively
%% within a section. Without the first three commands below, the first
%% figure in each section would be ``Figure 1''.
%% 
\renewcommand{\theequation}{\arabic{section}.\arabic{equation}}
\renewcommand{\thefigure}{\arabic{section}.\arabic{figure}}
\renewcommand{\thetable}{\arabic{section}.\arabic{table}}

\numberwithin{equation}{section}
\numberwithin{figure}{section}
\numberwithin{table}{section}

%% Number items consecutively within sections, as in Definition 2.1,
%% Lemma 2.2, Theorem 2.3, Corollary 2.4, Remark 2.5. This numbering
%% scheme makes it easier for the reader to locate an item. 

%% These environments are set in italic type
\newtheorem{theorem}{Theorem}[section]
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{lemma}[theorem]{Lemma}

%% These environments are set in Roman (plain) type
\theoremstyle{remark}
\newtheorem{remark}[theorem]{Remark}

\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{example}[theorem]{Example}

%% Don't number \subsubsections
\renewcommand{\thesubsubsection}{\hskip -1em}
%%%%%%%%%%%%%%%%%%% End of numbering commands%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%% Font declarations %%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% For flexibility, it's best to use two-stage macros: First define a
%% font class for a type of object (e.g., boldface for sets of
%% numbers), then define document macros using the font macro. That
%% way it's easy to decide final notation after the document is
%% written. 
%%
\newcommand{\Number}[1]{\mathbf{#1}}
\newcommand{\Vector}[1]{\mathbf{#1}}
%\newcommand{\Script}[1]{\mathscr{#1}}% Requires the mathrsfs package

%% Document macros (the macros that actually appear in the document)
\newcommand{\C}{\Number{C}}
\newcommand{\N}{\Number{N}}
\newcommand{\R}{\Number{R}}
\newcommand{\Z}{\Number{Z}}
\newcommand{\e}{\Vector{e}}

%%%%%%%%%%%%%%%%%% End of font-specific macros %%%%%%%%%%%%%%%%%%%%%

%% Miscellaneous symbol abbreviations. A macro can accept arguments.
%% For example, \dual{f} typesets f-hat.
%% The \left and \right commands cause delimiters to re-size
%% automatically according to what comes between them.
\newcommand{\abs}[1]{\left\lvert#1\right\rvert}
\newcommand{\norm}[1]{\left\lVert#1\right\rVert}
\newcommand{\del}{\partial}
\newcommand{\dual}[1]{\widehat{#1}}
\newcommand{\eps}{\varepsilon}
%% Angle brackets, for inner products. Use like this: \brak{v}{w}. 
%% Less than/greater than symbols are not suitable; LaTeX treats them
%% as binary relations, giving them too much spacing.
\newcommand{\brak}[2]{\left\langle#1,#2\right\rangle}

%% Text operators, which fine-tune their spacing just like \exp,
%% \log, \cos, etc.
\DeclareMathOperator{\re}{Re}
\DeclareMathOperator{\im}{Im}

%% Miscellaneous formatting/spacing commands
\newcommand{\Neg}{\phantom{-}} % Invisible minus sign, for alignment

%% Ordinarily, lined fractions are set in a small font in a paragraph;
%% integrals, sums, and limits have their sub- and super-scripts
%% placed to avoid uneven line spacing. Sometimes you want displayed
%% math notation in paragraph mode. The next command defines a short,
%% useful alias. Use displaystyle sparingly in paragraph mode; uneven
%% line spacing is considered unprofessional.
%%
\newcommand{\dsp}{\displaystyle}

%% If your title is long, you can use a double backslash, \\, to force
%% a line break. You should generally strive to have all lines of your
%% title about the same length.
\title{My Mathematical Thesis}

%% The ``tie'' character (~) prevents a new line from starting at that
%% point. Ties should be used habitually to prevent logical blocks
%% (sections, theorems, citations and references, etc.) from being
%% separated from their reference numbers. There are other, more
%% subtle places where a line break should not occur. Please consult
%% the TeXBook.
%%
\author{A.~Student}

%% Generate today's date when the document is compiled. You should
%% probably hard-code the date for versioning control.
\date{\today} 

%%%%%%%%%%%%%%%%%%%%%% End of Preamble %%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%% Document starts here %%%%%%%%%%%%%%%%%%%%%%%
\begin{document}

%% Print the title, author, and date in the document
\maketitle

%% Our first ``environment'' is the abstract. An environment is text
%% set off by ``tags'' of the form \begin{envt}, \end{envt}. The
%% appearance of an environment in the final printed document is
%% handled by LaTeX, external packages, and macros in the preamble.
\begin{abstract}
An abstract is a paragraph or few that gives the reader an overview
of the document. Abstracts are commonly found on research articles,
but not necessarily on theses.
\end{abstract}

%% The text of the document starts here. For a formal document, most
%% or all of the text is divided into chapters, sections, etc. These
%% divisions are indicated by tags. A \label command creates a tag
%% that can be used to cross-reference a section, theorem, page,
%% equation, etc. 
%%
%% The actual tag should be chosen for your benefit; easy to remember
%% and type. A tag may contain letters, digits, and some punctuation
%% (e.g., dash, colon). The system used below prefixes each tag with
%% an abbreviation indicating the type of environment being labeled.
%%
\section{Introduction}
\label{section:intro}

This document illustrates some capabilities of the typesetting system
\LaTeX. To a surprisingly large extent, you only need to type the
words; \LaTeX\ handles formatting. \LaTeX\ \emph{commands} are text
strings that follow a backslash, such as \verb+\LaTeX+ (for the
distinctively-typeset logo) or \verb+\emph{}+ (which emphasizes the
text between the braces).  Certain characters are special; to get \#,
\$, \%, or~\& in text, precede them with a backslash.\footnote{In
  \LaTeX, the dollar sign toggles math mode
  (Section~\ref{section:nuts}), while the percent sign is a comment
  character. The pound sign and ampersand have more advanced meanings,
  related to macro parameters and alignment, respectively.}

\subsection{Further Subdivision}
\label{section:Subdiv}

You will probably begin writing your thesis with an outline. When you
type your thesis in \LaTeX, you use sectioning commands to reflect the
logical structure of your document.

A new paragraph is begun by placing a blank line in the input file.
Multiple spaces in a \LaTeX\ file are not significant. \LaTeX\ 
recognizes when a space signifies the end of a sentence, and adjusts
the appearance accordingly. To fine-tune the spacing and appearance of
your document, you should first type the entire file, then tweak if
you must. While you may be accustomed to word processors, whose
primary emphasis is \emph{appearance}, you should try to think in
terms of organization and good writing when using \LaTeX. 

As a beginner, you should avoid worrying about appearance; type design
and page composition are sophisticated enterprises requiring years of
study. Instead, concentrate on the quality and logical structure of
your document: good writing, overall organization, efficient and
flexible use of \LaTeX\ macros, neatly formatted input. Concepts and
notation that appear frequently in your document require carefully
designed macros. Your thesis advisor is a good person to consult about
this issue.

\subsection*{Unnumbered Matter}

Subsection~\ref{section:Subdiv} was started with a \verb+\subsection+
command. An unnumbered subsection is created by appending an asterisk,
as in \verb+\subsection*+. The argument of a (sub)section command is
the title of that portion of text, such as ``Further Subdivision''.

\section{Mathematics}

Most of a typical document is entered in \emph{paragraph mode}. In the
source file, the input is plain text, written in an ordinary text
editor (not a word processor). Mathematics is subject to different
rules of font choice, spacing, and line breaking than ordinary text,
and is placed into special environments.

\subsection{Nuts and Bolts}
%% A sectional unit needn't be labeled, but it's a good habit, since
%% you may need to refer to something down the road.
\label{section:nuts}

Short snippets of mathematics, such as $y = \abs{f(x)}$ or
$\brak{\e_i}{\e_j} = \delta_{ij}$, are placed in a paragraph by
enclosing them with dollar signs. More complicated expressions and
equations, such as fractions, sums, and integrals, are often better
set in a displayed equation:
\[
\int_{\Sigma} K\, dA = 2\pi\chi_{\Sigma},\qquad
K\, dA = -\sqrt{-1}\biggl(\frac{\del\bar{\del} g}{g}
         -\frac{\del g}{g}\wedge \frac{\bar{\del}g}{g}\biggr).
%%  \dual{f}(\omega)=\int_{-\infty}^\infty f(x)e^{2\pi i\omega x}\,dx.
\]
Mathematical typesetting is an art, see \cite{K},~\cite{MG}, and
below. Basic points include proper use of fonts, attention to spacing,
and proper line breaking.  For basic documents, the \LaTeX\ defaults
work well, but as your skill progresses you should pay attention to
the fine points.

Greek letters are obtained by typing their name as a command in math
mode: \verb+$\alpha$+ gives~$\alpha$. Mathematical symbols are
generated similarly in math mode. If you need a non-standard symbol,
please consider carefully whether it would be better to use an English
phrase instead of a symbol. For example, it is strongly preferable to
write out ``for every''~and ``there exists'' instead of relying on
$\forall$~and $\exists$. There are over 2000~symbols available,
see~\cite{symbol}. 

Multi-line displayed equations are best handled with the AMS's
enhancements, see~\cite{AMS}:
\begin{alignat}{2}
  x(t) &=               &&c_1\cos(\sqrt{5}t)+c_2\sin(\sqrt{5}t) \\
  x'(t)&=\sqrt{5}\bigl(-&&c_1\sin(\sqrt{5}t)+c_2\cos(\sqrt{5}t)\bigr)
\end{alignat}
Some alignment capabilities are shown for illustration; don't
fine-tune your typesetting until your thesis nears completion.

Environments for definitions, theorems, etc., are defined in this
file. Section~\ref{section:example} illustrates their use.


\section{Typographical Pro Tips}
\label{section:fine-points}

A typeset page is composed of abstract entities known as \emph{boxes}
(typographical elements) and \emph{glue} (stretchable white space). A
box may itself contain sub-boxes and glue. At the lowest level are
boxes containing one symbol. Knuth's explanations,~\cite{K}, are
definitive and reader-friendly. A few of the most basic points are
included here.

\subsection{Spacing}

In ordinary text, \emph{inter-word space} occurs between adjacent
words and \emph{end-of-sentence space} occurs after the period at the
end of a sentence. The size of a particular inter-word or
end-of-sentence space depends slightly on how much text must fit into
one line, but end-of-sentence space is about twice as large as
inter-word space, and the two look awkward if used in each others
stead.

\LaTeX\ places end-of-sentence space after a non-capital letter
followed by a period followed by white space. ``After an
abbreviation,'' Prof. Calculus explained, ``you must tell
\LaTeX\ explicitly to use inter-word space by putting a
backslash-space immediately after the period.''

``Thus, \verb+Prof. Calculus+ (see above) should be typed
\verb+Prof.\ Calculus+,'' Prof.\ Calculus continued.
\medskip

The converse situation---a sentence ending with a capital letter (and
a period)---is rare, but can occur even if you do not work at NASA. By
default, \LaTeX\ puts inter-word space after a capital letter followed
by a period. To ensure end-of-sentence space, put~\verb+\@+ before the
period, as in \verb+NASA\@.+ One's first impulse, to put two (or more)
spaces in the input file, unfortunately has no effect whatsoever.

\subsection{Line Breaks}

Sometimes you want to prevent \LaTeX\ from breaking the line at a
particular point. For example, this happens before the number in
Section\_3, page\_42, Theorem\_3.1.416, or between A.\_Person's
initial and last name, I.\_M. Typeset's initials, or between a noun
and its mathematical symbol: the function\_$f$, evaluated at\_$x$. (In
each case, the line break subtly interrupts the reader's
concentration.) A ``tie'', the tilde character, gives a non-breaking
space: See \verb+page~42+. Do not leave actual space before or after a
tie.

\subsection{Hyphens and Dashes}

Word-break hyphens needed to justify the right margin are added
automatically by \LaTeX. For ordinary hyphens, use a single hyphen
character~\verb+-+ with no surrounding space.

Two consecutive hyphen characters (with no surrounding space) give an
\emph{en~dash}, punctuation suitable for numerical ranges, see
pp.~42--43. 

Three consecutive hyphen characters (with no surrounding space) give
an \emph{em~dash}, punctuation suitable---you see?---for small asides
and the like.

Four or more consecutive hyphen characters give combinations of dashes
and hyphens, and should never be used.

\subsection{Mathematics}

In mathematics, most spaces in the input are ignored. One em of space
(roughly the width of a lower-case~m) may be obtained with
\verb+\quad+; two ems may be obtained with \verb+\qquad+. Both
commands work in paragraph mode as well as math.

Though mathematical symbols are italicized, math mode is $different$
from text italics, and should not be used as a substitute.

Mathematics sometimes calls for fussy spacing: Compare  $sin x$ and
$\sin x$, or $ydx$ and $y\,dx$. The first issue is avoided by using
only commands for named functions: \verb+\sin+, \verb+\cos+,
\verb+\ln+, and so forth. These commands not only set the name
upright, but they automatically add appropriate spacing between the
function name and the following variable.

For the second spacing issue, sometimes you have to tweak
manually. The command~\verb+\,+ (backslash-comma) gives a thin space;
thus, \verb+$y\, dx$+. (The space character is not needed by \LaTeX,
but makes the input easier for a human to read.)

\subsection{Semantic Coding}

In \LaTeX, you can define your own commands, or \emph{macros}. These
should be fairly easy to type, and used to separate the meaning of
your code from the way it will be typeset.

Notation for the real numbers provides a classic example. Before
\LaTeX, journals used boldface capitals, $\R$, $\C$, $\Z$, etc. After
\LaTeX, ``blackboard bold'' fonts were created: $\mathbb{R}$,
$\mathbb{C}$, $\mathbb{Z}$. Which should you use?

Under no circumstances should you type \verb+\mathbf{R}+ or
\verb+\mathbb{R}+ each time you refer to the real numbers in a
document. Instead, use indirection and abstraction to your benefit. In
your preamble, define macros such as:
\begin{verbatim}
  \newcommand{\Number}[1]{\mathbf{#1}}
  \newcommand{\R}{\Number{R}}
  \newcommand{\C}{\Number{C}} % etc.
\end{verbatim}
In the document body, use only \verb+\R+ to denote the real numbers,
\verb+\C+~for the complex numbers, etc.

Why does this matter? First, the shorter commands save considerable
typing. Second, and more importantly, the two-stage coding separates
the \emph{meaning} or \emph{semantics} (the symbol for numbers) from
the typographical \emph{appearance} or \emph{presentation} (the font
choice). If, after typing your thesis, your advisor insists you use
ordinary boldface, you can convert your sources by making one trivial
change (the definition of the \verb+\Number+ macro) in the preamble.

\section{Further Information}

\LaTeX\ easily handles most typesetting needs of scholarly papers,
including tables, figures, footnotes, cross-referencing, running
headers, bibliographies, tables of contents, and indices. Some of
these features are built into the standard document classes, others
are provided by packages, which are explicitly imported in the
preamble. Output can be converted to a number of printable and
electronically publishable formats, such as Postscript, HTML, or
hyperlinked PDF using widely available tools.

Once you have an idea of the \LaTeX\ basics, you'll learn fastest by
typing a document of your own, see Section~\ref{section:Subdiv}. Links
to further information may be found on the Holy Cross Math/CS Club's
web page, under Mathematical Typesetting:
\begin{verbatim}
    http://math.holycross.edu/~ahwang/math_club/software.html
\end{verbatim}

If you're using OS X or GNU/Linux, you can use \texttt{ePiX} to
put line diagrams into your document. Please see
\begin{verbatim}
    http://math.holycross.edu/~ahwang/current/ePiX.html
\end{verbatim}
for details.

\section{A Short Document}
\label{section:example}

Let $f:\R\to\R$ be a function.

\begin{definition}
  \label{def:diffble}
  We say $f$~is \emph{differentiable} at~$x_0$ if
  \begin{equation}
    \label{eqn:diffble}
  f'(x_0):=\lim_{h\to0}\frac{f(x_0+h)-f(x_0)}{h}
  \end{equation}
  exists. If~$f$ is differentiable at~$x_0$ for every $x_0\in\R$, we say
  $f$~is \emph{differentiable}.
\end{definition}

\begin{theorem}
  Let $f$~be differentiable at~$x_0$. Then $f$~is continuous at~$x_0$.
\end{theorem}

\begin{proof}
  We must show that $f(x_0+h)\to f(x_0)$ as $h\to0$. However, by
  Equation~\eqref{eqn:diffble} and properties of limits, we have
  \[
  \lim_{h\to0} f(x_0+h)-f(x_0)
    =\lim_{h\to0}h\cdot\frac{f(x_0+h)-f(x_0)}{h}
    =0\cdot f'(x_0) = 0.
  \]
  This establishes the theorem.
\end{proof}

\begin{remark}
  \label{rem:discont}
  A function may be differentiable at~$x_0$, yet be discontinuous at~$x$
  for all $x\neq x_0$.
\end{remark}

\begin{thebibliography}{99}
\bibitem{AMS} \emph{User's Guide for the} \texttt{amsmath}
  \emph{Package}, Version~2.0, published by the American Mathematical
  Society. (See the Math/CS Club page, or web search for
  \texttt{amsldoc.pdf})
%%
\bibitem{K} D.~E. Knuth, \emph{The \TeX\ Book}, Addison-Wesley, 1986.
%%
\bibitem{MG} F.~Mittelbach, S.~Goossens, et al., \emph{The
  \LaTeX\ Companion}, Second Edition, Addison-Wesley, 2004.
%%
\bibitem{symbol} Scott Pakin, \emph{The Comprehensive \LaTeX\ Symbol
  List}. (Web search for the title.)
\end{thebibliography}

\end{document}
