%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%           Annotated example of a simple report in LaTeX            %%
%%               (note: LaTeX comments begin with a %)                %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Build this document with
%%
%%   pdflatex annotated_article_example.tex
%%
%% or
%%
%%   latex annotated_article_example.tex
%%   dvips annotated_article_example.dvi
%%   ps2pdf annotated_article_example.ps
%%
%% The result will be annotated_article_example.pdf.
%%
%% IMPORTANT NOTE: Because this report uses cross references, you must
%% build it *TWICE*. LaTeX finds all of the cross reference TARGETS first
%% and then, on the second run, plugs them all in to the appropriate
%% places.
%%
%% (note: any good LaTeX-friendly text editor will have these build
%%  lines built into it)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PREAMBLE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Every LaTeX document starts with a \documentclass line. The
%% document class sets up the most prominent features of the document
%% style (e.g., page styles, font, etc.).
%%
%% Standard document classes include article, book, and report.
%%
%%   *) The article document class is the most commonly used for short
%%      documents. It provides sectioning commands and flexible titling
%%      options.
%%
%%   *) The report document class gives you chapters and puts the title
%%      information centered on a separate unnumbered page.
%%
%%   *) The book document class gives you the ability to make parts and
%%      chapters and is usually used in two-sided printing mode (e.g.,
%%      page numbering alternates from being on the top left to top
%%      right of the page rather than in the bottom center).
%%
%% More advanced document classes include memoir, which is a drop-in
%% replacement for the standard classes that has many other features as
%% well. It folds in a rich feature set from some of the most popular
%% packages (packages are explained below).
\documentclass{article}

%% Typically, after defining the document class, you include packages
%% that have macro definitions that make life easier.


% The standard report margins might be wider than you're used to.
% Their size and proportions are designed to make text look better on a
% page. However, you might want 1in margins. Comment out this line to
% see what the default margins look like.
\usepackage[margin=1in]{geometry}

% The graphicx package gives you the ability to include graphics and
% scale them easily (in fact, you can scale or rotate or resize any part
% of your document).
\usepackage{graphicx}

% The caption package provides lots of captioning customizations. Here,
% we just use it for \captionof, which lets us have figures and tables
% without having to deal with them ``floating.''
\usepackage{caption}

% These math packages give you modern symbols and environments
\usepackage{mathtools, amssymb}

% These commands (provided by mathtools) change figures/tables/equations
% so they are numbered by section (e.g., ``Figure 3.1'') instead of the
% normal way (e.g., ``Figure 8'')
\numberwithin{table}{section}
\numberwithin{figure}{section}
\numberwithin{equation}{section}

% The varioref package can automatically put parentheses around
% equation references.
\usepackage{varioref}
\labelformat{equation}{(#1)}

% The hyperref package is a versatile package. Among other things, it
% automatically hyperlinks cross-references (e.g., it links ``Figure 1''
% to wherever that figure actually is in the document).
% The ``colorlinks'' option can be removed. It colors the hyperlinks.
%
% NOTE: The hyperref package should ALMOST ALWAYS be the *LAST* package
% loaded in your preamble.
\usepackage[colorlinks]{hyperref}

% This new "environment" will cause everything in it to be centered and
% grouped on the same page (good for figures and tables when you don't
% want to use floats but you do want to have captions). You can use it
% with
%
% \begin{centergroup}
%  ...
% \end{centergorup}
\newenvironment{centergroup}{\trivlist\item\begin{minipage}{\columnwidth}\centering}{\end{minipage}\endtrivlist}

%% Here we setup the title page.
%%   *) The \\ commands force line breaks.
%%   *) The \and commands put space between author names.
%%   *) The \normalsize command resets text following it back to normal
%%      size
%%   *) The --- inserts an ``em dash,'' which is the long dash used to
%%      separate thoughts in a sentence. Similarly, a -- inserts an
%%      ``en dash'' to separate numbers in a range (e.g., 5--15), and
%%      a single - inserts a hyphen to separate parts of a hyphenated
%%      word.
%%   *) The \title, \author, and \date macros place text at different
%%      spots on the title page with different default text sizes.
%%
\title{Lab 0: Introduction to \LaTeX\\
       ~\\
       \normalsize
       ECE~209~---
       Tuesday, 4:30~---
       T.~Pavlic (instructor)\\~\\}
