LaTeX: the best system for typesetting theses and papers in Computer Science.

Landscape Figures and Tables

Local tutorial presentations/resources: EEM --- Gates/Stern -- Clements

Hypertext Help for LaTeX - LaTeX reference sheet
LaTeX tutorial
--- LaTeX project home page --- LaTeX Encyclopedia
Not so short introduction to LaTeX
UIUC guide on typesetting Math
Lots of stuff about LaTeX More stuff about LaTeX
eem's macros for editing LaTeX and bibtex files in gnuemacs .emacs .tex-mode-ml.el .bib-mode.el
emacs reference card
eem's macros for WinEdt: WinEdt Macros Installation Instructions
and how to get started (guidelines if you are using LaTeX on UNIX).

LaTeX resources in the CS library POP
Jamie Blustein's LaTeX Bookmarks

Although you can create and edit latex files using any text editor, it is very strongly recommended to use a latex-aware integrated development environment (IDE). Visit the LaTeX project web site for more information.
For Windows, free MikTex is a well-respected implementation of LaTeX, upon which more than one latex-aware IDE has been built:
a. WinEdt is shareware US40 b. TeXnicCenter.org (free) c. LEd (free) Recommended LaTeX IDE for Linux: KILE (KDE Integrated Latex Editor) See also LyX, a WYSIWYM IDE for LaTeX that some beginners in LaTeX have found useful. Bibliography Bibliography is stored in a .bib file and referenced in a paper or thesis using a codename associated with each bibliographic entry. Program bibtex extracts only the data for the entries cited in the paper/thesis and automatically constructs a .bbl file with the Latex source for the reference section according to the specified document and bibliography style. Latex can handle multiple .bib files. Bib files are a resource that can be reused for multiple documents or by multiple users. For acceptable bibliography styles, visit the Computer Science Style Guide Suggestions. For an introduction to BibTeX and many links see the Wikipedia entry for BibTeX. How to include URLs in BibTeX entries. Note: To debug a .bib file, open and view the .blg file that is created automatically. A syntactic error (e.g. a missing comma) in a bib file can caue the rest of the file to be unreadable. Example files LaTeX file for paper paper.tex bibliography file for theses and papers paper.bib For formatting Dalhousie Computer Science theses, there is a LaTeX template developed specifically for this purpose. Old instructions (before the above template was developed): For thesis formatting, the easiest way is the following: - Use Microsoft Word files posted in the FGS web site for the cover page, signature page, and copyright page. - Use dalThesis.tex as a template for the body of your thesis. You need to copy file dalThesis.cls and setspace.sty into the same directory as dalThesis.tex. The file dalThesis.tex shows you examples of most LaTeX features, including tables and complicated multiline equations. Note the enhanced readability of LaTeX source for equations and tables by proper vertical alignment of rows. The template uses the graphicx package for including pictures. See file dalThesis.pdf for the formatted thesis (without the cover pages). Directory dalThesis contains all the files necessary to typeset the thesis, including the .eps and .pdf files of the figures, and the bibliography thesis.bib. UIUC thesis instructions (with useful hints about graphics and other goodies) http://www.cen.uiuc.edu/~bbalasub/ Emacs reference card pdf ps GRAPHICS IN LaTeX It is important to use the following programs, which are standard (in the MALNIS group) and use non-proprietary file formats. A paper submitted may need to be edited years later in response to reviewers' comments. Graphics in LaTeX can be imported if they are in encapsulated postscript format (eps). With pdflatex, one can import graphics in pdf, png or jpg format. The epsfig package allows the import of eps graphics files. The example paper above uses the epsfig package The recommended alternative is the graphicx package (which makes change to enable typesetting with pdflatex trivial). Example of using graphicx. See also the graphicx tutorial for a full description of its capabilities. WinEdt/MikTeX includes graphicx, so no need to download any files Recommended programs for drawing diagrams and figures and generating an eps or a png version: 1. A simple graphics program for Windows and Linux is Dia It has a large collection of graphical primitives for various application domains (e.g. flowcharts, ER diagrams). (to add vertices to a polygon in Dia, click middle on a vertex, to get a new vertex adjacent to it). To get a good resolution png file, File => Export => File Type "Portable Network Graphics" => increase image width to thousands => export Png is preferred when it works. If not, export into jpg. To get a high-resolution jpg file, Page Setup => A0, then Export => jpeg To get a high-resolution pdf file, Page Setup => A0 and scaling: fix to 1x1, then Print => pdf To get a high-resolution eps file, save as high res pdf, then open the pdf file using Ghostview, Convert, epswrite option with very high resolution (6000). 2 . yEd is a nice graph drawing program in Java, which can do diagrams quite well. It includes tools for graph layout and transformations. Text can be rotated. Much smaller collection of predefined graphical primitives than Dia. 3. jPicEdt, is an open source Java-based user friendly graphical interface that can generate LaTeX, eepic and PsTricks code. PsTricks is a collection of LaTeX commands that can are postscript-aware and can generate graphical elements that go beyond the limited set that LaTeX natively provides. 4. Ipe supports entry of text as LaTeX source code. This makes it easy to enter mathematical expressions, and to reuse the LaTeX-macros of the main document. In the display text is displayed as it will appear in the figure. 5. UNIX/Linux/X windows: Xfig (user manual tutorial xfig&latex xfig.pdf xfig-howto.pdf shape libraries) To run Xfig from Windows, have helpdesk install X-Win32 on your PC, and configure putty properly for tunnelling. Once this is done, the steps to run xfig are: - start putty, - login to locutus, - start X-Win32, - run xfig & on locutus. This will use an ssh tunnel to start an xfig window on Windows. All the files reside on locutus. Windows: Winfig, an Xfig port to Windows (shareware, US20)
To export a graphic designed in Winfig into pdf (best quality): design it properly, i.e. zoom out for FULL PAGE DESIGN IN LANDSCAPE MODE,
set letter size and landscape in "page and grid settings", print it into pdf in landscape or run from the command prompt or on UNIX: fig2dev -L pdf infile.fig outfile.pdf
To export a graphic designed in Winfig into jpeg , run from the command prompt or on UNIX: fig2dev -L jpeg infile.fig outfile.jpg
Use negative vspaces around the includegraphics statement in the tex file to trim extra space, if necessary.
Exporting from Winfig into pdf does not work (and it would require fiddling with page size and orientation).
To export an Excel graph into pdf (best quality), resize it to full screen in Excel, print into pdf in landscape mode.
To export an Excel graph into jpeg, copy and paste it into Paint, save as jpeg. For better quality, enlarge the graphic to full-screen size in Excel first.
To convert a graphic in a pdf file into a small eps file on Windows, first copy and paste graphic into Paint, save as jpg, Import jpg file into Winfig, export as eps.
To convert a graphic in a pdf file into a jpeg file (for pdflatex), zoom in in Acrobat to get the graphic to fill the screen, copy and paste graphic into Paint, save as jpeg.
Regardless of the format, make sure you KEEP THE ORIGINAL FILES (e.g. xfig or excel) together with the pdf or eps files used in latex. This will make later revisions easy.
Exporting graphics in pdf or jpg format into eps format:
1. Paste the graphic into a graphics editing program that can export into .eps format (e.g. Winfig)
2. Use Acrobat to save pdf file into eps format.
3. Print jpg file into pdf from Paint.
4. Use the "convert" command on UNIX/Linux to convert a jpg or a pdf file into eps (man convert on torch, not locutus).

