Presentation is loading. Please wait.

Presentation is loading. Please wait.

CMSC 601 LaTeX Spring 2011 Tim Finin

Similar presentations


Presentation on theme: "CMSC 601 LaTeX Spring 2011 Tim Finin"— Presentation transcript:

1 CMSC 601 LaTeX Spring 2011 Tim Finin finin@cs.umbc.edu

2 Objective Understand the role of LaTeX in your research Learn how to create a simple LaTeX2e document – Create a LaTeX source file – Create and include figures – Reference figures and sections – Create lists – Include other tex files – Generate pdf output – Cite bibliographic references

3 History: TeX and LaTeX Donald Knuth created TeX in the late 70s so he could typeset his famous Art of Computer Programming booksTeX TeX produced great output and was very powerful (and programmable) but also very obscure Leslie Lamport of SRI produced LaTeX in the ealry 80s as a macro package making TeX easy to useLaTeX I’ve never know anyone who used TeX directly

4 Other Options Microsoft Word is a great product – Track changes is a great feature – You can’t beat it for small documents HTML is fine if your target is a screen – The W3C does all of its documentation in HTML – The Kindle ebook format is HTML Google Docs is up and coming – great for real-time collaboration That’s about it these days – No one uses Tj6, Scribe, Pub, troff, WordPerfect, …

5 Why LaTeX?

6 Why LaTeX It’s good for complex documents like a dissertation It’s the standard for Computer Science, Mathematics and many other STEM fieldsSTEM fields – Many conferences have their own LaTex document – Elsevier uses LaTeX to typeset all their journals LaTeX’s bibliography system, BibTex, is the best LaTex is programmable! LaTeX is open source software, has a large community of users and developers and a good infrastructure (e.g., CTAN)CTAN

7 Accessing LaTeX Latex and associated tools are typically pre- installed on Linux and Mac OS X They are also on the CSEE servers and gl Use Miktex for WindowsMiktex

8 sample.tex \documentclass[12pt]{article} \usepackage{times} \begin{document} \title{Hello World in LaTeX} \author{My Name Goes Here} \maketitle Hello, world! {\em Hello, world!} {\bf Hello, world!} {\Large \bf Hello, world!!!} \end{document} Start by declaring the document type (article) and use the 12pt option setting the font size Loads required packages defining commands or setting parameters LaTex uses begin|end commands for blocks. Every document must have a document block The title and author command set document variables and the maketitle command generates the output text Latex comands start with a backslash, required args are in {}, options in []s Paragraphs are separated by blank lines {}s introduce un-named blocks and control scope. \em for italics, \bf for bold, \Large to increase font size

9 f.aux Compiling with pdflatex > pdflatex sample This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009) entering extended mode (./sample.tex LaTeX2e... (/usr/local/texlive/2009/texmf-dist/tex/latex/base/article.cls Document Class: article 2007/10/19 v1.4h Standard LaTeX document class (/usr/local/texlive/2009/texmf-dist/tex/latex/base/size12.clo))... Output written on sample.pdf (1 page, 29675 bytes). Transcript written on sample.log. f.tex pdflatex f.pdf

10 Compiling, old school > latex sample This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009)... Output written on sample.dvi (1 page, 652 bytes). Transcript written on sample.log. > dvips sample -o sample.ps This is dvips(k) 5.98 Copyright 2009 Radical Eye Software (www.radicaleye.com) ' TeX output 2011.01.31:0857' -> sample.ps... > ps2pdf sample.ps > f.tex latex dvips f.dvi f.ps ps2pdf f.pdf

11 Output files > ls -l sample* -rw-r--r-- 1 finin staff 8 Jan 31 08:57 sample.aux -rw-r--r-- 1 finin staff 652 Jan 31 08:57 sample.dvi -rw-r--r-- 1 finin staff 3363 Jan 31 08:57 sample.log -rw-r--r--@ 1 finin staff 3336 Jan 31 09:00 sample.pdf -rw-r--r-- 1 finin staff 10664 Jan 31 08:58 sample.ps -rw-r--r-- 1 finin staff 237 Jan 31 08:33 sample.tex

