For those of you who missed the UK TeX Users Group and University of East Anglia course back in July, there’s another LaTeX training session happening at Oxford this October.
An Introduction to LaTeX
The Department for Continuing Education at Oxford University is organising a full-day course on October 16th.
It is aimed at beginners and will cover creating documents (including letters), graphics and bibliography.
Registration
The course costs £50 and enrolment is either online or by downloading an application form – both available on the course webpage:
There’s clearly a need for introductory courses like these!
Future Courses
It sounds like the UK TeX Users Group will repeat this course later in the year if there’s sufficient demand. Joseph Wright writes:
We are starting a list of interested people in case anyone drops out, and will be looking at holding another course later in the year if there is the interest. So do consider sending a registration e-mail: the more people we know are interested the more likely it is that another course can be organised.
Who to Contact
As before, please email Joseph Wright <joseph.wright@morningstar2.co.uk> with details of your experience with LaTeX and your academic subject area.
It’s easy and convenient to use just one .tex file when writing short documents. But for anything larger than, say, 10,000 words, I tend to divide the document into smaller parts so each chapter is its own .tex file.
For example, you might be writing a thesis that includes three chapters (introduction, results, conclusion) and an appendix. These are called introduction.tex, results.tex, conclusion.tex and appendix.tex.
These four files are like any other .tex file except you omit the preamble (\documentclass, \usepackage, etc.) and the \begin{document} and \end{document} commands. The reason you don’t include these commands is that they are included in your main file, thesis.tex, ensuring that your formatting is consistent throughout the final output document. This also means that page numbers and footnotes will be numbered correctly all the way through.
Which Commands to Use
There are two commands you can use in your main file, thesis.tex, to insert your four chapter files: \include and \input.
The \input command slots each chapter in straight after the one before it without any pagebreaks, while \include works by starting each new chapter on a new page and ends it with a clearpage command. (Thanks to the latex-community forum for help on explaining this to me!)
In other words, ‘natural candidates for \include are whole chapters of a book but not necessarily small fractions of text,’ for which \input would be more appropriate. (Quotation from The LaTeX Companion.)
Your thesis.tex file would therefore look something like this:
\documentclass{article}
\usepackage{semtrans}
\begin{document}
\title{My Thesis}
\author{John E. Smith}
\maketitle
\clearpage
Note: your four files (introduction.tex, results.tex, conclusion.tex and appendix.tex) must be saved in the same folder as thesis.tex, otherwise it won’t work.
Omitting Files
If you wanted to produce a PDF from the file thesis.tex without the appendix, all you have to do is comment out that particular \include command (you just add a % at the beginning of the line): %\include{appendix}
Here are some easy instructions for creating your first LaTeX document.
1. Opening a New Document
Open TeXnicCenter and click on File > New. This will load a blank document. Select File > Save As and give your file a suitable name. I will use ‘test’.
You’ll see that this file is a .tex file (test.tex). The TEX file is the one you use to write and edit your document.
2. Preamble
Document Class
Before you can start writing, you need to specify exactly what type of document you want to create. This is done in the preamble.
LaTeX supports several different document types, such as article, report, book, beamer, etc. These are called document classes.
All LaTeX commands begin with a backslash ‘\‘ and are followed by special characters or letters. So to specify your type of document, the command is:
As I’ve mentioned in a previous post, add-on features for the LaTeX system are known as packages. If, for example, you want to use the semtrans package to display special transliteration characters in your document, you need to state that in the preamble.
The general command for specifying the package you want to use is:
\usepackage[options]{package}
Sometimes, there won’t be any options to specify (like with semtrans). You can also include a whole list of packages you want to use in the preamble, but you have to use a new command each time. For example:
Now to begin the text you want to write, you start with the command:
\begin{document}
and end with the command:
\end{document}
This \end{document} command should be the very last thing in your document. Anything that comes after it will be ignored by LaTeX.
4. Example Document
You are now ready to write your first document. Type the following into your test.tex file in TeXnicCenter (I have specified an article of 10pt type on A4 paper):
\documentclass[10pt,a4paper]{article}
\begin{document}
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Quisque ut ante pulvinar mauris interdum euismod. Aliquam dui tellus, blandit at, tincidunt ac, feugiat id, nibh.
Phasellus id metus. Aliquam erat volutpat. Donec fringilla. Donec euismod, velit quis adipiscing hendrerit, enim eros tempor mi, a hendrerit ipsum eros eget leo.
\end{document}
Save the document. Note that to start a new paragraph, you just need to leave an empty line in the text.
5. Generating a PDF
Step 1: On the toolbar, you’ll see a drop-down option. Select LaTeX => PDF. See the picture on the right.
Step 2: Click on Build > Current File > Build. The shortcut is ctrl+F7 and there is also an icon on the toolbar.
You’ll see the document compiling if you have the output bar open. If not, click on View > Output Bar. If there are any errors in your document, you will see them listed in the output bar.
Step 3: To view your PDF, click on Build > View Output. The shortcut is F5 and there is also an icon on the toolbar.
If you want to combine steps 2 and 3, you can just click on Build > Build and View. The shortcut is ctrl+shift+F5 and there is an icon on the toolbar.
N.B. If you add more text to your document, save it, and want to generate the PDF again, you must close the test.pdf file first. Otherwise it won’t work.
An alternative to using PDFs is viewing your output as a DVI file. To do this, start at step 1 again, but select LaTeX => DVI, then steps 2 and 3 are the same.
The advantage of using a DVI file during the draft stage is that you don’t have to keep closing it before generating a new version again.
Here is the output PDF of the document: test.pdf
6. A Note on File Types
If you now have a look at the folder where you saved test.tex, you’ll see test.pdf there as well.
But there are a whole lot of other files too, such as:
test.aux
test.bbl
test.blg
test.log
Just ignore these.
If you want to edit your text, click on the TEX file, test.tex. If you want to re-open the PDF or DVI files, click on test.pdf or test.dvi.
Useful Links
Another alternative is WinEdt. This can be downloaded and used free for a trial period of 31 days. Thereafter you have to buy it – currently $40 for educational use. See http://www.winedt.com/.
These are just the programs I’m familiar with – there are lots of other editors out there. And for the minimalist approach you can just use Notepad and generate a PDF from the command line…
Important Features
Here are some things to bear in mind when choosing an editor:
Can you do a word count? TeXnicCenter doesn’t have one, so I use a free PDF wordcount called Translator’s Abacus. (Beware of a program called LaTeX Word Counter – it doesn’t seem to count footnotes.)
Is there a spell-check? TeXnicCenter automatically has one for US English and German, but you can add more languages:
Unzip the .zip file and copy the .aff and .dic files in it to C:\Program Files\TeXnicCenter\language (you’ll see the English and German files already there).
Restart TeXnicCenter. Select ‘Tools’ then ‘Options’. Click on the ‘Spelling’ tab and select the new dictionary you want to add.
A LaTeX editor. This is the piece of software you will use to write your LaTeX files and to generate a final PDF output.
Somewhere to save all your files.
Patience.
Installing LaTeX
LaTeX comes in several flavours – they all effectively do the same job. Some are specific to certain platforms (Windows/Mac/Linux/etc.).
MikTeX
I work on Windows and use MikTeX. To download this, go to http://miktex.org/. As of today, the latest stable version is MikTeX 2.7. Click on the link to this under ‘Downloads’ in the navigation bar. You will then find a page with simple installation instructions.
According to the Cambridge University Computing Service pages, LaTeX and TeX are installed on the Windows PWF machines. For details, see http://www.cam.ac.uk/cs/pwf/pclist.html.
It covers everything you’re likely to need – and more. At the moment, it costs about £35 from online retailers.
It can sometimes be tricky to find what you’re looking for in the index, but if you look back at the table of contents, you can usually work out which section it might be under.
The bottom line: if you’re writing a short document in English with no special characters, use Microsoft Word.
For longer documents, like a masters or doctoral dissertation – invest your time in learning how to use LaTeX.
LaTeX lets you concentrate on what you are writing, not what it looks like. It’s efficient – formatting, structuring, numbering, indexing and referencing are all taken care of – you can just write.
Advantages of using LaTeX
excellent support for transliteration and for non-latin alphabets
separation of content and style (you type, it makes it pretty)
scalability – LaTeX can be used for a one-page letter or a 300 page book
high quality output – PDFs produced look elegant and professional
performance – LaTeX doesn’t crash like Word
can be used with the bibliography/reference package, BibTeX
files are very small – a LaTeX file is just a text file
it’s free
platform independent – can be used on Windows, Macs, Linux
you never have to write an English/Arabic document in Word again!
Disadvantages of using LaTeX
it can be a bit overwhelming at first
learning how to use it takes time
complicated workflow – there are several steps to write, generate and produce a finished file
just as with any software, there are occasional bugs – but I’ve only come across one so far
Summary
I use LaTeX because of its excellent handling of Arabic script, transliteration and typesetting control. If any of the above sounds interesting, read on and try it out.