200 likes | 302 Views
LaTeX 2e Basics. CSE470 Fall 2000 Software Engineering B.J. Czerny Updated by J. Brown, A. Subramanian. Objectives. Learn how to create simple LaTeX2e documents, including: Creating and including figures Referencing figures and sections Inserting other tex files
E N D
LaTeX 2e Basics CSE470 Fall 2000 Software Engineering B.J. Czerny Updated by J. Brown, A. Subramanian
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
Sample LaTeX File \documentclass[11pt]{article} \usepackage{boxedminipage, doublespace, psfig} \begin{document} \title{Sample Title} \author{Sample Author} \date{Sample Date} \maketitle \section{Sample Section} \label{s:sample} Text goes here. \end{document}
Including a PostScript Figure \begin{figure}[h] \begin{center} \begin{boxedminipage}[htbp]{\textwidth} \centerline{\hbox {\psfig{figure=figname.ps,height=2.5in,silent=} } } \caption{\label{f:figexample}Example of a figure.} \end{boxedminipage} \end{center} \end{figure}
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:sample} 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 ASCII Output • 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 • .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, inproceeding, etc. • Keywork identifying publication • Series of Fields • Author • Journal • Title, etc.
Referencing a .bib Entry • \cite{cite-key} • \nocite{cite-key1, cite-key2, cite-key3,…} • 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
LaTeX Files • Input source file: .tex • Structure and layout definition file: .sty • 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/Public/F99/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