summaryrefslogtreecommitdiff
path: root/info/startlatex2e/StartLaTeX2e.tex
blob: 846e19b7d89369db31fe53717294ee228b1dd9c9 (plain)
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
%% StartLaTeX2e.tex
%% Copyright 2020 M. P. Morris
%
% 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 “author-maintained”.
% 
% The Current Maintainer of this work is M. P. Morris.
%
% This work consists of the files StartLaTeX2e.tex
% and the derived files StartLaTeX2e.dvi, StartLaTex2e.ps and StartLaTeX2e.pdf.

\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[UKenglish]{babel}
\usepackage[useregional, showdow]{datetime2}
\usepackage[dvips]{graphicx, color}
%\usepackage{lmodern}
\usepackage{pifont}
\usepackage{textcomp}
\usepackage[TS1,T1]{fontenc}
\usepackage{hyphenat}
\usepackage{fancyvrb}
\usepackage{array}
%\usepackage[left=1in, top=1in, bottom=1.25in, right=1in]{geometry}
\usepackage[title]{appendix}

%opening
\title{Getting Started  \\ with \\ \LaTeXe}

\author{Michael P. Morris \footnote { \textcopyright Michael P. Morris, 2020. The distribution and modification of this file is constrained by the conditions of LaTeX Project Public License version 1.3. This work is author maintained. Any error reports for this work can be sent to the author at \texttt{mmorris-500@hotmail.com}.} \\ 
	\texttt{{\footnotesize mmorris-500@hotmail.com}}}

\date{Wednesday 30 September 2020}

\begin{document}

\maketitle

% \thispagestyle{empty}

% \clearpage

% \pagenumbering{roman}

\tableofcontents

\clearpage

\listoffigures

\clearpage

\listoftables

\clearpage

%\pagenumbering{arabic}

\section{Introduction}

