Difference between revisions of "LaTeX/C2/Equations/English"
Pravin1389 (Talk | contribs) |
Pravin1389 (Talk | contribs) |
||
Line 1: | Line 1: | ||
− | {| | + | {| border = 1 |
|- | |- | ||
− | | | + | || Initial conditions |
− | + | || # Copy equations.tex into numbers.tex | |
− | | | + | |
# Both equations.tex and numbers.tex should be sized | # Both equations.tex and numbers.tex should be sized | ||
# Both should be opened in Texworks | # Both should be opened in Texworks | ||
Line 15: | Line 14: | ||
# All should be arranged, as recorded in the tutorial | # All should be arranged, as recorded in the tutorial | ||
# equations.tex should be directly below the slides file | # equations.tex should be directly below the slides file | ||
− | |||
− | |||
|- | |- | ||
− | | | + | || Texworks: Lucida |
− | + | || Grande, 22pt, 20px. Preview: 75%, 200dpi | |
− | | | + | |
|- | |- | ||
− | | | + | || Opening slide |
− | + | || Welcome to this tutorial on writing equations using LaTeX | |
− | | | + | |
My name is Kannan Moudgalya | My name is Kannan Moudgalya | ||
|- | |- | ||
− | | | + | || Learning objectives slide |
− | + | ||
− | + | ||
Down arrow | Down arrow | ||
− | |||
Down arrow | Down arrow | ||
− | |||
Down arrow | Down arrow | ||
− | | | + | || In this tutorial, we will learn how to create <u>an</u> equation in LaTeX |
How to write <u>multiple</u> equations | How to write <u>multiple</u> equations | ||
Line 47: | Line 38: | ||
Why we should avoid the dollar mode and blank lines while writing equations | Why we should avoid the dollar mode and blank lines while writing equations | ||
|- | |- | ||
− | | | + | || System requirements slide |
− | + | || One may use any of Linux, Windows or the Mac operating system | |
− | | | + | |
One needs LaTeX | One needs LaTeX | ||
Line 55: | Line 45: | ||
I shall use Texworks, although it is not required | I shall use Texworks, although it is not required | ||
|- | |- | ||
− | | | + | || Prerequisites slide |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
Press Down arrow | Press Down arrow | ||
− | |||
Down arrow | Down arrow | ||
− | | | + | || What are the prerequisites? |
One needs to be familiar with spoken tutorials that introduce LaTeX | One needs to be familiar with spoken tutorials that introduce LaTeX | ||
Line 73: | Line 58: | ||
This information is available at the Spoken Tutorial webpage | This information is available at the Spoken Tutorial webpage | ||
|- | |- | ||
− | | | + | || Additional material slide |
− | + | ||
Open in Texworks | Open in Texworks | ||
− | |||
Back to slides file, press down arrow | Back to slides file, press down arrow | ||
− | |||
Press down arrow | Press down arrow | ||
− | |||
Press down arrow | Press down arrow | ||
− | | | + | || I shall use <u>equations.tex</u> |
Line 98: | Line 79: | ||
If you don't have it, please download it from the Spoken Tutorial website | If you don't have it, please download it from the Spoken Tutorial website | ||
|- | |- | ||
− | | | + | || Slide on Leslie Lamport’s book |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
Web browser is opened | Web browser is opened | ||
− | | | + | || I will next call your attention to this standard textbook by Leslie Lamport |
I learnt my LaTeX from this book | I learnt my LaTeX from this book | ||
Line 119: | Line 90: | ||
Let me show on the web browser where one can buy it | Let me show on the web browser where one can buy it | ||
|- | |- | ||
− | | | + | || |
− | | | + | || Let us begin the tutorial |
− | + | ||
|- | |- | ||
− | | | + | || Open equations.tex |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
Open numbers.tex | Open numbers.tex | ||
− | | | + | || Let us learn how to write equations using LaTeX |
I have already opened the file equations.tex in TeXworks. | I have already opened the file equations.tex in TeXworks. | ||
Line 156: | Line 112: | ||
I recommend this method whenever a code file is given with ANY spoken tutorial | I recommend this method whenever a code file is given with ANY spoken tutorial | ||
|- | |- | ||
− | | | + | || Press the typeset key |
− | + | || Let us compile this file by pressing the typeset arrow at the top left hand corner | |
− | | | + | |
You can see the pdf file on the right | You can see the pdf file on the right | ||
Line 168: | Line 123: | ||
This is the only way I can show the entire file and also use a large font | This is the only way I can show the entire file and also use a large font | ||
|- | |- | ||
− | | | + | || |
− | + | ||
Change 7 to 15 | Change 7 to 15 | ||
− | |||
Put back 7 | Put back 7 | ||
− | |||
Click amsmath line | Click amsmath line | ||
− | + | || You may want to increase it to a more reasonable value, such as 15cm | |
− | + | ||
− | | | + | |
But I will continue to use 8cm | But I will continue to use 8cm | ||
Line 187: | Line 137: | ||
I am using the package amsmath | I am using the package amsmath | ||
|- | |- | ||
− | | | + | || Click the first align |
− | + | ||
− | + | lick u(t) line in tex | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
click u(t) on slide | click u(t) on slide | ||
− | |||
− | |||
Hover on \left and click \right | Hover on \left and click \right | ||
− | | | + | || I write the first equation within the align star environment, as shown here |
You can see how it gets typeset in the pdf file | You can see how it gets typeset in the pdf file | ||
Line 218: | Line 158: | ||
With “back slash left square” and “back slash right square” brackets as shown here | With “back slash left square” and “back slash right square” brackets as shown here | ||
|- | |- | ||
− | | | + | || Scroll the tex file up |
− | + | ||
Line 238: | Line 177: | ||
Delete row 1 compile | Delete row 1 compile | ||
− | |||
− | |||
Click the pdf | Click the pdf | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
Undo the last command in tex | Undo the last command in tex | ||
− | | | + | || Similarly, I write a second equation using align star |
Line 281: | Line 212: | ||
Similarly, you can change the columns too | Similarly, you can change the columns too | ||
|- | |- | ||
− | | | + | || |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
Put $ and compile | Put $ and compile | ||
− | + | || Recall that we used the $ mode to write formulae in another tutorial | |
− | + | ||
− | | | + | |
Here, align plays the role of the $ mode | Here, align plays the role of the $ mode | ||
Line 321: | Line 234: | ||
Compile again, it works | Compile again, it works | ||
|- | |- | ||
− | | | + | || |
− | + | ||
+ | Below the line with alpha, leave a blank line | ||
− | |||
+ | Put % | ||
− | + | ||
− | | | + | || Another common mistake is leaving blank lines in the align environment |
Let me leave an empty line and compile | Let me leave an empty line and compile | ||
Line 346: | Line 259: | ||
Let us remove this line and compile | Let us remove this line and compile | ||
|- | |- | ||
− | | | + | || |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
Remove \end{align*} | Remove \end{align*} | ||
− | |||
Remove \begin{align*} | Remove \begin{align*} | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
Line 380: | Line 279: | ||
Put the text into \intertext{} | Put the text into \intertext{} | ||
− | |||
− | |||
Line 395: | Line 292: | ||
Compile | Compile | ||
− | |||
− | |||
− | |||
− | |||
− | |||
Line 408: | Line 300: | ||
Put & sign before = | Put & sign before = | ||
− | |||
Repeat in the 2<sup>nd</sup> eqn. | Repeat in the 2<sup>nd</sup> eqn. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
Compile | Compile | ||
− | + | || Next, I want to align the two equations by the equal to sign | |
− | + | ||
− | + | ||
− | | | + | |
For this, we need to put both equations inside one align star environment | For this, we need to put both equations inside one align star environment | ||
Line 472: | Line 355: | ||
On compiling, we see the two equations aligned by the equal to sign | On compiling, we see the two equations aligned by the equal to sign | ||
|- | |- | ||
− | | | + | || |
− | | | + | || The equations are aligned even though there is text in between. |
− | + | ||
Remember to use the <u>intertext</u> command whether you want the equations aligned or not | Remember to use the <u>intertext</u> command whether you want the equations aligned or not | ||
|- | |- | ||
− | | | + | || |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
Delete text lines | Delete text lines | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
Line 501: | Line 369: | ||
Put \\ | Put \\ | ||
− | |||
Compile | Compile | ||
− | |||
Undo | Undo | ||
− | | | + | || What do we do if we don’t have text between equations? |
To understand this, let us delete the entire text between the two equations | To understand this, let us delete the entire text between the two equations | ||
Line 525: | Line 391: | ||
Let us compile once more | Let us compile once more | ||
|- | |- | ||
− | | | + | || |
− | | | + | || This is where we will stop |
− | + | ||
Let me go to the slides | Let me go to the slides | ||
|- | |- | ||
− | | | + | || Summary slide |
− | + | ||
Down arrow | Down arrow | ||
Down arrow | Down arrow | ||
− | | | + | || This page summarises what we learnt in this tutorial |
Please recall each of these commands | Please recall each of these commands | ||
Line 543: | Line 407: | ||
This is your first assignment | This is your first assignment | ||
|- | |- | ||
− | | | + | || More assignments slide |
− | + | ||
Down arrow | Down arrow | ||
− | | | + | || I will give some more assignments |
Can you pause the video and try to produce these equations? | Can you pause the video and try to produce these equations? | ||
Line 553: | Line 416: | ||
The required code is given here | The required code is given here | ||
|- | |- | ||
− | | | + | || Assignment 3 |
− | + | || Can you produce these equations? | |
− | | | + | |
Notice that these equations are now aligned at the equal to sign | Notice that these equations are now aligned at the equal to sign | ||
|- | |- | ||
− | | | + | || Assignment 4 |
− | + | || What happens if you forget a required ampersand sign? | |
− | | | + | |
Please pause the video and try this input | Please pause the video and try this input | ||
Line 569: | Line 430: | ||
Forgetting ampersand signs is a common mistake made by everyone! | Forgetting ampersand signs is a common mistake made by everyone! | ||
|- | |- | ||
− | | | + | || Assignment 5 |
− | + | || Can you pause this video and try to produce this output? | |
− | | | + | |
Use the hint given here | Use the hint given here | ||
|- | |- | ||
− | | | + | || Assignment 6 |
− | + | || In this assignment, you have to align three equations | |
− | | | + | |
Please pause the video here, and try to produce them by yourself | Please pause the video here, and try to produce them by yourself | ||
Line 583: | Line 442: | ||
I have given the answer here | I have given the answer here | ||
|- | |- | ||
− | | | + | || Assignment 7 |
− | + | || I have the last assignment in this slide | |
− | | | + | |
Insert some text between equations | Insert some text between equations | ||
|- | |- | ||
− | | | + | || About the ST slide |
− | + | || I will now give some general information | |
− | + | ||
− | + | ||
− | + | ||
− | | | + | |
− | + | ||
This video summarises the '''Spoken Tutorial''' project | This video summarises the '''Spoken Tutorial''' project | ||
− | |||
− | |||
− | |||
|- | |- | ||
− | | | + | || Workshops slide |
− | + | || We conduct workshops using '''Spoken Tutorials''' | |
− | | | + | |
|- | |- | ||
− | | | + | || Answers slide |
− | + | ||
Press down arrow | Press down arrow | ||
Line 618: | Line 466: | ||
Down arrow twice | Down arrow twice | ||
− | | | + | || Do you have questions in <u>THIS</u> '''Spoken Tutorial?''' * Please visit this site |
* Choose the minute and second where you have the question | * Choose the minute and second where you have the question | ||
* Explain your question briefly | * Explain your question briefly | ||
* Someone from our team will answer them | * Someone from our team will answer them | ||
− | |||
You will have to register on this website to ask questions | You will have to register on this website to ask questions | ||
|- | |- | ||
− | | | + | || Where to post slide |
− | + | || For topics not covered in spoken tutorials, visit '''stack exchange''' at this address | |
− | | | + | |
|- | |- | ||
− | | | + | || Contact us slide |
− | + | || For any other questions, please contact us | |
− | | | + | |
|- | |- | ||
− | | | + | || Acknowledgement slide |
− | + | || '''Spoken Tutorial''' project is funded by MHRD, Government of India | |
− | | | + | |
|- | |- | ||
− | | | + | || |
− | | | + | || Thanks for joining |
− | + | ||
Goodbye | Goodbye | ||
|- | |- | ||
|} | |} |
Revision as of 15:06, 16 October 2019
Initial conditions | # Copy equations.tex into numbers.tex
|
Texworks: Lucida | Grande, 22pt, 20px. Preview: 75%, 200dpi |
Opening slide | Welcome to this tutorial on writing equations using LaTeX
My name is Kannan Moudgalya |
Learning objectives slide
Down arrow Down arrow Down arrow |
In this tutorial, we will learn how to create an equation in LaTeX
How to write multiple equations How to align multiple equations and Why we should avoid the dollar mode and blank lines while writing equations |
System requirements slide | One may use any of Linux, Windows or the Mac operating system
One needs LaTeX I shall use Texworks, although it is not required |
Prerequisites slide
Press Down arrow Down arrow |
What are the prerequisites?
One needs to be familiar with spoken tutorials that introduce LaTeX Exposure to the recommended method of side-by-side learning This information is available at the Spoken Tutorial webpage |
Additional material slide
Open in Texworks Back to slides file, press down arrow Press down arrow Press down arrow |
I shall use equations.tex
You need to have it to practise along with me If you don't have it, please download it from the Spoken Tutorial website |
Slide on Leslie Lamport’s book
Web browser is opened |
I will next call your attention to this standard textbook by Leslie Lamport
I learnt my LaTeX from this book It is available for about Rs. 500 Let me show on the web browser where one can buy it |
Let us begin the tutorial | |
Open equations.tex
Open numbers.tex |
Let us learn how to write equations using LaTeX
I have already opened the file equations.tex in TeXworks. I have saved it as numbers.tex to use in this tutorial I will keep the file equations.tex intact, and not change it Let me open numbers.tex Please pause the tutorial, make this copy and open it Whenever you want to start afresh, you can make a new copy of equations.tex I recommend this method whenever a code file is given with ANY spoken tutorial |
Press the typeset key | Let us compile this file by pressing the typeset arrow at the top left hand corner
You can see the pdf file on the right Let us look at the tex file, which begins with its usual commands I have chosen the width of the pdf file to be 8cm This is the only way I can show the entire file and also use a large font |
Change 7 to 15 Put back 7 Click amsmath line |
You may want to increase it to a more reasonable value, such as 15cm
But I will continue to use 8cm I am using the package amsmath |
Click the first align
lick u(t) line in tex
|
I write the first equation within the align star environment, as shown here
You can see how it gets typeset in the pdf file On the left hand side of this equation, we have u(t) On the right hand side, I have produced big square brackets How did I do this? With “back slash left square” and “back slash right square” brackets as shown here |
Scroll the tex file up
|
Similarly, I write a second equation using align star
We can see the pdf output here On the right hand side, we have a 3 by 3 matrix See the corresponding output Suppose we delete the first row in this matrix and compile
The first line is gone It is your responsibility to make the equations correct and consistent Let me put the row back
You can also add more rows, if necessary Similarly, you can change the columns too |
Put $ and compile |
Recall that we used the $ mode to write formulae in another tutorial
Here, align plays the role of the $ mode In fact, one should not put the dollar sign within the align environment Suppose we put the alpha symbol within $ signs and compile
Press the cross symbol on the top left red box And abort the previous compilation Let us remove the $ signs Compile again, it works |
Below the line with alpha, leave a blank line
Put %
|
Another common mistake is leaving blank lines in the align environment
Let me leave an empty line and compile It gives an error message If you need this gap, put %, the comment character, in the first column Abort compilation Compile again - we see that it works Let us remove this line and compile |
Remove \end{align*} Remove \begin{align*}
Put & sign before = Repeat in the 2nd eqn.
Compile |
Next, I want to align the two equations by the equal to sign
For this, we need to put both equations inside one align star environment Remove the end align* command of the first equation Remove the begin align* command of the second equation
We see only one equation appearing The text in between the two equations appears as a large string The second equation does not even show up This is not what we wanted This problem is solved with the help of the intertext command Let us put the text in between braces Let us also put this command back slash intertext as I type now Note that intertext is one word, without a space in between Do not forget the back slash before intertext Also, do not forget the closing brace These are all common mistakes On compiling, we get this pdf file You see the equations right aligned I am not happy with it I want to align by the equal to sign Let us put the ampersand sign in front of the equal to sign of the first equation Let us do it on the second equation also If you have more equations to be aligned, do this for all of them On compiling, we see the two equations aligned by the equal to sign |
The equations are aligned even though there is text in between.
Remember to use the intertext command whether you want the equations aligned or not | |
Delete text lines
Compile Undo |
What do we do if we don’t have text between equations?
To understand this, let us delete the entire text between the two equations Note that we should not leave an empty line On compiling, we see both equations coming in the same line We didn’t tell LaTeX to start the second equation in the next line We solve this by putting two back slashes Let us compile, to get the correct pdf file Let us now undo and put the text in between two equations Let us compile once more |
This is where we will stop
Let me go to the slides | |
Summary slide
Down arrow Down arrow |
This page summarises what we learnt in this tutorial
Please recall each of these commands This is your first assignment |
More assignments slide
Down arrow |
I will give some more assignments
Can you pause the video and try to produce these equations? The required code is given here |
Assignment 3 | Can you produce these equations?
Notice that these equations are now aligned at the equal to sign |
Assignment 4 | What happens if you forget a required ampersand sign?
Please pause the video and try this input You should get this output Forgetting ampersand signs is a common mistake made by everyone! |
Assignment 5 | Can you pause this video and try to produce this output?
Use the hint given here |
Assignment 6 | In this assignment, you have to align three equations
Please pause the video here, and try to produce them by yourself I have given the answer here |
Assignment 7 | I have the last assignment in this slide
Insert some text between equations |
About the ST slide | I will now give some general information
This video summarises the Spoken Tutorial project |
Workshops slide | We conduct workshops using Spoken Tutorials |
Answers slide
Press down arrow Down arrow Down arrow Down arrow Down arrow twice |
Do you have questions in THIS Spoken Tutorial? * Please visit this site
|
Where to post slide | For topics not covered in spoken tutorials, visit stack exchange at this address |
Contact us slide | For any other questions, please contact us |
Acknowledgement slide | Spoken Tutorial project is funded by MHRD, Government of India |
Thanks for joining
Goodbye |