ETD Guide/Students/LaTeX

From Wikibooks, open books for an open world
Jump to: navigation, search

Scientists within the natural and engineering sciences have special needs for mathematics and algorithmic graphics. The text formatting system LaTeX has been used for decades to mark up scientific documents. Even today, there is no viewable alternative to print texts containing a lot of mathematics without using LaTeX. This system uses a kind of semantic or typographic markup for rendering formulas, graphs, and so on. Within some disciplines LaTeX is nearly exclusively used to render complex documents.

TeX and LaTeX[edit]

TeX is a document formatting language (and the program that processes it) written by Donald Knuth for the professional preparation of complex publications. It excels particularly at formatting mathematical equations and for managing two-dimensional presentations of data (tabular and otherwise). LaTeX is a set of macros written by Leslie Lamport as a "front-end" to TeX that makes articles, reports, theses, dissertations, and books easy to create and manage.

How to get LaTeX[edit]

LaTeX is free to download from any CTAN archive (http://www.ctan.org ), and works on Macintosh, MS-DOS, Unix, and Windows 3.1/95/NT (though some commands may vary on some architectures). To convert your electronic thesis or dissertation in LaTeX, you must first type your document completely into the ASCII editor using the LaTeX macros appropriately, then use a certain chain of commands that produce a layout and printable version of the document.

LaTeX under UNIX / LINUX systems[edit]

To create LaTeX files, all you need is an ASCII-based editor, like Emacs, Vi. Writing a dissertation just means typing the contents and the LaTeX-commands directly in an ASCII-based file and save this as *.tex. To compile a LaTeX file and produce a printable version of the document, you have to follow the following steps: 1. Run latex "latex mydissertation.tex" This produces the following files: mydissertation.dvi / mydissertation.aux, etc. 2. Run dvips "dvips mydissertation.dvi" This produces a file dissertation.ps that is printable on a printer, or convertible into PDF.

While writing your thesis in LaTeX, please keep the following rules in mind: As document style we advise to choose report or book, because both start with chapter as the highest order for section structuring. The preamble of the latex file could look like in the following example:

\documentclass[12pt,a4,titlepage]{book}

\usepackage{babel}

\usepackage{longtable}

\usepackage[dvips]{epsfig}


With usepackage we import additional styles that are needed, e.g. for tables, mathematics, figures etc. In order to get archivable form of the latex dissertations we advise not to use or to program complex

macros. Simple \newcommand or \renewcommand may be used, e.g.

\newcommand{\begin{itemize}}{bi}

Headings can be separated using the following commands:

Document Structure Level
\part{Heading Part I } -1
\chapter{Heading Chapter 1} 0
\section{Heading Subchapter 1.1} 1
\subsection{Heading Section 1.1.1} 2
\subsubsection{...} 3
\paragraph{...} 4
\subparagraph{...} 5

Levels -1 to 2 appear in the table of contents. Part is used to split the whole document into several parts. The chapters numbering are constantly growing. Within the document than a single page is displayed, that contains: Part I Introduction or Part II Method and so on. Chapters are numbered without taking the parts into account. The numbering is standardized: Chapter 1 Mathematics. Sections are subunits of chapters and numbered: Basic Algorithms.

Chapters are numbered without taking the parts into account. The numbering is standardized: Chapter 1 Mathematics. Sections are subunits of chapters and numbered: Basic Algorithms.

Sections are numbered as follows: 1.1.1 Decision Tree Algorithm A. For those parts like acknowledgements, dedication, and curriculum vita where authors usually don't want to use numbering, the following style can be used:

\chapter*{Thank You} . The asterisk prevents the numbering.


Appendices are included using the \appendix command. Please use commands as in the following example if your appendix consists of several chapters:

\appendix or

\appendix* not numbered headings of the appendices

\chapter{Program Source}

\chapter*{Curriculum Vita}


Using graphics: figures and pictures should be included in LaTeX documents using the eps (encapsulated postscript) format. Before including them, one has to use a certain style package in the preamble: \usepackage[dvips]{epsfig}

The parameter [h] positions the figure at the current position. Keep in mind, always to use a caption-environment to put the figure captions below the picture:

\begin{figure}[h]

\begin{center}

\epsffile{didi.eps}

\end{center}

\caption[short description for the table of figures]{Long description for the text}

\end{figure}


The title page is the most complicated part. Most universities supply own templates for the title page and the whole dissertation. There is no best practice available. In order to separate the several items on a title page in order to be able to reuse those information pieces e.g. if the whole dissertation is converted to HTML or SGML/XML, we advise to use \newcommands as simplest method to apply a pseudo structure to a LaTeX title page. Usually LaTeX provides the following standards item for a title page:

\date{}

\author{}

\title{}


But as this is not enough for a thesis, most universities provide own style sheets or templates. Tables should be used as follows: authors are advised to use the table-environment because it provides the possibility to include table captions in a structured way.

\begin{table}

\caption{Tabellenbeispiel}

\begin{center}

\begin{tabular}{ccc}

x & 1 & 2 \\ \hline

1 & 1 & 2 \\

2 & 2 & 4 \\ \hline

\end{tabular}

\end{center}

\end{table}


Citations can be used as their own structured items as follows:

1. Using the citation-environment. This is used for inline citations.

\begin{citation}{label1}

Contents

\end{citation}


2. Using the quotation-environment. This is used to structure whole paragraphs as citations. Those citations use an indent like usual paragraphs.

\begin{quotation}

contents

\end{quotation}


3. another method is the use of the quote-environment. This environment is used for whole paragraph citations, but those paragraphs don't have an indent.

\begin{quote}

content

\end{quote}


Numbered lists are typeset using the enumerate-environment. By integration new enumerate- environment in existing one a hierarchically nested sublist is built.

\begin{enumerate}

\item {Testitem1}

\begin{enumerate}

\item {Ebene 2 Testitem1}

\item {Ebene 2 Testitem2}

\end{enumerate}

\item Testitem2

\end{enumerate}


Bulleted lists are typeset using the itemize-environment. Here a hierarchical nesting is also possible.

\begin{itemize}

\item Testitem1

\begin{itemize}

\item Ebene 2 Testitem1

\item Ebene 2 Testitem2

\end{itemize}

\item Testitem2

\end{itemize}


Definition lists contain a definition term and a definition text.

\begin{description}

\item[Definition term] Explanation of the definition term

\item[Element2] Explanation 2

\end{description}


If an author wants to include source code this is best done using the \verbatim-environment.

\begin{verbatim}

#!/usr/bin/perl -w

#+-----------------------------------+

#| this script has been written 1998 by

#+-----------------------------------+

\end{verbatim}


Anchors, references and cross-references are typeset using the \label command, which links a key to the specified item of a document.

\begin{verbatim}

\label{keyword}

\end{verbatim}


References to these parts have to use the command \ref or \pageref in order to produce a reference to the object or to the page.

ref{keyword}

pageref{keyword}


A very important part of a dissertation is the bibliography. We advise all authors to use the bibtex-system and graphical front ends, e.g. bibview under LINUX or UNIX systems to manage bibliographic records and entries. References to bibliographic entries that are held in a bibtex-database are written as in the example:

\cite{schluessel}


The bibtex-database can be included into the LaTeX file by the following command, where a predefined style like alpha, plain, apalike can be used to layout the entries:

\bibliography{file name without .bib}

\bibliographystyle{style, e.g. alpha, plain, apalike, etc.}


Within the BibTeX-system database entries can be done using a plain ASCII editor. like emacs. There are several types of literature predefined:

  • Article in Conference Proceedings
  • Article in a Journal
  • Article in a Collection
  • Chapter or pages in a book
  • Conference Proceedings
  • Book
  • Booklet, but no Publisher, Institution
  • PHD Thesis
  • Masters Thesis
  • Technical Report
  • Technical Manual
  • Unpublished


The following example shows how a BiBTeX-entry has to be written:

% Article in a Journal

@Article{shortkey2,

author = {Name, Firstname},

title = {Title No. 2},

journal = {Journal for ETDs},

year = {1999},

OPTkey = {},

OPTvolume = {},

OPTnumber = {},

OPTpages = {},

OPTmonth = {},

OPTnote = {},

OPTannote = {}

The following table shows those items have to be used for certain bibliographic entry types:

LaTeX Table 1.jpg


LaTeX Table 2.jpg


To process a latex and a bibtex-file under UNIX system you have to type the following command sequence:

latex mydissertation.tex

bibtex mydissertation.aux

latex mydissertation.tex


This produces the following files: mydissertation.dvi / mydissertation.aux /mydissertation.bbl / mydissertation.blg, etc.

Run dvips "dvips mydissertation.dvi" This produces a file dissertation.ps that is printable on a printer, or convertible into PDF.

LaTeX under Windows operating systems[edit]

Using LaTeX under MS Windows requires the TeY System, a DVI-Viewer, Ghostscript and Ghostview. There are several LaTeX distributions: MikTeX , a highly regarded setup for Windows 95/NT (http://www.miktex.org/) and emTeX , the classic DOS and OS/2 TeX setup by Eberhard Mattes (ftp://ctan.tug.org/tex-archive/systems/msdos/emtex/).

There are front ends available for Latex that provide a WYSIWIG view to the user. One of the most used ones is Scientific Workplace by McKichan Software Inc. (http://www.mackichan.com/products/swp30.html). The disadvantage is that it is quite costly for single users.


Next Section: Framemaker