LaTeX (pronounced \emph{lah-tek}) is a markup language designed to produce high quality documents. It was created by Donald Knuth who generously released it into the public domain and is freely available from the Comprehensive TeX Archive Network (\textsc{ctan}) at\texttt{ http://www.ctan.org}. Since it’s release it has been greatly added to and there are currently over 5800 add-on packages available. The most recent version is \LaTeXe and LaTeX 3 is under development. 

This document grew from my own efforts to become a proficient LaTeX user. It is not a comprehensive guide to using LaTeX. It is aimed at giving an overview of the elements of how to program a document and then compile it into either postscript or \textsc{pdf} format in English. It is a very bare bones outline of LaTeX and only touches on the possibilities. The best source of information is the package documentation. This is available from \textsc{ctan}. There are also a number of published guides and the reference list contains several useful references. A more comprehensive list of these, and a helpful list of texts on typography is also available from \textsc{ctan}. 

This document focuses on the Windows 10 operating system. Users of unix-alike or Mac systems should consult their OS documentation for issues that are specific to them. There are a large number of packages and some of them overlap in functionality. There are multiple options for citation systems, for document templates and for fonts. The recommendations made in this document reflect my own experiences and prejudices.

I am very interested in hearing about errors and suggestions for improvements, especially code that doesn't function as advertised. These can be sent to the author at \texttt{mmorris-500@hotmail.com}. 

Finally, I'd like to mention The TeX Users Group, of which I am a member. This is a not-for-profit group for those interested in LaTeX. Membership is inexpensive and members are sent TUGboat, the Journal of the Tex Users Group, three times a year, and the TeX Collection on \textsc{dvd} annually. This is a good way of keeping up with developments and also with changes to TeX distributions.




\clearpage


\section{LaTeX Conventions}

\subsection{Distributions}

There are three main LaTeX systems available from \textsc{ctan}: 

\begin{itemize}
\item TeXLive is cross platform and will install on \textsc{unix}-alike, Mac and Windows systems.

\item MacTeX is aimed at Mac OS users.

\item ProTeX is aimed at Windows users.
\end{itemize}

\subsection{Commands}



Commands in LaTeX begin with a \texttt{\textbackslash}. There are two main types: one is for loading packages and specifying options in the preamble, and the other is for formatting text. Packages are loaded with the package name inside the \texttt{\{\}} and options specified inside \texttt{[]}. 

\begin{verbatim}
\[Option1, Option2]{PackageName}
\end{verbatim}

If there are multiple options, they are separated with commas. Text is formatted with

\begin{verbatim}
\Command{Text}
\end{verbatim}

with the text to be formatted placed inside the \texttt{\{\}}. This sometimes causes an error with all the text following a command being formatted in this way. An alternative is

\begin{verbatim}
{\Command Text}
\end{verbatim}


It is always a good idea to annotate your code. Annotations can be added to LaTeX code by starting comment lines with a \texttt{\%}. This will stop LaTeX from running it and returning an error message:

\begin{verbatim}
% This is a comment.
\end{verbatim}


\subsection{Environments}

Environments are used in the body of the document to define a particular behaviour. These range from abstracts, tables and figures, lists and sections of text with differing text justification. LaTeX environments are enclosed with \texttt{\textbackslash begin\{ \}} and \texttt{\textbackslash end\{ \}} A short list of environments are in Table 1:

\begin{verbatim}
\begin{Environment}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla est 
purus, ultrices in porttitor in, accumsan non quam. Nam consectetur 
porttitor rhoncus.
\end{environment}
\end{verbatim}

\begin{table}
	\small
	\begin{center}
		\begin{tabular}{ll}
			\hline
			Environment & Description\\
			\hline
			abstract    & Text of a document’s abstract. \\
			centre      & Centred text. \\
			flushleft   & Left aligned text. \\
			flushright  & Right aligned text. \\
			description & Labelled lists. \\
			enumerate   & Numbered lists. \\
			itemize     & Bulleted lists. \\
			quotation   & Include quotes. \\
			verbatim    & Text in typewriter font that that will appear exactly as typed. \\
			table       & Floating tables. \\
			figure      & Floating figures. \\
			\hline
		\end{tabular}
		\caption{Options for environment}
	\end{center}
\end{table}


The verbatim environment prints the entered text in a typewriter font with no formatting. If the text isn't broken with a <return>, it produces text in one long line. The first 100 digits of pi may appear on your editor as

\begin{flushleft}
\texttt{\textbackslash begin\{verbatim\}}
\begin{verbatim}
The first 100 digits of pi:
3.14159265358979323846264338327950288419716939937510582097494459
23078164062862089986280348253421170679
\end{verbatim}
\texttt{\textbackslash end\{verbatim\}}
\end{flushleft}

but when the document is compiled, it produces

\begin{verbatim}
The first 100 digits of pi:
3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679
\end{verbatim}

This can be fixed by breaking the text into lengths that don't cross into the margins. The location of the breaks are best estimated after the document is compiled. I this number is broken into 25 digit sections 

\begin{flushleft}
\texttt{\textbackslash begin\{verbatim\}}
\begin{verbatim}
The first 100 digits of pi:
3.141592653589793238462643 <return>
38327950288419716939937510 <return>
58209749445923078164062862 <return>
089986280348253421170679
\end{verbatim}
\texttt{\textbackslash end\{verbatim\}}
\end{flushleft}

it produces

\begin{verbatim}
The first 100 digits of pi:
3.141592653589793238462643
38327950288419716939937510
58209749445923078164062862
089986280348253421170679
\end{verbatim}




\subsection{Project Management}

The first step in creating a document with LaTeX is to write the text of the required document and save it as a plain text file into a directory created specifically for that project. This text file is marked up so that when it is compiled it becomes a formatted postscript or \textsc{pdf} document. When it is compiled, LaTeX will produce several other files and this directory will keep all of them together. This directory should also contain any graphic and bibliographical files so that LaTeX can find them.

The task of programming a LaTeX document is made simpler by using an editor. There are quite a few of these: TeXstudio, TeXworks and TeXmaker are freely available and run on Windows, \textsc{unix}-alike and Mac OS systems. Jabref is a freely available reference management program that can help with organising citations.

\subsubsection{Postscript vs \textsc{pdf}}

One of the first options to consider is if the document is to be produced in postscript or \textsc{pdf} format. Both LaTeX and PDFLaTeX will produce postscript, and PDFLaTeX is designed to produce \textsc{pdf} documents. Postscript is the `gold standard’ for printed documents and produces the highest quality files for printing. \textsc{pdf} documents can include hypertext links and live connections to websites, and PDFLaTeX will produce documents that conform to the \textsc{pdf/a} standard with pdfx. This is an \textsc{iso} standard version of \textsc{pdf} and is for archivable electronic documents. \textsc{pdf} files can be produced from postscript files with Ghostscript, but they will be plain text only. Postscript files can be viewed with GSView and pdf files can be viewed by any of the many freely available viewers.




\subsection{Running LaTeX}

When the document is marked up, it is compiled. This can be done either through an editor or manually from the command line. For the command line option to work on Windows, LaTeX and PDFLaTeX must be in the Windows search path. To do this, go to the Control Panel:

Control Panel $\rightarrow$ System and Security $\rightarrow$ System $\rightarrow$ Advanced System Settings $\rightarrow$ Environmental Variables $\rightarrow$ Path in the User Variables box $\rightarrow$ Edit.

Then navigate to the directory containing the binary files and add it to the path. If it is a ProTeX distribution on windows 10 they are in: 

\begin{verbatim}
C:\Program Files\MikTeX2.9\miktex\bin\x64
\end{verbatim}

For other systems, consult the documentation.


LaTeX is run from the command line by navigating to the project folder and then run on the marked up text file. To run it on a file named TestFile.txt: 

\begin{verbatim}
latex TestFile.tex
\end{verbatim}

This produces a DVI file that can be converted to postscript with dvips. If PDF format is preferred

\begin{verbatim}
pdflatex TestFile.tex
\end{verbatim}

produces a file in this format with no intermediate step.

It is more convenient to run this from a \textsc{gui} interface. In TeX Studio, load a marked up text file, then go to Tools $\rightarrow$ Commands $\rightarrow$ LaTeX or PDFLaTeX and it will run automatically.




\subsection{LaTeX Output}

LaTeX must be compiled to produce a readable document. For postscript output, there are two steps.

Step 1: Produce a DVI file.

The first step in compiling a LaTeX document is to produce a \textsc{dvi} file. This can be done either through the command line or an editor with a \textsc{gui} interface. If the file contains a title page, Table of Contents, lists of tables and figures and a bibliography, LaTeX will have to be run multiple times to format them correctly. Biber is also required if the citations are managed with BibLaTeX. To compile TestFile.txt:


\begin{verbatim}
latex TestFile.tex
biber TestFile.tex
latex TestFile.tex
latex TestFile.tex
\end{verbatim}

This creates a .dvi file named TestFile.dvi.

Step 2: Produce a postscript file.

The next step is to convert the \textsc{dvi} file to a postscript file with dvips. The resulting postscript file can be viewed with GSView. 

\begin{verbatim}
dvips TestFile.dvi
\end{verbatim}

converts the TestFile from .dvi to .ps format.

If \textsc{pdf} is required, it can be generated with no intermediate step with PDFLaTeX. This can create a document with hyperlinks, and in \textsc{pdf/a} format.

\begin{verbatim}
pdflatex TestFile.tex
\end{verbatim}


\clearpage





\section{Preamble}


Each LaTeX document has a preamble which contains instructions regarding document type, page size and other options that will affect it as a whole. It is the first part of any document and goes before the body of the text.

The first line of the preamble is

\begin{verbatim}
\documentclass[Options]{DocumentType}
\end{verbatim}

This specifies the type of document to be produced. The base options are article, book, letter or report. After this is selected, options define the size of the font for the document, paper size, number of columns and whether it is to be printed on one side of the page or two. 

The main default options are: a 10pt font size, a paper size of 8.5 x 11", which is the US standard letter size, portrait orientation, a separate title page for the report class but not the others, typesetting in one column, and printing on one side of the page only. 

All these can be customised with the following:

\begin{table}
	\small
	\begin{center}
		\begin{tabular}{ll}
			\hline
			Option               &  Command \\
			\hline
			Document Type        &  \texttt{letter, article, report, book} \\
			Typeface Size (pts)  &  \texttt{10, 11, 12} \\
			Title Page           &  \texttt{titlepage, notitlepage} \\
			Columns              &  \texttt{onecolumn, twocolumn} \\
			Layout               &  \texttt{oneside, twoside} \\
			\hline
		\end{tabular}
		\caption{LaTeX document options.}
	\end{center}
\end{table}


\begin{table}
	\small
	\begin{center}
		\begin{tabular}{lll}
			\hline
			Size   &   Measurement(mm)   &   Command \\
			\hline
			A4         &  210 x 297  &     \texttt{a4paper}   \\
			A5         &  148 x 210  &     \texttt{a5paper}   \\
			B5         &  176 x 250  &     \texttt{b5paper}   \\
			Executive  &  185 x 267  &     \texttt{executivepaper}   \\
			Legal      &  216 x 356  &     \texttt{legalpaper}   \\
			Letter     &  216 x 279  &     \texttt{letterpaper}   \\
			
		\hline
		\end{tabular}
		\caption{LaTeX paper sizes.}
	\end{center}
\end{table}


This creates an article class document with A4 sized paper and a 12 point font. The other options will stay at their default settings:

\begin{verbatim}
\documentclass[12pt, a4paper]{article}
\end{verbatim}

After the document type is defined, packages that will be used in the document are loaded with

\begin{verbatim}
\usepackage[Options]{PackageName}
\end{verbatim}

These commands load fonts, define page layout and numbering, headers and footers and the option to add dates etc. The first package is babel. This package supports hyphenation. It supports about 200 languages, including three dialects of English: \texttt{english} refers to American and Canadian, \texttt{UKenglish} refers to British, and \texttt{australian} refers to Australian and New Zealand English. If the document contains text in multiple languages, they can all be loaded here. The language listed last is the document’s main language:

\begin{verbatim}
\usepackage[french, german, australian]{babel}
\end{verbatim}

This loads French, German and Australian English with Australian being the document's main language. To swap to one of the other languages in the text, use \texttt{\textbackslash selectlanguage\{LanguageName\}} for blocks of text such as paragraphs, and \texttt{\textbackslash foreignlanguage\{LanguageName\}\{Text\}} for text that is part of a paragraph.

\begin{verbatim}
\selectlanguage(french)
French language text.
\selectlanguage(australian)
Returns to Australian English.
\end{verbatim}

or

\begin{verbatim}
\foreignlanguage{french}{French language text.}
\end{verbatim}

will hyphenate the French text.


Dates can be added with datetime2. This package is loaded in the preamble with 

\begin{verbatim}
\usepackage{datetime2}
\end{verbatim}

and the date itself inserted in the text with 

\begin{verbatim}
\today
\end{verbatim}

This will add the date the document was compiled in \textsc{yyyy-mm-dd} format so it will look like 2020-09-19. The format can be changed with the [useregional] option. This will set the date format so that it matches language specified when Babel was loaded. The following code is Australian and will format the timestamp to \textsc{dd mm yyyy}. To add the day of the week, add \texttt{showdow}:

\begin{verbatim}
\usepackage[useregional, showdow]{datetime2}
\end{verbatim}





Fontenc gives access to the glyphs of languages. The default option is OT1. This gives access to 128 glyphs, but doesn’t allow hyphenation of accented characters that appear in other European languages. If the document is in English this doesn’t matter, but if the document contains glyphs from other Western European languages, the encoding should be changed to T1. This encoding contains 256 glyphs. Coding TS1 can also be loaded to give access to text symbols. To load both of these:

\begin{verbatim}
\usepackage[TS1, T1]{fontenc}
\end{verbatim}



\begin{verbatim}
\usepackage{lmodern}
\end{verbatim}

This loads the font for the document, in this case Latin Modern. The default font is Computer Modern and is LaTeX’s original font. This contains 128 glyphs which is fine for documents in English. Latin Modern is an expanded version of this and has many more characters and can cater for non-English European languages that use Latin characters. Table 4 contains a short list of fonts and package names. A comprehensive list of fonts can be found at The LaTeX Font Catalogue at \texttt{www.tug.org}.

\begin{table}
	\small
	\begin{center}
		\begin{tabular}{lll}
			\hline
Font Name               & Package Name & Sample Text \\
\hline
Avant Garde             & \texttt{avant}		   & \fontfamily{pag}\selectfont ipsum dolor sit amet \\
Bookman                 & \texttt{bookman}	   & \fontfamily{pbk}\selectfont ipsum dolor sit amet \\
Charter                 & \texttt{charter}	   & \fontfamily{bch}\selectfont ipsum dolor sit amet \\ 
Computer Modern         & \texttt{cmodern}	   & \fontfamily{cmr}\selectfont ipsum dolor sit amet \\
Helvetica               & \texttt{helvet}       & \fontfamily{phv}\selectfont ipsum dolor sit amet \\
Latin Modern            & \texttt{lmodern}	   & \fontfamily{lmr}\selectfont ipsum dolor sit amet \\
New Century Schoolbook  & \texttt{newcent}	   & \fontfamily{pnc}\selectfont ipsum dolor sit amet \\
Palatino                & \texttt{mathpazo}     & \fontfamily{ppl}\selectfont ipsum dolor sit amet \\
Times New Roman         & \texttt{mathptmx}     & \fontfamily{ptm}\selectfont ipsum dolor sit amet \\
\hline		
		\end{tabular}
		\caption{Some of LaTeX's fonts.}
	\end{center}
\end{table}


Textcomp gives access to more symbols. It is loaded with

\begin{verbatim}
\usepackage{textcomp}
\end{verbatim}



\begin{verbatim}
\usepackage[Options]{geometry}
\end{verbatim}

Margins can be adjusted from the defaults with the geometry package. The left, right, top and bottom margins can all be specified with this, and an allowance made for binding if the document is to be bound. It accepts units in millimetres, centimetres, points and inches (mm, cm, pt, in). The options are:


\begin{table}
	\small
	\begin{center}
		\begin{tabular}{ll}
			\hline
			Option & Comment \\
			\hline
			\texttt{left}          & Left Margin \\
			\texttt{right}         & Right Margin \\
			\texttt{top}           & Top Margin \\
			\texttt{bottom}        & Bottom Margin \\
			\texttt{bindingoffset} & Add space for binding \\
			\texttt{headheight}    & Changes the size of the header \\
			\hline
		\end{tabular}
		\caption{Options for package Geometry.}
	\end{center}
\end{table}


If headers and footers are used in the document, LaTeX may return an error message to say that the headheight is too small. This can be modified with the \texttt{\textbackslash headheight} command. The header is designed to hold a single line of text, but can be adjusted to accommodate multiple lines. The following code sets the left margin at 1.5 inches, the right margin at 1 inch, the top margin at 1 inch, the bottom margin at 1.75 inches and the height for the header to 18 point:

\begin{verbatim}
\usepackage[left=1.5in, right=1.0in, top=1.0in, bottom=1.75in, 
headheight=18pt]{geometry}
\end{verbatim}

These options can be changed mid-document with \texttt{\textbackslash newgeometry\{\}} which specifies the new margins. This reverts back to the original settings with\texttt{ \textbackslash restore\{geometry\}}. This can be done at any point in the document. The \texttt{\textbackslash newgeometry\{\}} command has the same options as those used by geometry in the preamble:

\begin{verbatim}
\newgeometry{left=0.5in, right=0.5in, top=0.5in, bottom=0.5in}
\end{verbatim}

This changes the margins to a uniform 0.5 inches all around.


Plain LaTeX has limited facilities for headers and footers so these are best handled by fancyhdr. This package provides header and footer placement to the left, centre and right and customizable lines for both headers and footers. This package is loaded in the preamble with

\begin{verbatim}
\usepackage{fancyhdr}
\pagestyle{fancy}
\end{verbatim}

There are six locations available: left, centre and right headers and footers. The location and contents of each header or footer is specified as:


\begin{verbatim}
\lhead{\today}
\chead{Top Centre}
\rhead{\thepage}
\lfoot{Bottom Left}
\cfoot{Bottom Centre}
\rfoot{Bottom Right}
\end{verbatim}

The text of the header or footer is contained between the \{\}. These can contain page numbers and dates generated using \texttt{\textbackslash thepage} and \texttt{\textbackslash today} respectively. Decorative lines can be added to both headers and footers with 

\begin{verbatim}
\renewcommand{headrulewidth}{0.5pt}
\renewcommand{footrulewidth}{0.5pt}
\end{verbatim}

This will place a line that is 0.5 points wide beneath the header and above the footer. Line weights can be increased and decreased. For no lines, specify the line weight as 0.0pt.

The following code loads fancyhdr and places a running header or title top left, page numbers top right and todays date stamp bottom left and lines 0.5 points thick below the footer and above the header:

\begin{verbatim}
\usepackage{fancyhdr}
\pagestyle{fancy}
\lhead{Running Header or Title.}
\chead{}
\rhead{\thepage}
\lfoot{\today}
\cfoot{}
\rfoot{}
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0.5pt}
\end{verbatim}


\clearpage



\section{Text}

The body of the text for LaTeX documents is enclosed in the document environment:

\begin{verbatim}
\begin{document}
\end{verbatim}

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla est purus, ultrices in porttitor in, accumsan non quam. Nam consectetur porttitor rhoncus.

\begin{verbatim}
\end{document}
\end{verbatim}


A blank line between two sections of text, or \texttt{\textbackslash par}, denotes a paragraph break and \texttt{\textbackslash \textbackslash} starts a new line. To insert a page break, \texttt{\textbackslash newpage} or \texttt{\textbackslash clearpage} commands are used. \texttt{\textbackslash clearpage} is preferred if the document contains chapters or sections with floating tables or figures. This will place any remaining floats and add pages to fit them in at the end of the section if LaTeX is unable to place them in the text.


\subsection{Fonts}

The base font and size for LaTeX documents is loaded in the preamble. Fonts and font styles can be changed in the body of the text. These can be changed in two ways. The first is to insert the text in curly braces following a command.

 \begin{verbatim}
 \textit{Lorem ipsum dolor sit amet . . . }
 \end{verbatim}
 
 formats the text in the curly braces as
 \bigskip
 \textit{Lorem ipsum dolor sit amet . . . }
 \bigskip
 
 This is useful if there are single words or sentances, but for blocks of text, an environment is convenient:
 
 
 \begin{verbatim}
\begin{itshape}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla 
est purus, ultrices in porttitor in, accumsan non quam. Nam 
consectetur porttitor rhoncus. Curabitur eu est et leo feugiat 
auctor vel quis lorem.
\end{itshape}
 \end{verbatim}
 
 produces
 
 \bigskip
 
 \begin{itshape}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla est purus, ultrices in porttitor	in, accumsan non quam. Nam consectetur porttitor rhoncus. Curabitur eu est et leo feugiat auctor vel quis lorem.
 \end{itshape}
\bigskip

Table 6 gives font styles and their commands. Fonts can be made larger or smaller from {\tiny tiny} to {\Huge Huge} in a similar way. Table 7 gives commands for resizing fonts.


\begin{table}
	\small
	\begin{center}
		\begin{tabular}{lll}
			\hline
Style         & Command                              &  Sample                 \\
\hline
Roman         & \texttt{\textbackslash textrm\{\}}     & \textrm{Roman}         \\
Sans Serif    & \texttt{\textbackslash textsf\{\}}     & \textsf{Sans Serif}    \\
Typewriter    & \texttt{\textbackslash texttt\{\}}     & \texttt{Typewriter}    \\ 
Italics       & \texttt{\textbackslash textit\{\}}     & \textit{Italics}       \\
Boldface      & \texttt{\textbackslash textbf\{\}}     & \textbf{Boldface}      \\
Small Caps    & \texttt{\textbackslash textsc\{\}}     & \textsc{Small Caps}    \\
Underline     & \texttt{\textbackslash underline\{\}}  & \underline{Underline}  \\
Emphasis      & \texttt{\textbackslash emph\{\}}       & \emph{Emphasis}        \\
Slanted       & \texttt{\textbackslash textsl\{\}}     & \textsl{Slanted}       \\    		
\hline
		\end{tabular}
		\caption{Text styles. }
	\end{center}
\end{table}




 

\begin{table}
	\small
	\begin{center}
		\begin{tabular}{lc}
			\hline
			Command & Sample \\
			\hline
			\texttt{\textbackslash tiny\{\}}          &  \tiny{tiny}                  \\
			\texttt{\textbackslash scriptsize\{\}}    &  \scriptsize{scriptsize}      \\
			\texttt{\textbackslash footnotesize\{\}}  &  \footnotesize{footnotesize} \\
			\texttt{\textbackslash small\{\}}         &  \small{small}               \\
			\texttt{\textbackslash normalsize\{\}}    &  \normalsize{normalsize}     \\
			\texttt{\textbackslash large\{\}}         &  \large{large}               \\
			\texttt{\textbackslash Large\{\}}         &  \Large{Large}               \\
			\texttt{\textbackslash LARGE\{\}}         &  \LARGE{LARGE}               \\
			\texttt{\textbackslash huge\{\}}          &  \huge{huge}                 \\
			\texttt{\textbackslash Huge\{\}}          &  \Huge{Huge}                 \\
			\hline
		\end{tabular}
		\caption{Font sizes.}
	\end{center}
\end{table}



The font can be changed in the text without loading additional packages in the preamble with \texttt{\textbackslash texttt\{\textbackslash fontfamily\{Family\}\textbackslash selectfont\}}. Some common fonts and their family names are listed in Table 8. 


\begin{table}
	\small
	\begin{center}
		\begin{tabular}{lll}
			\hline
			Font & Family Name & Sample \\
			\hline
			Avant Garde	            & \texttt{pag} & \fontfamily{pag}\selectfont Avant Garde	            \\
			Bookman	                & \texttt{pbk} & \fontfamily{pbk}\selectfont Bookman                 \\
			Charter	                & \texttt{bch} & \fontfamily{bch}\selectfont Charter                 \\
			Computer Modern	        & \texttt{cmr} & \fontfamily{cmr}\selectfont Computer Modern         \\
			Courier	                & \texttt{pcr} & \fontfamily{pcr}\selectfont Courier                 \\
			Helvetica	            & \texttt{phv} & \fontfamily{phv}\selectfont Helvetica               \\
			Latin Modern	        & \texttt{lmr} & \fontfamily{lmr}\selectfont Latin Modern            \\
			New Century Schoolbook	& \texttt{pnc} & \fontfamily{pnc}\selectfont New Century Schoolbook  \\
			Palatino	            & \texttt{ppl} & \fontfamily{ppl}\selectfont Palatino                \\
			Times New Roman         & \texttt{ptm} & \fontfamily{ptm}\selectfont Times New Roman         \\
			Utopia	                & \texttt{put} & \fontfamily{put}\selectfont Utopia                  \\
			Zapf Chancery	        & \texttt{pzc} & \fontfamily{pzc}\selectfont Zapf Chancery           \\
			\hline
		\end{tabular}
		\caption{Some font family names.}
	\end{center}
\end{table}


\subsection{Special Characters}


The following symbols are used by LaTeX as part of it's programming instructions so require marking up if they are to be placed as text in a document:

\begin{center}
\{ \} \% \& \$ \_ \# \textbackslash \~{} \^{} \\
\end{center}

Quotation marks are defined by using the \textasciigrave and \textquotesingle keys or \texttt{\textbackslash textquoteleft} and \texttt{\textbackslash textquoteright}. \texttt{\textasciigrave Word'} produces `Word'. For double quotes, use two of each or \texttt{\textbackslash textquotedblleft / \textbackslash textquotedblright} : \texttt{\textasciigrave \textasciigrave Word''} produces ``Word''. The \textasciigrave is located at the top left of the keyboard. The \texttt{\textquotesingle} symbol is the usual single quotation mark. The \textquotedbl key on the keyboard is not used. Two dashes are available: en dash for ranges (--) and the em dash (---) for punctuation. A list of these and their commands along with a range of other common symbols is in Table 9.


\begin{table}
	\begin{center}
		\begin{tabular}{llllll }
			\hline
			\{     &    \texttt{\textbackslash \{ }  &  ---  &  \texttt{\textminus \textminus \textminus or \textbackslash textemdash}  &  \textsterling  &  \texttt{\textbackslash textsterling}   \\
			
			\}     &     \texttt{\textbackslash \}}    &   \textasciigrave  &  \small \texttt{\textbackslash asciigrave}  &  \texteuro  &  \texttt{\textbackslash texteuro}   \\
			
			\%     &      \texttt{\textbackslash \%}    &   \textasciiacute  & \texttt{\textbackslash textasciiacute}  &  \textcent  &  \texttt{\textbackslash textcent}   \\
			
			\&     &      \texttt{\textbackslash \& }   &  \textasciibreve  &  \texttt{\textbackslash textasciibreve}  & \textyen  &  \texttt{\textbackslash textyen}   \\
			
			\$     &      \texttt{\textbackslash \$ or \textbackslash textdollar}    &  \textbullet  &   \texttt{\textbackslash textbullet}  &  \textdegree  &  \texttt{\textbackslash textdegree}   \\
			
			\_     &     \texttt{\textbackslash \_}    &  \textopenbullet  &  \texttt{\textbackslash textopenbullet}  &   \textcelsius  &  \texttt{\textbackslash textcelsius}   \\
			
			\#     &      \texttt{\textbackslash \#}    &  \dots  &  \texttt{\textbackslash dots}  &  \textcopyright  &  \texttt{\textbackslash textcopyright}   \\
			
			\textbackslash   & \texttt{\textbackslash textbackslash}  & \textasteriskcentered  & \texttt{\textbackslash textasteriskcentered}  &  \textcopyleft  &  \texttt{\textbackslash textcopyleft}   \\
			
			
			\~{}   &     \texttt{\textbackslash \textasciitilde\{\} }  &  \textdagger  &  \texttt{\textbackslash textdagger}  &  \texttrademark  &  \texttt{\textbackslash texttrademark}   \\
			
			
			\^{}   &      \texttt{\textbackslash \textasciicircum\{\} }  &  \textdaggerdbl  &  \texttt{\textbackslash textdaggerdbl}  &  \texttimes  & \texttt{\textbackslash texttime}   \\		
			
			
			\textquoteleft     &     \texttt{\textbackslash textquoteleft or \textasciigrave}  &  \textparagraph  & \texttt{\textbackslash textparagraph}  &  \textdiv  & \texttt{\textbackslash textdiv}   \\
			
			
			\textquoteright  &  \texttt{\textbackslash textquoteright or \textquotesingle}  & \textsection  & \texttt{\textbackslash textsection}  &  \textminus  &  \texttt{\textbackslash textminus}   \\
			
			
			\textquotedblleft  &     \texttt{\textbackslash textquotedblleft or \textasciigrave \textasciigrave}  & \texttildelow & \texttt{\textbackslash texttildelow}  &  \textgreater  &  \texttt{\textbackslash textgreater}   \\
			
			
			\textquotedblright  &    \texttt{\textbackslash textquotedblright or \textquotesingle \textquotesingle}  &  \textasciitilde  & \texttt{\textbackslash textasciitilde}  &  \textless  &  \texttt{\textbackslash textless}   \\
			
			
			--     &      \texttt{\textminus \textminus or \textbackslash textendash}  &  
			\textperiodcentered  & \texttt{\textbackslash textperiodcentered}  &  $\sim$  &  \texttt{\$\textbackslash sim\$}   \\
			\hline
		\end{tabular}
		\caption{Special characters and some common symbols. }
	\end{center}
\end{table}			

This list is a very small sample of the symbols available in LaTeX. Scott Pakin maintains ‘The Comprehensive LaTeX Symbol List’ which provides a list of over 14,000 symbols. This list is freely available from \textsc{ctan}.





\subsection{Line Spacing}

The default line spacing for LaTeX is single spaced. This can be changed to double or one and a half spacing with setspace if it is loaded in the preamble. It supports single, one-and-a-half line spacing and double spacing with \texttt{\textbackslash singlespacing}, \texttt{\textbackslash onehalfspacing} and \texttt{\textbackslash doublespacing} respectively. This will change the spacing of the entire document, but figures, tables and footnotes will be unaffected.

\begin{verbatim}
\documentclass[a4paper]{article}
\usepackage{setspace} 

. . . 

\begin{document}
\doublespacing

. . . 

\end{document}
\end{verbatim}




\subsection{Page Numbering}
The default page numbering in LaTeX is Arabic numerals which begin on the first page. Additional styles are shown in Table 10: 


\begin{table}
	\small
	\begin{center}
		\begin{tabular}{lll}
			\hline
			Style  &  Numeral Type  &  Example Text \\
			\hline
			\texttt{arabic}  &  Arabic numerals            &  1, 2, 3, 4, 5      \\
			\texttt{roman}   &  Lower case Roman numerals  &  i, ii, iii, iv, v  \\
			\texttt{Roman}   &  Upper case Roman numerals  &  I, II, III, IV, V  \\
			\texttt{alph}    &  Lower case letters         &  a, b, c, d, e, f   \\
			\texttt{Alph}    &  Upper case letters         &  A, B, C, D, E, F   \\
			
			\hline
		\end{tabular}
		\caption{Page numbering options.}
	\end{center}
\end{table}




If the page numbering for the document is to be other than arabic, it can be specified in the preamble after the abstract with 

\begin{verbatim}
\pagenumbering{Style}
\end{verbatim}

It is possible to have two styles in a document, for instance lower case Roman numerals for the front matter and Arabic numerals for the remainder of the text. 

This is handled with \texttt{\textbackslash pagenumbering\{Style\}}. At the beginning of the front matter, insert \texttt{\textbackslash pagenumbering\{roman\}} and when the main matter of the document begins, insert \texttt{\textbackslash pagenumbering\{arabic\}}. If the title page is to be un-numbered, insert \texttt{\textbackslash thispagestyle\{empty\}} following \texttt{\textbackslash maketitle}.  

The following creates an article class document with an un-numbered title page containing an abstract, a Table of Contents, List of Figures and List of Tables on separate pages with Roman numerals and the body text in Arabic numerals.

\begin{verbatim}
\documentclass[a4paper]{article}
\title{\LaTeXe Document}
\author{Michael P. Morris}

\begin{document}
\maketitle
\thispagestyle{empty}
\begin{abstract}
Abstract text.
\end{abstract}
\clearpage
\pagenumbering{roman}
\tableofcontents
\clearpage
\listoffigures
\clearpage
\listoftables
\clearpage
\pagenumbering{arabic}

Document Text.

\end{document}
\end{verbatim}

To change the page numbering counter, use \texttt{\textbackslash setcounter\{page\}\{PageNumber\}}. 

\begin{verbatim}
\pagenumbering{arabic}
\setcounter{page}{5}
\end{verbatim}

This changes the page numbering to Arabic and begins the page count at page 5.

\clearpage



\section{Mathematics in LaTeX}

One of LaTeX’s strengths is it’s facilities for mathematical equations. This is done by either activating math mode, or by the equation or displaymath environments. 

Math mode is activated by enclosing an equation within a pair of \$. This turns text into italics and the \texttt{–} character becomes a minus rather than a dash. This mode is especially useful when an equation is set within text:

\begin{verbatim}
Vestibulum mollis, arcu iaculis bibendum varius, velit sapien 
blandit metus, ac posuere lorem nulla ac dolor. $e=mc^2$ Maecenas 
urna elit, tincidunt in dapibus nec, vehicula eu dui. Duis lacinia 
fringilla massa.
\end{verbatim}

produces:

\bigskip
Vestibulum mollis, arcu iaculis bibendum varius, velit sapien blandit metus, ac posuere lorem nulla ac dolor. $e=mc^2$ Maecenas urna elit, tincidunt in dapibus nec, vehicula eu dui. Duis lacinia fringilla massa.
\bigskip

or when you need to include mathematics, such as the results of a statistical test, in a report:

\begin{verbatim}
... main effect for the interaction between the factors was 
significant (F(2,125) = 3.146, p < 0.05, \omega^2 = 0.032), 
though the practical significance ...
\end{verbatim}

produces

\bigskip
. . . main effect for the interaction between the factors was significant $(F(2,125) = 3.146, p < 0.05, \omega^2 = 0.032)$, though the practical significance . . .
\bigskip


The difference between equation and displaymath environments is that formulae set with equation are numbered:

\begin{verbatim}
\begin{equation}
\bar{X} = \frac{\Sigma X}{n}
\end{equation}
\end{verbatim}


\begin{equation}
\bar{X} = \frac{\Sigma X}{n}
\end{equation}



\begin{verbatim}
\begin{displaymath}
\bar{X} = \frac{\Sigma X}{n}
\end{displaymath}
\end{verbatim}



\begin{displaymath}
\bar{X} = \frac{\Sigma X}{n}
\end{displaymath}



\begin{table}
	\small
	\begin{center}
		\begin{tabular}{ll}
			\hline
			$a \times b + c - d \div e$     &  \texttt{a \textbackslash times b + c - d \textbackslash div e} \\
			$a < b > c$                     & \texttt{a < b > c}  \\	
			$a^2 + b^2 = c^2$               & \texttt{a\^{}2 + b\^{}2 = c\^{}2} \\                                           
			$y - y_1 = m(x - x_1)$          & \texttt{y - y\_1 = m(x - x\_1)}  \\
			$f'$                            & \texttt{f'} \\  
			$n!$                            & \texttt{n!} \\             
			$\frac{a}{b}$                   & \texttt{\textbackslash frac\{a\}\{b\}} \\ 
			$a \choose b$                   & \texttt{a \textbackslash choose b} \\
			$\sqrt a$                       & \texttt{\textbackslash sqrt a} \\                         
			$\root n \of {a}$.              & \texttt{\textbackslash root n \textbackslash of \{a\}}  \\     
			$\overbrace{abc}$               & \texttt{\textbackslash overbrace\{\}} \\                         
			$\underbrace{abc}$              & \texttt{\textbackslash underbrace\{\}} \\ 		
			\hline
		\end{tabular}
		\caption{Some common mathematical symbols. }
	\end{center}