\author{Sally She \and Henry He}
\date{Table 4\\~\\~\\\today}

%%%%%%%%%%%%%%%%%%%%%%%% MAIN DOCUMENT CONTENT %%%%%%%%%%%%%%%%%%%%%%%%%

% We surround our main content with a ``document'' ``environment.'' This
% marks the end of our LaTeX setup and the start of our document output.
%
% All ``environments'' are identified by \begin{...} and \end{...}
% macros.
\begin{document}

%% Put the title page here (it will be centered on the page)
\maketitle

%% The report documentclass would automatically moves us to a new page
%% after the title. Because we're using an article, we have to do it
%% ourselves. Here, we also make sure that there is NO page number on
%% the cover page and reset the page numbering so it starts on the
%% actual first page.
%%
%% We can use \newpage or \clearpage to force a new page.
%% *) \newpage creates a new page
%% *) \clearpage creates a new page after making sure all figures and
%%    tables have been anchored and written out
\thispagestyle{empty}           % Removes page number on this page
\clearpage                      % Moves us to next empty page
\setcounter{page}{1}            % Reset page number to 1

%% Optionally, you could put a \tableofcontents or a \listoffigures or a
%% \listoftables here (these are not usually necessary for short
%% articles or reports).
%%
%% Uncomment these lines if you want to see what they look like. Note
%% that you'll have to run LaTeX at least twice to see the full effect
%% (your editor may automatically do this for you).
%\tableofcontents
%\listoffigures
%\listoftables

%% Tell LaTeX to start a new section called ``Introduction''
\section{Introduction}

%% Here, we use the standard \ref command to fill in the appropriate
%% number of the Measurements section (see its label below).
The procedure can be found in section~\ref{sec:proc}. Measurements can
be found in section~\ref{sec:meas} and theory can be found in
section~\ref{sec:thy}.

%% Because we're including the hyperref package, we could use the
%% \autoref command instead.
The procedure can be found in \autoref{sec:proc}. Measurements can be
found in \autoref{sec:meas} and theory can be found in
\autoref{sec:thy}.

%% Tell LaTeX to start a new section called ``Procedure''
%% (here, we add a \label command so we can refer to this section in
%% other parts of the document (like the introduction above))
\section{Procedure}
\label{sec:proc}

A picture of the circuit can be found in \autoref{fig:picture}.

% Normally, most LaTeX references have something like the following:
%
% \begin{figure}\centering
%       % some image here, perhaps an \includegraphics line
%       \caption{Some figure.}
%       \label{fig:picture}
% \end{figure}
%
% OR they add the optional [ht!] argument, like:
%
% \begin{figure}[ht!]\centering
%       % some image here, perhaps an \includegraphics line
%       \caption{Some figure.}
%       \label{fig:picture}
% \end{figure}
%
% Putting something in a ``table'' or a ``figure'' environment makes it
% ``float'' to the best place on the page. There are ways to reduce how
% easily it ``floats'' so that it stays near by. The [ht!] argument is
% one of those ways. It TRIES to make sure the figure stays where you
% initially put it, but you have no guarantee of that.
%
% By using a ``figure'' environment, your \caption command produces a
% ``Figure #.#: '' in front of your caption. You can refer to the figure
% elsewhere in the document by the name given by your \label command.
%
% The \centering makes sure the figure is centered.

