# Tag Archives: LaTeX Package

This package allows you to customize headers and footers in the LaTeX document.

You can find comprehensive information on this package in The LaTeX Companion.

Here I’ll explain how to make a simple header showing your name and the date.

This is what you need to include:

\documentclass{article}
\usepackage{fancyhdr}
\pagestyle{fancyplain}

\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}

Here is the output PDF of the document: SimpleFancyhdr.pdf

The fancyhdr package was created by Piet van Oostrum.

# Getting Started: Creating a Basic LaTeX Document

Step-by-Step Guide

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:

\documentclass[options]{class}

See section 1.4 of The Not So Short Introduction to LaTeX for basic information and section 1.6.1 for detailed information about all the options.

Packages

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:

\documentclass{report}
\usepackage{babel}
\usepackage{url}

3. Body Text

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.

# Symbols

The Comprehensive LaTeX Symbol List

If you find yourself wondering how to create your chosen transliteration style and can’t find the right character input, this will make happy reading:

The Comprehensive LaTeX Symbol List by Scott Pakin (4.3Mb PDF)

Common Transliteration Symbols in LaTeX

At 152 pages, the comprehensive symbol list is a bit unwieldy.

As a quick reference, I’ve made a one-page table of the most commonly used transliteration symbols for dealing with French, German, Spanish and transliterated Arabic – along with some examples.

Common Transliteration Symbols in LaTeX (61Kb PDF)

Semtrans Package

For people working with Semitic languages, the Semtrans package can be useful.

I found this after weeks searching for how to represent the Arabic letter kha’ in the style commonly used in German scholarship (a letter ‘h’ with a little u underneath). You get this by typing \U{h}. See page 14 of the comprehensive symbol list. `Ayn is \Ayn.

N.B. When using the command \U{h} in a section heading, you need to add \protect beforehand, so the command becomes \protect\U{h}. Otherwise, you will get error messages and the symbol won’t display. Thanks to Berteun for this tip. I haven’t found any difficulties with the \Ayn command.

# LaTeX Package Reviews

For people who already use LaTeX, I’ll be discussing some LaTeX packages relevant to the humanities (particularly to Middle Eastern Studies).  Hopefully this will save you trawling the internet for information.

These posts will be interspersed between more basic information that I’ve categorized ‘Getting Started’.

For newcomers to LaTeX, add-on features for the system are known as packages. For example, multicol allows you to use multiple columns in a document, while the url package lets you properly format links.