\end{table}




Some of the mathematical symbols are shown in Table 11.  LaTeX comes with Greek letters in upper and lowercase fonts. A complete list of these and the commands are in Table 12. They can be inserted in math mode by placing them between \textbackslash begin\{math\} and \textbackslash end\{math\} or if you only need a single character, they can be placed between \texttt{\$}. All the lowercase letters and some of the uppercase letters are provided.

\begin{verbatim}
The $\beta$ weights for the results . . . 
\end{verbatim}

produces: 
\bigskip

The $\beta$ weights for the results . . . 

\bigskip


\begin{table}
	\small
	\begin{center}
		\begin{tabular}{llllllllll}
			\hline
			$\Gamma$  &  \texttt{\textbackslash Gamma}  &  $\Delta$ &  \texttt{\textbackslash Delta}  &  $\Theta$ &  \texttt{\textbackslash Theta}  &  $\Lambda$  &  \texttt{\textbackslash Lambda}  &  $\Xi$    &  \texttt{\textbackslash Xi}  \\
			
			$\Pi$  &  \texttt{\textbackslash Pi}  &  $\Sigma$    &  \texttt{\textbackslash Sigma}  &  $\Upsilon$  &  \texttt{\textbackslash Upsilon}  &  $\Phi$    &  \texttt{\textbackslash Phi}  &  $\Psi$    &  \texttt{\textbackslash Psi}  \\
			
			$\Omega$    &  \texttt{\textbackslash Omega}  \\
			
			$\alpha$ &  \texttt{\textbackslash alpha}  &	$\beta$  &  \texttt{\textbackslash beta}  &  $\gamma$  &  \texttt{\textbackslash gamma}  &  $\delta$  &  \texttt{\textbackslash delta}	 &  $\epsilon$  &  \texttt{\textbackslash epsilon}	\\
			
			$\zeta$ &  \texttt{\textbackslash zeta}  &  $\eta$  &  \texttt{\textbackslash eta}  &  $\theta$  &  \texttt{\textbackslash theta}  &  $\iota$  &  \texttt{\textbackslash iota}  &  $\kappa$  &  \texttt{\textbackslash kappa}  \\
			
			$\lambda$  &  \texttt{\textbackslash lambda}  & 	$\mu$  &  \texttt{\textbackslash mu}  &		$\nu$&  \texttt{\textbackslash nu}  &	$\xi$&  \texttt{\textbackslash xi}  &	$\pi$&  \texttt{\textbackslash pi}  \\	
			
			$\rho$  &  \texttt{\textbackslash rho}  &  $\sigma$  &  \texttt{\textbackslash sigma}  &  $\tau$  &  \texttt{\textbackslash tau}  &  $\upsilon$  &  \texttt{\textbackslash upsilon}  &  $\phi$  &  \texttt{\textbackslash phi}  \\
			
			$\chi$  &  \texttt{\textbackslash chi}  &  $\psi$   &  \texttt{\textbackslash psi}  &  $\omega$   &  \texttt{\textbackslash omega}  \\
			
			\hline
		\end{tabular}
		\caption{Upper and lowercase Greek letters.}
	\end{center}
