# Fancy Stuff

Here are commands that you might find useful (either as they are, or as a model for what your need):
bold italic font
better spacing in eqnarray
change labeling of list items
enumerate copycat
equation labels at left
an environment for proofs
example of Theorem, Lemma, etc. declarations, and choice of fonts
various label formats
appendix sections
how to include in the TOC a section without number
numbers only
page and margin dimensions
matrices and functions
multi-line mathematics
fragile commands and how to protect them (link to a LaTeX guide by NASA), here is the local copy
other stuff
\usepackage{hyperref}
This should be the last \usepackage item (if not the last command in the preamble of your document), so that its settings are not overruled. Often no other change is needed in the file.

Warning: It seems that \documentclass{article} does not work with hyperref; use instead \documentclass{amsart}.

For a manual which describes more features, check   http://www.tug.org/applications/hyperref/manual.html.
A less technical description is in the "The Not So Short Introduction to LaTeX" mentioned in the Internet help section of this chapter.

• produce bold italic font (declarations are cumulative):
\textit{regular and \textbf{bold} italic}
See more in, e.g., the Info page for LaTeX, under Commands/Typefaces. For details about Info, as well as a HTML version of it, see the Online help section.

• the default (large) spacing of eqnarray can be adjusted by changing \arraycolsep, as in this example (copied from the "Not so short introduction to LaTeX", version 4.13):

{\setlength{\arraycolsep}{2pt}
\begin{eqnarray}
a & = & b
\end{eqnarray}
}



• change the way items are numbered in the enumerate environment (can deal with itemize too):
\renewcommand{\labelenumi}{(\alph{enumi})}
If this command is placed in the preamble, then it affects all uses of enumerate.
If it is placed within a \begin{enumerate}...\end{enumerate} block, it is effective only for that particular list.

• define an "enumerate" where the items are numbered in bold-face, and are not preceded by "--" (this is a simple definition, which does not have all the features of \item; it might be used to count statements in a "Remarks" environment):

\newcounter{myenum}
\newenvironment{myenumerate}{\setcounter{myenum}{1}\def\item{\par{\bf
\arabic{myenum}.\ }\stepcounter{myenum}}}{\newline}



• to have the equation numbers on the left use the leqno option (and reqno for equation numbers on the right, but this seems to be the default):
\documentclass[12pt, leqno]{article}

• Define an environment for proofs (note that such an environment is already defined in \documentclass{amsart}):

%             this might be already defined
\newcommand{\qed}{\hfill \mbox{\raggedright \rule{.07in}{.1in}}}

%             this might be already defined
\newenvironment{proof}{\vspace{1ex}\noindent{\bf Proof}\hspace{0.5em}}
{\hfill\qed\vspace{1ex}}

