-
Notifications
You must be signed in to change notification settings - Fork 2
/
example.tex
659 lines (550 loc) · 24.4 KB
/
example.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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% LaTeX Example
%% Copyright (C) 2016 Joshua Ellis
%%
%%
%% This LaTeX file is free: you can redistribute it and/or modify it under the
%% terms of the GNU General Public License as published by the Free Software
%% Foundation, either version 3 of the License, or (at your option) any later
%% version.
%%
%% This is distributed in the hope that it will be useful, but WITHOUT ANY
%% WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
%% A PARTICULAR PURPOSE. See the GNU General Public License for more details.
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% HEADER
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% In general, LaTeX commands start with `\` and consist of letters only.
%% Optional parameters are specified in brackets `[]`, whilst compulsory
%% arguments (if any) are specified in braces `{}`. (Strictly speaking, this is
%% only a convention and packages can use other things. One notable example is
%% the Beamer package which adds extra optional arguments with `<>'.)
%%
%% LaTeX is generally insensitive to whitespaces including newlines. So if a
%% functions takes a lot of arguments or has many options, it can be easily
%% split across lines without repercussions. The one important exception is
%% that full empty lines mark the end/start of a paragraph.
%% All LaTeX documents begin with the the `\documentclass` command which serves
%% to set the general style of the document. It defines the page layout, the
%% chapter/section styles, how figures appear, etc. and may provide some
%% additional environments too. LaTeX comes with four main classes: `article`,
%% `report`, `book` and `letter`.
%%
%% The [KOMA-script](https://www.ctan.org/pkg/koma-script) package provides
%% alternatives to replacements for the default classes (`scrartcl`, `scrreprt`,
%% `scrbook`, `scrlttr2`) and provides a lot of options to more easily customize the
%% layout of the page.
\documentclass[
a4paper, % The size of the layout
11pt, % The font size (10pt, 11pt, 12pt)
oneside, % Whether the document is one-sided or two-sided
onecolumn, % Whether to have one or two columns in the layout
bibliography=totoc, % Adjust how the bibliography appears in ToC
final, % As opposed to draft (which speeds up compilation)
]{scrartcl}
%% Note all of these optional arguments are required; in fact, most of the ones
%% specified here would have been chosen by default if left unspecified. There
%% are also some other options which have not be specified but they are
%% documented in the [KOMA-script](https://www.ctan.org/pkg/koma-script)
%% documentation.
%%
%% One of the important options in the list above is `draft`/`final`. If draft
%% mode is enabled, LaTeX and most packages will disable features which take up
%% a lot of time in order to speed up compilation. Draft mode also highlights
%% certain error in the output document. On the other hand, final mode enables
%% all features which will increase (sometimes quite significantly) the
%% compilation time of the document.
%% The part of the document starting from here through to the `\begin{document}`
%% command is called the preamble. This is where you include additional
%% packages which provide additional functionalities. Below are many packages
%% which I use on a semi-regular basis.
%%
%% Although you'll find that they are all enabled below, this is for the sake of
%% checking compatibility between all the packages. It is advisable to only
%% enable those packages you actually need as this will speed up compilation,
%% and decrease the likelihood that two packages conflict.
%%
%% All packages are available from the Comprehence TeX Archive Network (CTAN) at
%% http://ctan.org. Quite often, for each `\usepackage{pkg-name}`, it is
%% possible to go to http://ctan.org/pkg/pkg-name in order to find information
%% about the package (there are a few exception to this though, in which case a
%% Google search will suffice).
%%
%% Although you'll know the reason for including a package initially, most
%% people will forget this initial reason after a few months. It is a **VERY**
%% good idea to have a small comment next to *EVERY* `\usepackage` giving a
%% quick recap as to what this package does. This will be invaluable in case
%% you include two packages which conflict each other.
%% For the vast majority of packages, the order in which they are loaded does
%% not matter. There are a few exceptions though, mostly relating to the
%% various referencing packages (hyperef, cleveref, ...). The following package
%% must be loaded first and provides some additional functionalities to other
%% packages.
\usepackage{etex}
\usepackage{ifluatex} % Provides the command \ifluatex
%% Formatting
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{geometry} % Customize text width, page height, margins, etc.
\geometry{
%% See the geometry package's documentation for all the options available
textwidth=13cm,
}
\usepackage{multicol} % {multicols}{n} environment
\usepackage{pdflscape} % {landscape} environment
\usepackage{pageslts} % Improved page numbering
\usepackage{enumitem} % Easily customize lists
\usepackage{setspace} % Line spacing
\singlespacing
% \onehalfspacing
% \doublespacing
%% Change the formatting of titles and sections.
\setkomafont{part}{\normalfont\scshape\Huge}
\setkomafont{partnumber}{\normalfont\scshape\huge}
\setkomafont{section}{\normalfont\Huge}
\setkomafont{subsection}{\normalfont\huge}
\setkomafont{subsubsection}{\normalfont\Large}
\setkomafont{paragraph}{\normalfont\large\scshape}
%% Change the formatting of section entries in the table of contents
\setkomafont{sectionentry}{\scshape}
%% Modify the indentation at the start of each paragraph.
\setlength{\parindent}{1em}
%% Font
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{microtype} % Fine small typographical details
\usepackage{realscripts} % Use the font's sub- and superscripts
%% LaTeX allows for some if-else statements. It is very rare that you'll have
%% to use them, though this is one example since we only want to include a
%% particular package if this example is compiled with LuaLaTeX.
\ifluatex
\usepackage{fontspec} % Allows for any font to be specified
% Change the main font
\setmainfont{EB Garamond}[
Contextuals={Alternate},
% Ligatures={Historic},
Ligatures={Rare},
Numbers=OldStyle,
% CharacterVariant={1}, % historical s
% CharacterVariant={3}, % historical j
% CharacterVariant={6}, % guillemets
% CharacterVariant={11}, % distinguish i and 1
% CharacterVariant={21}, % a
% CharacterVariant={27}, % g
ItalicFeatures={
CharacterVariant={4}, % &
CharacterVariant={5:3}, % v
}
]
% Change the mono-space font
\setmonofont{Inconsolata-g}[
Scale=MatchLowercase,
]
\else
\usepackage{ebgaramond} % A fall-back that isn't as nice as fontspec
\fi %% marks the end of the if-else statement
\usepackage[cmintegrals,varg]{newtxmath} % Nice math font with Garamond
%% Languages
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[UKenglish]{babel} % Set up the language
\usepackage[style=british]{csquotes} % Advanced handling of quotes
\usepackage[perpage,symbol*]{footmisc} % Have symbols instead of numbers for footnotes
%% siunitx is an incredible useful package to display numbers and their
%% associated units. It also offers extra commands to specify lists and ranges
%% of values with units. Some commands which it provides include:
%% - \SI{quantity}{units}
%% - \SIRange{start}{end}{units}
%% - \SIList{a, b, ..., d}{units}
%% With the units being given as `\kilo\metre\per\year\per\pico\barn`.
\usepackage{siunitx}
%% Adjust the way units are displayed in ranges and units so that they are only
%% mentinoed once.
\sisetup{
range-units=single,
list-units=single,
}
%% Declare a few extra units
\DeclareSIUnit\year{yr}
\DeclareSIUnit\barn{b}
\DeclareSIUnit\fb{\femto\barn}
\DeclareSIUnit\pb{\pico\barn}
%% Graphics & Figure
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Graphics can be included in a LaTeX document with
%%
%% ```
%% \includegraphics[options]{image}
%% ```
%%
%% Usually, the extension for the image is not specified and LaTeX will
%% figure out the best one. It is of course possible to add the extension to
%% specify a particular image.
%%
%% In order to ensure that the image is a particular width, you can use
%% `width=<distance>`. This will also scale the height but keep the aspect
%% ratio (if you also specify the height, the aspect ratio will not be kept).
%% It is tempting to specify an exact distance such as `4cm`; but it is
%% generally better to have a relative distance such as `0.4\linewidth`. This
%% way, the image will scale nicely if the context is changed.
\usepackage{graphicx} % Handle graphics
%% Look for images in the './images/' sub-directory
\graphicspath{{./images/}}
\usepackage{xcolor} % Define and use colours
\usepackage{subcaption} % Subfigures inside a figure
\usepackage{tikz} % Powerful drawing language
\usepackage{pgfplots} % Plotting with LaTeX
\usepackage[compat=1.1.0]{tikz-feynman} % Package to draw Feynman diagram
\pgfplotsset{compat=1.14}
%% TikZ pictures and plots can significantly increase the time it takes to
%% produce the output. The `external` TikZ library library defers the creation
%% of these figures to a sub-process which creates a separate PDF file which is
%% then simply imported into the main document. To call the sub-process, you
%% have to execute the appropriate makefile. If you are using LatexMk, you can
%% use the `.latexmkrc` to automatically do this for you.
%%
%% The following setup works on Linux, and should work on OS X too.
% \usetikzlibrary{external}
% \tikzexternalize[shell escape=-shell-escape, prefix=images/tikz/]
% \immediate\write18{mkdir -p images/tikz/}
% \tikzset{
% external/mode=list and make,
% external/system call={
% lualatex \tikzexternalcheckshellescape -halt-on-error -interaction=batchmode -jobname="\image" "\texsource" || rm "\image.pdf"},
% }
%% Math Packages
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{amsmath} % The core math package
\usepackage{amssymb} % Defines additional math fonts and symbols
\usepackage{mathtools} % Various extra maths functions
\usepackage{dsfont} % A double stroke font (for double stroke 1)
% \usepackage{autonum} % Only number referenced equations (must be loaded after cleverref)
%% Define a new command called \withnumber which forces the line to have number
%% (even if it is referenced elsewhere).
\newcommand\withnumber{\refstepcounter{equation}\tag{\theequation}}
%% Allows page breaks in math (1 = avoid if possible, 4 = whenever). Page
%% breaks can be avoided at particular places by using \\* instead of \\.
\allowdisplaybreaks[2]
%% Tables
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{tabularx} % Improved tabular environment
\usepackage{longtable} % Multipage tables
\usepackage{array} % New column types, including >x<
\usepackage{booktabs} % Provides nicer horizontal lines
\usepackage{multirow} % Allows cells to span multiple rows
\usepackage{longtable} % Allows for tables to span multiple pages
%% Define the maths version of clr columns.
\newcolumntype{C}{>{\(}c<{\)}}
\newcolumntype{L}{>{\(}l<{\)}}
\newcolumntype{R}{>{\(}r<{\)}}
%% When designing tables, it is better to avoid having too many lines. In
%% general, the vertical alignments will suffice to guide the eye and the only
%% horizontal lines present should demarcate particular sections within the
%% table (e.g. the title from the body, and the body from the averages at the
%% bottom). The `booktabs` package provides `\toprule`, `\midrule` and
%% `\bottomrule` for this purpose.
%% Code
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{minted}
%% The following code allows for LaTeX code to be displayed and simultaneously
%% run.
\newenvironment{example}{
\VerbatimEnvironment
\begin{VerbatimOut}{example.out}} % Since we are starting a verb env
{\end{VerbatimOut} % We can't have extra line spaces
% \vspace{\baselineskip}%
\begin{center}
\setlength{\parindent}{0pt}%
\fbox{%
\begin{minipage}{0.9\linewidth}%
\input{example.out}%
\end{minipage}%
}%
\vskip-0.5\baselineskip%
\begin{minipage}{\dimexpr0.9\linewidth + 0.6em\relax}%
\inputminted[
resetmargins,
autogobble,
bgcolor=gray!10!white,
]{latex}{example.out}%
\end{minipage}%
\end{center}
\vspace{-0.8\baselineskip}%
}
%% Define \texinline
\newmintinline[texinline]{latex}{}
%% Linking and Referencing
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{hyperref} % Automatically inserts hyperlinks.
\usepackage{cleveref} % Use `\cref` to reference anything
\usepackage{autonum} % Must be loaded after all *ref packages
%% Define some slightly nicer colors
\definecolor{link-color}{RGB}{96 0 0}
\definecolor{cite-color}{RGB}{0 96 0}
\definecolor{file-color}{RGB}{0 0 96}
\definecolor{url-color}{RGB}{0 0 96}
\definecolor{link-border-color}{RGB}{255 159 159}
\definecolor{cite-border-color}{RGB}{159 255 159}
\definecolor{file-border-color}{RGB}{159 159 255}
\definecolor{url-border-color}{RGB}{159 159 255}
\hypersetup{
%% When `colorlinks` is true, all links will be coloured which looks nice in
%% digital version of the document but not in print. If the document is
%% intended for printing, then `colorlinks` should set to false.
colorlinks=true,
linkcolor=link-color,
citecolor=cite-color,
filecolor=file-color,
urlcolor=url-color,
linkbordercolor=link-border-color,
citebordercolor=cite-border-color,
urlbordercolor=url-border-color,
}
%% Glossary
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% This package requires `makeglossaries` to be run after the initial run of
%% LaTeX so that the glossary is generated and the a second run of LaTeX is need
%% to included the newly generated glossary. (This is automatically handled by
%% Latexmk with the provided .latexmkrc).
%% hyperref should be loaded first
\usepackage[toc]{glossaries}
\usepackage{glossaries-extra}
\setglossarystyle{index}
\setabbreviationstyle[acronym]{long-short-sc}
\loadglsentries{glossary.glos}
\makeglossaries
%% Bibliography
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% hyperref should be loaded first
\usepackage[
%% See the extensive documentation for biblatex for a description of what
%% these options do
autocite=inline,
backend=biber,
biblabel=brackets,
doi=true,
eprint=true,
maxnames=4,
style=phys,
]{biblatex}
%% Add a bib file
\addbibresource{references.bib}
%% Other modifications/package
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{mwe} % Useful for minimal working examples
%% This is not a CTAN package but instead contains a whole lot of small scripts I
%% use nearly all the time.
\usepackage[theorems=false]{jpellis}
%% Document Information
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Define a few shorthand commands. The `makeatletter' and `makeatother' allows
%% the use of '@' in commands which is reserved for hidden functions.
\makeatletter
\newcommand\@degreetitle{}
\newcommand\degreetitle[1]{\renewcommand\@degreetitle{#1}}
\newcommand\@department{}
\newcommand\department[1]{\renewcommand\@department{#1}}
\newcommand\@university{}
\newcommand\university[1]{\renewcommand\@university{#1}}
\newcommand\@keywords{}
\newcommand\keywords[1]{\renewcommand\@keywords{#1}}
\AtEndPreamble{
%% Set the PDF metadata, though this can only be done once they've been all
%% defined which is at the end of the preamble.
\hypersetup{
pdftitle={\@title},
pdfauthor={\@author},
pdfsubject={\@subject},
pdfkeywords={\@keywords},
}
}
\makeatother
%% The \texorpdfstring string will, depending on context, either print proper
%% TeX command (in this case LaTeX will the special kerning), or the plain text
%% fallback. This is useful if you have equation, links or special formatting
%% in titles as the PDF bookmarks can't handle them.
\title{A \texorpdfstring{\LaTeX}{LaTeX} Example}
\subtitle{A Practical Introduction to \texorpdfstring{\LaTeX}{LaTeX}}
\subject{LaTeX}
\keywords{LaTeX, example}
\author{Joshua P.~\textsc{Ellis}}
\degreetitle{Doctor of Philosphy (Physics)}
\department{School of Physics}
\university{The University of Melbourne}
\date{\today}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% DOCUMENT
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
%% Adjust the pagenumbering to capital Latin letters
\pagenumbering{Alph}
%% Title
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% We don't want any page numbers, chapter headings, etc. on the page
\pagestyle{empty}
\begin{titlepage}
\makeatletter
\begin{center}
\vspace*{2.5cm}
{\Huge \@title} \\[0em]
\rule{\linewidth}{2pt}
{\huge \textsc{\@subtitle}} \\[6em]
{\large By} \\[1cm]
{\huge \@author} \\[0.5ex]
{\Large \normalfont \@degreetitle}
\vfill
{\Large \@department} \\[1ex]
{\Large \@university}
\vfill
{\large \@date}
\end{center}
\makeatother
\end{titlepage}
%% Table of Content
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\cleardoublepage
\pagestyle{plain}
\pagenumbering{roman}
\tableofcontents
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% CONTENT
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\cleardoublepage
\pagestyle{headings}
\pagenumbering{arabic}
\section{Introduction}
\label{sec:introduction}
\gls{latex} is a program designed to typeset documents. Unlike programs such as
\href{http://office.microsoft.com/en-au/word/}{Microsoft Word} and
\href{http://www.libreoffice.org/discover/writer/}{Libre\-Office Writer},
\LaTeX{} does not show you what the output looks like to begin with, but
instead, you type what you \emph{mean} and \LaTeX{} then figures out how to best
display this. Most new-comers to \LaTeX{} find this quite daunting and
sometimes annoying, but once familiar with the way \LaTeX{}, it becomes
incredibly powerful.
\subsection{Philosophy}
\label{subsec:philosophy}
The main philosphy behind \gls{latex} is \enquote{what you mean is what you get}
which is in contract to applications such as Microsoft Word and Libre\-Office
Writer which work on \enquote{what you see is what you get}.
To illustrate the difference, suppose we want to emphasize a particular word in
the middle of a sentence. In Word, one would highlight the word and then
italicized and someone new to \LaTeX{} would be tempted to write
\begin{example}
This is a sentence with just \textit{one} word emphasized.
\end{example}
but italics doesn't always equate with emphasis. In printed text, italics are
fine for emphasis, but when it comes to a presentation, bold text and some
colour is more appropriate for emphasis. For this reason, we really ought to be
using the \texinline{\emph} command which is dedicated to emphasize text. As an
example that illustrates the difference, consider an emphasized word within an
emphasized sentence:
\begin{example}
``\emph{Here's an \emph{emphasized} word within a phrase.}''
\end{example}
\subsection{Mathematics}
\label{subsec:mathematics}
One of the greatest strengths of \gls{latex} is its ability to handle
mathematics very nicely. Maths can be inputted in two main ways: inline, or in
dedicated environments.
Inline maths is surrounded by \texinline{\(...\)}, though you'll often see
\texinline{$...$}. For the most part, they are exactly equivalent; however, the
former is preferred as it is proper \LaTeX{} and will mess up less often (for
example, if you accidentally start an inline equation within an inline math
environment). As the name implies, the math is displaying within the text: \(E
= mc^{2}\). It is useful for short equation or to refer to particular symbols.
On the other hand, there are also display maths environments which present the
full equation on its own line:
\begin{equation}
\label{eq:schrodinger_equation}
i \hbar \pfrac{\Psi(\vt x, t)}{t} = - \frac{\hbar^2}{2m} \nabla^2 \Psi(\vt x, t) + V(\vt x, t) \Psi(\vt x, t).
\end{equation}
The display environment come in two main varieties: \texinline{{equation}} and
\texinline{{align}}. The former is used to display a single line, while the
second is useful to display multiple equations:
\begin{subequations}
\label{eq:maxwell_equations}
\begin{align}
\label{eq:gauss_law} \withnumber
\nabla \cdot \vt E &= \frac{\rho}{\varepsilon_0} \\
\label{eq:gauss_law_magnetism} \withnumber
\nabla \cdot \vt B &= 0 \\
\label{eq:maxwell-faraday_equation} \withnumber
\nabla \times \vt E &= - \pfrac{\vt B}{t} \\
\label{eq:ampere_law} \withnumber
\nabla \times \vt B &= \mu_0 \vt J + \mu_0 \varepsilon_0 \pfrac{\vt E}{t}
\end{align}
\end{subequations}
The alignment within the \texinline{{align}} environment is controlled with the
\texinline{&} symbol.
\subsection{Cross-Referencing}
\label{subsec:cross-referencing}
\LaTeX{} takes care of all the referencing with \texinline{\label{...}} to place
a label, and \texinline{\ref{...}} to refer back to a label. With the
\href{http://ctan.org/pkg/cleveref}{cleveref} package, it takes care of
explaining what you're referring to (whether it be a section, equation, figure,
etc.):
\begin{example}
\cref{eq:schrodinger_equation}
% Spaces are counted, the `%` at the end of
% the lines tells LaTeX it ignore them.
\cref{%
eq:gauss_law,%
eq:gauss_law_magnetism,%
eq:maxwell-faraday_equation,%
eq:ampere_law%
}
\cref{sec:introduction,eq:maxwell_equations}
\end{example}
When a reference is invalid (either because of a typo, or because the associated
label doesn't exist), references show up as \enquote{??}.
\subsection{Bibliography}
\label{subsec:bibliography}
\gls{latex}'s referencing capabailities do not end referencing labels within the
document (c.f.~\cref{subsec:cross-referencing}) but can also be used to manage
bibliographies, indices and glossaries (though usually with the help of
additional programs).
One very common use is to manage citations and bibliographies. A fairly common
package for this is \gls{bibtex} which works with \gls{biber}. As with a lot of
other things in \LaTeX{}, the commands automatically takes care of inserting the
proper reference to some article:
\begin{example}
The paper by \citeauthor{Smith2013} \cite{Smith2013}.
\end{example}
\subsection{Glossary}
\label{subsec:glossary}
Glossary entries can be recorded with the \texinline{\gls{...}}, and at the end
of the document \texinline{\printglossaries} displays the glossary and
cross-links each term to the pages on which they are used. This can be useful
to keep track of jargon or certain keywords.
Another useful feature of the glossaries package is its ability to handle
acronyms so that they are defined the first time used, and subsequently the
acronym is used only.
\begin{example}
The \gls{SM} of particle physics \dots{} in the \gls{SM}.
\end{example}
\subsection{Sharing \emph{\&} Contributing}
\label{subsec:sharing_and_contributing}
If you found this little document helpful, please feel free to share it others;
it's completely free! I also welcome suggestions for or modifications to this
document.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% APPENDIX
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\cleardoublepage
\appendix
\pagenumbering{Roman}
\pagestyle{plain}
%% Glossary
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\cleardoublepage
\printglossaries
%% Bibliography
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\cleardoublepage
\pagestyle{plain}
\printbibliography
\end{document}
%%% Local Variables:
%%% TeX-master: t
%%% End: