-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlatex.tex
More file actions
2232 lines (1908 loc) · 63.1 KB
/
Copy pathlatex.tex
File metadata and controls
2232 lines (1908 loc) · 63.1 KB
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
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
\documentclass[12pt]{article}
\usepackage{mgates-letter}
\definecolor{dark_blue} {rgb}{0., 0., 0.65}
\usepackage{textcomp}
\usepackage{mathrsfs} % mathscr font
\usepackage{boxedminipage}
\usepackage{rotating}
%\usepackage{natbib}
\usepackage[colorlinks, filecolor=dark_blue, urlcolor=dark_blue, linkcolor=black, citecolor=black]{hyperref}
\begin{document}
\title{\LaTeX{} quick reference}
\author{Mark Gates}
\date{\today}
\maketitle
\noindent
\begin{minipage}{1.3in}
\href{http://creativecommons.org/licenses/by-sa/2.0/}{\includegraphics[width=1.25in]{cc/by-sa.pdf}}
\end{minipage}
\begin{minipage}{5in}
This guide is available from
\href{http://web.eecs.utk.edu/~mgates3/}{http://web.eecs.utk.edu/${\sim}$mgates3/}
\\
Copyright \copyright 2007--2011 by Mark Gates.
\\
You may freely copy and modify this document under the
\href{http://creativecommons.org/licenses/by-sa/2.0/}{Creative Commons Attribution-ShareAlike license}.
When distributing modified versions, please include your Latex file.
\end{minipage}
\paragraph{Purpose.}
This document was initially made as a quick reference to all the
commands that I typically use, organized so I can understand it, with
examples and without clutter. It also includes many shortcuts that I
have defined in my mgates.sty file. It is not intended to be exhaustive,
nor overly descriptive. Most of the general \LaTeX commands can be found
in the \emph{Not So Short Introduction to \LaTeXe} \cite{NotSoShort};
most of the math in the \emph{Short Math Guide to \LaTeX}
\cite{AMSShortGuide}; most of the bibliography information in the BibTeX
tutorial \cite{Markey05} and the natbib documentation \cite{Daly06}.
I also wrote a separate Latex fonts guide.
% ----------------------------------------
\newpage
\setcounter{tocdepth}{2}
\tableofcontents
% set these after the TOC
\setlength{\parindent}{0em}
\setlength{\parskip}{1em}
% ----------------------------------------
\newpage
\section{Commands}
\subsection{Document structure}
\verb+\documentclass[+\emph{options}\verb+]{+\emph{class}\verb+}+
\textbf{Common classes} \\
\begin{tabular}{@{}ll}
article & articles without chapters \\
proc & proceedings, based on article \\
minimal & minimal formatting \\
report & reports with chapters \\
book & real books \\
\end{tabular}
\textbf{Common options} \\
\begin{tabular}{@{}ll}
10pt, 11pt, 12pt & main font size \\
a4paper, letterpaper, ... & paper size \\
fleqn & equations left-aligned instead of centered \\
leqno & equation numbers on left instead of right \\
titlepage, notitlepage & start new page after title \\
onecolumn, twocolumn & one or two columns \\
twoside, oneside & \\
landscape & paper orientation \\
openright, openany & chapters begin on right page, or any page \\
\end{tabular}
\subsubsection*{Preamble}
\verb+\usepackage[+\emph{options}\verb+]{+\emph{package}\verb+}+
\verb+\includeonly{+\emph{filenames}\verb+}+ \\
skip \verb+\include+ with listed files
\subsubsection*{Document}
\verb+\begin{document}+
\verb+\include{+\emph{filename}\verb+}+ \\
start new page with contents of file
\verb+\input{+\emph{filename}\verb+}+ \\
include contents of file, without starting a new page
\verb+\end{document}+
% ----------------------------------------
\newpage
\subsection{Page format}
\verb+\pagestyle{ plain | headings | empty }+ \\
\begin{tabular}{@{}ll}
plain & page number in footer \\
headings & page number and chapter in header \\
empty & no header or footer \\
\end{tabular}
\verb+\thispagestyle{ plain | headings | empty }+ \\
override \verb+\pagestyle+ on a single page
\begin{verbatim}
% set 1" margins on 8.5" x 11" paper
% top left is measured from 1", 1"
\topmargin 0in
\oddsidemargin 0in
\evensidemargin 0in
\headheight 0in
\headsep 0in
\topskip 0in
\textheight 9in
\textwidth 6.5in
% set these after the TOC
\setlength{\parindent}{0em}
\setlength{\parskip}{1em}
\setlength\arraycolsep{2pt}
\end{verbatim}
% ----------------------------------------
\newpage
\subsection{Chapters and Sections}
\verb+\title{...}+ \\
\verb+\author{John Doe \and Jane Doe}+ \\
\verb+\date{\today}+ \\
\verb+\maketitle+
\verb+\frontmatter %+ (book only) starts roman numeral page numbering, unnumbered sections
\verb+\setcounter{tocdepth}{1} %+ whether to display sub- or subsubsections in toc \\
\verb+\tableofcontents+
\verb+\mainmatter %+ (book only) starts arabic page \& section numbering
\verb+\part{...}+ \\
\verb+\chapter{...} \chapter*{...} %+ (book only) \\
\verb+\section{...} \section*{...}+ \\
\verb+\subsection{...} \subsection*{...}+ \\
\verb+\subsubsection{...} \subsubsection*{...}+ \\
\verb+\paragraph{...} \paragraph*{...}+ \\
\verb+\subparagraph{...} \subparagraph*{...}+
\verb+\appendix %+ (book only) starts alphabetic section numbering
\verb+\backmatter+
* Starred versions are unnumbered and not in the table of contents.
Examples:
\begin{boxedminipage}{6.5in}
\section*{1 \quad section}
\subsection*{1.1 \quad subsection}
\subsubsection*{1.1.1 \quad subsubsection}
\paragraph{paragraph} Run-in paragraph header. Lorem ipsum dolar
blah blah blah blah blah blah blah blah blah blah blah blah blah blah
\subparagraph{subparagraph} Run-in paragraph header. Lorem ipsum dolar
blah blah blah blah blah blah blah blah blah blah blah blah blah blah
\end{boxedminipage}
% ----------------------------------------
\newpage
\subsection{Fonts}
\textbf{Font sizes} \\
\begin{tabular}{@{}lllll}
\multicolumn{2}{@{}l}{Point size}
& Latex cmd & User-defined * & Sample \\
\hline
5 & 6 & \verb+\tiny+ & \verb+\xxxsmall+ & \xxxsmall {the quick brown fox} \\
7 & 8 & \verb+\scriptsize+ & \verb+\xxsmall+ & \xxsmall {the quick brown fox} \\
8 & 10 & \verb+\footnotesize+ & \verb+\xsmall+ & \xsmall {the quick brown fox} \\
9 & 11 & \verb+\small+ & \verb+\small+ & \small {the quick brown fox} \\
\textbf{10} & \textbf{12}
& \verb+\normal+ & \verb+\normal+ & \normal {the quick brown fox} \\
\hline
12 & 14 & \verb+\large+ & \verb+\large+ & \large {the quick brown fox} \\
14 & 17 & \verb+\Large+ & \verb+\xlarge+ & \xlarge {the quick brown fox} \\
17 & 20 & \verb+\LARGE+ & \verb+\xxlarge+ & \xxlarge {the quick brown fox} \\
20 & 25 & \verb+\huge+ & \verb+\xxxlarge+ & \xxxlarge {the quick brown fox} \\
25 & 25 & \verb+\Huge+ & \verb+\xxxxlarge+ & \xxxxlarge{the quick brown fox} \\
\end{tabular}
* see mgates.sty file
\textbf{Fonts} \\
\begin{tabular}{@{}ll}
Command & Sample \\
\hline
\verb+\textrm+ & \textrm{roman} \\
\verb+\textsf+ & \textsf{sans serif} \\
\verb+\texttt+ & \texttt{typewriter} \\
\verb+\textup+ & \textup{upright} \\
\verb+\textsl+ & \textsl{slanted} \\
\verb+\emph+ & \emph{emphasized} \\
\verb+\underline+ & \underline{underline} \\
\verb+\textit+ & \textit{italic} \\
\verb+\textmd+ & \textmd{medium} \\
\verb+\textbf+ & \textbf{bold font} \\
\verb+\textsc+ & \textsc{Small Caps} \\
\verb+\textnormal+ & \textnormal{normal} \\
\end{tabular}
In math mode (e.g. inside \$...\$), use the math fonts listed in the
math section.
% ----------------------------------------
\newpage
\subsection{Reserved characters}
\begin{tabular}{@{}lll}
Char & Special meaning & Command \\
\hline
\verb+#+ & ? & \verb+\#+ \\
\verb+$+ & math mode & \verb+\$+ \\
\verb+%+ & comment & \verb+\%+ \\
\verb+^+ & math superscript & \verb+\^{}+ \\
\verb+&+ & tab stop & \verb+\&+ \\
\verb+_+ & math subscript & \verb+\_+ \\
\verb+{+ & start parameter & \verb+\{+ \\
\verb+}+ & end parameter & \verb+\+ \\
\verb+~+ & nonbreaking space & \verb+\~{}+ \\
\verb+\+ & start command & \verb+$\backslash$+ \\
\end{tabular}
These can also be typed in the verbatim environment or with \verb+\verb+.
% ----------------------------------------
\subsection{Special characters}
\begin{tabular}{@{}ll|ll|ll}
Symbol & Command &
Symbol & Command &
Symbol & Command
\\
\hline
`` & \verb+``+ &
" & \verb+"+ or \verb+''+ &
\\
` & \verb+`+ &
' & \verb+'+ &
\\
in-law & \verb+in-law+ &
13--67 (en) & \verb+13--67+ &
yes---no (em) & \verb+yes---no+
\\
yes \ldots no & \verb+yes \ldots no+ &
?`No? & \verb+?`No?+ &
!`No! & \verb+!`No!+
\\
\dag & \verb+\dag+ &
\ddag & \verb+\ddag+ &
\\
\S & \verb+\S+ &
\P & \verb+\P+ &
\\
\copyright & \verb+\copyright+ &
\textregistered & \verb+\textregistered+ &
\\
\pounds & \verb+\pounds+ &
\texteuro & \verb+\texteuro+ * &
\\
\end{tabular}
* in textcomp package
% ----------------------------------------
\newpage
\subsection{Accented characters}
\begin{tabular}{@{}ll|ll|ll|ll}
Char & Command &
Char & Command &
Char & Command &
Char & Command
\\
\hline
\`o & \verb+\`o+ &
\'o & \verb+\'o+ &
\^o & \verb+\^o+ &
\~o & \verb+\~o+
\\
\=o & \verb+\=o+ &
\.o & \verb+\.o+ &
\"o & \verb+\"o+ &
\c c & \verb+\c+ c
\\
\u o & \verb+\u o+ &
\v o & \verb+\v o+ &
\H o & \verb+\H o+ &
\\
\d o & \verb+\d o+ &
\b o & \verb+\b o+ &
\t oo & \verb+\t oo+ &
\\
\hline
\oe & \verb+\oe+ &
\OE & \verb+\OE+ &
\ae & \verb+\ae+ &
\AE & \verb+\AE+
\\
\aa & \verb+\aa+ &
\AA & \verb+\AA+ &
\\
\o & \verb+\o+ &
\O & \verb+\O+ &
\l & \verb+\l+ &
\L & \verb+\L+
\\
\end{tabular}
The first 4 lines can be applied to appropriate characters. \\
To put accent over \emph{i} or \emph{j}, use \verb+\i+ (\i) or \verb+\j+ (\j).
% ----------------------------------------
\subsection{Special spaces}
\begin{tabular}{@{}llll}
Command & Size & 1 space & 10 spaces \\
\hline
\verb+\,+ & $3/8$ quad & (\,) & [\,\,\,\,\,\,\,\,\,\,] \\
\verb+\:+ & $4/8$ quad & (\:) & [\:\:\:\:\:\:\:\:\:\:] \\
\verb+\;+ & $5/8$ quad & (\;) & [\;\;\;\;\;\;\;\;\;\;] \\
\verb*+\ + & en? space & (\ ) & [\ \ \ \ \ \ \ \ \ \ ] \\
\verb+\quad+ & em space & (\quad) & [\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad] \\
\verb+\qquad+ & $2$ quad & (\qquad) & [\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad] \\
\verb+\!+ & $-3/8$ quad & (\!) & [\!\!\!\!\!\!\!\!\!\!] \\
\end{tabular}
In math mode, \verb+phantom+ reserves space for text without printing it,
for example \\
\begin{minipage}{3in}
\begin{align*}
x_1 \phantom{+ x_2} + x_3 = 2, \\
x_1 + x_2 \phantom{+ x_3} = 5, \\
x_1 + x_2 + x_3 = 7.
\end{align*}
\end{minipage}
\qquad
\begin{minipage}{3in}
\begin{verbatim}
x_1 \phantom{+ x_2} + x_3 = 2, \\
x_1 + x_2 \phantom{+ x_3} = 5, \\
x_1 + x_2 + x_3 = 7.
\end{verbatim}
\end{minipage}
% ----------------------------------------
\subsection{Special phrases}
\begin{tabular}{@{}ll}
Command & Sample \\
\hline
\verb+\today+ & \today \\
\verb+\TeX+ & \TeX \\
\verb+\LaTeX+ & \LaTeX \\
\verb+\LaTeXe+ & \LaTeXe \\
\end{tabular}
% ----------------------------------------
\newpage
\subsection{Line and page breaks}
\verb+\\+ or \verb+\newline+ \\
line break, without new paragraph. \verb+\\*+ also prohibts page break.
\verb+\linebreak[+\emph{n}\verb+]+ \\
\verb+\nolinebreak[+\emph{n}\verb+]+ \\
line break, keeping line justified.
$n$ ranges from 0 to 4 (most insistent).
\begin{boxedminipage}{\textwidth}
For example, here is a paragraph with a newline in it, lorem ipsum dolar
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah,
\verb+\newline+. \\
It also has a linebreak in it for comparison, lorem ipsum dolar
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah,
\verb+\linebreak[4]+. \linebreak[4]
Notice the difference in justification. Using \verb+\linebreak+ can
cause ``underfull hbox'' warnings.
\end{boxedminipage}
\verb+\newpage+ \\
page break
\verb+\pagebreak[+\emph{n}\verb+]+ \\
\verb+\nopagebreak[+\emph{n}\verb+]+ \\
page break, keeping line justified.
$n$ ranges from 0 to 4 (most insistent).
\verb+\hyphenation{ fortran hy-phen-a-tion }+ \\
list of words and where they may be hyphenated (in preamble).
\verb+\-+ \\
where a word may be hyphenated (in text).
Example: \verb+su\-per\-scal\-ar+
\verb*+\ + space not to enlarge \\
\verb+~+ space not to enlarge or line break \\
``Mr.\ Smith'' (\verb+Mr.\ Smith+) or \\
``Mr.~Smith'' (\verb+Mr.~Smith+) instead of \\
``Mr. Smith'' (\verb+Mr. Smith+)
\verb+\@+ between capital letter and punctuation that really does end a sentance \\
``\ldots FORTRAN\@. But\ldots'' (\verb+FORTRAN\@. But+) instead of \\
``\ldots FORTRAN. But\ldots'' (\verb+FORTRAN. But+)
% ----------------------------------------
\newpage
\subsection{References, citations, footnotes}
\label{references}
\verb+\label{+\emph{name}\verb+}+ assigns a unique name to an
equation, figure, table, or section. For figures and tables, label must
be after the caption.
\verb+\eqref{+\emph{name}\verb+}+ inserts reference to the labeled
equation; equivalent to \verb+(\ref{+\emph{name}\verb+})+.
\verb+\ref{+\emph{name}\verb+}+ inserts reference to the label.
You must add the descriptive text such as ``figure.''
\verb+\pageref{+\emph{name}\verb+}+ inserts page number of the label.
\verb+\cite{+\emph{name}\verb+}+ inserts reference to bibliography
citation. Name is assigned by \verb+bibitem+, not \verb+label+.
\verb+\footnote{+\emph{text}\verb+}+ generates a footnote.
See also equation numbering on page \pageref{equation-numbering}.
% ----------------------------------------
\subsection{Hyperlinks}
\verb+\usepackage[+\emph{options}\verb+]{hyperref}+
\\
\verb+\usepackage[colorlinks, urlcolor=blue, linkcolor=black]{hyperref}+
To color links, use the \verb+colorlinks+ option. To override default colors, specify \\
\begin{tabular}{@{}lll}
linkcolor & red & internal links (sections, pages, etc.) \\
citecolor & green & citation links (bibliography) \\
filecolor & magenta & file links \\
urlcolor & cyan & URL links (mail, web) \\
\end{tabular}
\verb+\href{+\emph{url}\verb+}{+\emph{text}\verb+}+ \\
\verb+\href{http://www.ctan.org/}{CTAN}+
\qquad \href{http://www.ctan.org/}{CTAN}
\verb+\href{mailto:noone@example.com}{noone@example.com}+
\qquad \href{mailto:noone@example.com}{noone@example.com}
% ----------------------------------------
\newpage
\section{Environments}
\subsection{Text alignment}
\begin{boxedminipage}[t]{3in}
\begin{flushleft}
this paragraph is \\
flush left.
\end{flushleft}
\end{boxedminipage}
\qquad
\begin{minipage}[t]{3in}
\begin{verbatim}
\begin{flushleft}
this paragraph \\
is flush left.
\end{flushleft}
\end{verbatim}
\end{minipage}
\begin{boxedminipage}[t]{3in}
\begin{flushright}
this paragraph is \\
flush right.
\end{flushright}
\end{boxedminipage}
\qquad
\begin{minipage}[t]{3in}
\begin{verbatim}
\begin{flushright}
this paragraph \\
is flush right.
\end{flushright}
\end{verbatim}
\end{minipage}
\begin{boxedminipage}[t]{3in}
\begin{center}
this paragraph is \\
centered.
\end{center}
\end{boxedminipage}
\qquad
\begin{minipage}[t]{3in}
\begin{verbatim}
\begin{center}
this paragraph \\
is centered.
\end{center}
\end{verbatim}
\end{minipage}
% ----------------------------------------
\subsection{Boxes}
Only minipage is an environment, but these are all related.
\verb+\mbox{...}+ \\
\verb+\makebox[+\emph{width}\verb+][t|b|c]{...}+ \\
groups items in a box. Everything must be on one line (?).
\verb+\fbox{...}+ \\
\verb+\framebox[+\emph{width}\verb+][t|b|c]{...}+ \\
framed box. Everything must be on one line (?).
\verb+\parbox[t|b|c]{+\emph{width}\verb+}{...}+ \\
paragraph box that wraps text.
\verb+\begin{minipage}[t|b|c]{+\emph{width}\verb+} ... \end{minipage}+ \\
minipage box, similar to parbox but can contain almost anything.
\verb+\begin{boxedminipage}[t|b|c]{+\emph{width}\verb+} ... \end{boxedminipage}+ \\
with \verb+\usepackage{boxedminipage}+.
\verb+\rule{+\emph{width}\verb+}{+\emph{height}\verb+}+
\verb+\raisebox+
page and other parameters to tweak
% ----------------------------------------
\newpage
\subsection{Block quotes}
\begin{boxedminipage}[t]{3in}
Martin Luther King Jr. said,
\begin{quote}
I have a dream that someday\ldots
\end{quote}
\end{boxedminipage}
\qquad
\begin{minipage}[t]{3in}
\begin{verbatim}
Martin Luther King Jr. said,
\begin{quote}
I have a dream that someday\ldots
\end{quote}
\end{verbatim}
\end{minipage}
For multiple paragraph quotations, use \verb+quotation+ instead of
\verb+quote+, to indent the first line of each paragraph.
\subsection{Verse}
Reverse indents if line wraps.
\begin{boxedminipage}[t]{3in}
\textbf{Humpty Dumpty}
\begin{verse}
Humpty Dumpty sat on a wall:\\
Humpty Dumpty had a great fall.\\
All the King's horses and all the King's men\\
Couldn't put Humpty together again.
\end{verse}
\end{boxedminipage}
\qquad
\begin{minipage}[t]{3in}
\begin{verbatim}
\textbf{Humpty Dumpty}
\begin{verse}
Humpty Dumpty sat on a wall:\\
Humpty Dumpty had a great fall.\\
All the King's horses and all the
King's men\\
Couldn't put Humpty together again.
\end{verse}
\end{verbatim}
\end{minipage}
% ----------------------------------------
\subsection{Verbatim}
\verb+verbatim+ reproduces text exactly as you type it,
not interpretting any characters or commands. It was used
here for all the LaTeX code listings.
% note \end{verbatim} obviously can't be
% inside \begin{verbatim}...\end{verbatim}
\verb+\begin{verbatim}+ \\
\verb+text can include special characters # $ < + \\
\verb+and \textbf{commands}.+ \\
\verb+\end{verbatim}+
\verb|\verb+text+| \\
where the delimiter `+' is any character except letters, *, and space.
Adding a star highlights spaces. \\
\verb+\begin{verbatim*} ... \end{verbatim*}+ \\
\verb|\verb*+text with spaces+| \qquad \verb*+text with spaces+
% ----------------------------------------
\newpage
\subsection{Lists}
\begin{boxedminipage}[t]{3in}
\begin{enumerate}
\item One
\item[3.] Two (with special number)
\item Three
\end{enumerate}
\end{boxedminipage}
\qquad
\begin{minipage}[t]{3in}
\begin{verbatim}
\begin{enumerate}
\item One
\item[3.] Two (with special number)
\item Three
\end{enumerate}
\end{verbatim}
\end{minipage}
\begin{boxedminipage}[t]{3in}
\begin{itemize}
\item One
\item[-] Two (with special bullet)
\end{itemize}
\end{boxedminipage}
\qquad
\begin{minipage}[t]{3in}
\begin{verbatim}
\begin{itemize}
\item One
\item[-] Two (with special bullet)
\end{itemize}
\end{verbatim}
\end{minipage}
\begin{boxedminipage}[t]{3in}
\begin{description}
\item[One] Description of one
\item[Two] Description of two
\end{description}
\end{boxedminipage}
\qquad
\begin{minipage}[t]{3in}
\begin{verbatim}
\begin{description}
\item[One] Description of one
\item[Two] Description of two
\end{description}
\end{verbatim}
\end{minipage}
% ----------------------------------------
\subsection{Tables (tabular)}
\begin{boxedminipage}[t]{3in}
\begin{tabular}{l|ll}
col1 & col2 & col3 \\
\hline
col1 & col2 & col3 \\
col1 & col2 & col3
\end{tabular}
\end{boxedminipage}
\qquad
\begin{minipage}[t]{3in}
\vspace{-24pt}
\begin{verbatim}
\begin{tabular}{l|ll}
col1 & col2 & col3 \\
\hline
col1 & col2 & col3 \\
col1 & col2 & col3 \\
\end{tabular}
\end{verbatim}
\end{minipage}
In general: \\
\verb+\begin{tabular}[t|b|c]{+\emph{column spec}\verb+}+ \\
\verb+col1 & col2 & ... & coln \\+ \\
\verb+col1 & col2 & ... & coln \\+ \\
\verb+\end{tabular}+
In \emph{column spec}, for each column use \verb+l+, \verb+r+, \verb+c+
for a left, right, or centered column, \verb+p{+\emph{width}\verb+}+ for
a column of given width that wraps text. Use \verb+|+ (pipe) for a
vertical line between columns. Use \verb+@{...}+ to specify the
delimiter between columns. An empty \verb+@{}+ deletes the gutter or
left indent.
Between lines, use \verb+\hline+ for a horizontal line.
Use \verb+\multicolumn{+\emph{n}\verb+}{+\emph{column spec}\verb+}{+\emph{text}\verb+}+
to have text span multiple columns.
% ----------------------------------------
\newpage
\subsection{Figures and Tables}
A figure typically includes 1 or more graphics. Example:
\begin{figure}[h]
\begin{boxedminipage}{3in}
\centering
\includegraphics[scale=0.8]{sine}
\caption{$\sin(x)$}
\label{sine}
\end{boxedminipage}
\qquad
\begin{minipage}{3in}
\begin{verbatim}
\begin{figure}[h]
\centering
\includegraphics[scale=0.8]{sine}
\caption{$\sin(x)$}
\label{sine}
\end{figure}
\end{verbatim}
\end{minipage}
\end{figure}
A table typically includes a tabular environment; see previous section.
Example:
\begin{table}[h]
\begin{boxedminipage}{3in}
\centering
\begin{tabular}{ccc}
& sales & growth \\
2000 & 10,000 & 15\% \\
2001 & 12,000 & 20\% \\
\end{tabular}
\caption{Sales growth}
\label{sales-growth}
\end{boxedminipage}
\qquad
\begin{minipage}{3in}
\begin{verbatim}
\begin{table}[h]
\centering
\begin{tabular}{ccc}
& sales & growth \\
2000 & 10,000 & 15\% \\
2001 & 12,000 & 20\% \\
\end{tabular}
\caption{Sales growth}
\label{sales-growth}
\end{table}
\end{verbatim}
\end{minipage}
\end{table}
\verb+figure+ and \verb+table+ take an optional placement specifier: \\
\begin{tabular}{@{}ll}
\verb+h+ & \emph{here} in the text \\
\verb+t+ & \emph{top} of a page \\
\verb+b+ & \emph{bottom} of a page \\
\verb+p+ & on a special \emph{page} of only floats \\
\verb+!+ & be insistent \\
\end{tabular}
To use \verb+includegraphics+, include
\verb+\usepackage[+\emph{driver}\verb+]{graphicx}+
in the preamble. The \emph{driver} should normally be omitted; if necesary,
it is \verb+dvips+ for latex
and \verb+pdftex+ for pdflatex. Files must be eps for dvips, while
pdftex takes pdf, jpg, tif, or png. It's convenient to leave off the
extension; latex/pdflatex will look for the appropriate file. (In this
example, spring.pdf or spring.eps.) Since many journals want eps
files instead of pdf files, I often generate eps files first, then
convert them to pdf using epstopdf.
\verb+includegraphics+ options \\
\begin{tabular}{@{}ll}
\verb+width=+\emph{width} & scale to width, maintaining aspect ratio if no height \\
\verb+height=+\emph{height} & scale to height, maintaining aspect ratio if no width \\
\verb+angle=+\emph{degrees} & rotate counterclockwise \\
\verb+scale=+\emph{scale} & resize image by scalar value \\
\end{tabular}
% ----------------------------------------
\newpage
\section{Math}
Surround inline equations with dollar signs, for example \verb+$x=2$+
produces $x=2$. For equations in their own block, use one of the
environments below. For unnumbered equations append a * star to the
environment name. As a shortcut for unnumbered equations, \verb+\[...\]+
is the same as \verb+\begin{equation*}...\end{equation*}+.
\noindent
\rule{6.5in}{0.5pt}
\noindent
\begin{minipage}[t]{3.125in}
\verb+equation+ sets a single equation \eqref{x1}.
%
\begin{equation} \label{x1}
x = a + b.
\end{equation}
%
\verb+gather+ sets multiple equations (\ref{x2},\ref{y2}), centered on
each other.
%
\begin{gather}
x = a + b, \label{x2} \\
y = c + d + e + f. \label{y2}
\end{gather}
%
\verb+align+ sets multiple equations (\ref{x3},\ref{y3}), aligned
typically on $=$ sign.
%
\begin{align}
x &= a + b, \label{x3} \\
y &= c + d + e + f, \label{y3}
\end{align}
%
\verb+multline+ splits a long equation
\eqref{x6} over multiple lines, distributing the space.
%
\begin{multline} \label{x6}
x = a + b + c + d + e + f\\
+ g + h + i + j + k. \\
+ l + m + n.
\end{multline}
%
\verb+split+ splits a long equation \eqref{x5} over multiple
lines, aligning it. Use inside equation, align, or gather.
%
\begin{equation}
\begin{split} \label{x5}
x &= a + b \\
&= c + d + e.
\end{split}
\end{equation}
%
\verb+subequations+ assigns all enclosed equations subordinate equation
numbering, so (\ref{x4},\ref{y4}) are parts of \eqref{group4}.
%
\begin{subequations} \label{group4}
\begin{align}
x &= a + b, \label{x4} \\
y &= c + d + e + f. \label{y4}
\end{align}
\end{subequations}
\end{minipage}
\hspace{1em}
\begin{minipage}[t]{3.125in}
\begin{verbatim}
\begin{equation} \label{x1}
x = a + b.
\end{equation}
\end{verbatim}
\vspace{-16pt}
\begin{verbatim}
\begin{gather}
x = a + b, \label{x2} \\
y = c + d + e + f. \label{y2}
\end{gather}
\end{verbatim}
\vspace{-0pt}
\begin{verbatim}
\begin{align}
x &= a + b, \label{x3} \\
y &= c + d + e + f, \label{y3}
\end{align}
\end{verbatim}
\vspace{2pt}
\begin{verbatim}
\begin{multline} \label{x6}
x = a + b + c + d + e + f \\
+ g + h + i + j + k. \\
+ l + m + n.
\end{multline}
\end{verbatim}
\vspace{6pt}
\begin{verbatim}
\begin{equation}
\begin{split} \label{x5}
x &= a + b \\
&= c + d + e.
\end{split}
\end{equation}
\end{verbatim}
\vspace{-14pt}
\begin{verbatim}
\begin{subequations} \label{group4}
\begin{align}
x &= a + b, \label{x4} \\
y &= c + d + e + f. \label{y4}
\end{align}
\end{subequations}
\end{verbatim}
\end{minipage}
\newpage
\noindent
\begin{minipage}[t]{3in}
\verb+align+ can also have several columns of equations or descriptions.
The \verb+intertext+ command is useful to insert text while preserving
alignment.
\begin{align*}
x &= 1, & y &= 2, && \text{initialize}
\\
z &= 3, & w &= 4,
\intertext{some more text, and}
a &= 5, & b &= 5.
\end{align*}
%
The non-AMS command for aligning equations is \verb+eqnarray+, but it
produces rather poor spacing and is \emph{not recommended}.
%
\begin{eqnarray}
x &=& a + b, \label{x7} \\
y &=& c + d + e + f. \label{y7}
\end{eqnarray}
%
\end{minipage}
\hspace{1em}
\begin{minipage}[t]{3in}
\begin{verbatim}
\begin{align*}
x &= 1, & y &= 2, && \text{initialize}
\\
z &= 3, & w &= 4,
\intertext{some more text, and}
a &= 5, & b &= 5.
\end{align*}
\end{verbatim}
\vspace{46pt}
\begin{verbatim}
\begin{eqnarray}
x &=& a + b, \label{x7} \\
y &=& c + d + e + f. \label{y7}
\end{eqnarray}
\end{verbatim}
\end{minipage}
\noindent
\rule{6.5in}{0.5pt}