<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">\documentclass{article}
\usepackage{fullpage, palatino, xcolor, hyperref, graphicx}
\hypersetup{colorlinks}
\author{Andrew Myers}
\title{A tiny example of {\LaTeX} (and \TeX)}
\date{November 30, 2015}
\begin{document}
\maketitle

\section{Introduction}

This is a small document that demonstrates a few features of \LaTeX. You can build it by typing the command \verb|pdflatex example.tex|.

{\LaTeX} was developed by Leslie Lamport but is actually a program written on top of the {\TeX} system created by Donald Knuth.
{\TeX} is very powerful and {\LaTeX} inherits its power.

\LaTeX has many useful built-in \emph{macros}. For example, we can
make words \textbf{bold} or {\LARGE large} using the \verb|\textbf|
and \verb|\LARGE| macros. We can even create
{\color{red} colored} text with the help of the \texttt{xcolor} package.
We can also include figures using the \texttt{graphicx} package, or draw
them directly using \href{http://www.texample.net/tikz/}{Tikz}.
(Notice that the
\href{https://www.ctan.org/pkg/hyperref?lang=en}{\texttt{hyperref}} package lets us create hyperlinks.)

\begin{figure}
 \begin{center}
  \includegraphics[scale=0.5]{delete-leaf.png}
 \end{center}
 \caption{Deleting a leaf node}
\end{figure}

\section{Macros}

{\TeX} is a programming language! So we can define our own macros. For example, we can define a macro that puts its argument in double quotation marks:

\begin{verbatim}
\newcommand\quoteit[1]{``#1''}
This is \quoteit{a win}.
\end{verbatim}

\newcommand\quoteit[1]{``#1''}

This is \quoteit{a win}.

\newcommand\repeattext[2]{
    \newcounter{i}
    \setcounter{i}{0}
    \newcommand\rpt{
        #2
        \ifnum \value{i} &lt; #1
          \addtocounter{i}{1}
          (\arabic{i})
          \rpt
        \fi
    }
    \rpt
}

\vspace{2em}

We can even define recursive functions and use them to do computation (see \verb|example.tex|):
\repeattext{10}{Why type when you can program instead?}

\end{document}
</pre></body></html>