% Use memoir as a (one-sided) article replacement (try replacing % ``oneside'' with ``twoside'' if you print on both sides) % % If you get rid of the ``article'' argument, each chapter will start on % a new page (like a book). \documentclass[article,oneside]{memoir} % This command sets the level of section divisions that the table of % contents (TOC) keeps track of. In this case, we only show chapters and % sections in the TOC. \settocdepth{section} % Later, we use \setsecnumdepth to define when section numbering turns % off. We turn off all section numbering in the main document, and then % we turn it on for nearly all divisions in the appendix. % Sets up 1 inch margins \setlrmarginsandblock{1in}{*}{*} \setulmarginsandblock{1in}{*}{*} \checkandfixthelayout % Define outside-of-environment captions (like \captionof) \newfixedcaption{\figcaption}{figure} \newfixedcaption{\tabcaption}{table} % 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} % Setup title page (\title defines \thetitle, which can be used later) \title{Introduction to \LaTeX} \author{% {\normalsize ECE~327~--- Tuesday, 8:30~--- T.~Pavlic (instructor)} \andnext \andnext Bench 4:\andnext Sally She \and Henry He \and Joe Schmoe} \date{~\\\today} % Make a copy of the ``companion'' page style to our ``custom'' \copypagestyle{custom}{companion} % % We're not using margin notes, so make header span textwidth \makerunningwidth{custom}{\textwidth} \makeheadrule{custom}{\textwidth}{\normalrulethickness} % % For two-page printing, what you'd see on the left-hand page \makeevenhead{custom} {\normalfont\bfseries\thepage} % Left header (page) {\thetitle} % Center header (title) {\normalfont\bfseries\leftmark} % Right header (chapter) % The header you see on the right-hand page (or all one-sided pages) \makeoddhead{custom} {\normalfont\bfseries\rightmark} % Left header (section) {\thetitle} % Center header (title) {\normalfont\bfseries\thepage} % Right header (page) % To customize the footers, uncomment (for even and odd pages): %\makeevenfoot{custom} % {left footer} % {center footer} % {right footer} %\makeoddfoot{custom} % {left footer} % {center footer} % {right footer} % % Switch to our custom page style \pagestyle{custom} % Title page has empty page style (empty headers and no page number) \aliaspagestyle{title}{empty} % For including graphics (e.g., using \includegraphics{...}) \usepackage{graphicx} % Include mathematics help \usepackage{mathtools, amssymb, amsfonts} % Style equation references to have parentheses around them \usepackage{varioref} \labelformat{equation}{(#1)} % Include hyperref for linking and \autoref support \usepackage[colorlinks,linkcolor=blue]{hyperref} % Even though we're using chapters internally, make the rest of the % world think we're using sections (this is for \autoref) \let\chapterautorefname\sectionautorefname \let\sectionautorefname\subsectionautorefname \let\subsectionautorefname\subsubsectionautorefname \let\subsubsectionautorefname\paragraphautorefname \begin{document} % Make title page and obliterate its effect on page number \maketitle \clearpage % Table of contents, list of figures, etc. are ``front'' matter. % They get roman numeral numbering/etc. \frontmatter % The * after \tableofcontents prevents it from getting an entry in the % TOC \tableofcontents* \listoffigures* \listoftables* \clearpage % Start our main document \mainmatter % Turn off section numbering (part comes before chapter) \setsecnumdepth{part} % Use chapters like sections \chapter{Introduction} This document has some appendices. For example, \autoref{sec:glossary} is a glossary, and \autoref{sec:data} gives some parts, and \autoref{sec:things} has some other things. \chapter{Some Subsections} We can have lower-level sections and subsections and subsubsections and paragraphs\ldots \section{Some Math} Some in-line math might like like $x_0 = 5$, while an unnumbered and displayed equation could look like % % (use an asterisk after equation to get rid of numbering) \begin{equation*} \sin( T ) = \int_0^T \cos(t) dt. \end{equation*} % If we want to refer to an equation later, we better number it, like % % (notice the \label line, which we refer to with \ref or \autoref % later) \begin{equation} \exp(it) \triangleq e^{it} = \cos(t) + i \sin(t) \label{eq:euler} \end{equation} % and % \begin{equation} \Re( e^{it} ) = \cos(t). \label{eq:real_euler} \end{equation} % % (notice how we use \ref and \autoref) Of course, giving both Equations~\ref{eq:euler} and~\ref{eq:real_euler} is silly because \autoref{eq:real_euler} is obvious from \autoref{eq:euler}. \section{Some Figures} I might also want to include figures, like \autoref{fig:myfig}. % See the note in the ``Data'' appendix (below) about the table for % an explanation of the difference between using a {figure} environment % and including a figure this way. \begin{centergroup} % % If you're using PDFLaTeX, the \includegraphics line here looks % for a figure called ``myfigure.png'' or ``myfigure.jpg'' or % ``myfigure.gif'' or ``myfigure.pdf'' in the current directory. % % If you're using LaTeX, the \includegraphics line here looks % for a figure called ``myfigure.eps'' in the current directory. % % The optional [width=0.5\columnwidth] argument specifies that % the figure width should be scaled to half of the width of the % text column. %\includegraphics[width=0.5\columnwidth]{myfigure} % % Because I didn't include any figures with this sample, I'm % going to insert a dummy box with text in it. \fbox{A picture could be here.} % See the note in the ``Data'' appendix (below) about the table for % an explanation of the difference between \figcaption and % \caption. \figcaption{Some figure.} \label{fig:myfig} \end{centergroup} \subsection{More Information} We can refer to \autoref{fig:myfig} from anywhere in the document. In fact, we can still refer to \autoref{eq:euler}, and each of these references is hyperlinked to the appropriate target within the document. \chapter{Conclusions} We put some conclusions here. % Tell LaTeX we are starting our appendices now \appendix % Turn on section numbering for appendix \setsecnumdepth{subsubsection} % If we want, we can tell the TOC to keep track of deeper divisions when % we're in the appendix (uncomment and run (PDF)LaTeX a couple of times % to see the effect). %\settocdepth{paragraph} % Change figure/table/equation numbering to number by chapter % (for example, Equation~(A.1) and Figure~B.5) \numberwithin{figure}{chapter} \numberwithin{table}{chapter} \numberwithin{equation}{chapter} \clearpage \chapter{Glossary} \label{sec:glossary} \begin{description} \item[operational amplifier] differential amplifier with practically infinite gain, which makes it fodder for feedback applications \item[impedance] the frequency-dependent relationship between the voltage and current on a one-port electronic device \end{description} \clearpage \chapter{Data} \label{sec:data} Check out \autoref{tab:data}. % NOTE: Most LaTeX references will use a table environment % (i.e., \begin{table}...\end{table}) and a \caption command to % do the same thing. The {table} and {figure} environments are % ``floats'' which means that they will not stay where you put % them. If you pass them the optional [ht!] argument, they'll TRY % to stay where you put them. % % (NOTE: To turn on ``centering'' within table (or figure) % environments, use the command \centering right after the % \begin{table} (or \begin{figure}).) % % At first, this ``floating'' behavior may seem counter-intuitive, % and so I show an alternative. Instead of using a table % environment, I use a ``center'' environment, which centers the % tabular content. I then have to add a caption. Because I'm not % in a table environment, I have to tell LaTeX what kind of % caption to use. So I use the \tabcaption command % (which is defined above using a memoir macro). I could do % something similar with figures. % % If you're not using memoir and want a \tabcaption-like feature, % include the caption package and use \captionof{table}{CAPTION} % and \captionof{figure}{CAPTION} to replace \tabcaption{CAPTION} % and \figcaption{CAPTION} respectively. \begin{centergroup} % The {ccc} argument gives three centered columns \begin{tabular}{ccc} % % memoir absorbs some of the features of the booktabs package, % which includes \toprule, \midrule, \bottomrule, and \cmidrule % \cmidrule lets me place lines that span a range of columns % (rather than all of them) and lets me trim one or both sides % of the line to add some separation. % \toprule Frequency & Gain & Phase Shift\\ \cmidrule(r){1-1} \cmidrule(rl){2-2} \cmidrule(l){3-3} 5 Hz & 5 & $-10^{\circ}$\\ 15 Hz & 5 & $-15^{\circ}$\\ 1 kHz & 0.5 & $-90^{\circ}$\\ \bottomrule \end{tabular} \tabcaption{Some data} \label{tab:data} \end{centergroup} Notice how \autoref{tab:data} has a number that includes the appendix. When we turn on numbering this way, the numbers reset to 1 each time we enter a new appendix. \section{Section in Appendix} Of course, we can divide up each appendix as well. \subsection{And more} We can have deeper divisions too. \clearpage \chapter{Other Things} \label{sec:things} We might find extra equations here, like % \begin{equation} x_0 = \frac{ -b + \sqrt{b^2 - 4ac} }{ 2 a } \quad \text{and} \quad x_1 = \frac{ -b - \sqrt{b^2 - 4ac} }{ 2 a }. \end{equation} \end{document}