Suboptimal options:
Powerpoint
drawing tools are simple to use and sufficient for the majority of diagrams. Make diagram full-page size. Print into pdf format and use pdflatex (more on pdflatex below).
Visio is another option. To save a visio diagram in eps format, use the settings shown here (thanks to Yongzheng).

Note: Eps files generated from Visio or Corel Draw may have garbage in the beginning and end. Edit the eps file to remove everything before the first line
and after the last line
%%EOF

Image conversions
Use ImageMagick or IrfanView (both free for non-commercial use and running on both Windows and Linux) to convert between file formats.
The conversion programs epstopdf and jpeg2ps are very useful.

Data and function plotting
Use gnuplot instead of Microsoft Excel. It allows both interactive plotting as well as script-driven plotting. The latter is attractive if you want to produce several graphs that use the same scale and are of the same size, so that they can be visually compared with each other and included in a paper. To do this, put your data in a .dat file (plain text, you can export from Excel or print directly as your program's output), and then put the script in a .plt file (also plain text) that you can use to create your plots. You can export your plot of data file 1.dat as an eps file by the following gnuplot commands:
set terminal postscript eps; set output "eem-foo.eps"; plot '1.dat'
To get the plot to look the way you want, you will precede this by a number of "set" commands, and possibly add to the plot command a number of options.
There is a Windows gnuplot executable, downloadable from the gnuplot web site.
Include the .dat files that you used to produce the plots in your thesis, together with your thesis. Graphs contained in a paper submitted may need to be reformatted years later in response to reviewers' comments.

Colored text, invisible text, comments and revised text.
Add to the preamble of the file the following
\usepackage{color}
To obtain text in colour, use the following constructs:
\textcolor{red}{text}
\textcolor{magenta}{text}
% or other named colours
\textcolor[rgb]{0.00,0.53,0.68}{text}
% or any other r,g,b values
or
{\red text}

The following commands (defined in the preamble of the tex file) are useful:

%%%%% defines environment \invis{...} for commenting out large chunks of text
\long\def\invis#1{}

%%%%% defines environment \comment{...}
for adding comments to the text in tiny font size, used for explanations of changes made
%\newcommand{\comment}[1]{ {\tiny {#1} } } % show comments, for editing
\newcommand{\comment}[1]{ } %hide comments, for final version

%%%%% defines environment \attention{...} that makes large red text, used for comments on issues to pay attention to in the next revision.
\newcommand{\attention}[1]{\textcolor{red}{\textbf{\large #1}}}

%%%%% defines environment \revised{...} that makes revised text red, i.e. highlighted for easy review

\newcommand{\revised}[1]{\textcolor{red}{#1}}
%\newcommand{\revised}[1]{#1}

PSEUDOCODE IN LaTeX
If the pseudocode does not have math symbols, the verbatim environment will produce a plain looking output.
The tabbing environment works, but the LaTeX source is not very readable (except with proper indentation).
There are packages that facilitate typesetting of pseudocode, so that the LaTeX source is compact and highly readable as pseudocode.
The recommended package is algorithms.
Place algorithm.sty and algorithmic.sty in the same directory as your LaTeX file, and follow example.tex .
No matter how you typeset it, your pseudcode must be a floating body with a caption. If you use verbatim or tabbing, wrap it within a figure environment. The algorithms package supports floating pseudocode of type "algorithm" with its own sequential numbering.

THEOREMS AND DEFINITIONS IN LaTeX
LaTeX allows the definition of a macro to generate any kind of labelled enunciation that we want to look separated from the rest of the text and with sequential numbers next to it. More information: 1 , 2 .

SLIDES
Slides in LaTeX (slides class for plain slides, part of LaTeX2e) simple example
Slides using pdfLatex

Slides in Beamer (another LaTeX class for slides, that is supposed to be improved over Prosper, in sectioning a long presentation and also in its flexibility in pausing and overlays) -Beamer sites: 1 2
Beamer files are processed with pdflatex. This means that included graphics must be in pdf, jpg or png format. Eps format is not acceptable.
If you have eps figures, convert them to pdf using Acrobat. If there is extra empty space in the pdf file, it can be absorbed by \vspace with a negative argument.
Beamer is included in the standard installation of MikTeX/WinEdt.
It is worth adding some macros toWinEdt to faciliate editing of Beamer files.
A very comprehensive tutorial/reference manual for Beamer is available as part of its installation, and also here.
Examples of slides made with Beamer: 1 2

Slides in Prosper (a LaTeX class for powerpoint-like effects):
example source pdf (from Ray Spiteri), Prosper web sites 1-2 -
Dal Logo on slides made with Prosper: Use a low-res logo to prevent bloating.
Prosper does not work with pdflatex, because its bullets are only available in .eps format.
Hint:
Pdf files generated with Prosper may grow large due to the inclusion of figures, and the fact that bullets or institution logos are eps icons (same is true in powerpoint files). To debug individual slides, I recommend copying a single slide into a "test" file, which typesets very fast. When the test file looks right, copy the slide source back into the presentation source file.
To install Prosper on MikTex
:
MikTeX Options (program) -> Packages -> Download Site -> Change -> Select repository -> Show catalog -> check Prosper -> OK. Package will be downloaded and installed.
Note: The prosper styles introduce a footer with the presentation title and page number. To ensure that the page number is not cut off, use A4 letter size in dvips. Prosper styles were designed for A4 paper size.

Letter in LaTeX -- Euro in LaTeX (usepackage eurosym, \euro{} \EUR{...})

Using LaTeX to produce conference posters

LaTeX TO PDF: pdflatex
pdflatex: a command to obtain a pdf file directly from a tex file. See tutorial in: http://scgwiki.iam.unibe.ch:8080/SCG/47
Advantage: pdf files obtained directly through pdflatex are typically much smaller than ps files.
pdflatex does not allow inclusion of graphics in eps format. Graphics must be in pdf format for inclusion.
You must use the graphicx package to include the graphic in pdf format (specify file.pdf where you would specify file.eps). It allows inclusion of images in formats such as JPEG. Use the viewport option to specify its bounding box.
To obtain your graphics in pdf format:
UNIX utility epstopdf can do the conversion of an eps file to pdf for inclusion.
In Windows, if you do your graphics in Powerpoint, put them into one-page Powerpoint files and print them into pdf format.
Shareware for this task is available in http://www.pdf995.com/

Check out the page PDFLaTeX by Example.

Hyperreferences in pdf document for all cross references (figs, eqs, refs, etc.) and
explicit hyperlinks to the Web.

Simply include the following in the preamble of the .tex file (if its inclusion causes error messages, try moving it earlier or later in the preamble), to have hyperreferences created automatically in the pdf file for all the standard cross-references (to figures, sections, references):
\usepackage{hyperref} % For creating hyperlinks in cross reference or
\usepackage[dvips]{hyperref}% If you use the dvips driver, e.g. in Linux
Presence of hyperreferences makes online reading of the pdf file infinitely more convenient.

The hyperref package allows manual insertion of links, both internal and external.
These work with both pdflatex and latex/dvips/ps2pdf (on WinEdt). Prosper loads hyperref.
For external hyperlinks use:
\href{URL}{text} % text is the anchor text to URL
\url{URL} % same as \href{URL}{URL}

For internal hyperlinks use:
\hyperlink{name}{text} % to link to named anchor
\hypertarget{name}{text} % to define a named anchor

For more information see the hyperref manual.

LaTeX to HTML conversion

It is possible to convert any LaTeX document, such as a paper or a thesis, into html format, using the latex2html command, recently installed on locutus.
For the manual page of the command, run latex2html -h
For full online documentation, visit www.latex2html.org
To convert file.tex into html format, run latex2html file

Insert \usepackage{html} in the beginning of the .tex file, and download file html.sty in the same directory

Equations and figures are converted into images.
Arbitrary hypertext references can be included with the \htmladdnormallink and \htmladdimg commands.
For the resulting file.tex to remain compatible with LaTeX for printing, they must be included in \begin{htmlonly}...\end{htmlonly}
Similarly, LaTeX commands, meant only for printed or pdf versions (including \href), must be included in \begin{latexonly}...\end{latexonly}
There is support for converting pretty much all LaTeX crossreferences into hyperlinks. Visit the online documentation for details.

I have not tried to install LaTeX2HTML on Windows yet, but it should theoretically be possible, if perl is already installed.

Making an index

References 1 2 3 4

Squeezing space in LaTeX

Here is an excellent reference on how to squeeze space in LaTeX from Cambridge University.

For proposals, bibliography may have to be squeezed. Do this by including package natlib and set \bibsep to 0mm
\usepackage{natbib}
\setlength{\bibsep}{0mm}

If natlib.sty is not installed, download it from here and put it in the same directory as your .tex file.

Vertical alignment of text and graphics with tabular and minipage

Use \vspace and pay attention to the [t] or [b] arguments to the minipage environment.
Examples

Landscape Figures and Tables

The rotating package provides two new environments, sidewaysfigure and sidewaystable, which you use in place of the standard L A TEX environments figure and table. The sideways environments always put the landscape table or figure on a page by itself.
(Quoted from: www.rpi.edu/dept/arc/training/latex/Examples/exrotating.pdf )

Converting from Microsoft Word to LaTeX

Steps to follow to convert a paper written in Microsoft Word.
1. Save the Word file as text
2. Insert preamble of latex file
3. Add the \chapter, \section, \subsection commands
4. Search and Replace Word quotes by  and ''
5 . Convert equations to latex format (by hand). Labels of equations should be the equation numbers.
6 . Convert the figures to latex format. Blow up the pdf in Acrobat and copy and paste each graphic into Paint or a better image editing program. Save each graphic as .png
7 . Add the \figure environments for each figure. Label should be "fig#".
8 . Convert tables into latex format (by hand, copy and paste if possible)
9 . By search and replace, replace hard coded equation and figure numbers into \ref
10 . If the bibliography in Microsoft Word was done using EndNote, you can export the EndNote bibliography into latex format. See references 1 2 3 .

1. Choose Bibtex Export'' as the reference style (Edit =>Output Styles=> Open Style Manager).
2. Edit this style: remove all lines that look like Note = {Notes},. You might first want to make a backup of the BibTex export style file.
3. Select references to export (you can just select all to keep things simple).
4. Export a plain text file containing the BibTeX-formatted references by selecting File => Export... Save this file with a .bib extension.

Converting from LaTeX to Microsoft Word (RTF)

The open source program latex2rtf converts latex source to rtf format. Equations can be either converted as images or translated into RTF equations.
The program relies on other open source programs to work, written originally for Unix and with ports to Windows of varying quality. As a result, the overall package is more robust on Unix. The resulting rtf files have the LaTeX look and feel!
latex2rtf has been installed on selene.cs.dal.ca, thanks to Mahdi.
Note that the -M12 option (both inline and displayed eqs are converted to images) produces distorted images for inline equations.
The -M6 option (converts displayed eqs to images, while inline are converted to RTF) works fine, but the displayed eqs. look different from the inline explanations of their symbols. The conversion problem likely has to do with ImageMagick or netpbm packages not being properly set up.

A publisher has accepted the -M6 generated file, but his typesetter converted the image equations into RTF with mixed results in terms of quality.
Another publisher accepts eqs written in MathType (a product that can add latex eqs into Word).
Always check whether they accept LaTeX, even if they only mention Word in their web site.

Producing a good pdf file

A good pdf file contains only Type 1 fonts.
Some care needs to be taken when converting a dvi file to pdf to achieve this.
Useful references with various perspectives on this issue are the following: 1 2 3 - 4
Note that you can run your own dvips command from the command window opened within WinEdt (menu choice). No need to fiddle with WinEdt macro definitions.
Most conferences will not accept pdf files that contain other than Type 1 fonts.