12 Files LaTeX Uses Input source file (.tex) Files containing structure and layout definitions (.sty) Tex formatted output file (.dvi) Others:.toc (table of contents),.lof (list of figures),.lot (list of tables),.bib (bibliography)

13 Document Classes There are standard document classes: article, report, book, slides, letter \documentclass[11pt,letterpaper]{article} Conferences and journals publish their own \documentclass[10pt,journal,compsoc]{IEEEtran} \documentclass[runningheads,a4paper]{llncs} These an be further customized via packages \usepackage{graphicx} \usepackage{algorithm} – Using additional packages

14 Including Other LaTeX Files Supports modularity – a single LaTeX document can consist of multiple LaTeX files – Very useful for group work, e.g., many authors using SVN \input{intro} – used to include other Latex files – Latex filename is intro.tex \documentclass[letterpaper]{article} \usepackage{aaai} \usepackage{times} \usepackage{graphicx} % comment: more here \begin{document} \include{title} \include{intro} \include{motivation} \include{related} \include{approach} \include{evaluation} \include{conclusion} \include{bibliograph} \end{document} \documentclass[letterpaper]{article} \usepackage{aaai} \usepackage{times} \usepackage{graphicx} % comment: more here \begin{document} \include{title} \include{intro} \include{motivation} \include{related} \include{approach} \include{evaluation} \include{conclusion} \include{bibliograph} \end{document} A typical top level file

15 Fall 1998CPS 470 Software Engineering 15 More Complex LaTeX File \documentclass[12pt]{article} \usepackage{doublespace,epsfig} \usepackage{../custom} \begin{document} \input{abstract} \section{Sample Section} \label{s:sample} Text goes here... \end{document}

16 Cross-references \label{key-string} – assigns the key key-string to the current element of the document \ref{key-string} – inserts a string identifying the element to which key- string refers \pageref{key-string} – inserts the page number on which the element referenced by key-string appears

17 Fall 1998CPS 470 Software Engineering 17 Cross-reference Example Figure~\ref{f:figexample} in Section~\ref{s:sample} is on page~\pageref{f:figexample}. Figure 1 in Section 1 is on page 1.

18 Including a Figure \begin{figure} [htbp] \centerline{\epsfig{figure=figname.eps, height=2.5in,silent=,clip=}} \caption{\label{f:figexample} Example of a figure.} \end{figure}

19 Fall 1998CPS 470 Software Engineering 19 Making a List \begin{itemize} % \begin{enumerate} \item Text for this item. \end{itemize} % \end{enumerate}

20 Table of Contents Contains section headings and page number where each section starts. \tableofcontents Causes LaTeX to generate a.toc file Must run LaTeX on the file at least twice: – On the first pass, LaTeX collects information – On the second pass, LaTeX reads back information and typesets it.

21 List of Figures Contains caption text of the figures and page number where each figure appears. \listoffigures – Causes LaTeX to generate.lof file. As for the table of contents, must run LaTeX at least twice.

22 Bibliographies and BIBTeX Must create a bibliography “database” –.bib file – formatted by keyword, readable by BIBTeX Bibliographies can have different formats yet the same.bib file (alphabetical, order of citation, etc.) BIBTeX formats entries based on the bibliography style chosen (.bst or.sty) – ieeetr, plain, alpha, acm, etc.

23 BIBTeX Entry Entry type – book, article, inproceedings, etc. Keyword identifying publication – should be unique for each entry Series of fields for each type – author, title, journal, etc.

24 Referencing.bib entry \cite{keyword} \nocite{key1, key2, key3,…} example: In \cite{pressman97}, the characteristics of software are discussed. In [1], the characteristics of software are discussed.

25 BIBTex and LaTeX Command sequence – latex file.tex – bibtex file – latex file – May have to latex file again if unresolved references

26 Format Sections – \section{…} = 1. Latex is Great – \subsection{…} = 1.1 Why Latex is Great – \subsubsection{…} = 1.1.1 Reason One – \appendix - changes numbering scheme – \chapter{…} - To be used with book and report document classes Titles, Authors and others – \title{…} \author{…} – \footnote{…}