\end{table}


This is a very short introduction to LaTeX’s mathematical capabilities. A wide range of Greek letters, symbols, functions, operators, arrows and character modifiers such as bars, graves, tildes and hats are also available.

\clearpage




\section{Front Matter}

\subsection{Title Pages}

Contents of the title pages are defined in the final part of the preamble with \texttt{\textbackslash title\{\}}, \texttt{\textbackslash author\{\}} and \texttt{\textbackslash date\{\}}. The current date can be placed inside \texttt{\textbackslash date\{\}} with \texttt{\textbackslash today}, or a date can be entered manually. The title page is created with \texttt{\textbackslash maketitle} which follows \texttt{\textbackslash begin\{document\}}:

\begin{verbatim}
\documentclass[a4paper]{article}

\title{\LaTeXe Document}
\author{Michael P. Morris}
\date{\today}

\begin{document}
\maketitle

. . .


\end{document} 
\end{verbatim}




\subsection{The Abstract}

Abstracts are created by the abstract environment:

\begin{verbatim}
\begin{abstract}
	
Lorem ipsum dolor sit amet . . .  

\end{abstract}
\end{verbatim}


The abstract appears on the title page but can be placed on a page of it’s own by inserting pagebreaks following \texttt{\textbackslash maketitle} and after the end of the abstract environment. This example uses \texttt{\textbackslash clearpage}:

