Difference between revisions of "LaTeX/C2/Mathematical-Typesetting/English"

From Script | Spoken-Tutorial
Jump to: navigation, search
(Created page with "'''Script - Format ''' {| style="border-spacing:0;" | style="border:0.05pt solid #000000;padding-top:0.049cm;padding-bottom:0.049cm;padding-left:0.185cm;padding-right:0.185c...")
 
(No difference)

Latest revision as of 15:52, 5 August 2016

Script - Format


FOSS    LaTeX
Tutorial Title: Mathematical Symbols in LaTeX
Author: Kannan Moudgalya
Reviewer: Ambika Vanchinathan
Date: Original: 18 July 2007.  Revised: 6 July 2016
Keywords: Video tutorial, LaTeX tutorial, Dollar sign, Greek symbols, spaces in maths, minus sign, fractions, braces, subscripts, superscripts, amsmath package, matrix, pmatrix, bmatrix
Visual Cue
Narration
Show Slide 1 Welcome to this spoken tutorial on Mathematical Typesetting in LaTeX.

My name is Kannan Moudgalya.

Slide 2: LaTeX pronunciation A reminder: we should call it LaTeX and not latex.
Show Slide 3

Learning Objectives

In this tutorial, we will learn how to create mathematical symbols in LaTeX.

In particular,

  • How to get into and leave from the mathematical mode
  • The role of spaces and creating them
  • Mathematical symbols
  • Finally, A M S math package and its use in creating matrices
Show Slide 4

System Requirements

I am creating this tutorial on our less than 10,000 Rupee laptop.

I am using Ubuntu, TeXworks, and LaTeX.

Show Slide 5

Prerequisites

The prerequisites are the following:
  • Basic spoken tutorials on LaTeX.
  • Exposure to the side-by-side tutorial.
  • All are available from our website.
Show Slide 6

Learning material used in this tutorial

  • I shall use the file maths.tex
  • It is available as a code file, in our web page, where you found this tutorial
  • In the same location, you will find this pdf file from the TeX user group, India
  • We shall use it when we do assignments
Go to TeXworks window Let me go to the ‘TeXworks’ window.
Go to TeXworks, opened in 600x400, with maths.tex read in I have already opened the file maths.tex.

Please download this file and practise along with me.

\setlength\parindent{0pt} We have already seen the commands that are at the top of this file.

This command removes the paragraph indent.

We will study the effect of this statement through an assignment.

Let us start with Greek symbols that are used in mathematics.


$\alpha$

We use dollar sign to get into mathematical mode in LaTeX.

Let us begin with alpha.


We write $ back slash alpha $.

Compile Let us compile and see that we get the Greek letter alpha in the pdf.


The first dollar says that we are getting into the mathematical mode.

The second dollar says that we are leaving this mode.

From now on, I will not explicitly mention dollar or the back slash.

But you have to do exactly what you see on the screen.

$\beta$, $\gamma$, $\delta$ Similarly we write beta, gamma, and delta.
Compile I did not save the tex file, as TeXworks does it automatically.
Delete everything except alpha Let us delete these.
$\alphaa$ We will next take up the concept of spaces in mathematical expressions.

How do we generate alpha a?

That is, the product of alpha and a.

Let us try alpha a.

Compile Let me compile.
Highlight error LaTeX complains that alpha a is an undefined control sequence.

It says that it does not understand this command.

Let me close this.
Space between alpha and a LaTeX handles this through a space after every command.

Let us leave a space after alpha.

Compile Let us abort the compilation.

Let us recompile.

This has solved the problem.

As it is used to terminate a command, the space does not appear in pdf.

What do we do if we WANT to introduce spaces in the output?

We have to explicitly tell LaTeX, as we do now.

\\

Append $\alpha \ a$

Let us ask LaTeX to start a new line.

Let us write alpha backslash space a.

Compile Compile it.

This has created a space.

Append $\alpha \quad a$

Compile

If you want more space, use quad, as we do now.

Compile it.


You can see that quad has left a large space.

We will now move to another topic.
Delete 2nd and 3rd lines

Compile.

Let us delete the last two lines.

Let’s compile.

Prepend “Product of $\alpha$ and a is” to $\alpha a$

Compile.

What happens to the font when we go from the text to the mathematical mode?

To understand this, let us write “Product of $\alpha and a is”.

Compile.

You can see that the fonts of these two a's are different.
Change “ a “ to “ $a$ “

Compile.

This is solved by writing this 'a' also inside dollar signs.

Compile.

Now the fonts of these of two a’s are identical.

Not keeping the font of variables identical is a common mistake.

Delete everything Let’s get rid of these.

Let’s compile.

-$\alpha$

Compile


Let us now discuss a rule for creating minus signs.

Suppose that we want to create minus alpha.

Let’s compile.

Notice that the minus sign appears as a small dash here.

Append \\ $-\alpha$ in next line

Compile

Let us also copy, with the minus sign inside dollar.

Let us compile again.

See the difference in the minus sign now.


The second one is what we need.

This dash is not to be used.


Not putting the minus sign within dollars is a common mistake made by beginners.

Delete all Let us delete all of these.
Next we would like to explain the 'frac' command that is used to create fractions.
\frac a b


Compile

'frac a b'.

Let’s compile.

Point or highlight as per narration It generates 'a by b'.

The command 'frac' is terminated by a space.

It looks for two arguments.


The first character 'a' is taken as the first argument.

It becomes the numerator.

The second character 'b' is taken as the second argument.

It becomes the denominator.


Notice that the size of a and b gets reduced automatically.


What do we do if we have longer characters?

\frac ab cd, don’t compile What if we want to create ab by cd.

I want you to try this.

\frac{ab}{cd}


Compile

In LaTeX, the arguments longer than one character are enclosed by braces.


For example, let us put braces here.

When we compile THIS, we get the desired output.


All the entries within the braces are taken as a single argument.


As a result, one can enter any complicated expression within braces.

Delete all Let us delete all of these.
Now we will look at subscripts and superscripts.
X_a


'x' underscore 'a' creates 'x sub a'.

The size of 'a' gets automatically reduced to an appropriate level.

What if we want to put ab as the subscript?

You have to use braces.

Try it yourself.

x^3 Superscripts are created by the caret or the up arrow symbol.

For example, if you want to create 'x' to the power 3, you will write: x up arrow 3.

x_a^b We can also put subscripts and superscripts simultaneously.


Let us put x sub a superscript b.

Compile Let’s compile.


Once again, using braces, we can produce complicated subscripts and superscripts.

Delete Let me delete this.


\usepackage{amsmath}

Alright, next we will move onto Matrices.


The package a m s math has some matrix definitions that I like.

Let us include it through the usepackage command.

$\begin{matrix}

a & b

\end{matrix}$

The ampersand, that is the 'and' symbol, is used to separate the columns.


Let us create a matrix now.

We write begin matrix.

a and b, end matrix


Don’t forget the dollar signs.

Compile Compile and see the matrix, as expected.
After b, put \\, CR

c & d & e


Now suppose, we want to add a second row to this.

We put two back slashes, meaning, go to the next line.


Suppose that we want three entries in the second row, say, c, d, e.

Compile Compile it and see the second row also included now.
Change matrix to pmatrix in both places, compile Supposing we change matrix to pmatrix, at begin and end.


Compile and get this.


It is now time for YOU to start exploring.

Let us go to the slides now.
Show Slide 5

Summary

Let us summarise what we learnt in this tutorial.

Entering and leaving the mathematical mode

Using spaces and creating them

Fractions, subscripts and superscripts

Defining an argument with braces

amsmath package to create matrices

Show slide 6 Let me give some assignments.
# Spaces


This assignment is on spaces - large and small.

Please pause the video, read the slide and do the assignment.

2.  Fractions and braces This assignment is on fractions using braces.
3.  Subscripts, superscripts This assignment is on subscripts and superscripts.
4.  Matrices Through this assignment, we shall learn a few more methods to create matrices.
5.  More maths symbols

Highlight chap11-prn.pdf

Show this file (cont. mode)


Go back to the slides

This assignment is on creating more mathematical symbols.

This is based on the TUG India LaTeX guide.

Let us see that document now.

I already asked you to download this document from our web page.

You will reproduce some symbols given in this document.

6.  Package amssymb You will try out more symbols through the next assignment.
7. More of TUG India Document This assignment is also based on the TUG India document.
8. Paragraph indent You will experiment with the paragraph indent in this assignment.
This brings us to the end of this tutorial.
About project slide This video summarises the Spoken Tutorial project.

If you do not have good bandwidth, you may download and watch it.

Workshop slide We conduct workshops using Spoken Tutorials.

Give certificates.

Please contact us.

Spoken Tutorial Forum slide * Do you have questions in THIS Spoken Tutorial?
  • Please visit this site.
  • Choose the minute and second where you have the question.
  • Explain your question briefly.
  • Someone from our team will answer them.
Slide for no cluttering * The Spoken Tutorial forum is for specific questions on this tutorial.
  • Please do not post unrelated and general questions.
  • This will help reduce the clutter.
  • With less clutter, we can use these discussions as instructional material.
General questions * For topics not covered in spoken tutorials, visit stack exchange at this address.
  • This is a great place to get answers on LaTeX.
  • You may also have questions on our workshops, certificates, etc.
  • For this, get in touch with us at this email address.
Spoken Tutorial project is funded by NMEICT, MHRD, Government of India.
Thanks for joining.

Goodbye.

Contributors and Content Editors

Nancyvarkey