% Instead, we are going to ENSURE that our figure stays put. It is NOT
% going to float. We use a {centergroup} environment. However, we
% cannot use the simple \caption command because LaTeX doesn't know what
% KIND of caption (e.g., figure or table) we want. So we have to use the
% \captionof command and pass it ``figure''.
\begin{centergroup}
        % Usually, you will be including some external graphic.
        %
        % If you are using pdflatex to build your document, you can only
        % include PDF, PNG, GIF, or JPG files.
        %
        % If you are using latex to build your document, you can only
        % include EPS files.
        %
        % If you omit the extension (e.g., \usepackage{some_figure}),
        % LaTeX will look for figures with the appropriate extension. So
        % if you have some_figure.jpg and some_figure.eps in the same
        % directory as your document, you'll be able to use either
        % latex.
        %
        % The \includegraphics line below has an optional [width=...]
        % argument added that scales the document so that its width is
        % half the width of the text column. I could have done
        % [width=2in] or [width=5cm] instead. Or I could have left out
        % the [...] part entirely and used the natural width of the
        % image.
        %
        % For now, I'm COMMENTING OUT the includegraphics and putting a
        % dummy box in instead.
        %\includegraphics[width=0.5\columnwidth]{some_figure.png}
        \fbox{A cool graphic would be here. Instead, you get a framed
        box.}
        \captionof{figure}{Some figure.}
        \label{fig:picture}
\end{centergroup}

%% A new ``Measurements'' section with label
\section{Measurements}
\label{sec:meas}

Measurements can be found in \autoref{tab:data}.

% As with the {figure} discussion above, usually you see something like
%
% \begin{table}\centering
%    % some table generation here, usually using a {tabular} environment
% \end{table}
%
% OR, if you don't want the table to ``float'' as MUCH:
%
% \begin{table}[ht!]\centering
%    % some table generation here, usually using a {tabular} environment
% \end{table}
%
% By using a ``table'' environment, your \caption command produces a
% ``Table #.#: '' in front of your caption. You can use refer to the
% table elsewhere in the document by the name given by your \label
% command.
%
% The \centering makes sure the figure is centered.
%
% Again, because floating figures sometimes isn't optimal for lab
% reports/etc., we use an non-floating environment and then the
% \captionof command with ``table'' as the first argument.
\begin{centergroup}
        %
        % The tabular environment takes one required argument. Because
        % it's required, the argument goes in curly braces (instead of
        % square braces). That argument defines the justification of
        % each column. In this case, we want THREE columns that are each
        % CENTERED.
        %
        % *) In the table, each row is ended by a line break (\\)
        % *) An ampersand (&) separates cells in a row
        % *) The \hline macro draws a horizontal rule followed by a line
        %    break
        %
        % If you want vertical rules, replace the {ccc} argument with
        % {|c|c|c|}. That is, put pipes (|) where you want the vertical
        % rules.
        %
        \begin{tabular}{ccc}
                Frequency & Gain & Phase Shift \\
                \hline
                10 Hz & 5 & 0.01 radians\\
                20 Hz & 5 & 0.1 radians\\
                1000 Hz & 2 & 1.5 radians
        \end{tabular}
        \captionof{table}{Some data.}
        \label{tab:data}
\end{centergroup}

%% A new ``Theory'' section with label
\section{Theory}
\label{sec:thy}

% We can typeset equations easily with environments like ``equation''.
% By using ``equation*'', the equation does not get numbered. By using
% ``equation'' and a \label command, the equation gets numbered and we
% can refer to it later.
%
% If we want our math to be in-line, we surround it by single dollar
% signs (like $v = 5$) instead of using an equation environment.
The average power over period $T$
%
\begin{equation*}
        A_v =
        \frac{1}{T}
        \int_0^T
        v(t)^2
        dt,
\end{equation*}
%
and so
%
\begin{equation}
        P_v = 4.
        \label{eq:average_power}
\end{equation}
%
By \autoref{eq:average_power}, $P_v < 10$.

We can do Greek letters too, like $\alpha$, $\beta$, $\gamma$, $\delta$,
$\varepsilon$, and others. For example,
%
\begin{equation*}
        \pi \approx 3.141592653589793\cdots.
\end{equation*}

%% Here, we start a section called ``Acknowledgments.'' Because we used
%% \section* command instead of the \section command, the section does
%% not get numbered.
\section*{Acknowledgments}

Some acknowledgments would go here if necessary.

\end{document}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%% END DOCUMENT %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