\begin{verbatim}
\documentclass[a4paper]{article}

\title{\LaTeXe Document}
\author{Michael P. Morris}
\date{\today}

\begin{document}
\maketitle
\clearpage
\begin{abstract}
Lorem ipsum dolor sit amet . . . 
\end{abstract}
\clearpage

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla est 
purus, ultrices in porttitor in, accumsan non quam. Nam consectetur 
porttitor rhoncus . . . 


\end{document} 
\end{verbatim}



\subsection{Table of Contents, List of Figures and List of Tables.}

The Table of Contents, List of Figures and List of Tables are inserted with:

\begin{verbatim}
\tableofcontents

\listoffigures

\listoftables
\end{verbatim}

A page break after each command will place them on separate pages. LaTeX will generate these automatically when the document is compiled from the sectioning commands and the figure and table captions. 


The following creates a document with a title page containing the title and abstract, a Table of Contents, List of Figures and List of Tables. These are placed on separate pages and numbered in Roman numerals, with the body of the text in Arabic numerals. It is double spaced with a ragged right margin. Page breaks are specified with \texttt{\textbackslash clearpage}:

\begin{verbatim}
\documentclass[a4paper]{article}

\title{\LaTeXe Document}
\author{Michael P. Morris}
\date{\today}

\begin{document}
\maketitle
\doublespacing
\begin{flushleft}
\begin{abstract}

