-
Notifications
You must be signed in to change notification settings - Fork 0
/
Guide to LaTeX.tex
521 lines (413 loc) · 22.7 KB
/
Guide to LaTeX.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
\documentclass[11pt]{article}
\usepackage{amsmath,amsfonts, booktabs, centernot, textcomp,amssymb,geometry,graphicx,verbatim,enumerate, bbm}
\usepackage[colorlinks=true, linktoc=all, linkcolor=black, urlcolor=blue]{hyperref}
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
\usepackage{algorithm} % Boxes/formatting around algorithms
\usepackage[noend]{algpseudocode} % Algorithms
\usepackage{fancyhdr}
\setlength{\headheight}{15.2pt}
\pagestyle{fancy}
\setlength\parindent{0pt}
\newcounter{sectionnum}
\def\Name{Leah Dickstein} % Your name
\def\Homework{n}% Homework number
\def\Session{Spring 2015}
\title{Guide to \LaTeX}
\author{\Name}
\lhead{Guide to \LaTeX: Section \thesectionnum}
\rhead{\Name}
\begin{document}
\maketitle
\textbf{Significant contributions from}: Justin Commins\\
\textbf{Note}: Make sure you have LaTeX and a good TeX editor!\\
Desktop:\\
Install TeX first. Installation instructions \href{http://www.howtotex.com/howto/}{\textbf{here}}
\begin{itemize}
\item \href{http://www.xm1math.net/texmaker/}{\textbf{TexMaker}} (what I personally use)
\item \href{http://www.lyx.org/}{\textbf{LyX}} (a WYSIWYG, meaning it's basically Word for LaTeX. Lower learning curve, but I think it's slower in the long run because the whole point is NOT using your mouse.)
\end{itemize}
Browser:
\begin{itemize}
\item \href{https://www.sharelatex.com/}{\textbf{ShareLaTeX}} (comes with a ton of templates and allows multiple people working on the same doc!)
\item \href{https://www.overleaf.com/}{\textbf{Overleaf}} (compiles real-time, but is slower)\\
\end{itemize}
\textbf{Note 2:} Don't pronounce it Latex like the plastic. It's either Law-Tech or Lay-Tech. I prefer the former.\\
\textbf{Note 3}: I can't find the fucking symbol! How do I represent this? \href{http://detexify.kirelabs.org/classify.html}{\textbf{Detexify}} is your best bet.
\tableofcontents
\section{Getting Started}
\setcounter{sectionnum}{1}
We've already provided you with HW solution templates and self-grade templates, which should allow you to skip past this section. If you're starting from scratch, you start your blank document with:
\begin{verbatim}
\documentclass[11pt]{article}
\begin{document}
Body of text.
\end{document}
\end{verbatim}
Anything between \verb+\documentclass+ and \verb+\begin{document}+ is called the \textbf{Preamble} of the article, and anything below is the \textbf{Body}. Anything below \verb+\end{document}+ won't be compiled, so you can put temporary text or text that contains compile errors for storage.\\
Alright, it's time to begin: with a title! In the preamble, put:
\begin{verbatim}
\title{Guide to LaTeX}
\author{Your Name Here!}
\end{verbatim}
LaTeX will automatically put the date it was last compiled. Now you're good to go, and you can just start typing. However, throwing a bunch of text on a page is pretty hard to read...two things:\\
1) LaTeX ignores whitespace. Start newlines with either \verb+\\+ or \verb+\newline+. Start new pages with \verb+\newpage+.\\
2) Give your document more structure with sections! LaTeX has quite a few options:
\part*{An Example Part}
The command: \verb+\part{An Example Part}+\\
\section*{An Example Section}
The command: \verb+\section{An Example Section}+\\
\subsection*{You can have subsections}
The command: \verb+\subsection{You can have subsections}+\\
\subsubsection*{And subsubsections!}
The command: \verb+\subsubsection{And subsubsections!}+\\
That's the smallest you can go :( This isn't inception.\\
LaTeX auto-numbers everything, but if you don't want the numbering just add an asterisk. \verb+\section{Unicorns!}+ $>>$ \verb+\section*{and Rainbows!}+. As you'll see later, stuff that's not auto-numbered doesn't get added to the Table of Contents. You can add those headers manually.\\ You can leave the curly braces blank and just have the number, e.g. \verb+\section{•}+ \\
\textcolor{magenta}{\textbf{For the purposes of your homework}}, ignore parts and chapters. Just use sections.
\setcounter{section}{1}
\section{Environments}
\setcounter{sectionnum}{2}
\subsection{Text Alignment}
\begin{center} This is \verb+\begin{center}\end{center}+\end{center}
\begin{flushleft} This is \verb+\begin{flushleft}\end{flushleft}+\end{flushleft}
\begin{flushright} This is \verb+\begin{flushright}\end{flushright}+\end{flushright}
\begin{raggedright} This is \verb+\begin{raggedright}\end{raggedright}+\end{raggedright}
\subsection{Lists}
Two environments are most common: \textbf{itemize} and \textbf{enumerate}. Itemize = bullet points, Enumerate = numbered lists.\\
\textbf{Example}:
\begin{verbatim}
\begin{itemize}
\item a
\item b
\item \begin{itemize}
\item c1
\item c2
\item \begin{enumerate}
\item c3i
\item c3ii
\end{enumerate}
\end{itemize}
\end{itemize}
\end{verbatim}
\textbf{Output}:
\begin{itemize}
\item a
\item b
\item \begin{itemize}
\item LaTeX notices that you're indenting
\item and changes the bullet
\item \begin{enumerate}
\item Note the change
\item from itemize to enumerate!
\end{enumerate}
\end{itemize}
\end{itemize}
\textbf{Notes}:
\begin{enumerate}
\item[1)] You can newline within the same bullet point, but don't end a bulletpoint with a newline. Just use \verb+\item+
\item[2)] Max depth of nested lists: 4
\item[3)] If you want to change the formatting of the number (like in this example), you can manually do so using brackets $>>$ \verb+\item[3)]+
\item[4)] You can do a lot more, especially if you want to change from arabic numbers to something else or change the bullet points, but it gets fairly complicated. Read more \href{http://en.wikibooks.org/wiki/LaTeX/List_Structures}{\textbf{here}}.
\end{enumerate}
\subsection{Math}
Inline math can be done with \verb+$n$+. Some characters or control sequences can only be displayed as math. Here's a sum $\sum_{k=0}^n 2^k$. This looks like\\
\verb+Here's a sum $\sum_{k=0}^n 2^k$.+
\verb+\displaymath+, however, looks like, and will take it's own line regarless of placement. It has its own formatting too. \verb+\[ \sum_{k=0}^n 2^k \]+ \[\sum_{k=0}^n 2^k\]
\textbf{Note}: \verb+$$...$$+ works as well instead of \verb+\[ ... \]+, although it is recommended against. It breaks the formatting of a (relatively obscure) command called \verb+\fleqno+.\\
\verb+\left( math-stuff \right)+ can be useful too. This controls the sizes of your brackets. It tends to work better in it's own line, so \verb+\[ ... \]+ is the way to go. Here it is in action.\[\left(a+\left(b+\left(\frac{c}{d}\right)\right)\right) \]
\begin{center}vs\end{center}
\[(a+(b+(\frac{c}{d})))\]
Sometimes you want to have normal text in the middle of your math equation. Just typing text removes all the spaces! Use \verb+\text{}+.\\
Spacing is really important, because math mode often squishes stuff together too much. I recommend memorizing these for ease of use:\\
\begin{center}
\begin{tabular}{c|c}
\verb+\,+ & Small space\\
\verb+\:+ & Medium space\\
\verb+\;+ & Large space\\
\verb+\quad+ & Really large space
\end{tabular}
\end{center}
\subsubsection{Align}
Equations look nice when they're lined up.
\begin{verbatim}
\begin{align}
x &= 2 + 3 * 4^2\\
&= 2 + 3 * 16\\
&= 2 + 48\\
&= 50
\end{align}
\end{verbatim}
\begin{align}
x &= 2 + 3 * 4^2\\
&= 2 + 3 * 16\\
&= 2 + 48\\
&= 50
\end{align}
The default numbers all equations on the right side. To remove numbering of equations, just add a star \verb+\begin{align}+ $>>$ \verb+\begin{align*}+.\\
This example only used one \verb+&+, but you can have multiple columns (that align left) using \verb+&&+, \verb+&&&+, etc. The formatting can get a bit weird, so \textcolor{magenta}{for your homework} you will most often use one \verb+&+.
%ADD HOW TO PUT EQUATION NUMBERS ON LEFT
\subsection{Tables}
To make a table, use \verb+\begin{tabular}{}+ The second argument is your list of columns, and what format the have. For example, \verb+\begin{tabular}{lcr}{\end{tabular}+ gives left- center- and right- justified columns. You don't need the second argument in matrices.
\begin{verbatim}
\begin{tabular}{ll|l}
11 & 12 & 13 \\
21 & 22 & 23
\end{tabular}
$\begin{bmatrix}
11 & 12 & 13 \\
21 & 22 & 23
\end{bmatrix}$
\end{verbatim}
\begin{minipage}{0.5\textwidth}
\begin{center}
\begin{tabular}{ll|l}
11 & 12 & 13 \\
21 & 22 & 23
\end{tabular}\end{center}
\end{minipage}
\begin{minipage}{0.5\textwidth}
\begin{center}$ \begin{bmatrix}
11 & 12 & 13 \\
21 & 22 & 23
\end{bmatrix} $\end{center}
\end{minipage}\\
\textbf{Notes:}
\begin{enumerate}
\item I add a vertical line in the tabular argument e.g. ccc $>>$ cc|c
\item Add a horizontal line using \verb+\hline+
\item We used bmatrix instead of just matrix. There IS a matrix environment \verb+\begin{matrix}+, but bmatrix auto-includes the bracket.
\end{enumerate}
\subsection{Verbatim}
If you want to escape everything, use either \begin{verbatim}\verb+ some-code-or-commands +\end{verbatim}\\
or\\
\verb+ \begin{verbatim} \end{verbatim} +\\
Similar to math mode, the short way shows it inline, and using \verb+\begin{}+ creates a differently formatted environment.
\subsection{Figure}
\section{More Formatting Magic}
\setcounter{sectionnum}{3}
\subsection{Foonotes}
Footnotes are super easy, but important enough to get its own section. Directly behind the text, put \verb+\footnote{text}+ and LaTeX will take care of putting it at the bottom, numbering, etc. To specify numbering, use \verb+\footnote[number]{text}+.
\subsection{Include Graphics}
\textcolor{magenta}{***EXTREMELY IMPORTANT***}\\
When your classes ask you to make a figure, make it in powerpoint and take a screenshot. Then throw the image into your LaTeX.\\
Add to the preamble \verb+\usepackage{graphicx}+.
\begin{verbatim}
\includegraphics[width=0.5\textwidth]{image_name}
\end{verbatim}
1) Don't put the file extension like .jpeg or .png, just the image name. LaTeX will search the home directory for the name. \textit{If you have a space in the file name (WHY??) then you need to put the extension.}\\
2) If you use Texmaker, it will autocomplete to \verb+\includegraphics[scale=•]{•}+ but I prefer using \verb+width=\textwidth+. You get a better sense of how it fills the page.\\
3) If you want to include pdf pages, add the package \verb+\usepackage{pdfpages}+ to the preamble. The command is \verb+\includepdf[pages={1,3,5}]{myfile.pdf}+. For the whole document or a range use a hyphen: \verb+\includepdf[pages={-}]{myfile.pdf}+.\\
Documentation \href{http://en.wikibooks.org/wiki/LaTeX/Importing_Graphics}{\textbf{here}}. You can do more fancy stuff like adding borders to your images, rotate, crop, etc.
\subsection{Table of Contents}
Add \verb+\tableofcontents+ where you want your Table of Contents to be printed. All auto-numbered sections are added automatically.\\
There's also \verb+\listoffigures+ and \verb+\listoftables+. Most of the commands below also apply; just replace \verb+toc+ with \verb+lof+ or \verb+lot+.\\
You can add stuff manually with the command: \begin{verbatim}
\addcontentsline{toc}{subsection}{Extra Special Stuff}\end{verbatim} This adds "Extra Special Stuff" (in the appropriate spot) with depth "subsection".\\
The default depth shows all sections, subsections, and subsubsections. To change the depth of the ToC, add to the preamble (remember that's the part above \verb+\begin{document}+) the command: \verb+\setcounter{tocdepth}{2}+. This would remove subsubsections. If you changed the 2 to 4, the ToC would include paragraphs, etc.\\
\textbf{Note}: You have to compile LaTeX twice for your ToC changes to show up. The first time you compile the ToC records changes you've made, and the second time it displays the changes.\\
Documentation \href{http://en.wikibooks.org/wiki/LaTeX/Document_Structure#Table_of_contents}{\textbf{here}}.
\subsection{Margins}
In the preamble, use the geometry package: \verb+\usepackage[margin=1in]{geometry}+.\\
You can also change the margins halfway through the document. On the page you want to change, add \verb+{\newgeometry{left=0.8in,right=0.8in,top=1in,bottom=1in}+, and if you want to go back just type \verb+\restoregeometry+.
\subsection{Minipage}
Sometimes you want to have multiple columns, or to split your page up into sections. You want to put two pictures or tables next to each other that would otherwise be hard to do. Enter the minipage command! If I want to have two columns, I would just\\
\begin{minipage}{0.5\textwidth}
use the command
\end{minipage}
\begin{minipage}{0.5\textwidth}
\begin{verbatim}
\begin{minipage}{0.5\textwidth}
text here!
\end{minipage}
\end{verbatim}
\end{minipage}\newline\\
In this case, \verb+\textwidth+ is the width of the page from margin to margin, and I'm just dividing it in two. If I wanted four columns, I would use \verb+0.25\textwidth+ between the curly braces. You can also have fixed widths, although I find them less useful.\\
You can also modify the vertical orientation of the text. By modifying the command \verb+\begin{minipage}{width}+ $>>$ \verb+\begin{minipage}[t]{width}+ it's now aligned to the top instead of the default center. You can align bottom with [b].\\
Remember to newline before and after the minipage, as it doesn't have built in newlines.\\
\textbf{Super fancy example}: \verb+\begin{minipage}[t][5cm][b]{0.5\textwidth}+ .\\ This has a defined height of 5cm, aligns to the bottom of the page, and takes up half the page in width.\footnote{http://www.sascha-frank.com/latex-minipage.html}\\
\textbf{Note}: Do NOT nest minipages within each other! It messes up formatting and makes LaTeX sad, especially when it comes to footnotes. Figure out a simpler way to organize your page.
\section{Useful Packages}
\setcounter{sectionnum}{4}
TeX is like coding (it's actually Turing complete!). Everything you need, there's probably a package for it! You do NOT have to have a new \verb+\usepackage{package-name}+ for each package. You can chain them like \verb+\usepackage{package1, package2, package3}+. If a package has features that can be modified, you add brackets in front e.g. \verb+\usepackage{circuitikz}+ $>>$ \verb+\usepackage[american]{circuitikz}+ switches the Circuit package from the default European style to the American style (which is used in EE40.)
\subsection{Links}
Add to the preamble \verb+\usepackage{hyperref}+ \\
Whenever you want to add a link, just use \verb+\href{url-name}{text}+. If you want to add a local file, you can modify the command to \verb+\href{run:/path/to/file.ext}{text}+.\\
This allows you to have anchors within the same document!\\
An anchor is \verb+\hypertarget{label}{target caption}+\\ and a link to an anchor is \verb+\hyperlink{label}{link caption}+. \\
This is what I usually use:
\begin{verbatim}
\usepackage[colorlinks=true, linktoc=all, linkcolor=black, urlcolor=blue]{hyperref}
\end{verbatim}
It colors my links, but the default colors are red for internal links and magenta for URLs. Since I don't like those colors, I change URLs to blue. I want my ToC to look normal, so I change internal link color to black. Finally, I link up my ToC. The added bonus is that you can now see your ToC in Preview! Compile the doc and open it in Preview, then click View-Table of Contents or Alt-Command-3.
\subsection{Colors}
Add to the preamble \verb+\usepackage{color}+ to gain access to the default 8 colors. Alternatively, you can write \verb+\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}+, which will give you access to a BAJILLION colors. Table of colors can be found \href{http://en.wikibooks.org/wiki/LaTeX/Colors}{\textbf{here}}.\\
\textbf{Default colors}: white, black, red, green, blue, cyan, magenta, yellow.\\
Two ways to add color to text:
\begin{itemize}
\item \verb+\textcolor{declared-color}{text}+ is the simplest and what I use most often. It is inline, which means you can \textbf{not} have newlines within the text.
\item \verb+{\color{declared-color} some text}+ will work even if you are coloring more than one paragraph.
\end{itemize}
Fancy stuff:
\begin{itemize}
\item \verb+\pagecolor{delcared-color}+
\item \verb+\colorbox{yellow}{Hi!}+ $>>$ \colorbox{yellow}{Hi!}
\item \verb+\fcolorbox{Fuchsia}{Apricot}{Hello world}+ $>>$ \fcolorbox{Fuchsia}{Apricot}{Hello world} \\ Different colored frame. Note that I had to capitalize these colors, because that's how they're defined in dvips.
\end{itemize}
\subsection{Fancy Header}
How do you get that header that shows up on every page, you ask? Add this to the preamble:
\begin{verbatim}
\usepackage{fancyhdr}
\setlength{\headheight}{15.2pt}
\pagestyle{fancy}
\lhead{Guide to LaTeX: Section \thesectionnum}
\chead{}
\rhead{\Name}
\lfoot{}
\cfoot{}
\rfoot{}
\end{verbatim}
This is the code for this particular document. Fancyhdr is the package for the header, and there are three columns where I can place text in both the header and the footer. You can see I've also defined variables (covered below) so that the section number updates based on which page I'm on.\\
\href{http://en.wikibooks.org/wiki/LaTeX/Page_Layout#Customizing_with_fancyhdr}{\textbf{Here's}} a short documentation, and \href{http://get-software.net/macros/latex/contrib/fancyhdr/fancyhdr.pdf}{\textbf{here's}} a much longer pdf written by the original writer of the package.
\subsection{Algorithms}
The following was taken from \href{https://piazza.com/class/i3qmjjk51u62ib?cid=91}{\textbf{Jimmy Wu's Piazza post}} (thanks Jimmy! You're an awesome TA!)
\begin{verbatim}
\usepackage{algorithm} % Boxes/formatting around algorithms
\usepackage[noend]{algpseudocode} % Algorithms
\begin{algorithm}
\begin{algorithmic}[1]
\Statex
\Function{Align-To-Profile}{$M$, $X$, $p$}
\For{$i \gets 1 \ldots m$}
\State $V(i,0) \gets \sum_{k=1}^i S(-,i)$
\EndFor
\For{$j \gets 1 \ldots n$}
\State $V(0,j) \gets \sum_{l=1}^j K\sigma(x_l,-)$
\EndFor
\Statex
\For{$i \gets 1 \ldots m$}
\For{$j \gets 1 \ldots n$}
\State $V(i,j) \gets \max
\begin{cases}
V(i,j-1) + K\sigma(x_j,-) \\
V(i-1,j) + S(-,i) \\
V(i-1,j-1) + S(x_j,i)
\end{cases}$
\EndFor
\EndFor
\State \Return alignment for $X$ by backtracking from $V(m,n)$ Needleman-Wunsch
\EndFunction
\end{algorithmic}
\end{algorithm}
\end{verbatim}
%\begin{algorithm}
% \begin{algorithmic}[1]
% \Statex
% \Function{Align-To-Profile}{$M$, $X$, $p$}
% \For{$i \gets 1 \ldots m$}
% \State $V(i,0) \gets \sum_{k=1}^i S(-,i)$
% \EndFor
% \For{$j \gets 1 \ldots n$}
% \State $V(0,j) \gets \sum_{l=1}^j K\sigma(x_l,-)$
% \EndFor
%
% \Statex
% \For{$i \gets 1 \ldots m$}
% \For{$j \gets 1 \ldots n$}
% \State $V(i,j) \gets \max
% \begin{cases}
% V(i,j-1) + K\sigma(x_j,-) \\
% V(i-1,j) + S(-,i) \\
% V(i-1,j-1) + S(x_j,i)
% \end{cases}$
% \EndFor
% \EndFor
% \State \Return alignment for $X$ by backtracking from $V(m,n)$ Needleman-Wunsch
% \EndFunction
% \end{algorithmic}
%\end{algorithm}
More commands (such as If statements, etc.) can be found \href{http://en.wikibooks.org/wiki/LaTeX/Algorithms#Typesetting_using_the_algorithmicx_package}{\textbf{here}}.
\subsection{Circuits}
I learned Circuits from \href{http://www.latex-tutorial.com/tutorials/advanced/lesson-12/}{\textbf{this website}}.\\
Circuits is a subset of tikz, which is the default TeX Drawing package. So you need to make sure you have both in the preamble:
\begin{verbatim}
\usepackage{tikz}
\usepackage{circuitikz}
\end{verbatim}
The circuits have built-in shortcuts for resistors, current sources, etc. so you simply...draw. Look at the following example!
\begin{verbatim}
\begin{figure}[h!]
\begin{center}
\begin{circuitikz}
\draw (0,0)
to[V,v=$U_q$] (0,2) % The voltage source
to[short] (2,2)
to[R=$R_1$] (2,0) % The resistor
to[short] (0,0);
\end{circuitikz}
\caption{My first circuit.}
\end{center}
\end{figure}
\end{verbatim}
%This code produces this image:\\
%\begin{center}\includegraphics[scale=1]{circuit_1}\end{center}
Here's a more complicated example, from my EE40 HW:
\begin{verbatim}
\begin{circuitikz}
\draw (0,0)
to[R = $16\Omega$] (0,2)
to[short] (2,2)
to[R=$16\Omega$] (2,0)
to[short] (0,0);
\draw (2,2)
to[R=$4\Omega$] (4,2)
to[R=$12\Omega$] (4,0)
to[short] (2,0);
\draw (4, 0)
to[short] (7, 0)
to[I = 10A] (7, 2)
to[short] (4, 2);
\draw (7, 2)
to[short] (9,2)
to[R = $6\Omega$] (9, 0)
to[short] (7,0);
\draw (9, 2)
to[R = $4\Omega$] (11, 2)
to[R = $16\Omega$] (11, 0)
to[short] (9, 0);
\draw (11,2)
to[short] (13,2)
to[R = $16\Omega$] (13, 0)
to[short] (11, 0);
\end{circuitikz}
\end{verbatim}
Which produces the following:\\
%\begin{center}
%\includegraphics[width=\textwidth]{circuit_2}
%\end{center}
I recommend working from left to right. I tried starting in the center and drawing to the left, then drawing to the right, and it broke everything. There's a really long manual from the creator of the package \href{http://www.latex-tutorial.com/media/downloads/manuals/circuitikzmanual.tar.gz}{\textbf{here}}.
\subsection{Graphs and FSMs}
Use \href{http://madebyevan.com/fsm/}{\textbf{this GUI}} from Evan Wallace (random guy on the Internet, thanks!). You can then just click "Export LaTeX".
\section{Extra for Experts}
\setcounter{sectionnum}{5}
Like...actual coding.
\subsection{Defining Variables}
If I want to create something like a template, I want to populate a bunch of fields with the same name/value, which changes per person. You can define variables in the preamble:
\begin{verbatim}
\def\Name{Leah Dickstein}
\end{verbatim}
Now, I can use the command \verb+\Name+ whenever I want my name to show up. For example, in my header I have:
\begin{verbatim}
\title{Guide to LaTeX}
\author{\Name}
\lhead{Guide to LaTeX: Section \thesectionnum}
\rhead{\Name}
\end{verbatim}
In the header, you also notice \verb+\thesectionnum+. I created a new counter for the section number, and after each section I update the counter.
\begin{verbatim}
\newcounter{sectionnum}
\setcounter{sectionnum}{2}
\end{verbatim}
Note that when I represent the counter, I add the keyword "the".
\section{Appendices}
\setcounter{sectionnum}{6}
If I have time, I'll fill this in with tables of symbols. But for now, there are extensive resources online with huge tables of common symbols \href{http://estudijas.lu.lv/pluginfile.php/14809/mod_page/content/12/instrukcijas/matematika_moodle/LaTeX_Symbols.pdf}{\textbf{here}} and \href{http://www.artofproblemsolving.com/Wiki/index.php/LaTeX:Symbols}{\textbf{here}}. My recommendation? Download something like TexMaker that allows you to click for symbols, because memorizing is pointless.
\end{document}