-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathicmmcm-sample.tex
1732 lines (1417 loc) · 61.1 KB
/
icmmcm-sample.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
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{icmmcm}
% Copyright (C) 2003-2016 Claire M. Connelly and the Department
% of Mathematics, Harvey Mudd College.
% This work may be distributed and/or modified under the conditions of
% the LaTeX Project Public License, either version 1.3 of this license
% or (at your option) any later version.
% The latest version of this license is in
% http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
% This work has the LPPL maintenance status `maintained'.
% The Current Maintainer of this work is Claire M. Connelly.
\usepackage{url} % For formatting URLs and other web or
% file references.
\usepackage{mflogo} % Provides the METAFONT logo; you
% won't need it for your report.
\usepackage{graphicx} % For importing graphics.
\usepackage{natbib}
%%% Sample ICM/MCM Contest Submission
%%%
%%% Based on sample senior thesis document
%%% Last modified by Jeremy Rouse
%%% Summer 2000
%%%
%%% and on the LaTeX Hints document
%%% created by C.M. Connelly <[email protected]>
%%% Copyright 2002-2012
%%% ---------------
%%% Local Command and Environment Definitions
%%% If you have any local command or environment definitions, put them
%%% here or in a separate style file that you load with \usepackage.
% \newtheorem declarations
\newtheorem{Theo1}{Theorem}
\newtheorem{Theo2}{Theorem}[section]
\newtheorem{Lemma}[Theo2]{Lemma}
% Each of the above defines a new theorem environment.
% Multiple theorems can be done in the same environment.
% Theo2's number is defined by the subsection it's in.
% Theo3 uses the same numbering counter and numbering system as
% Theo2 (that's the meaning of [Theo2]).
%%% You probably won't want any of the following commands, which are
%%% here to allow various the names of commands, make examples typeset
%%% properly, and so on. You can, of course, use them as examples for
%%% your own user-defined commands.
\newcommand{\bslash}{\symbol{'134}}%backslash
\newcommand{\bsl}{{\texttt{\bslash}}}
\newcommand{\com}[1]{\bsl\texttt{#1}\xspace}
\newcommand{\file}[1]{\texttt{#1}\xspace}
\newcommand{\pdftex}{PDF\tex}
\newcommand{\pdflatex}{PDF\latex}
\newcommand{\acronym}[1]{\textsc{#1}\xspace}
\newcommand{\key}[1]{\textsf{\emph{#1}}\xspace}
\newcommand{\class}[1]{\textsf{#1}\xspace}
\newcommand{\package}[1]{\textsf{#1}\xspace}
\newcommand{\env}[1]{\texttt{#1}\xspace}
\newcommand{\prog}[1]{\texttt{#1}\xspace}
\newcommand{\command}[1]{\texttt{\bsl{}#1}\xspace}
\newcommand{\ctt}{\texttt{comp.text.tex}\xspace}
\newcommand{\tex}{\TeX\xspace}
\newcommand{\latex}{\LaTeX\xspace}
%%% Note that the \xspace command comes from the xspace package. It
%%% allows you type a command that inserts text without having to
%%% worry about how you ``end'' that command.
%%%
%%% Without \xspace, you would need to end a command with a backslash
%%% followed by a space or with an empty set of braces if you followed
%%% the command with a space. For example,
%%%
%%% \foo is a very important algorithm.
%%%
%%% might produce
%%%
%%% The foobarbaz algorithmis a very important algorithm.
%%%
%%% whereas with the \xspace command, the same code would produce
%%%
%%% The foobarbaz algorithm is a very important algorithm.
%%%
%%% If you need to butt a command that produces text against a letter
%%% of some sort -- say, to pluralize it -- you need to tell TeX
%%% where your command name ends so that it expands the correct
%%% macro. So you might do
%%%
%%% \bar{}s are very busy creatures.
%%% TeX has an amazingly good hyphenation algorithm, but sometimes it
%%% gets confused and needs some help.
%%%
%%% For words that only occur once or twice, you can insert hints
%%% directly into your text, as in
%%%
%%% our data\-base system is one of the most complex ever devised
%%%
%%% For words that you use a lot, and that seem to keep ending up at
%%% the end of a line, however, inserting the hints each time gets to
%%% be a drag. You can use the \hyphenation command to globally tell
%%% TeX where to hyphenate words it can't figure out on its own.
\hyphenation{white-space}
%%% End Local Command and Environment Definitions
%%% ---------------
%%% ---------------
%%% Title Block
\title{\latex Hints for ICM/MCM Contest Reports}
%%% Which contest are you taking part in? (Just one!)
\contest{ICM/MCM}
%%% The question you answered. (Again, just the one.)
\question{Report Sample}
%%% Your Contest Team Control Number
\team{12345}
%%% A normal document would specify the author's name (and possibly
%%% their affiliation or other information) in an \author command.
%%% Because the ICM/MCM Contest rules specify that the names of the
%%% team members, their advisor, and their institution should not
%%% appear anywhere in the report, do *not* define an \author command.
%%% Defining the \date command is optional. If you leave it blank,
%%% your document will include the date that the file is typeset, in
%%% the form ``Month dd, yyyy''.
% \date{}
%%% End Title Block
%%% ---------------
\begin{document}
%%% ---------------
%%% Summary
\begin{summary}
This document is meant to give you a quick introduction to \TeX\ and
\LaTeX. It covers a lot of material, but still barely manages to
scratch the surface. It should provide you with some inspiration
and, I hope, with some useful code you can copy, modify, and use in
your report.
You should use the \file{blank-template.tex} file as a basis for
your report rather than this file. Be sure to change its name to
something sensible (maybe your team control number), and to set the
values of the \com{title}, \com{question}, and \com{team} commands
to appropriate values.
Good luck!
\hfill{}-- Claire
\end{summary}
%%% End Summary
%%% ---------------
%%% ---------------
%%% Print Title Block, Contents, et al.
\maketitle
\tableofcontents
%%% Uncomment the following lines if you have figures or tables in
%%% your report:
\listoffigures
\listoftables
%%% End Print Title Block, Contents, et al.
%%% ---------------
\section{Introduction: What Is \latex?}%
\label{sec:introduction}
\latex is a tool that allows you to concentrate on your writing while
taking advantage of the \tex typesetting system to produce
high-quality typeset documents.
\latex's benefits include
\begin{enumerate}
\item Standardized document classes
\item Structural frameworks for organizing documents
\item Automatic numbering and cross-referencing of structural elements
\item ``Floating'' figures and tables
\item High-level programming interface for accessing \tex's
typesetting capabilities
\item Access to \latex extensions through loading ``packages''
\end{enumerate}
\section{Structured Writing}%
\label{sec:structured-writing}
Like HTML,\footnote{HyperText Markup Language} \latex is a markup
language rather than a \acronym{Wysiwyg}{}\footnote{What You See Is
What You Get.} system. You write plain text files that use special
\key{commands} and \key{environments} that govern the appearance and
function of parts of your text in your final typeset document.
\subsection{Document Classes}%
\label{sec:document-classes}
The general appearance of your document is determined by your choice
of \key{document class}. Document classes also load \latex packages
to provide additional functionality.
\latex provides a number of basic classes, including \class{article},
\class{letter}, \class{report}, and \class{book}. There are also a
large number of other document classes available, including
\class{amsart} and \class{amsbook}, created by the American
Mathematical Society and providing some additional mathematically
useful structures and commands; \class{foils}, \class{prosper}, and
\class{seminar}, which allow you to create ``slides'' for
presentations; the math department's \class{thesis} class, for
formatting senior theses; and many journal- or company-specific
classes that format your document to match the ``house style'' of a
particular periodical or publisher.
\subsection{Packages}%
\label{sec:packages}%
\label{sec:ctan}
\latex packages, or \key{style files}, define additional commands and
environments, or change the way that previously defined commands and
environments work. By loading packages, you can change the fonts used
in your document, write your document in a non-English language with a
non-\acronym{Ascii} font encoding, include graphics, format program
listings, add custom headers and footers to your document, and much
more.
A typical \tex installation includes hundreds of style files, and
hundreds more are available from the Comprehensive \tex Archive
Network (CTAN), at \url{http://www.ctan.org/}.
\subsection{Structural Commands}%
\label{sec:structural-commands}
\begin{table}
\centering
\begin{tabular}{ll}
\toprule
Command & Notes \\
\midrule
\com{part} & \class{book} \& \class{report} only \\
\com{chapter} &\class{book} \& \class{report} only \\
\com{section} \\
\com{subsection} \\
\com{subsubsection} \\
\com{paragraph} \\
\com{subparagraph} \\
\bottomrule
\end{tabular}
\caption[Structural commands in \latex]{Structural commands in \latex.}%
\label{tab:structural-commands}
\end{table}
\latex provides a set of structural commands for defining sections of
your document, as shown in Table~\ref{tab:structural-commands}.
Note that the argument to structural commands are moving arguments
(see Section~\ref{sec:fragile-commands}) because they can be reused in
the table of contents or in page headers or footers. Structural
commands can take an optional argument in which you specify nonfragile
commands or a shorter version of the actual section title that fits.
You'll generally know when you need to provide an optional argument by
\TeX's behavior.
\subsection{Labels and References}%
\label{sec:labels-and-references}
Sections are numbered automatically by \latex during typesetting. If
you change your mind and decide that a subsection should be promoted
to a section, or moved to the end of your document, the sections will
be renumbered so that the numbers are consistent.
Sections can also be \command{label}{}ed with a tag such as
\begin{quote}
\begin{verbatim}
\section{Our Complicated Equations}%
\label{sec:complicated-eqs}
\end{verbatim}
\end{quote}
and referred to with a \command{ref} or \command{pageref} command, as
in
\begin{quote}
\begin{verbatim}
In Section~\ref{sec:complicated-eqs}, we pointed out...
\end{verbatim}
\end{quote}
or
\begin{quote}
\begin{verbatim}
On page~\pageref{fig:gordian-knot}, we illustrated...
\end{verbatim}
\end{quote}
\latex substitutes the correct section number when typesetting your
document.
The same commands can be used with numbered environments such as
\env{equation}, \env{theorem}, and so forth.
Use \emph{meaningful} labels---labeling a section as \texttt{sec12}
may seem useful, but it will be confusing if you end up moving it to a
different place in the document and its number changes to Section~34.
It's also easier to remember what reference you want if you use a
meaningful name.
You may also want to impose some additional organization through the
use of \emph{namespaces}, as I've done in this document. Rather than
give different types of objects undistinguished labels, I precede
section labels with \texttt{sec:}, equations with \texttt{eq:},
figures with \texttt{fig:}, tables with \texttt{tab:}, and so on.
Emacs with Aux\tex and Ref\tex gives you easy access to these labels,
as do many other editors with \tex-specific features. It's much
easier to find the particular label you're looking for if you have
some additional information to help you. Adding the prefixes also
reminds you of what text should precede the \com{ref} command.
\subsection{Commands}
\latex uses commands for changes that are very limited in scope (a few
words) or are unlimited in scope (the rest of a document). For
example, the commands
\begin{quote}
\begin{verbatim}
\textbf{bold}
\emph{italic (emphasized)}
\textsf{sans serif}
\end{verbatim}
\end{quote}
produce the following output in a typeset document:
\begin{quote}
\textbf{bold} \emph{italic (emphasized)} \textsf{sans serif}
\end{quote}
These are ``commands with arguments''---the command itself starts with
a backslash (\bsl), and its \key{argument} appears inside braces
{\verb+{ }+). Some commands may also have \key{optional arguments},
which are typed inside brackets (\verb+[ ]+).
There are also commands that take no arguments, such as
\command{noindent}, \command{raggedright}, and \command{pagebreak}.
You can define your own commands, as discussed in
Section~\ref{sec:customization}.
\subsection{Environments}%
\label{sec:environments}
\latex provides a number of \key{environments} that affect the
appearance of text, and are generally used for more structurally
significant purposes. For example, the commands listed above are
typeset inside a \env{verbatim} environment typed inside a \env{quote}
environment. Their results were typeset inside a \env{quote}
environment.
Environments use special commands to start and close---\command{begin}
and \command{end}, followed by the name of the environment in braces,
as in
\begin{quote}
\begin{verbatim}
\begin{quote}
``This is disgusting---I can't eat this. That arugala is so
bitter\ldots{} It's like my algebra teacher on bread.''
\flushright -- Julia Roberts in \emph{Full Frontal}
\end{quote}
\end{verbatim}
\end{quote}
producing
\begin{quote}
``This is disgusting---I can't eat this. That arugala is so
bitter\ldots{} It's like my algebra teacher on bread.''
\flushright -- Julia Roberts in \emph{Full Frontal}
\end{quote}
Some environments may take additional arguments in braces (required)
or brackets (optional).
Note that the order in which environments nest is extremely important.
If you type an environment inside another environment, the inner
environment must be \command{end}{}ed \emph{before} the second
environment is closed. It's also vitally important that you have an
\command{end} line for each \command{begin} line, or \latex will
complain.
\subsubsection{The \env{document} Environment and the Preamble}%
\label{sec:document-environment}
The most important environment is the \env{document} environment,
which encloses the \key{body} of your document. The code before the
\command{begin}\verb+{document}+ line is called the \key{preamble},
and includes the all-powerful \command{documentclass} command, which
loads a particular document class (see
Section~\ref{sec:document-classes}); optional \command{usepackage}
commands, which load in additional \latex packages (see
Section~\ref{sec:packages}); and other setup commands, such as
user-defined commands and environments, counter settings, and so
forth.
I generally also include the commands defining the title, author, and
date in my preambles, but other people include them just after
\command{begin}\verb+{document}+, before the \command{maketitle}
command, which creates the title block of your document.
\subsubsection{Math Environments}%
\label{sec:math-environments}
One of the major hallmarks of \tex is its ability to typeset
mathematical equations.
The two primary ways of doing so are with the use of \key{inline} and
\key{display math environments}. These environments are used so
often that there are shorthands provided for typing them. Inline math
environments, such as $a^2 + b^2 = c^2$, can be typed as
\begin{quote}
\begin{verbatim}
\begin{math}
a^{2} + b^{2} = c^{2}
\end{math}
\end{verbatim}
\end{quote}
or
\begin{quote}
\begin{verbatim}
$a^{2} + b^{2} = c^{2}$.
\end{verbatim}
\end{quote}
Display math environments set your equation apart from your running
text. They're generally used for more complicated expressions, such
as
\[
f(x) = \int \left( \frac{x^2 + x^3}{1} \right)dx
\]
which can be typed as
\begin{quote}
\begin{verbatim}
\begin{displaymath}
f(x) = \int \left( \frac{x^2 + x^3}{1} \right)dx
\end{displaymath}
\end{verbatim}
\end{quote}
or
\begin{quote}
\begin{verbatim}
\[
f(x) = \int \left( \frac{x^2 + x^3}{1} \right)dx
\]
\end{verbatim}
\end{quote}
Generally, you'll want to use the \verb+$+ %$ <- fool font-lock-mode
delimited form for inline math, and the \com{[} \com{]} form for
display math environments. [Besides being easy to type, these forms
are \key{robust}, which means that they can be used in \key{moving
arguments}, elements that \tex may need to typeset in more than one
place (such as a table of contents) or adjust (such as footnotes).]
\paragraph{The \env{equation} Environment}%
\label{sec:equation-environment}
You'll probably want to use the \env{equation} environment for any
formula you plan to refer to. \latex not only typesets the contents
of an \env{equation} environment in display mode, it also numbers it,
as in
\begin{equation}
\label{eq:myequation}
f(x) = \int \left( \frac{x^2 + x^3}{1} \right)dx
\end{equation}
written as
\begin{quote}
\begin{verbatim}
\begin{equation}
\label{eq:myequation}
f(x) = \int \left( \frac{x^2 + x^3}{1} \right)dx
\end{equation}
\end{verbatim}
\end{quote}
Note that you can refer to this formula as
Equation~\ref{eq:myequation} with
\begin{verbatim}
\ref{eq:myequation}.
\end{verbatim}
\subsection{Fonts}%
\label{sec:fonts}
Generally you'll want to let \latex handle the fonts for you---Knuth's
Computer Modern fonts are used by default, and include a wide range of
variations that can cover most any use you can think of.
If you want to get fancy (and portable; see
Section~\ref{sec:fuzzy-fonts}), you can use Type~1 PostScript fonts,
such as Times, Palatino, Utopia, and so forth. These font sets are
accessible with packages with names like \package{times},
\package{palatino}, and \package{utopia}. There are others, as
well---a command such as \com{locate psnfss | grep sty} will find most
of them.
You can also get fonts from CTAN (see Section~\ref{sec:ctan}), both
bitmap and Type 1. There's even support for TrueType fonts in some
\TeX\ systems.
\subsubsection{Font Commands}%
\label{sec:font-commands}
Most of your concern about fonts is probably related to what you're
writing. You might want some \emph{emphasized} or \textbf{bold} text
to stress a point or highlight a key term. Filenames might be set in
\texttt{typewriter text} (although you should consider using the
\package{url} package to help you out---by default, text set in
typewriter text isn't hyphenated, which can lead to some unattractive
line breaks).
You can also set text in \textsf{sans serif} or \textsc{small caps}.
Table~\ref{tab:font-commands} shows you some of the most commonly used
font commands provided by \latex.
\begin{table}[htbp]
\centering
\begin{tabular}{ll}
\toprule
Command & Result\\
\midrule
\com{emph} & \emph{emphasized text}\\
\com{textsf} & \textsf{sans-serif text}\\
\com{texttt} & \texttt{typewriter text}\\
\com{textbf} & \textbf{bold text}\\
\com{textsc} & \textsc{small caps text}\\
\com{textsl} & \textsl{slanted text}\\
\com{textit} & \textit{italic text}\\
\bottomrule
\end{tabular}
\caption[Commonly used font commands]{Commonly used font commands.}
\label{tab:font-commands}
\end{table}
I recommend that you use \com{emph} in preference to \com{textit}, and
use \com{textbf} sparingly. \com{emph} is a smarter command than
\com{textit}---it switches back to the roman font when necessary. For
example, \emph{She loved \emph{Scooby Doo}.} versus \textit{He loved
\textit{Titanic}.}
For complicated font changes, or for special font usages that you're
typing a lot, creating a macro (Section~\ref{sec:customization}) is
the way to go. I often just write, tossing in custom commands as I
go, and waiting to define them until just before I compile the
document.
\subsection{Customization}%
\label{sec:customization}
The main advantage of using commands and environments is that they
allow you to organize your writing. A useful side-effect is that you
can change your mind about the way an element is typeset, and change
all the appearances of that element in document by editing one piece
of code. For example, in this document the names of environments have
been set in ``typewriter text'', using a command I created called
\command{env}, which is defined as
\begin{quote}
\begin{verbatim}
\newcommand{\env}[1]{\texttt{#1}\xspace}
\end{verbatim}
\end{quote}
All I have to do to make the names of all the environments in the
document appear in sans-serif type instead is to change that one line
to
\begin{quote}
\begin{verbatim}
\newcommand{\env}[1]{\textsf{#1}\xspace}
\end{verbatim}
\end{quote}
You can do the same with almost anything you can conceptualize---key
terms, people's names (especially names of people from
non-English-speaking countries), files, functions, and so on.
\section{Mathematical Notation}%
\label{sec:mathematical-notation}
As we saw in Section~\ref{sec:math-environments}, math is typed into
one of several kinds of math environments. Choose your environment
based on the context and importance of the content. Any formula you
plan to refer to should be typed in an \env{equation} environment (or
a similar environment that supports labels).
You should punctuate your mathematics as if the formulae were normal
parts of English sentences. Reading them aloud is often a useful
method for ensuring that you have all the commas in the right places.
Where appropriate, you should also follow a displayed formula at the
end of a sentence with a period.
\subsection{Sums and Products}%
\label{sec:sums-n-products}
It's easy to typeset sums and products. For example,
\begin{equation}
f(n) = \sqrt[n]{\sum_{k=1}^{n} {n \choose k} f \left( n - k \right)},~
\prod_{n=2}^{\infty} \frac{n^{3}-1}{n^{3}+1} = \frac{2}{3}.
\end{equation}
%%% The ~ in the equation puts a nonbreaking space (equivalent to an
%%% interword space in text mode) between the two halves of the equation.
%%%
%%% Also, note that the use of the \choose command here causes the
%%% amsmath package to issue the warning
%%%
%%% Package amsmath Warning: Foreign command \atopwithdelims;
%%% (amsmath) \frac or \genfrac should be used instead
%%% (amsmath) on input line 557.
%%%
%%% amsmath would prefer the use of the \binom command it supplies.
\subsection{Matrices}%
\label{sec:matrices}
It's a little more difficult to create matrices, but not too bad:
%%% In LaTeX, & is the alignment tab, and separates columns. \\ is the end of
%%% line marker, and separates rows. The ccc denotes that there are three
%%% columns. The array environment and the tabular environment are
%%% more or less identical, so what goes here also applies to a table.
%%%
\begin{equation}
\left[ \begin{array}{ccc}
2 & 1 & 2\\
1 & 0 & 2\\
2 & 1 & 1
\end{array} \right]
\left[ \begin{array}{ccc}
-2 & 1 & 2\\
3 & -2 & -2\\
1 & 0 & -1
\end{array} \right] =
\left[ \begin{array}{ccc}
1 & 0 & 0\\
0 & 1 & 0\\
0 & 0 & 1
\end{array} \right].
\end{equation}
\subsection{Symbols}%
\label{sec:symbols}
\LaTeX provides an enormous number of symbols. Additional packages
(loaded with \com{usepackage}) may provide additional symbols and
fonts.
For example, $\mathbb{N}$, $\mathbb{Z}$, $\mathbb{Q}$, $\mathbb{R}$,
and $\mathbb{C}$ require you to load the \package{amsfonts} package
(which is automatically loaded by the \texttt{icmmcm} class). These
symbols are generated by \com{mathbb}, which only works in math mode.
Subscripts and superscripts are easy---\verb!$a_n$! produces $a_n$,
and \verb!$x^2$! produces $x^2$. Ordinal numbers, such as
$3^{\textrm{rd}}$, $n^{\textrm{th}}$, and so forth,\footnote{Some
fonts may include their own ordinals that can be accessed with
special commands.} can be produced with code like
\verb!$3^{\textrm{rd}}$!, \verb!$n^{\textrm{th}}$!.
Equation~\ref{eq:superscript} shows a formula with a superscript.
\begin{equation}
\label{eq:superscript}
\int_{0}^{\pi} \, \cos^{2n+1} x \, {\rm d} x = 0 \qquad
\forall \, n \in \mathbb{N}.
\end{equation}
Notice that \com{cos} produces a nice roman ``$\cos$'' within math
mode. There are similar commands for common functions like \com{log},
\com{exp}, and so forth. More can be defined with the
\com{DeclareMathOperator} command provided by the \package{amsmath}
package.
You can stack symbols over other symbols. In math formulas,
\begin{equation}
m\ddot{x} + \gamma\dot{x} + kx = 0,
\end{equation}
or to produce diacritical accents, as in
\begin{quote}
Paul Erd\H{o}s s'est reveill\'{e} t\^{o}t pour enseigner le
fran\c{c}ais \`{a} son fr\`{e}re et sa s\oe{}ur.
\end{quote}
\LaTeX{} has lots of Greek letters and ellipses too, some of which are
shown in Figure~\ref{fig:greek-symbols}.
\begin{figure}
\begin{center}
\begin{equation}
\sqrt{
\left[
\begin{array}{cccccc}
\alpha & \beta & \gamma & \delta & \epsilon & \zeta \\
\eta & \theta & \iota & \kappa & \lambda & \mu \\
\nu & \xi & o & \rho & \pi & \sigma \\
\tau & \upsilon & \phi & \chi & \psi & \omega \\
\Gamma & \Delta & \Theta & \Lambda & \Xi & \Pi \\
\Sigma & \Upsilon & \Phi & \Psi & \Omega & \varphi\\
\cdots & \ldots & \vdots & \ddots & : & \cdot
\end{array}
\right ] }.
\end{equation}
\end{center}
\caption[Greek letters and some symbols]{Greek letters and some symbols.}%
\label{fig:greek-symbols}
\end{figure}
See \cite{gratzer-mil}, pp.~455--474, or \cite{kopka-daly-guide},
pp.~123--127, for lists of the symbols available. Intext, you might
see some of these symbols used as
\begin{quote}
The Strong Induction Principle asserts that if a statement holds for
the integers $1$,~$2$,\dots,~$n$, and if whenever it holds for $n =
1$, \dots,~$k$ then it also holds for $n = k+1$, then the statement
holds for the integers $1$,~$2$,~$3$, $\ldots\,$ Using this
Principle, it can be shown that $1+2+\cdots+n = n(n+1)/2$ for all
positive integers~$n$.
\end{quote}
Notice that in the lists of integers, the ellipsis was made using the
\com{ldots} command, and that the periods were nicely spaced between
the commas. In the sum, the dots were made with \com{cdots} and were
centered on the line. The \package{amsmath} package provides a
``smart'' \com{dots} command that can generally get things right based
on the context.
So, with \com{dots} alone, the previous examples come out as
\begin{quote}
$1$,~$2$,~\dots,~$n$\\
$n = 1$, \dots,~$k$\\
$1$,~$2$,~$3$, $\dots\,$\\
$1+2+\dots+n = n(n+1)/2$
\end{quote}
The general $n \times n$ matrix can be typeset as follows:
\begin{equation}
\left[
\begin{array}{cccc}
a_{11} & a_{12} & \ldots & a_{1n}\\
a_{21} & a_{22} & \ldots & a_{2n}\\
\vdots & \vdots & \ddots & \vdots\\
a_{n1} & a_{n2} & \ldots & a_{nn}\\
\end{array}
\right].
\end{equation}
A fine point: lists of numbers that you're using in a mathematical
sense (as opposed to dates, numbers of objects, etc.) should be typed
in math mode. For example, $341$, $541$, $561$, and $641$. The same
numbers without math mode are 341, 541, 561, and 641. Depending on
the fonts and packages that you're using, you may notice a little bit
more space around the first set than the second. With some packages,
numbers intext may be set using old-style figures by default, as in
\oldstylenums{341}, \oldstylenums{541}, \oldstylenums{561}, and
\oldstylenums{641}. %%% But without the \oldstylenums commands!
\subsection{More Math}
In Fourier analysis, we talk about the $z$-domain.
If $a$ is an even number, then
\[ a + \phi(a) < \frac{3 a}{2}, \]
and
\[ \sigma(a) > \frac{2^{\alpha+1}-1}{2^{\alpha}} \, a \geq \frac{3
a}{2}, \]
where $\alpha$ is the greatest power of 2 that divides $a$, $\phi(a)$
is the number of integers less than $a$ and relatively prime
to $a$, and $\sigma(a)$ is the sum of the divisors of $a$ (including
$1$ and $a$).
Typeset a piecewise function using the \env{cases} environment (from
the \package{amsmath} package) as follows:
\[ |x| =
\begin{cases}
x, & {\rm if~}x \geq 0;\\
-x, & {\rm otherwise.}\\
\end{cases}
\]
In frosh physics, students come to know the true meaning of
$\mathbf{F} = m \mathbf{a}$, $E = mc^{2}$, and $-\frac{\hbar^{2}}{2m}
\nabla^{2} \psi + V \psi = i \hbar \frac{\partial \psi}{\partial t}$.
\subsection{Aligning Equations}%
\label{sec:aligning-equations}
In days gone by, people used the \env{eqnarray} environment to align
equations. \env{eqnarray} has generally been replaced by \env{align}
and some variants such as \env{flalign}, which places the leftmost
column as far left as possible and the rightmost column as far right
as possible; \env{alignat}, which allows you to specify the spacing;
and more. See \cite{amsmath-doc}, \cite{gratzer-mil}, \cite{lamport},
or \cite{kopka-daly-guide} for more information about the
alternatives.
In Equations~\ref{eq:eqnarray}--\ref{eq:eqnarray-last}, the $=$ signs
have been aligned using the \env{eqnarray} environment.
\begin{eqnarray}{3}%
\label{eq:eqnarray}
x^4 + \frac{1}{x^4} & = & x^4 + 4 x^2 + 6 + \frac{4}{x^2} + \frac{1}{x^4} -
4 x^2 - 6 - \frac{4}{x^2}\\
& = & \left( x + \frac{1}{x} \right)^4 - 4 x^2 - 6 - \frac{4}{x^4}\\
& = & \left( x + \frac{1}{x} \right)^4 - 4 x^4 - 8 - \frac{4}{x^4} + 8 - 6\\
& = & \left( x + \frac{1}{x} \right)^4 - 4 \left( x + \frac{1}{x} \right)^2
- 6.%
\label{eq:eqnarray-last}
\end{eqnarray}
Equations~\ref{eq:align}--\ref{eq:align-last} show the same set
of equations aligned with the \env{align} environment.
\begin{align}{3}%
\label{eq:align}
x^4 + \frac{1}{x^4} &= x^4 + 4 x^2 + 6 + \frac{4}{x^2} + \frac{1}{x^4} -
4 x^2 - 6 - \frac{4}{x^2}\\
&= \left( x + \frac{1}{x} \right)^4 - 4 x^2 - 6 - \frac{4}{x^4}\\
&= \left( x + \frac{1}{x} \right)^4 - 4 x^4 - 8 - \frac{4}{x^4} + 8 - 6\\
&= \left( x + \frac{1}{x} \right)^4 - 4 \left( x + \frac{1}{x} \right)^2
- 6.%
\label{eq:align-last}
\end{align}
\subsection{Adjusting Spacing}%
\label{sec:math-spacing}
Sometimes you need to adjust the spacing and fonts inside integrals.
Typically, the ``d'' (as in $\textrm{d}x$) is set in Roman type.
Rather than
\begin{equation}
\int \int \frac{1}{1-xy} dx dy.
\end{equation}
you want
\begin{equation}
\int \! \! \! \int \, \frac{1}{1-xy} \, \, {\rm d}x \, {\rm d}y.
\end{equation}
The integral signs have been moved together using the ``negative
space'' command \com{!}. Extra space has been added between the
elements of integration, $\textrm{d}x$ and $\textrm{d}y$, and between
those elements and the integrand with the ``thin space'' command,
\com{,}.
Table~\ref{tab:math-spacing} shows the different spacing commands
available in math mode. There are additional spacing commands
provided by the \package{amsmath} package, not shown here.
\begin{table}[htbp]
\centering
\begin{tabular}{llll}
\toprule
& &\multicolumn{2}{l}{\LaTeX\ Command}\\
\cmidrule(l){3-4}
\multicolumn{2}{l}{Name} & Short & Long \\
\midrule
\multicolumn{2}{l}{Positive Space} \\
\quad{}& thinspace & \com{,} & \com{thinspace} \\
& medspace & \com{:} \\
& thickspace & \com{;} \\
& 1 em & & \com{quad} \\
& 2 em & & \com{qquad} \\
\addlinespace
\multicolumn{2}{l}{Negative Space} \\
& thinspace & \com{!} & \com{negthinspace} \\
\bottomrule
\end{tabular}
\caption[\protect\LaTeX\ math spacing commands]{\protect\LaTeX\ math spacing commands.}%
\label{tab:math-spacing}
\end{table}
\subsection{Specifying Equation Numbers or Names}%
\label{sec:specifying-eq-numbers}
All the equations you've seen so far are numbered consecutively. You
can specify a number (or name) for a single equation by placing the
formula in a display math environment (but not an \env{equation}
environment) and giving the desired number or name as the argument to
an \com{eqno} command. For example,
\[ \int_{0}^{\infty} \! e^{-x^{2}} \, {\rm d}x =
\frac{\sqrt{\pi}}{2}. \eqno (42), \]
or
\[ \int_{0}^{\infty} \! e^{-x^{2}} \, {\rm d}x =
\frac{\sqrt{\pi}}{2}. \eqno (\textrm{cool formula}), \]
Note that you have to specify parentheses in the argument to the
\com{eqno} command. If you name a formula, you also have to enclose
the text within a command such as \com{mathrm}, or it will be set as
if it was a string of variables (and without any spaces).
If you'd like to have many aligned equations without numbers, use the
starred form of the \env{align} environment, \env{align*}, as in
\begin{quote}
The area $K$ of $\triangle ABC$ is given by
\begin{align*}
K &= \frac{a h_{a}}{2}\\
&= \frac{a b}{2} \sin C\\
&= rs\\
&= \sqrt{s (s-a) (s-b) (s-c)}\\
&= \frac{a b c}{4 R}\\
&= \frac{a^{2} \sin B \sin C}{2 \sin A}\\
&= 2 R^{2} \sin A \sin B \sin C,
\end{align*}
where $A$, $B$, and $C$ are the angles in $\triangle ABC$, $r$ is the
radius of the inscribed circle, $R$ is the radius of the circumscribed
circle, $s$ is one-half of the perimeter, and $h_{a}$ is the length of
the altitude from the vertex $A$ to the side $BC$.
\end{quote}
\subsection{Sizing Delimiters}%
\label{sec:sizing-delimiters}
The \com{left} and \com{right} commands, followed by a bracket, brace,
or parenthesis, tell \TeX\ to adjust the size of the delimiter to its
contents.
\begin{equation}
f(x) = \left(1 + \left(1 + x \right)^{2} \right)^{n}.
\end{equation}
You can also use commands such as \com{big}, \com{Big},
\com{bigg}, or \com{Bigg} to specify larger delimiters (useful if
you have multiple levels of delimiters), as in
\[ \big( \quad \Big( \quad \bigg( \quad \Bigg( \]
or
\[ \Bigg( \bigg( \Big( \big( \, ( a + b ) + c \big) + d \Big) + e \bigg) + f \Bigg) \]
\subsection{Theorems}%
\label{sec:theorems}
The \env{theorem} environment is an easy way to typeset theorems in
the text. To use it, type a \com{newtheorem} command in the preamble
of your document like
\begin{verbatim}
\newtheorem{Theo1}{Theorem}
\end{verbatim}
You can then type a theorem using your theorem environment.
This document includes three such definitions,
\begin{verbatim}
\newtheorem{Theo1}{Theorem}
\newtheorem{Theo2}{Theorem}[section]
\newtheorem{Lemma}[Theo2]{Lemma}
\end{verbatim}
which show you some of the possibilities available. Examples of each
appear below.
\subsubsection{A \env{Theo1} Environment}
\begin{Theo1}
The equation $x^4 + y^4 = z^4$ has no solutions where $x$, $y$, and $z$ are
positive integers.
\end{Theo1}
\subsubsection{A \env{Theo2} Environment}
\begin{Theo2}[Wilson]
% Wilson is the title of this theorem
A positive integer $p$ is prime if and only if
$$(p-1)! \equiv -1 \pmod{p}.$$
\end{Theo2}