Lorem ipsum dolor sit amet . . . 

\end{abstract}
\thispagestyle{empty}
\clearpage
\pagenumbering{roman}
\tableofcontents
\clearpage
\listoffigures
\clearpage
\listoftables
\clearpage
\pagenumbering{arabic}

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla 
est purus, ultrices in porttitor in, accumsan non quam. Nam 
consectetur porttitor rhoncus . . . 

\end{flushleft}

\clearpage


\end{document}

\end{verbatim}


\clearpage





\section{Body}


\subsection{Sectioning}

Sectioning is the division on a document into part,chapter, section, subsection, subsubsection, paragraph and subparagraph. This is available for all LaTeX document classes, apart from letter. Chapters are not available for articles. Sectioning commands have the same format as text formatting commands: \texttt{\textbackslash Command\{SectionType\}}. The following creates two sections, each with two subsections. LaTeX numbers these automatically and the titles will appear in the Table of Contents:

\begin{verbatim}
\section{Section 1}
\subsection{1A}
\subsection{1B}

\section{Section 2}
\subsection{2A}
\subsection{2B}
\end{verbatim}



\subsection{Lists}

LaTeX lists are bulleted or numbered and are created in an environment. The itemize environment creates a bulleted list, and enumerate creates numbered lists. New list items are specified with \texttt{\textbackslash item}. For a bulleted list:


