-
Notifications
You must be signed in to change notification settings - Fork 0
/
module2.html
450 lines (392 loc) · 17.5 KB
/
module2.html
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
<!doctype html>
<!--
This single-page template is used for each learning module.
-->
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="LaTeX101 landing page">
<title>LaTeX101 Learning Module</title>
<!-- Bootstrap core CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<!-- Additional scripts required for collapse, etc. -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<style>
.bd-placeholder-img {
font-size: 1.125rem;
text-anchor: middle;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
@media (min-width: 768px) {
.bd-placeholder-img-lg {
font-size: 3.5rem;
}
}
.dm-code {
background:azure;
}
</style>
<script type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_CHTML">
console.log("downloading mathjax")
</script>
</head>
<body>
<nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark">
<a class="navbar-brand" href="..">dmackinnon1.github.io</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="./">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="dropdown01" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Modules</a>
<div class="dropdown-menu" aria-labelledby="dropdown01">
<a class="dropdown-item" href="./module0.html">0: What is LaTeX?</a>
<a class="dropdown-item" href="./module1.html">1: Getting Started</a>
<a class="dropdown-item" href="./module2.html">2: Essential LaTeX Commands</a>
<a class="dropdown-item" href="./module3.html">3: LaTeX on Various Platforms</a>
<a class="dropdown-item" href="./module4.html">4: Cloud-based LaTeX Environments</a>
<a class="dropdown-item" href="./module5.html">5: LaTeX as a Digital Literacy</a>
</div>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="dropdown02" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Utilities</a>
<div class="dropdown-menu" aria-labelledby="dropdown02">
<a class="dropdown-item" href="./quiz.html">Command Quiz</a>
<a class="dropdown-item" href="./simpleLaTeX.html">LaTeX Tester</a>
</div>
</li>
</ul>
</div>
</nav>
<main role="main">
<div id='top_padding'>
<br/><br/><br/>
</div>
<div class="container">
<!-- Row 1 introduction -->
<h1> Module 2: Essential LaTeX Commands </h1>
<div class="row" id="contents">
<div class="col-md-8">
<h2>Contents</h2>
<ul>
<li><a href="#goals">Learning Goals</a></li>
<li><a href="#before">Before You Start</a></li>
<li><a href="#main">Essential LaTeX Commands</a></li>
<li><a href="#more">Learn More</a></li>
<li><a href="#check">Checklist</a></li>
<li><a href="#references">References</a></li>
</ul>
</div>
</div>
<hr>
<div class="row" id="goals">
<div class="col-md-8">
<h2>Learning Goals</h2>
<p> The learning goals for this module include:
<ul>
<li>Learn about the basic command structure of LaTeX.</li>
<li>Learn some specific commands that are useful for high school mathematics teachers.</li>
<li>Find out where to look for LaTeX command references.</li>
<li>Practice using the commands using the <a href = "./simpleLaTex.html">Simple Renderer</a> and <a href="./quiz.htm"l>Command Quiz</a> utilities.</li>
</ul>
</p>
</div>
</div>
<hr>
<div class="row" id="before">
<div class="col-md-8">
<h2>Before You Start</h2>
<p> A good understanding of LaTeX comes from appreciating both the problem it is solving and
the kind of solution it provides.
</p>
<p>
<ol>
<li> Reflect on some of the symbols and notation that you use when writing mathematics: greek letters,
exponents, subscripts, radical signs... can you think of some others?</li>
<li> Have you used or read about languages used in computer programming? LaTeX is sometimes
described as a <strong>descriptive markup language</strong>. Take a moment to look at the Wikipedia
entry on <a href="https://en.wikipedia.org/wiki/Markup_language" target="_blank">markup languages</a>. </li>
</ol>
</p>
<p> As you work through this module, you can use the <a href = "./simpleLaTeX.html">Simple Renderer</a> to test commands, and when
you feel like assessing how much you have learned, try the <a href="./quiz.html">Command Quiz</a>.
</p>
<p> For each new command you learn, consider building the document that you started for <strong>Exercise 1</strong> in module 1. </p>
</div>
</div>
<hr>
<div class="row" id="main">
<div class="col-md-8">
<h2>Essential Commands</h2>
<p> In this document, we will describe commands assuming that you are using them within LaTeX's <strong>math mode</strong>.
If you are writing an entire LaTeX document, you need to mark the beginning and end of this mode within your document. In
many online environments and simple equation editors, you do not need to do this. Additional details on
math mode are provided module 4.
<h3> Two Important Characters </h3>
<p>
Because LaTeX is included directly in documents, there has to be some way to tell the difference between LaTeX commands and
normal words within the document. This is what the <strong>backslash</strong> (\) accomplishes - most LaTeX commands are prefixed
by the backslash, which functions as an <a href="https://en.wikipedia.org/wiki/Escape_character" target="_blank">escape character</a>.
</p>
<p> Not all math commands require a backslash. Exponents are created using the carrot (^) and subscripts are created using the underscore(_)
without being prefixed by a backslash. </p>
<p> The following snippet shows the use of underscore, carrots and a command requiring backslash (\theta).
<div class="dm-code">
<pre>
x_0 = \theta^2
</pre>
</div>
Which is rendered by LaTeX as:
\[ \large{x_0 = \theta^2} \]
</p>
<p> The other special character(s) that you need to be aware of are the <strong>curly braces</strong> ({}). These are used to
block off a set of LaTeX commands that need to be considered as one unit, or if values need to be provided to
be included as part of another command. If you need to include curly braces as part of the displayed math, you
must prefix them with a backslash.
</p>
<p> The following snippet shows the use of curly braces to create an exponent with more than one symbol.
<div class="dm-code">
<pre>
e^{i\theta} = \cos(\theta) + i\sin(\theta)
</pre>
</div>
Which is rendered by LaTeX as:
\[ \large{e^{i\theta} = \cos(\theta) + i\sin(\theta)} \]
</p>
<p> This next example shows how to include curly braces in the displayed math by
prefixing them with a backslash:
<div class="dm-code">
<pre>
\{\theta \in \textbf{R} | -\pi \leq \theta \leq \pi \}
</pre>
</div>
Rendered by LaTeX as:
\[ \large{\{\theta \in \textbf{R} | -\pi \leq \theta \leq \pi \}} \]
</p>
<br>
<h3> Finding the Right Command </h3>
<p> The above examples used many commands, like <strong>\theta</strong>, <strong>\pi</strong>, <strong>\leq</strong>, and others. There are commands
for virtually every symbol and notation that you might need - some of them are obvious,
as is the case for the greek letters, and some are memorable, like <strong>\leq</strong> for "less than or equal to."
Generally, you will need to look up commands using a reference. A <a href="https://oeis.org/wiki/List_of_LaTeX_mathematical_symbols" target="_blank">good listing</a> is available
at the <a href="https://oeis.org/" target="_blank">Online Encyclopedia of Integer Sequences (OEIS)</a> - an interesting site to check out, if
you have the time.
</p>
<p> Some commands, like <strong>\cos</strong> and <strong>\sin</strong> do not seem to do much - but they do let LaTeX know
that cos and sin are not just words, but functions - this causes them to be rendered not italicised,
whereas any word or letter without a backslash will be put in italics inside an equation (like the
variable x in the examples). In this way, LaTeX is helping to ensure that standard mathematical
communication practices are followed. The <strong>\textbf</strong> is another example of how we can
follow mathematical conventions by bolding the letter that represents the set of real numbers.
<h3> Fractions </h3>
<p>Fractions are difficult to write without the help of something like LaTeX, and also provide
a good example of a command that requires parameters. In this case, to write a fraction,
we need to provide two values, the numerator and the denominator. We do this in LaTeX like this:
<div class="dm-code">
<pre>
\frac{9}{10}
</pre>
</div>
Which is rendered as:
\[ \large{\frac{9}{10}} \]
</p>
<p>
The two sets of curly braces are required here to supply values for the numerator and the denominator.
Of course, we sometimes need to include fractions in more complicated expressions, like this one,
which shows the formula for a binomial coefficient:
<div class="dm-code">
<pre>
\binom{n}{r} = \frac{n!}{r!(n-r)!}
</pre>
</div>
Which is rendered by LaTeX as: <br>
\[ \large{\binom{n}{r} = \frac{n!}{r!(n-r)!}} \]
</p>
<p>
More involved fractions, and continued fractions, are supported by the <strong>\cfrac</strong>
command, whose use provides a good example of nesting commands. For example,
<div class="dm-code">
<pre>
a_0 + \cfrac{1}{a_1 + \cfrac{1}{a_2+\cfrac{1}{a_3}}}
</pre>
</div>
is rendered by LaTeX as: <br>
\[ \large{a_0 + \cfrac{1}{a_1 + \cfrac{1}{a_2+\cfrac{1}{a_3}}}} \]
</p>
<br>
<h3> Radicals </h3>
<p> Some LaTeX commands require special parameters that are identified using square
brackets. The radical sign is one of these. When used on its own, it is the conventional
square root<\p>
<div class="dm-code">
<pre>
y = \sqrt{x}
</pre>
</div>
which displays as: <br>
\[ \large{y = \sqrt{x}} \]
</p>
<br>
When a value is provided using square brackets, we can display other roots, for example:
<div class="dm-code">
<pre>
\sqrt[n]{x} = x^{\frac{1}{n}}
</pre>
</div>
which displays as: <br>
\[ \large{\sqrt[n]{x} = x^{\frac{1}{n}} } \]
</p>
<br>
<h3> Some More Advanced Notation </h3>
<p>
To format something like a matrix, we need
some way of creating a table structure, and some way of creating
large square brackets to surround the table.
The need to create Tables in LaTeX occurs in several settings, and matrix
mode provides a good example of how they are created. There are several
more advanced formatting situations that require a special mode. These
modes are indicated by the <strong>\begin</strong> and <strong>\end</strong>
commands, which take the name of the mode as an argument. In matrix mode, ampersands (&)
are used to denote columns or tab-alignments, while the double backslash (\\) is
used to denote the end of a row. A matrix then, is created like this:
<div class="dm-code">
<pre>
\left[\begin{matrix}
a & b & c \\
d & e & f \\
g & h & i
\end{matrix}\right]
</pre>
</div>
Which is rendered by LaTeX as: <br>
\[ \large{
\left[\begin{matrix}
a & b & c \\
d & e & f \\
g & h & i
\end{matrix}\right]} \]
</p>
<p> The <strong>\left</strong> and <strong>\right</strong> commands are used in front of
a bracket to signal that they should be adjusted to enclose the notation between them.
</p>
A similar structure (the <strong>align</strong> mode) is used to get the correct alignment in multi-line equations.
For example:
<div class="dm-code">
<pre>
\begin{align}
\Delta x & = x_2 - x_1 \\
& = 9-2 \\
& =7
\end{align}
</pre>
</div>
Which is rendered by LaTeX as: <br>
\[ \large{\begin{align}
\Delta x & = x_2 - x_1 \\
& = 9-2 \\
& =7
\end{align}} \]
<p> A good overview of more advanced math formatting is provided by the
<a href= "https://en.wikibooks.org/wiki/LaTeX/Mathematics" target="_blank">LaTeX Wikibook</a>.
</div>
</div>
<hr>
<div class="row" id="more">
<div class="col-md-8">
<h2>Learn More</h2>
<ul>
<li>
Try out each of the examples above using the <a href="./simpleLaTeX.html">Simple LaTeX Renderer</a>. Experiment by
changing each example.
</li>
<li> Look over the commands listed on the <a href="https://oeis.org/wiki/List_of_LaTeX_mathematical_symbols" target="_blank"> OEIS wiki</a>. Choose some that you think
you might want to use and <a href="./simpleLaTeX.html">test them out</a>.
</li>
<li> Give the <a href="./quiz.html">Command Quiz</a> a try.</li>
<li> Review the page on Mathematics notation in the <a href= "https://en.wikibooks.org/wiki/LaTeX/Mathematics" target="_blank">LaTeX Wikibook</a>.
</ul>
</div>
</div>
<hr>
<div class="row" id="check">
<div class="col-md-8">
<h2>Learning Checklist</h2>
<p>
Before moving on to the next module, take a moment to review the learning checklist.
</p>
<p>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="defaultCheck1">
<label class="form-check-label" for="defaultCheck1">
I tried several examples from this page using a LaTeX renderer or equation editor.
</label><br>
<input class="form-check-input" type="checkbox" value="" id="defaultCheck2">
<label class="form-check-label" for="defaultCheck2">
I experimented with additional examples from the referenced sources, like the OIES page
or the LaTeX Wikibook.
</label><br>
<input class="form-check-input" type="checkbox" value="" id="defaultCheck3">
<label class="form-check-label" for="defaultCheck3">
I gave the <a href="./quiz.html">Command Quiz</a> a try.
</label><br>
<input class="form-check-input" type="checkbox" value="" id="defaultCheck4">
<label class="form-check-label" for="defaultCheck4">
I updated my own document with some useful LaTeX command examples.
</label><br>
</div>
</p>
<p> If there were any items in the checklist that you did not complete,
consider reviewing this page again before moving on.
</p>
</div>
</div>
<hr>
<div class="row" id="references">
<div class="col-md-8">
<h2>References</h2>
<p> Forgues, D. and other OEIS contributors. (2013,2019). List of LaTeX mathematical symbols.
from OIES Wiki. Retrieved March 17, 2019 from
<a href="https://oeis.org/wiki/List_of_LaTeX_mathematical_symbols" target="_blank">
https://oeis.org/wiki/List_of_LaTeX_mathematical_symbols</a>
</p>
<p>
Wikipedia contributors. (2019, March 7). Markup language. In Wikipedia, The Free Encyclopedia. Retrieved 19:13, March 17, 2019, from
<a href="https://en.wikipedia.org/w/index.php?title=Markup_language&oldid=886646213" target="_blank">
https://en.wikipedia.org/w/index.php?title=Markup_language&oldid=886646213</a>
</p>
<p>
LaTeX Project. (2019) <em>An introduction to LaTeX</em>. Webpage. Retrieved February 27, 2019 from
<a href="https://www.latex-project.org/about/" target="_blank">https://www.latex-project.org/about/</a>
</p>
<p>
LaTeX/Introduction. (2019, February 4). Wikibooks, The Free Textbook Project. Retrieved March 15, 2019 from
<a href= "https://en.wikibooks.org/w/index.php?title=LaTeX/Introduction&oldid=3514336" target="_blank">
https://en.wikibooks.org/w/index.php?title=LaTeX/Introduction&oldid=3514336</a>.
</p>
</div>
</div>
<hr>
</div> <!-- /container -->
</main>
<footer class="container">
<div class="btn-group" role="group" aria-label="nav-buttons">
<button type="button" class="btn btn-outline-secondary"><a href="./module1.html">Back</a></button>
<button type="button" class="btn btn-outline-secondary"><a href="./">Home</a></button>
<button type="button" class="btn btn-outline-secondary"><a href="./module3.html">Next</a></button>
</div>
</footer>
<script>
MathJax.Hub.Typeset();
</script>
</html>