\newenvironment{pfof}[1]{\vspace{1ex}\noindent{\bf Proof of #1}\hspace{0.5em}}
{\hfill\qed\vspace{1ex}}



• Define environments for Theorems, Lemmas etc.;
Use the theorem package to change the fonts used in Definitions etc.

NOTE: \usepackage{theorem} should not be invoked in \documentclass{amsart}; the other commands are unchanged.


\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{theorem}

\sloppy					% makes TeX less fussy about line breaking

\pagestyle{plain}			% use just a plain page number

\numberwithin{equation}{section}	% add the section number to the equation label

\theoremstyle{plain}			% use "default" font

\newtheorem{thm}{Theorem}[section]
\newtheorem*{thm*}{Theorem}             % Theorem without a number
\newtheorem{lemma}[thm]{Lemma}
\newtheorem{prop}[thm]{Proposition}
\newtheorem{cor}[thm]{Corollary}

\theoremstyle{definition}		% use "definition-style" font for the rest

\newtheorem{defn}[thm]{Definition}
\newtheorem{examp}[thm]{Example}
\newtheorem{conj}[thm]{Conjecture}
\newtheorem{rmk}[thm]{Remark}


Note that the meaning of plain and definition in \theoremstyle depends on the \documentclass used. You can be more forcefull by using

{\theorembodyfont{\rmfamily}
\newtheorem{defn}[thm]{Definition}
\newtheorem{examp}[thm]{Example}
\newtheorem{conj}[thm]{Conjecture}
\newtheorem{rmk}[thm]{Remark}}


However, this will cause problems for some \documentclass'es.

• Redefine various labels for equations. etc.

\renewcommand{\theequation}{\thesection.\arabic{equation}}
\renewcommand{\thesection}{\arabic{section}}
\renewcommand{\thesubsection}{\arabic{section}.\arabic{subsection}}
\renewcommand{\thesubsection}{(\alph{subsection})}



• Redefine the heading of appendix sections (at least, for \documentclass{article}).

% begin appendix
\appendix

\newcommand{\appsection}[1]{\let\oldthesection\thesection
\renewcommand{\thesection}{Appendix \oldthesection}
\section{#1}\let\thesection\oldthesection}

% example (otherwise, use just \section)
\appsection{H\"older spaces}



• How to include in the TOC a section without number

    
\section*{Acknowledgement}




• Create a "number", without using the corresponding environment (can be done with other counters too).
\refstepcounter{equation}(\theequation)\label{new-number}
If you have to do this more often, define, e.g., the macro
 \newcommand{\MYitem}{\refstepcounter{equation}\textbf{(\theequation)}} 
and use \label whenever needed.

• Adjust page size and margins (look for "Page Layout" in the Not so short introduction):

\hoffset=-.75in
\textwidth=6.5in
\voffset=-.5in
\textheight=9.0in


or, using a more LaTeX-y format

\setlength{\hoffset}{-.75in}
\setlength{\textwidth}{6.5in}
\setlength{\voffset}{-.5in}
\setlength{\textheight}{9.0in}


Some other parameters that can be set (either with \setlength or \addtolength) are \oddsidemargin, \evensidemargin, \topmargin (the first affects the left margin of odd-numbered pages, the second that of even-numbered pages).

• Create a matrix (can also choose other parantheses, or allign the matrix extries to left or right):
$A= \left( \begin{array}{cc} a & b \\ c & d \end{array} \right)$


The same method can be used to describe a function given by cases (but see below): the opening brace is gotten with \left\{ which is paired with \right. (since there is no closing one).
A better way to do this is with the environment cases:

$G(x)= \begin{cases} 0, & x\le 0\\ \exp\left(-x^{-\alpha}\right), & x > 0 \end{cases}$


• To write more consequtive lines in mathematical mode one can use (all with the \begin \end environment construction): eqnarray, gather, gathered, align, aligned, multline, split, etc.
Some have a *'ed version (so that none of the lines is numbered).
The lines are divided with \\.
Some of these are to be used in math-mode (that is, inside  or ), others directly. It might be necessary to load the ams packages.

Check out also the systeme package: "the package allows you to enter systems of equations or inequalities in an intuitive way, and produces typeset output where the terms and signs are aligned vertically. "

• Other stuff:
• Beamer: use \alt to display one text or another in an overlay:
"The beamer command \alt<*overlay specification*>{foo}{bar} will insert foo if the current slide is within the given overlay specification, and bar otherwise. It is equivalent to \only<*overlay specification*>{foo} \only<*complementary overlay specification*>{bar}."
See this stackexchange posting about (improving) it. Answers: overprint, overlayarea, \phantom, etc.

\setcounter{tocdepth}{1} % Show sections
%\setcounter{tocdepth}{2} % + subsections
%\setcounter{tocdepth}{3} % + subsubsections
%\setcounter{tocdepth}{4} % + paragraphs
%\setcounter{tocdepth}{5} % + subparagraphs

\begin{document}
%...
\tableofcontents
%...
\end{document}

• To have labels/keys displayed, while editing the file; the \newcommand* line is optional
    \newcommand*{\showkeyslabelformat}[1]{\fbox{\normalfont \tiny \ttfamily #1}}
\usepackage{showkeys}

To limit what is displayed, can use something like
    \usepackage[notref,notcite]{showkeys}