\begin{verbatim}
\begin{itemize}
\item Item 1
\item Item 2
\item Item 3
\end{itemize}
\end{verbatim}

produces:

\begin{itemize}
	\item Item 1
	\item Item 2
	\item Item 3
\end{itemize}


The symbol denoting each item in a bulleted list can be changed by adding an option after each \texttt{\textbackslash item} command:

\begin{verbatim}
\begin{itemize}
\item[--] Item 1
\item[\textasteriskcentered] Item 2
\item[\textdagger] Item 3
\end{itemize}
\end{verbatim}

produces

\begin{itemize}
	\item[--] Item 1
	\item[\textasteriskcentered] Item 2
	\item[\textdagger] Item 3
\end{itemize}


Numbered lists are created by the enumerate environment:

\begin{verbatim}
\begin{enumerate}
\item Item 1
\item Item 2
\item Item 3
\end{enumerate}
\end{verbatim}

produces

\begin{enumerate}
	\item Item 1
	\item Item 2
	\item Item 3
\end{enumerate}



If there are sub-categories, the list can be nested with additional enumerate commands:

\begin{verbatim}
\begin{enumerate}
\item Item 1
\begin{enumerate}
\item Item A
\item Item B
\item item C
\end{enumerate}
\item Item 2
\item Item 3
\end{enumerate}
\end{verbatim}


produces


\begin{enumerate}
	\item Item 1
	\begin{enumerate}
		\item Item A
		\item Item B
		\item item C
	\end{enumerate}
	\item Item 2
	\item Item 3
\end{enumerate}





\subsection{Tables and Figures}

Tables and figures are placed inside their own environments. LaTeX places them in documents so that they don’t break across pages. Because their location can vary from the location specified by typesetters, they are referred to as floats. Using \texttt{\textbackslash clearpage} at the end of each section places any outstanding floats at the end of the section before the new one starts.

\subsubsection{Tables}
Tables are placed within the table environment. A caption can be added with \texttt{\textbackslash caption\{Caption Text\}} just before \texttt{\textbackslash end\{table\}} so that it appears below the table. LaTeX will number them automatically and the caption will appear in the List of Tables. If the font for the table is to be sized differently from the text, it is specified on the next line.

\begin{verbatim}
\begin{table}
	\small

. . . Table Contents . . . 

\caption{Caption text}
\end{table}
\end{verbatim}


The next line specifies the table’s alignment on the page. Options are centre, flushleft and flushright. Within this environment is tabular. This contains the table’s formatting instructions and the table data.

\begin{verbatim}
\begin{table}
	\small
\begin{center}
\begin{tabular}{l|c|c|r}
\hline
Column 1 & Column 2 & Column 3 & Column 4 \\
\hline
Row 1 & Text 2 & Text 3 & 3.157 \\
Row 2 & Text 2 & Text 3 & 14.930 \\
Row 3 & Text 2 & Text 3 & 0.720 \\
\hline
\end{tabular}
\caption{Caption text . . . }
\end{center}
\end{table}
\end{verbatim}

\texttt{\textbackslash begin\{tabular\}\{l|c|c|r\}} instructs LaTeX to begin a tabular environment with text alignment options for four columns. The first is left aligned, the second and third centred and the fourth column right aligned. An \texttt{|} adds a vertical line.

Horizontal lines can be inserted with \texttt{\textbackslash hline}. The next line contains the headings for each column. The \texttt{\&} symbol separates the text for each column and \texttt{\textbackslash \textbackslash} denotes the end of the row.

Below this is the first row of data. As with the columns, each column is separated with an \texttt{\&} symbol and the end of the row by a \texttt{\textbackslash \textbackslash}. Table 13 shows the compiled output.


\begin{table}
	\small
	\begin{center}
		\begin{tabular}{l|c|c|r}
			\hline
			Column 1 & Column 2 & Column 3 & Column 4 \\
			\hline
			Row 1 & Text 2 & Text 3 & 3.157 \\
			Row 2 & Text 2 & Text 3 & 14.930 \\
			Row 3 & Text 2 & Text 3 & 0.720 \\
			\hline
		\end{tabular}
		\caption{Example table.}
	\end{center}
\end{table}


\subsubsection{Figures}

The first step in importing graphic files is to place the file in the project directory so that LaTeX can find it. Figures are placed within the figure environment. The placement of the figure on the page is specified in the same way as tables: centre, flushleft or flushright. 

\begin{verbatim}
\begin{figure}
\center
\includegraphics[scale=1.0]{GraphicFileName}
\caption{Caption Text}
\end{figure}
\end{verbatim}

\texttt{\textbackslash includegraphics \{\}} tells LaTeX the name of the graphic file to load and \texttt{scale} specifies whether to reduce or enlarge. 1.0 is original size, 0.5 is half size and 2.0 is double. \texttt{\textbackslash caption\{\}} contains the text of the caption and this will appear as the figure title in the List of Figures in the frontmatter.

LaTeX handles only encapsulated postscript files, and PDFLaTeX can handle files in pdf, png or jpg formats. If the file is in a different format, it will have to be converted to these. If an encapsulated postscript file is included in a document created by PDFLaTeX, there will be a blank space where the graphic should be. Figure 1 has been reduced by 50\% by changing the scale to 0.5.


\begin{figure}
\center
\includegraphics[scale=0.5]{Drawing.eps}
\caption{Spiral}
\end{figure}

\clearpage


\section{End Matter}


\subsection{Citations and References}

LaTeX can generate citations and references automatically. The first step is to create a bibliographical database for the project. This is placed in the project directory so that LaTeX can find it when the document is compiled. The format for database entries is:

\begin{verbatim}
@book{Paper10,
	author = {Paper, A., Pen, B. and Ink, J},
	title = {Our Book},
	publisher = {First Authors Press},
	year = {2010}.
}

@article{Kliker12,
	author = {Kliker, G. and Flash, L.},
	title = {Photographing Critics},
	Journal = {The Journal of Critical Photography},
	Year = {2012},
	Volume = {12},
	pages = {50-60}.
}
\end{verbatim}

The standard reference types are article, book, booklet, conference, inbook, incollection, inproceedings, manual, mastersthesis, misc, phdthesis, proceedings, techreport and unpublished. This list is saved as a .bib file. 

All bibliographical entries contain a unique key. This is found in the first line. It can be anything, but the first author's surname and year of publication is memorable. If the database contains more than one publication by the same author(s) in the same year, they can be uniquely identified by adding a letter: Paper10a, Paper10b, Paper10c.

Jabref is a convenient way of managing these reference databases. It is an open source reference manager and is freely available from \texttt{www.jabref.org}. It has a \textsc{gui} interface, native support for BibTeX and BibLaTeX and can import 15 reference formats.



\subsubsection{BibLaTeX}

BibLaTeX is a modern package for managing citations and a wide range of citation styles are available for it from \textsc{ctan}. To use this in a document, it is loaded in the preamble along with the citation style and the name of the reference database:

\begin{verbatim}
\usepackage[style=CitationStyle]{biblatex}
\addbibresource{DatabaseName.bib}
\end{verbatim}


There are a large number of styles for this package available from \textsc{ctan}. A short list of common styles is in Table 14.

\begin{table}
	\small
	\begin{center}
		\begin{tabular}{ll}
			\hline
			Style   & Package \\
			\hline
			APA     &  apa, apa6                \\  
			Chicago &  chicago-authordate-trad  \\
			Harvard &  bath                     \\
			MLA     &  mla                      \\
			Oxford  &  oxnotes                  \\
			\hline
		\end{tabular}
		\caption{BibLaTeX citations styles}
	\end{center}
