Wednesday, September 20, 2017

MATHS7000: Using WinEdt on UoM clusters

Creating a New Article

Tex is a computer program that can typeset text and mathematical formulae. Latex is a markup language that uses tex as its typesetting engine. Basically this allows the user to embed commands within a text file that can be interpreted by latex to produce a high quality typeset documents. WinEdt is a latex integrated development environment (IDE) for windows, that means that you can both edit text files and produce typeset documents all in one program, it is available to download for free but only on a trial basis. For a free (and in my opinion better) IDE I recommend TeXStudio which is available on all platforms (including Mac and Linux). The program should be available in the clusters but after a recent install it has stopped working.
In this short article I will outline how to open up your first LATEXfile and produce a pdf output. First select ”WinEdt” from the start menu by searching for the item.

Once you have clicked on the program you will be presented with an empty window. You now want to open a new document (NOT a new file), see below

After clicking on a new document you will be presented with a variety of different templates that can be used to create a new document. In this example we want to try the ”LaTeX:AMS Article”, since it comes with Maths and graphics packages preloaded.

After opening up your new document you will see a template document with stars (i.e. *) in the places where you should enter informations. Most of the commands are self explanatory, so put your title in square and curly brackets following \title, the author in the curly brackets following \author and so on. You can try filling in your own information or copy mine...

IMPORTANT:- Until you have saved your document it will not appear on the system and you will not be able to view the output. Click on the save button and you will be presented with the save dialog. You MUST save the file with the correct file ending, this means that you have to put “.tex” on the end of the filename, for instance I

in the picture below.

Once your file has been successfully saved you are ready to create a new pdf document by compiling your tex file. WinEdt has a button

that does this it has a little lightning strike in it! Once you have pressed the button a new document should appear on screen.

Thursday, September 24, 2015

Using TexStudio on UoM windows image

A Simple Latex File
Tex is a computer program that can typeset text and mathematical formulae. Latex is a markup language that uses tex as its typesetting engine. Basically this allows the user to embed commands within a text file that can be interpreted by latex to produce a high quality typeset documents. TexStudio is a cross-platform latex integrated development environment (IDE) for windows, OSX and linux that means that you can both edit text files and produce typeset documents all in one program. Best of all the program is free and available to download, click here for my guide on setting it up on Windows.

Click on the start menu at the bottom of the page and enter 'texstudio' in the search bar, then click on the application. Now select File->New from Template... and choose to create an article.
Now press the funny green arrow (the one to the left of the two green arrows) and this should build and open up a window to view your created document inside TeXstudio.
Now you're ready to go!

Thursday, June 11, 2015

School Of Maths - Thesis Template - getting started on TeXstudio

Here we are going to describe how to open up the thesis template on the School of Maths website and get it running on TeXstudio. First go the page on the School's website where the templates are held (click here).

Installing MiKTeX and TeXstudio on windows

In this blog we will introduce how to install MiKTeX and TeXstudio on windows. It is very easy! You just have to accept all the default conditions.

Go to the MiKTeX downloads page (click here) and select the basic installer.

Wednesday, October 30, 2013

Using bibtex for referencing

I am going to give a quick description of bibtex here, but there is already a good guide on bibtex available on the university pages here. Using bibtex is fast and easy way to keep track of referencing within a document. It uses a plain text file containing a database of all your references, each of which must be given a unique keyword. A bibtex database entry looks something like this:

  title={The Paper Title},
  author={Joe Black and Mary White},
  journal={The Journal of Something},

The syntax is quite straight forward, the @keyword is used to indicate the type of entry, be it an article, a book or an entry in a conference proceedings. Next you give the entry a unique keyword so that you can cite the entry in the text. Then follows a list of items found in your reference, each separated by a comma. If you are having problems check that all items in the list have a comma following them as this is quite easy to forget. In fact you don't even need to know this as most websites (such as google scholar) give the option to export a citation in this format (see later on).

Now we shall start assuming you have a working tex document. Go to the menu and open a new file. Now go to the menu and select the save as option, making sure the directory is the same as where you have saved your tex document, then enter the name myBib.bib for the filename and BibTeX for the file type. Click save.

