LaTeX Part 1

  • 1,845 views
Uploaded on

This is the first part of a two part tutorial designed to introduce you to LaTeX and show you how to use it.

This is the first part of a two part tutorial designed to introduce you to LaTeX and show you how to use it.

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
1,845
On Slideshare
0
From Embeds
0
Number of Embeds
2

Actions

Shares
Downloads
119
Comments
0
Likes
2

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. An Intro to LTEXPart I A An introduction to creating a LTEXdocument A Aubry W. Verret Brown Science and Engineering Library Research Computing Lab November 10, 2008
  • 2. Outline I Introduction to LTEX A What is LTEX? A Why use LTEX? A How to Get LTEX A Basic LTEXDocument A Example Document Markup fo Example Document Basic LTEXCommands A Special LTEXcharacters A Compiling How LTEXWorks A How to Compile Files CLS files Output files Index and Table of Contents Generation The ToC
  • 3. Outline II The Index Bibliographies .bib files Bibliography Styles Compiling Bibliography Assistance Resources Preview
  • 4. What is LTEX? A Definition LTEXis a powerful document markup system that uses the TeX A typesetting program. It is pronounced as ’Lah Tek’ or ’Lay Tek’
  • 5. Why use LTEX? A LTEXproduces superior quality documents compared to word A processor such as Microsoft Word. It offers separation of content and formatting Makes it easy to collaborate with others on a document Many conferences prefer submissions done in LTEX A
  • 6. How to Get LTEX A There are several distributions of LTEXthat are free to obtain. A
  • 7. How to Get LTEX A There are several distributions of LTEXthat are free to obtain. A Windows - MikTeX is a common package to use. It is free and easy to install. Common editors to use are TeXnicCenter, WinShell, and Led.
  • 8. How to Get LTEX A There are several distributions of LTEXthat are free to obtain. A Windows - MikTeX is a common package to use. It is free and easy to install. Common editors to use are TeXnicCenter, WinShell, and Led. Mac - MacTex is the current distribution for Mac users.
  • 9. How to Get LTEX A There are several distributions of LTEXthat are free to obtain. A Windows - MikTeX is a common package to use. It is free and easy to install. Common editors to use are TeXnicCenter, WinShell, and Led. Mac - MacTex is the current distribution for Mac users. Linux - It is likely that LTEXis already a part of your operating A system, but if not you can install Tex live. You can use whatever text editor you would normally prefer to use, Emacs, Vi, etc.
  • 10. How to Get LTEX A There are several distributions of LTEXthat are free to obtain. A Windows - MikTeX is a common package to use. It is free and easy to install. Common editors to use are TeXnicCenter, WinShell, and Led. Mac - MacTex is the current distribution for Mac users. Linux - It is likely that LTEXis already a part of your operating A system, but if not you can install Tex live. You can use whatever text editor you would normally prefer to use, Emacs, Vi, etc. LTEXis also on all of the Lab computers A
  • 11. How to Get LTEX A There are several distributions of LTEXthat are free to obtain. A Windows - MikTeX is a common package to use. It is free and easy to install. Common editors to use are TeXnicCenter, WinShell, and Led. Mac - MacTex is the current distribution for Mac users. Linux - It is likely that LTEXis already a part of your operating A system, but if not you can install Tex live. You can use whatever text editor you would normally prefer to use, Emacs, Vi, etc. LTEXis also on all of the Lab computers A Go here for more information http://www.latex-project.org/ftp.html
  • 12. Basic LTEXDocument A The basic LTEXdocument consists of a preamble, a body, and an A ending.
  • 13. A Basic LTEXDocument A Example Document Aubry W. Verret November 7, 2008 Hello World!
  • 14. Markup for a Basic LTEXDocument A documentclass { a r t i c l e } t i t l e {A B a s i c LaTeX Document } a u t h o r { Aubry W. V e r r e t } d a t e { November 2008} b e g i n { document } maketitle H e l l o World ! end{ document }
  • 15. Basic LTEXcommands: Preamble A LTEXdocuments begin with a preamble: A
  • 16. Basic LTEXcommands: Preamble A LTEXdocuments begin with a preamble: A documentclass{}
  • 17. Basic LTEXcommands: Preamble A LTEXdocuments begin with a preamble: A documentclass{} title{}
  • 18. Basic LTEXcommands: Preamble A LTEXdocuments begin with a preamble: A documentclass{} title{} author{}
  • 19. Basic LTEXcommands: Preamble A LTEXdocuments begin with a preamble: A documentclass{} title{} author{} date{}
  • 20. Basic LTEXCommands: Body A The Body of the document:
  • 21. Basic LTEXCommands: Body A The Body of the document: begin{document}
  • 22. Basic LTEXCommands: Body A The Body of the document: begin{document} maketitle
  • 23. Basic LTEXCommands: Body A The Body of the document: begin{document} maketitle You can then type the body of your document. No need to indent-this happens automatically. Separate paragraphs by a blank line.
  • 24. Basic LTEXCommands: Body A The Body of the document: begin{document} maketitle You can then type the body of your document. No need to indent-this happens automatically. Separate paragraphs by a blank line. The document must end with end{document}
  • 25. Other Common Commands Here are some other commands that you will use often: section subsection chapter {bf text} {it text} smallskip medskip bigskip begin{enumerate}...end{enumerate} begin{itemize}...end{itemize}
  • 26. Special Characters LTEXreserves some characters for special purposes: A # $ % & ~ _ ^ { } These characters cannot be used by themselves in your document.
  • 27. Special Characters LTEXreserves some characters for special purposes: A # $ % & ~ _ ^ { } These characters cannot be used by themselves in your document. You can include these characters in your text by using the Escape Character
  • 28. Understanding How LTEXWorks A LTEXtakes in a number of different input files and outputs a A number of different files. The main input file is the .tex file. Along with the .tex file, LTEXreads in .cls files and .sty files which A provide all of the needed formatting information. LTEXoutputs a .dvi file and a .log file A
  • 29. Compiling LTEX A In order to compile your LTEXdocument use the latex command on A the .tex file.
  • 30. Compiling LTEX A In order to compile your LTEXdocument use the latex command on A the .tex file. For example, if you are using a unix environment then the command would look like this: latex name of file.tex
  • 31. .cls files .cls files specify the format of a specific type of document document. LTEXcomes with four different document classes: A
  • 32. .cls files .cls files specify the format of a specific type of document document. LTEXcomes with four different document classes: A book - This is good for writing longer books with many chapters
  • 33. .cls files .cls files specify the format of a specific type of document document. LTEXcomes with four different document classes: A book - This is good for writing longer books with many chapters report - This is good for longer works like dissertations, theses, short books
  • 34. .cls files .cls files specify the format of a specific type of document document. LTEXcomes with four different document classes: A book - This is good for writing longer books with many chapters report - This is good for longer works like dissertations, theses, short books article - This is good for conference presentations, short reports, shorter documents
  • 35. .cls files .cls files specify the format of a specific type of document document. LTEXcomes with four different document classes: A book - This is good for writing longer books with many chapters report - This is good for longer works like dissertations, theses, short books article - This is good for conference presentations, short reports, shorter documents letter - This is a simple way of writing a well-formatted letter.
  • 36. .cls files .cls files specify the format of a specific type of document document. LTEXcomes with four different document classes: A book - This is good for writing longer books with many chapters report - This is good for longer works like dissertations, theses, short books article - This is good for conference presentations, short reports, shorter documents letter - This is a simple way of writing a well-formatted letter. These are mostly similar with some small differences. For instance, the book class allows for chapters and the article class allows for abstracts.
  • 37. .cls files .cls files specify the format of a specific type of document document. LTEXcomes with four different document classes: A book - This is good for writing longer books with many chapters report - This is good for longer works like dissertations, theses, short books article - This is good for conference presentations, short reports, shorter documents letter - This is a simple way of writing a well-formatted letter. These are mostly similar with some small differences. For instance, the book class allows for chapters and the article class allows for abstracts. There are also many .sty files that allow for more specific formatting control.
  • 38. Output Files DVIs (device independent) are files that contain a preview of your document once it is compiled. It can be converted to a number of different formats, such as PDF for printing. LOG files contain a transcript of the compilation process. They mostly contain the same information that is printed to the screen during the process.
  • 39. How to Generate a Table of Contents Table of Contents in LTEXcan be generated automatically using the A tableofcontents command. Place the command wherever you want the table of contents to appear. This is usually right after the maketitle command. The way tableofcontents works is by taking entries from the sectioning commands. You must run the latex command twice to generate the ToC whenever you add new entries to it. The first time the entries are recorded on a .toc file. The second time they are actually typeset.
  • 40. How To Generate Indexes LTEXcan automatically generate indexes A Include usepackage{makeidx} makeindex in the preamble. When you encounter a term in your document that you would like to be indexed, use the index{term}term command You will need to run LTEXtwice in order for the index to appear. A Once for the entries to be recorded in a .idx file and twice for the entries to be typeset. It is possible to create various levels of entries.
  • 41. Bib files It is relatively simple to generate bibliographies in LTEXusing A bibtex and many different bibliographic formats are available. Bibliographic entries must be kept in a separate file, the .bib file This is the basic format for bib file entries: @BOOK{make up an abbreviation, AUTHOR = quot;authorquot;, TITLE = quot;book titlequot;, PUBLISHER = {who published it}, ADDRESS = {where it was published}, YEAR = year it was published}
  • 42. @BOOK{latex, AUTHOR = quot;Goossens, Michelquot;, TITLE = quot;The LaTeX Companionquot;, PUBLISHER = {Addison Wesley Longman, Inc.}, ADDRESS = {Reading, MA}, YEAR = 1994}
  • 43. @BOOK{latex, AUTHOR = quot;Goossens, Michelquot;, TITLE = quot;The LaTeX Companionquot;, PUBLISHER = {Addison Wesley Longman, Inc.}, ADDRESS = {Reading, MA}, YEAR = 1994} Your document should reference the source as follows: cite[p. 24] {latex}
  • 44. @BOOK{latex, AUTHOR = quot;Goossens, Michelquot;, TITLE = quot;The LaTeX Companionquot;, PUBLISHER = {Addison Wesley Longman, Inc.}, ADDRESS = {Reading, MA}, YEAR = 1994} Your document should reference the source as follows: cite[p. 24] {latex} To make the bibliography appear in your document include these commands at the end where you want the bibliography to go: bibliography{filename} bibliographystyle{plain}
  • 45. Bibliography styles There are several different options for the bibliographystyle command. It is also possible to define the style of the bibliography using external custom style files. Go here for more info on bib styles: http://amath.colorado.edu/documentation/LaTeX/ reference/faq/bibstyles.html#styles
  • 46. Compiling the bibliography Compiling a document with a bibliography is a little more complicated. run latex on the .tex file run bibtex on the .tex file run latex twice more The first time you run latex, a .aux file is created which bibtex will subsequently read. The subsequent latex runs allow latex to resolve all of the references between the document and the bib file. Each time you add new references to your document you must repeat this process.
  • 47. Bibliography Assistance You can use an external program to manage your bibliography. A good program for this is Jabref Free Detailed editing of entries Compatibility with various formats Automatic key generation You can get Jabref here: http://jabref.sourceforge.net/
  • 48. Where to get Help There are several different resources for learning LTEX A Books: LTEXConcisely by Adrian Johnstone A The LTEXCompanion by Michel Goossens A A Guide to LTEXby Melmut Kopka A LTEXFor Scientists and Engineers by David J. Buerger A The LTEXGraphics Companion A The LTEXWeb Companion A
  • 49. Online: There are numerous online tutorials and user guides for LTEX, specific commands, packages, etc. A The Research Computing Lab: You can send questions to me through our ticket system http: //www2.lib.virginia.edu/brown/rescomp/help/index.html
  • 50. What’s Coming Next? Intro to LTEXPart 2 will cover: A Including Notes Typesetting Mathematics Tables Graphics Figures Presentations