LaTeX 2e Basics CSE470 Spring 2000 Software Engineering B.J. Czerny Updated by Prasad.

22
LaTeX 2e Basics CSE470 Spring 2000 Software Engineering B.J. Czerny Updated by Prasad
  • date post

    21-Dec-2015
  • Category

    Documents

  • view

    219
  • download

    1

Transcript of LaTeX 2e Basics CSE470 Spring 2000 Software Engineering B.J. Czerny Updated by Prasad.

LaTeX 2e Basics

CSE470 Spring 2000

Software Engineering

B.J. Czerny

Updated by Prasad

Objectives• Learn how to create simple LaTeX2e

documents, including:– Creating and including figures– Referencing figures and sections– Inserting other tex files

• Learn how to generate a Postscript file

• Learn some advanced LaTeX features– Creating a Table of Contents– Creating Bibliography

A Simple Latex File

\documentclass{article}

\begin{document}

\section{sample section}

Text goes here

\end{document}

Simple LateX file after compiling …

Sample LaTeX File\documentclass[11pt]{article}\usepackage{boxedminipage, doublespace,

psfig}\begin{document}\title{CSE470: Lab1}\author{Prasad}\date{1/12/2000}\maketitle\section{Introduction to Latex}

\label{s:IntroSection}Introduction to Latex goes here.\end{document}

Sample File Output

Including a PostScript Figure\begin{figure}[h]\begin{center}

\center{\psfig{figure=figname.ps}}\caption{\label{f:figexample} Example of a

figure.}

\end{center}\end{figure}

PostScript Figure Added

Cross-references (internal references)

• \label{key-string}– assigns the key key-string to the current

element of the document

• \ref{key-string}– inserts a string identifying that the element key-

string refers to

• \pageref{key-string}– inserts the number of the page that key-string is

on.

Cross-reference Example

Figure \ref{f:figexample} in Section \ref{s:IntroSection} is on page \pageref{f:figexample}.

Results in:Figure 1 in Section 1 is on page 1.

Including Other LaTeX Files

• LaTeX supports modularity– a single LaTeX document can consist of

multiple LaTeX files

• \input{latex-file}– Command to include other LaTeX files– LaTeX filename includes the .tex extension

Processing a LaTeX file

• latex latex-file.tex– generates latex-file.dvi

• xdvi latex-file.dvi– displays the dvi file for preview

Generating a PostScript File

• Dvips latex-file.dvi– generates latex-file.ps

• gv latex-file.ps– displays the postscript version of the document

• lpr -Pmountaind latex-file.ps– prints latex-file.ps to the ‘mountaind’ printer

Generating HTML or ASCII Output

• latex2html latex-file.tex

• dvi2tty latex-file.dvi > latex-file.txt– creates an ascii version of the latex-file

Table of Contents

• Contains titles of section units and the corresponding page number where the section starts

• \tableofcontents– cause LaTeX to generate a .toc file

• Must run LaTeX at least twice

Creating a Bibliography with BibTeX

• Must create a bibliography database– References.bib file– read by BibTeX

• Bibliographies can have different formats– e.g., Alphabetical, Numbered, etc.

• BibTeX formats entries based on the bibliography style chosen– e.g., Plain, Alpha, IEEE, ACM, etc.

BibTeX Entry• Entry Type: book, article, in proceeding, etc.• Keywork identifying publication• Series of Fields

– Author– Journal– Title, etc.

• Example: @book{pressman97,

title = {Software Engg, A practitioner’s Approach}, author = {Roger S.Pressman}, publisher = {McGraw-Hill}, year = {1997} }

Referencing a .bib Entry

• References.bib file must be included in LateX by using

\bibliography{References}

• Cite the reference by using:\cite{cite-key}

• Example:– In \cite{pressman97}, the characteristics of software

are discussed.– Result: In [1], the characteristics of software are

discussed.

Command Sequence

• latex latex-file.tex

• bibtex latex-file

• latex latex-file.tex

LaTeX Files

• Input source file: .tex

• TeX formatted output file: .dvi

• Others: .toc, .lof, .bib, .lot, .log, .aux

Document Classes

• Five standard document classes– article, report, book, slide, letter

• Classes can be further customized– Specify class options– Use additional packages

References

• The LaTeX Companion, Michael Goosens, et.al.

• On-line:– http://www.cse.msu.edu/~cse470/S2000/Labs/Notes/Lab1/latex-index.html

– A Short Introduction to LaTeX– Essential LaTeX– A Gentle Introduction to TeX– http://www.sci.usq.edu.au/staff/robertsa/LaTeX/latex2e.html