Now open google scholar in your web browser and click on the settings option in the top banner of the web page. You should now see an option near the bottom of the screen to Show links to import citations into. Select this option and make sure the bibtex option is selected. Save your settings.
Now enter a search for famous reference, such as "Black Scholes option pricing". Underneath the listed items you should now see a link on each item to Import into Bibtex, click on the link. You should now see something like
Copy and paste the text into your bibtex file and save it.

Now we can cite the reference in our text. Add the following line in your text

My first citation is \cite{black1973pricing}.
where the keyword is the same as the one in your bib file entry. Finally add the lines
at the end of your document. Run pdfLatex, bibtex (the button with a B on it in winedt) and then pdfLatex again two or three times. It should look something like this:
There are many different styles of referencing that can be used and it is very easy to switch between the different styles simply by changing the bibliographystyle command.

One package included in latex that can make your referencing very nice is the natbib package. To use this package instead of the standard one include the line

at the top of your document and change your style to
and recompile your document.
Now we get a reference list without the numbers and the name and year quoted in the text. The style of your bibliography is optional but I feel that this is much cleaner and neater.

Tuesday, October 29, 2013

Installing and Running Gnuplot on Ubuntu

Gnuplot is simple to install and use on Ubuntu systems as the latest version is included in the Ubuntu repositories. One part that is not included by default is auto complete at the gnuplot command line. In order to install gnuplot and enable auto complete, simply open a terminal, and type the following command

sudo apt-get install gnuplot rlwrap

UPDATE On Ubuntu 12.04 and later you need to specify what version of gnuplot to install (qt or x11), so change the command above to

sudo apt-get install gnuplot-qt rlwrap

Then open your bash configuration file (if using the default bash shell)

gedit ~/.bashrc &

and add the following lines to the file somewhere near the bottom

# enable autocomplete in gnuplot
alias gnuplot="rlwrap -a -c -b\"\\\"\\\"\\\'\\\'\" gnuplot"

save the file and exit.

First we need some data for plotting, for instance the file

may be downloaded from my website.

Now open a new terminal and type gnuplot into the command line. You should see the following:

Now enter the following:

p 'te

and press the tab key. The filename should auto complete. If it does not appear press the tab key again as there might be multiple files beginning `te', and you might need to enter more letters to allow it to complete. If it is still not working, enter !ls and check that the file is present in your current working directory. Complete the gnuplot command to plot the file with lines and press return

p 'testResults.dat' w l

If it all works you should see:

Tuesday, September 25, 2012

Introduction to Gnuplot

Simple Plotting with Gnuplot

Gnuplot is a powerful command line driven plotting program that is available for Windows, Mac and linux (and others). It is freely available to install and use. The application has two main features: it allows us to interactively plot mathematical functions and data at the command line; and also to create scripts that can analyse data or just create hundreds of figure plots simultaneously.

The big advantage for scientists is the ability to quickly review results from numerical calculations. Rather than waiting minutes to load up a spreadsheet program and create a plot results can be viewed almost instantly.

Please see other posts [1] for how to install and use on different operating systems. In this tutorial we shall use a terminal on the linux based Ubuntu DE to demonstrate the commands. The commands themselves are the same regardless of which operating system we work on. For a full list of commands and a more indepth look at the program you can find the official docs here

Gnuplot Official Guide (pdf)

Open a new terminal and type gnuplot into the command line. You should see the following:

Now enter the following command, press return

plot sin(x) with lines

and you should see

Inputting other functions is relatively simple, the syntax is similar to that found on other popular mathematical programs such as matlab. You can also store parameters, create functions and change them interactively, for instance enter the following code

a = 1.4
b = 0.13
f(x) = a * exp(-b*x*x)
plot f(x) with lines

which appears on screen as

Now we can add labels, change the distance between tics, the range/domain, and add rename the key with the following

set xlabel "x"
set ylabel "y"
set xtics 4
set ytics 0.25
set xrange [-8:8]
set yrange [0:1.5]
plot f(x) title "My Function" with lines

Try experimenting with different functions and changing the properties of the plot. Next try plotting 2D and 3D data from files in the post " Plotting 2D and 3D data with Gnuplot ".