Вы находитесь на странице: 1из 4

CmpE 220 Fall 2011 AT X: HOW TO L E Version 1.

0
October 20, 2011

Contents
A 1 Installing L TEXcompiler A 2 Installing a L TEXeditor

1 2 2 3 4

3 Working on a simple tex le 4 Installing Additional Packages 5 Adding Images

This documents describes basic steps in installing, conguring and working with LaTeX system. The instructions are given for Windows operating systems.

A Installing L TEXcompiler

MiKTeX system is an implementation of TeX typesetting system for Windows and contains latex compiler and other related tools. Download Basic MiKTeX 2.9 Installer from http://miktex.org/2.9/setup and run it. If you have a previous version (e.g 2.8) already installed on your computer you dont need to upgrade to the latest version. Install MiKTeX with default conguration. Step-by-step instructions on installation is available at http://docs.miktex.org/2.9/manual/ch02s02.html

A Installing a L TEXeditor

Although you can use any text editor for editing LaTeX les, it is more convenient to use a designated LaTeX editor because they contain tools for compiling, creating a pdf le and provide auto-complete and context-sensitive help features. There are several latex editors: TeXstudio, LEd , Winedit. We recommend TeXstudio editor which is available at http://texstudio.sourceforge.net/

Working on a simple tex le

Open TeXstudio and create a new le named as hello.tex with the content shown in Figure 1.

\documentclass[12pt]{article} \begin{document} Hello World \end{document} Figure 1: hello.tex le You can create dvi, pdf or ps les from your tex le using the following commands located in the Tools menu of TeXstudio (shown in Figure 2). These les will be created in the same folder as your tex le. Latex: Compiles tex le and creates a dvi le. You can view this dvi le by using View DVI command on the same menu. DVI >PDF Converts the dvi le created by the above step to a pdf le. DVI >PS Converts the dvi le created by the above step to a ps le. PDFLaTeX Compiles tex le and directly creates a pdf le without the intermediary dvi le. You need to install Adobe Acrobat Reader or Foxit Reader to view pdf les and Ghostscript and GSView to view ps les. A DVI viewer, YAP, is included in MiKTeX package and will be installed.

Figure 2: Screenshot of TeXstudio

Installing Additional Packages

You may need to use some packages which are not included in the Basic MiKTeX package. When you are trying to compile a le which uses missing packages, the default setting for MiKTeX is to ask you whether or not to install the missing packages on-the-y and then install them from an online repository. This option can be changed in MiKTeX Settings located in MikTeX program group on the Windows Start Menu. Another way to install additional packages is using MiKTeX Package Manager also located in MikTeX program group on the Windows Start Menu. You can search for a package name and then install it. If the package you are searching for can not be found in the current repository try a dierent one by changing package repository from Repository menu. (Figure 3).

Figure 3: MiKTeX Package Manager

Adding Images

The grapicx package contains includegraphics command which can be used to add images into a LaTeX document. Usually, this command is used in a gure environment to add other features like caption, label, etc. A sample code for adding an image is shown in Figure 4. Note that in this example the image le is located in the same folder as the LaTeX le. If you are adding PDF, PNG, JPEG or GIF images you should use pdatex to convert your LaTeX le to a PDF le as explained in Section 3. If you want to create a PS (Post Script) le then you should only add EPS (Encapsulated PostScript) les to your le. includegraphics command has many options for setting height, width, scale, rotation etc. Detailed information on how to use these options is available in the tutorials on the LaTeX web page at the course web site. Note that with PNG and JPEG gures you may need to set the bounding box explicitly as in Figure 4. Depending on the dimensions of the gure bounding box parameters might dier. .... \usepackage{graphicx} .... .... \begin{figure}[h] \includegraphics[scale=.5, bb = 0 0 640 550]{pmn.png} \caption{This text will be displayed under the figure } \label{fig:pmn} %this is the label which will be used %with \ref command to refer to the figure \end{figure} .... Figure 4: Adding images

Вам также может понравиться