# LaTeX/C3/Feedback-diagram-with-Maths/English-timed

 Time Narration 00:00 Welcome to the spoken tutorial on embedding mathematics in Xfig. 00:05 In this tutorial, I shall explain how to create this figure. 00:11 Observe the mathematical expression in the second block. 00:16 You can embed any mathematical expression after learning this tutorial. 00:23 We shall create the figure in the previous slide, starting from this figure, which was created in the spoken tutorial on “Feedback Diagrams through Xfig”. 00:36 You should learn this tutorial before starting the current one. 00:42 Let me now explain, what all you need to learn the material taught in this course. 00:48 I am using Xfig Version 3.2, patch level 5. 00:52 You also need LaTeX and a familiarity with it. 00:56 You also need image cropping software. 01:01 pdfcrop works on Linux and Mac OS X. We will cover it in this tutorial. 01:09 Briss is said to work on Windows also, but not covered in this tutorial. 01:15 Let us go to Xfig. 01:19 Let us choose the File, then Open. 01:26 If we scroll through the list, we will see the file “feedback.fig”, created in the spoken tutorial on “Feedback Diagrams through Xfig”. Let us click it. 01:42 We will see the figure inside this box. 01:45 Let us open it. 01:53 Let us bring it inside. 02:01 Let us also zoom it. 02:05 Using the Save as option on “File”, we will save this figure as maths. 02:20 Let us save it. 02:24 We now have the file "maths.fig". 02:27 Let us select “Edit” and click the text “Plant”. 02:34 Let me take the mouse here. Let me delete this and enter $G(z) = \frac z{z-1}$ 02:50 Make sure that the mouse stays within the box while typing. 02:56 The default value for “Flag”' is “Normal” - change it to “Special”. 03:01 Click “Done”. 03:07 As the text is long, it overlaps with other entries. 03:12 Let us move the text outside the box and work with it. 03:23 Let me click here. 03:26 Let me choose Grid Mode. 03:31 Once we are satisfied with any changes that we may want here, we can put it back inside the box. 03:39 Let us save this file. 03:44 Let us export using combined pdf and Latex files. 03:51 File > Export > Combined pdf/LaTeX. Let us Export. 04:03 There is an error message that I get. But let us not worry about this. 04:11 Let me go to the terminal. 04:13 Let me type ls -lrt. 04:21 We get a list of files, with the last one being the most recent. 04:26 The last two files are maths.pdf_t and maths.pdf. 04:33 Let us give the command open maths.pdf. 04:42 Let us bring it inside. 04:45 We can see the block diagram without the mathematical expression. 04:50 Let me close this. 04:52 Let us see maths.pdf_t in emacs editor that I have already opened. 05:01 It is here. Let me open it. 05:14 Please note that you do NOT have to use emacs. 05:17 You can use WHATEVER editor that you are comfortable with. 05:22 You can see that the “picture” environment is used. 05:26 It also makes use of includegraphics and color packages – we need to tell LaTeX to take care of this requirement. 05:41 Let me now open the file maths-bp.tex; I have already created for this tutorial. 05:59 I have used article class. 06:02 I have used color and graphicx packages as these are used in the file pdf_t, the one we saw earlier. 06:15 I want empty pagestyle as I do not want the page number. 06:20 Finally, I want to include the file maths.pdf_t. 06: 27 Let us invoke the command pdflatex maths-bp in the terminal. 06:42 We get the message that the maths-bp.pdf is created. 06:48 Let us open it with the command open maths-bp.pdf. 06:58 We have the file we want. Let me zoom it. 07:07 Now that we know that the mathematical expression is working, let us move the text inside the block. 07:30 Let us save and export. It is already in the required language. Export. 07:38 Let us dismiss this warning. 07:41 Let me compile it again. 07:44 Let us click the pdf browser that has the file. 07: 49 Now you see the mathematical expression inside the box, the way we want. 07:56 Let us now see what happens if we do not choose the Special flag. 08:01 Let me come here. 08:04 Let me edit the text, change the Special Flag to Normal. Done. 08:25 File > Save. Let me export. 08:37 Let me compile. Let me come here. 08:41 The formula is no longer in the form we want. 08:46 Let us change the “Special Flag” back to “Special”. 09:03 Save, Export. 09:12 Recompile. You see that the file is in the form we want. 09:18 Let us now improve the appearance of this formula. 09:22 In this case, the use of 'dfrac' will make the fraction look better. 09:28 In view of this, let us change 'frac' to 'dfrac'. 09:38 Let me click here. Keep the mouse inside the box. 09:43 Put 'd' here. Done. Save, Export. 09:52 Let us compile once again using pdflatex. 10:03 We get the error message “Undefined control sequence” "\dfrac". 10:11 LaTeX complains because the command \dfrac is defined in the package “Amsmath” but we have not included it. 10:21 We need to include it in the file maths-bp.tex'. 10:27 Let us do it. Let us go to emacs. 10:35 Enter “\usepackage{amsmath}”. 10:41 Let us save the file. Let us compile once again. Let me first exit. 10:49 Let me now recompile. Now it compiles. Let us click this. 10:59 We see that the fraction has now come out nicely. 11:03 We have now achieved our objective of learning how to embed mathematical expressions in Xfig. 11:11 It is important to note that Xfig does not interpret the LaTeX commands at all. 11:16 The interpretation is done by the “pdflatex” command. 11:20 The LaTeX commands have to be correct and consistent at the time of compilation. 11:25 We will now explain how to remove the white space around the figure. 11:31 Let me go to the terminal. 11:33 Let me type the command “pdfcrop maths-bp.pdf” - this is the file we created, into “maths-out.pdf”. 11:53 Pdfcrop says, one page written on this file. 11:57 “pdfcrop” takes an input file, trims the space around the figure and writes out the cropped file in the output file. 12:09 “pdfcrop” is already installed in my system. 12:12 If you do not have it, you need to install it first. 12:15 Let us view this output file by the command, “open maths-out.pdf”. 12:29 Let me bring it inside. 12:31 The figure has now become extremely compact. 12:34 The white space that was here has been completely removed. 12:38 We can now insert this into documents. 12:42 Let me close this. Let me close this also. Let me close this also. 12:52 Let me come back to the slides. 12:57 The software “briss” can also be used to crop the white space. 13:01 It is supposed to work on Linux, Mac OS X and also on Windows. 13:08 I have checked its working on Mac OS X. But we will not demonstrate it here. 13:17 We have now come to the end of this tutorial. 13:20 We have an assignment for you. Make the diagram created in this tutorial more symmetric and beautiful. 13:27 Try out different mathematical expressions. 13:30 Try out other options such as flip and rotate, not covered in the spoken tutorial. 13:36 Try to build different diagrams. Explore the library. 13:41 Do an internet search and locate information relevant to Xfig. 13:47 Useful learning material is available at spoken-tutorial.org. It is here. 14:02 The concept of spoken tutorials is explained in "What is a Spoken Tutorial?". 14:09 You may learn LaTeX using the spoken tutorials, available here, which I have downloaded in this tab. 14:19 The tutorial on Mathematical Typesetting explains how to create maths in LaTeX. 14:29 The tutorial on Tables and Figures explains how to place figures of the type created in this tutorial into documents. 14:38 This website has a lot of information, including Xfig tutorials. Come back to the slides. 14:53 Spoken Tutorial is a part of the Talk to a Teacher project, supported by the National Mission on Education through ICT (NMEICT), MHRD, Government of India. 15:03 More information on this mission is available at:spoken-tutorial.org/NMEICT-Intro. 15:12 We welcome your participation and also feedback. 15:16 This is Kannan Moudgalya, signing off. Thanks for joining.