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
|
.. Objectives
.. ----------
.. By the end of this tutorial, you will
.. 1. Get acquainted to LaTeX.
.. #. Know why we prefer LaTeX?
.. #. Know the advantages and disadvantages of typesetting documents
.. using the LaTeX approach.
.. #. Have a description, of a typical work flow; which uses LaTeX to typeset
.. documents.
.. #. Recognise and differenciate between LaTeX commands, LaTeX comments and
.. special characters, spacing and actual document content.
.. #. Create and compile a very simple LaTeX document.
.. Prerequisites
.. -------------
.. 1. Should have already installed LaTeX and its supported packages on the host machine.
.. #. Should be comfortable using a text editor of your choice.
.. Author : Harish Badrinath < harish [at] fossee [dot] in >
Internal Reviewer : Kiran Isukapatla < kiran [at] fossee [dot] in >
External Reviewer :
Langauge Reviewer :
Checklist OK? : <put date stamp here, if OK>
Script
------
.. L1
{{{ Show the first slide containing title, name of the production
team along with the logo of MHRD }}}
.. R1
Hello Friends and welcome to the tutorial on introduction to LaTeX.
.. L2
{{{ Show the objectives slide }}}
.. R2
.. By the end of this tutorial, you will
.. 1. Get acquainted to LaTeX.
.. #. Know why we prefer LaTeX?
.. #. Know the advantages and disadvantages of typesetting documents
.. using the LaTeX approach.
.. #. Have a description, of a typical work flow; which uses LaTeX to typeset
.. documents.
.. #. Recognize and differentiate between LaTeX commands, LaTeX comments and
.. special characters, spacing and actual document content.
.. #. Be able to create and compile a very simple LaTeX document.
.. L3
{{{ Switch to the pre-requisite slide }}}
.. R3
Before beginning this tutorial, we would suggest having a working installation of
LaTeX on your computer. You can do this by completing the tutorial titled
"Installing LaTeX".
.. L4
.. R4
LaTeX began as TeX, a computer program originally created by
Donald E. Knuth. Its was designed mainly to aid typesetting
of text and mathematical formulae.
LaTeX is a document preparation system for high quality type
setting. It is based on the TeX typesetting language or certain
extensions.
LaTeX is pronounced Lah-tech or Lay-tec.
TeX is pronounced Tech. TeX is also the first syllable in the Greek word for
technology.
LaTeX allows authors to typeset and print their content at the highest
typographical quality, using predefined, professional layouts.
.. L5
.. R5
Below are some of the reasons we prefer LaTeX
(a) LaTeX offers excellent visual quality.
(b) It handles typesetting and lets you focus on content.
(c) Its makes writing complex math equation extremely simple.
(d) It is also a standard used widely, especially by the scientific community.
We can define LaTex as a document based markup language. This sentence is
deceptively simple, as it reveals a lot about LaTex. We now break this sentence
up as follows
Mark-up — a system of annotating text, adding extra information to
specify structure and presentation of text
Document based markup - you don’t have to worry about each
element individually.
This is essentially a fancy way of saying,LaTeX handles typesetting and lets
you focus on content.
.. L6
.. R6
Some of the advantages of using LaTeX approach to typesetting are
(1) Easy availability of professionally crafted layouts.
(2) Typesetting of mathematical formulae is supported in a convenient
environment.
(3) Typesetting for most cases can be done with very little learning curve
using easy to use/understand commands, that only specify the logical structure
of the document.
(4) Presence of lots of add-on packages.
(5) It encourages creation of well structured texts.
.. L7
.. R7
Some of the disadvantages of using LaTeX approach to typesetting is
(1) Designing a whole new layout is difficult.
.. L8
.. R8
LaTeX input files are simple ASCII text files that are processed by a TeX
processing engine.
Next comes the question compiling LaTeX input files and viewing the output
typeset document.
The process is a little different from other markup languages like HTML.
We compile ASCII text files into typeset files that are normally DVI,Postscript
or PDF files.
The latex command converts LaTeX input files into dvi files.
We can view DVI files on Gnu/Linux using xdvi.
Further DVI files can be converted either to a post script file, using the
dvips command or to a PDF file using the dvipdfm command.
The command pdflatex is used to convert LaTeX input files directly to pdf files.
The resultant PDF files can be viewed using standard tools on most platforms
(Eg: evince on Gnu/Linux). PDF file are also widely supported.
.. L9
.. R9
LaTeX, like most utilities in Linux is case sensitive. Commands begin with a
backslash.LaTeX environments have a begin and end marker. Any content after
\end{document} is ignored.
Anything that follows a percentage sign (%) till the end of that line is a
comment. Special characters like tilde or hash,etc have to be escaped by a
backslash. If you have to insert a backslash into a LaTeX output file, you have
to use the LaTeX command \textbackslash.
Normally LaTeX automatically spaces the given input optimally. But, sometimes we
have to insert manual line breaks. This is achieved using the \\ command.
We can also start a new paragraph using an empty line.
It must be noted that multiple spaces/empty lines are automatically compressed
to a single space/line.
.. L10
{{{ Show slide with exercise 1 }}}
.. R10
Now, we try to create a simple LaTeX document. Pause the tutorial and type the
content shown on the screen in a text editor. Save the file as temp.tex
.. L10
{{{continue from paused state}}}
.. R10
Now we compile the commands in the LaTeX input file that is, temp.tex into a
typeset file.
The first alternative is to compile LaTeX input file into a DVI file. We use
the latex command for this purpose.
For compiling the LaTeX input file temp.tex into a DVI file, we use the
following command
latex temp.tex.
The output file would be temp.dvi.
On Gnu/Linux use a program like xdvi to view the output file.
.. L11
.. R11
The other alternative is to create PDF files from LaTeX input files.
We use the pdflatex command for this purpose.
For compiling the LaTeX input file temp.tex into a PDF file, we use the
following command
pdflatex temp.tex
The output file would be temp.pdf
On Gnu/Linux use a program like evince to view the output file.
.. L12
{{{ Show summary slide }}}
.. R12
This brings us to the end of this tutorial. In this tutorial, we have learnt
.. 1. About LaTeX.
.. #. why we prefer LaTeX.
.. #. About the advantages and disadvantages of typesetting documents
.. using the LaTeX approach.
.. #. A description, of a typical work flow; which uses LaTeX to typeset
.. documents.
.. #. The ability to recognize and differentiate between LaTeX commands, LaTeX
.. comments and special characters, spacing and actual document content.
.. #. Created and compiled a very simple LaTeX document.
.. L13
{{{Show self assessment questions slide}}}
.. R13
Here are some self assessment questions for you to solve
1. Convert the temp.dvi created during the course of this tutorial to temp_1.ps
using the dvips command. Verify that the two files indeed look the same.
2. Convert the temp.dvi created during the course of this tutorial to
temp_1.pdf using the dvipdfm command. Verify that the two files indeed look the
same.
.. L14
{{{Show self assessment questions slide}}}
.. R14
And the answers,
1. We can use the following command to convert temp.dvi to temp_1.ps
dvips -o temp_1.ps temp.dvi
2. We can use the following command to convert temp.dvi to temp_1.pdf
dvipdfm -o temp_1.pdf temp.dvi
.. L15
{{{ Show the thank you slide }}}
.. R15
Hope you have enjoyed this tutorial and found it useful.
Thank you!
|