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