\end{table}



Citations are placed in the text with \texttt{\textbackslash cite\{\}}, \texttt{\textbackslash parencite\{\}} or \texttt{\textbackslash footcite\{\}} with the reference key placed between \texttt{\{\}}. \texttt{\textbackslash cite\{Kliker12\}} produces a reference that is something like Kliker and Flash (2012). \texttt{\textbackslash parencite\{Kliker12\}} produces a citation in parentheses (Kliker and Flash, 2012). \texttt{\textbackslash footcite} is used with oxnotes. This places a superscript numeral at the citation with the reference at the bottom of the page. 

The reference list is created with \texttt{\textbackslash printbibliography}. This can be placed anywhere inside the document environment. The following loads BibLaTeX with a Harvard style with references in a BibTeX file named DocRefs.bib. There is one citation in parentheses and the reference list is placed on a separate page at the end of the document:

\begin{verbatim}
\documentclass[a4paper]{article}
. . . 
\usepackage[bath]{biblatex}
\addbibresource{DocRefs.bib}

\begin{document}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla 
est purus, ultrices in porttitor in, accumsan non quam. Nam 
consectetur porttitor rhoncus. Curabitur eu est et leo feugiat 
auctor vel quis lorem. Ut et ligula dolor, sit amet consequat lorem. 
Aliquam porta eros sed velit imperdiet egestas. Maecenas tempus eros 
ut diam ullamcorper id dictum libero tempor. \parencite{Paper10} 

\clearpage
\printbibliography
\end{document}
\end{verbatim}


When documents with BibLaTeX citations are compiled, the citation processing package Biber must also be run to generate the citations and reference list.

Citation styles are regularly revised, new ones appear, and institutions and publications may have their own versions. If existing LaTeX packages that are available don’t meet these requirements, the citations and reference list can be entered into the document manually. The reference list can be added by adding a chapter or section for references, then adding each entry in the required style. Oxford style footnotes can be added by using \texttt{\textbackslash footnote\{\}}.




\subsection{Appendices}

Appendices can be added to documents with the appendix package. This is loaded in the preamble with 

\begin{verbatim}
\usepackage{appendix}
\end{verbatim}

Options for this package are listed in Table 15:


\begin{table}
	\small
	\begin{center}
		\begin{tabular}{ll}
		\hline
			\texttt{toc}       &  Includes a title in the Table of Contents prior to listing the appendices \\
			\texttt{page}      &  Places a title prior to the beginning of the appendices \\
			\texttt{title}     &  Adds the name `Appendix' to each appendix title \\
			\texttt{titletoc}  &  Does the same to each appendix title in the Table of Contents \\
			\texttt{header}    &  Does the same for each page header \\
			\hline
		\end{tabular}
		\caption{Options for package Appendix.}
	\end{center}
\end{table}


The appendices themselves are placed inside the appendix environment and are sectioned in the same way as the document text:

\begin{verbatim}
\begin{appendices}

\section{Notes on Sources}

\section{Raw Data}

\end{appendices}
\end{verbatim}

To begin the appendices on a new page, and to place each new appendix on a new page, insert a page break before the appendices environment and the beginning of a new appendix.


\clearpage





\section{Compiling Documents}

LaTeX can produce postscript and \textsc{pdf} files. Postscript is the `Gold Standard’ for printed documents and LaTeX produces these without any special commands in the document file. These files are compiled by running LaTeX multiple times to resolve front matter, headings and lists, and if the document contains references created through BibLaTeX, Biber will have to be added to resolve the citations. This can be done either by the command line or through an editor’s \textsc{gui} interface. For a document named Filename.tex containing citations created with BibLaTeX:

\begin{verbatim}
latex Filename.tex
biber Filename.tex
latex Filename.tex
latex Filename.tex
\end{verbatim}

is suggested. This creates a Device Independent (.dvi) file. This intermediate file is then converted to postscript with dvips:

\begin{verbatim}
dvips Filename.dvi 
\end{verbatim}


\textsc{pdf} files can be created from standard LaTeX postscript files with Ghostscript, or else by using PDFLaTeX. PDFLaTeX is designed to produce documents in \textsc{pdf} format and can produce them directly from a marked-up file. It allows a user to insert file description information such as Title, Author, Subject and Keywords and allows documents to be created in \textsc{pdf/a} format. This is an \textsc{iso} standard format for archiving electronic documents. It supports hyperlinks within the text and links to internet sites.

The contents of the document description can be inserted in the preamble with:

\begin{verbatim}
\pdfinfo{
	/Author(Michael Morris)
	/Title(A Very Short Guide to Getting Started with LaTeX2e)
	/CreationDate(D:20200910102500)
	/ModDate(D: 20200910102500)
	/Subject(LaTeX2e)
	/Keywords(PDF;Latex;Guide)
}
\end{verbatim}

The creation date and modification date format is \texttt{\textsc{yyyymmddhhmmss}}.

\textsc{pdf/a} files are created with pdfx. This is loaded in the preamble with:

\begin{verbatim}
\usepackage[a-1b]{pdfx}
\end{verbatim}

Hypertext links can be inserted into \textsc{pdf} documents with hyperref. This turns all internal references, such as the table of contents and lists of tables and figures, cross references and citations into active hyperlinks. Clicking on the link will take you to the appropriate place in the text. This should be the last package loaded in the preamble. It is loaded with:

\begin{verbatim}
\usepackage{hyperref}
\end{verbatim}

By default, the hyperlinks appear boxed in red. This can be changed to coloured text using the colorlinks option, and a set of bookmarks to help navigate the document can be generated. Multiple options can be loaded at the same time if they are separated with commas:

\begin{verbatim}
\usepackage[colorlinks, bookmarks=true]{hyperref}
\end{verbatim}

Links to external web pages can be created within the body of the text with

\begin{verbatim}
\textbackslash href\{url\}\{Descriptive Text\}
\end{verbatim}

The Descriptive Text option provides a comment on the link that appears when the mouse pointer hovers over it. The following inserts a link to \textsc{ctan}:

\begin{verbatim}
\href{www.ctan.org}{Comprehensive TeX Archive Network}
\end{verbatim}


\clearpage




\section{References}

\begin{flushleft}
Goosens, M., Mittelbach, F., Rahtz, S., Roegel, D. and Voss, H. (2008) \textit{The LaTeX Graphics Companion}. 2nd Edition. Boston: Addison-Wesley. \\
\bigskip
Lamport, L. (1986) \textit{LaTeX: A Document Preparation System}. 2nd Edition. Boston: Addison-Wesley.\\
\bigskip
Mittelbach, F. and Goosens, M. 2004. \textit{The LaTeX Companion}. 2nd Edition. Boston: Addison-Wesley.\\
\bigskip
Mori, L.F. (2007). Tables in LaTeX2e: Packages and Methods. \textit{The PracTeX Journal}, 1, 1-38.\\
\bigskip
Pakin, S., 2020. \textit{The Comprehensive LaTeX Symbol List}. Retrieved from http://tug.ctan.org/info/symbols/comprehensive/symbols-a4.pdf on 25 September, 2020.\\
\bigskip
Thanh, H.T., Rahtz, S., Hagen, H., Henkel, H., Schroder, M. and Berry, K. (2020) \textit{The pdfTeX User Manual}. Revision 821. Retrieved from http://mirror.aarnet.edu.au/pub/CTAN/systems/doc/pdftex/manual/pdftex-a.pdf on 25 September, 2020.\\
\end{flushleft}



\end{document}