27 Lists Source – \begin{itemize} – \item Apple – \item Orange – \end{itemize} Result – Apple – Orange

28 Group Group is some text between { and } Many commands work until the end of the group Code – put {one word \bf in bold} here Result – put one word in bold here

29 Alignment Environments center, flushleft, flushright Example – \begin{flushright} – Right aligned – \end{flushright} Result Right aligned

30 Font size \tiny \scriptsize \footnotesize \small \normalsize \large \Large \LARGE \huge \Huge

31 Example of Latex document \documentclass{article} \title{Simple Example} \author{Andrei Gurtov} \date{March 2000} \begin{document} \maketitle Hello world! \end{document}

32 Tabular Columns – \begin{tabular}{|…|…|} – \end{tabular} Rows – & - Split text into columns – \\ - End a row – \hline - Draw line under row – e.g. 123123 & 34.00\\ \hline Two Columns l = automatically adjust size, left justify r = automatically adjust size, right justify p = set size e.g p{4.7cm} c = centre text

33 Example of table \begin{tabular}{|l|r|c|} \hline Date & Price & Size \\ \hline Yesterday & 5 & big \\ \hline Today & 3 & small \\ \hline \end{tabular}

34 Floating Objects Floating objects can stop splitting of tables and images over pages. \begin{figure}[options] \end{figure} \begin{table}[options] \end{table} They will now appear in the – List of Figures (LOF) and – List of Tables (LOT). Options (recommendations) h = place table here t = place at top of page b = place at bottom of page

35 Example of floating figure \begin{figure}[ht] \centering\epsfig{file=uni.ps, width=5cm} \caption{University of Helsinki} \label{uni} \end{figure} Figure~\ref{uni} shows...

36 Images Use epsfig package \usepackage{epsfig} Including images in main body \epsfig{file=filename.eps, width=10cm, height=9cm, angle=90} Creating EPS - Use xv and/or xfig. MS Power Point, save as GIF and convert to EPS.

37 Bibliography by hand \begin{thebibliography}{} \bibitem[Come95]{Come95} Comer, D. E., {\it Internetworking with TCP/IP: Principles, Protocols and Architecture}, volume 1, 3rd edition. Prentice-Hall, 1995. \end{thebibliography}

38 Bibliography using Bibtex Bibliography information is stored in a *.bib file, in Bibtex format. Include chicago package – \usepackage{chicago} Set referencing style – \bibliographystyle{chicago} Create reference section by – \bibliography{bibfile with no extension}

39 Bibliography using Bibtex @book{Come95, author=“D. E. Comer”, title={Internetworking with TCP/IP: Principles, Protocols and Architecture}, publisher=“Prentice-Hall”, year=1995, volume=1, edition=“Third”}

40 Bibliography contd. Citing references in text – \cite{cuc98} = (Cuce 1998) – \citeN{cru98} = Crud (1998) – \shortcite{tom98} = (Tom, et. al. 1998) Creating Bibtex Files – Use Emacs with extensions. – or copy Bibtex entries from bibliography database.

41 Some Math \begin{center} {\large $$ y=\frac{a^3+2c_{x}}{1+\sqrt{b_{x}}} $$ \\ \vspace{0.2in} $$ Q=\sum_{i=1}^{j}\int_{\mu}^{\infty}f(x_{j}) dx $$ \\ \vspace{0.2in} $$ \Psi = \oint_{- \infty}^{\infty}f_{xy}({\frac{\partial Qx}{\partial Qy}})^{\Im_{\pi}^ \prime} $$ \\ }

42 Tools UNIX based systems – xdvi, ghostview, fixps, emacs with latex/bibtex support. Windows 98/NT – Ghostview, Acrobat Distiller, Acrobat Reader, Scientific Workplace (not the best), the Bibtex viewer is good. Paint Shop Pro, Latex and Emacs

43 Conclusions Latex is optimal for master and phd thesis? Mathematical formulae are easy. Use bibtex search engines Consider converting Postscript files to PDF (more widespread in Windows world) and to conserve space.


Download ppt "CMSC 601 LaTeX Spring 2011 Tim Finin"

Similar presentations


Ads by Google