%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Annotated example of a homework submission in LaTeX %% %% (note: LaTeX comments begin with a %) %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Build this document with %% %% pdflatex annotated_homework_example.tex %% %% or %% %% latex annotated_homework_example.tex %% dvips annotated_homework_example.dvi %% ps2pdf annotated_homework_example.ps %% %% The result will be annotated_homework_example.pdf. %% %% IMPORTANT NOTE: Because this sample 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). %% %% Optional arguments to LaTeX macros come in square brackets. In this %% case, [10pt] tells the article class that we want 10 point font. \documentclass[10pt]{article} %% The default margins for article may seem large to you. They are %% designed to look pleasant on a page. To use 1 inch margins instead, %% call the geometry package with this line: \usepackage[margin=1in]{geometry} %% The enumitem package provides nicer list support to LaTeX. \usepackage[shortlabels]{enumitem} %% This setcounter line makes it so that \section commands do not have %% numbers printed in front of them. Delete this line ENTIRELY *OR* %% change the 0 to 1 or higher to make it so that \section commands %% automatically get numbered. %% %% If you do increase the 0 to a positive integer or remove this line %% entirely, later you can use \section* to get a single unnumbered %% section. \setcounter{secnumdepth}{0} % The graphicx package lets us include images with \includegraphics \usepackage{graphicx} % The caption package lets us customize captions when we want to make % formal figures and tables \usepackage{caption} %% Here, we use the fancyhdr and lastpage packages to customize the %% header and footer of each page \usepackage{fancyhdr, lastpage} \pagestyle{fancy} \fancyhf{} % %% Put your name and homework identification here \lhead{Joe Schmoe} \chead{ECE~758~--- Thursday, 8:30~--- K.~Passino (instructor)/T.~Pavlic (grader)} \rhead{Pre-lab 0} % \cfoot{Page \thepage{} of \protect\pageref*{LastPage}} %% These next two lines are only used if you are going to cross %% reference equations in your submissions. They can probably be removed %% for 481 submissions. \usepackage{varioref} \labelformat{equation}{(#1)} % The hyperref package automatically links cross references to their % targets and does LOTS more. In our case, we include it so that we can % use \autoref. \autoref lets us do \autoref{eq:one} rather than % Equation~\ref{eq:one}. % % We use the colorlinks option here, which colors hyperlinks rather % than putting boxes around them. We then use the linkcolor option to % make them blue rather than the default red. We could have used % [pdfborder={0 0 0}] instead, which would leave the links uncolored, % but it would remove the boxes. % % \usepackage{hyperref} must almost always be LAST \usepackage in % preamble. Otherwise, you may get strange compilation errors! \usepackage[colorlinks,linkcolor=blue]{hyperref} %%%%%%%%%%%%%%%%%%%%%%%% 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} % This is a note about running LaTeX twice. It's centered, 3/4 the width % of the printed type block, and it has a box around it. You can remove % it. \centerline{\fbox{\parbox{0.75\columnwidth}{\textbf{SPECIAL NOTE:} If you notice a few ``\textbf{??}'' in funny places in your document (e.g., the footer may say ``\textbf{Page 1 of ??}''), then run \LaTeX{} again. That information was not available in the first pass, but it will be filled in properly in the second pass.}}} % Creates a section header with ``Manually Numbered Answers'' in it \section{Manually Numbered Answers} % Creates a list \begin{itemize} % Pass optional items in square brackets to each \item macro. % Those optional items get displayed as the label for that item. \item[2.1.] Here is my answer to question~2.1 of the text of the book. This question has sub-parts, and so I use another list to answer them. % % An enumerate list will automatically count each item % for you. Pass it the type of label you want (e.g., 1. % or a) or i) or ...). See below for another example. \begin{enumerate}[a)] \item Answer to first sub-part. \item Answer to second sub-part requires an image.\\ % % An \includegraphics line can take an % optional parameter [width=...] which % specifies the width of the included % image. You can give an absolute % dimension (like 5in) or you can say % you want it to be half of the text % width with 0.5\columnwidth. % %\centerline{\includegraphics[width=0.5\columnwidth]{figurename}} \centerline{\fbox{Normally, I would do \textbackslash\texttt{includegraphics}\{\texttt{figurename}\} here.}} \end{enumerate} \item[2.7.] Here is my answer to question~2.7. It also has sub-parts, but for some reason they're given with roman numerals, and so I'll use lowercase roman numerals here too. % % Here's another example. This time we use lowercase % roman numeral counting. \begin{enumerate}[i)] \item Answer to first sub-part. \item Answer to second sub-part. \end{enumerate} \end{itemize} % Creates a section header with ``Automatically Numbered Answers'' in it \section{Automatically Numbered Answers} % Use an enumerate environment so that items get numbered automatically % % (note that you can still override numbering for an item by passing an % optional argument, just like what was done above for itemize. Items % with optional arguments do not affect the numbering of the next items; % they're inserted in the middle of the numbered list.) \begin{enumerate} \item This question asks me to list things, and so I give an unnumbered/unlettered list. % % Itemize gives us unnumbered lists. Without an optional % argument, each item displays a symbol corresponding to % how deep the current list is. \begin{itemize} \item First item in the list. \item Second item in the list. \item Third item in the list. \end{itemize} \item This question requires me to list a mathematical equation, which I can refer to as \autoref{eq:trigcalc}. % % Math is very nice to typeset in LaTeX. \begin{equation} \frac{\sin(2\pi T)}{2\pi} = \int_0^T \cos(2\pi t) dt \label{eq:trigcalc} \end{equation} % Using an \texttt{equation*} environment instead of an \texttt{equation} environment gets rid of the equation numbering. Math can also be listed in-line, like $x = 5$. \end{enumerate} % Creates a section header with ``Question 5'' in it \section{Question 5} Or you could just give each answer its own section. % Remember how secnumdepth was set to 0 above? We can set it to 1 (or % higher) to restore numbering of sections. \setcounter{secnumdepth}{1} % Creates a NUMBERED section header with ``Automatically Numbered % Sections'' in it. \section{Automatically Numbered Sections} If you get rid of the \texttt{secnumdepth} line in the preamble (or set it to a positive number), your \textbackslash\texttt{section} commands automatically get numbered. % Another NUMBERED section header. \section{Another Numbered Section} So that's another option. % By using \section*, we get a behavior similar to when we set % secnumdepth to 0 \section*{Removing Numbers} Even when \texttt{secnumdepth} is left to its default positive value, using \textbackslash\texttt{section*} instead of \textbackslash\texttt{section} will remove numbering for that section. % End the main document content \end{document} %%%%%%%%%%%%%%%%%%%%%%%%%%%%% END DOCUMENT %%%%%%%%%%%%%%%%%%%%%%%%%%%%%