1 / 37

Introduction to LaTeX

Introduction to LaTeX. A Computerized Typesetting Program. What is LaTeX? ( Latex , Chapters 1 & 2). LaTeX (pronounced lahtekh or laytekh) is a typesetting program, not a word processor.

more
Télécharger la présentation

Introduction to LaTeX

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to LaTeX • A Computerized Typesetting Program

  2. What is LaTeX?(Latex, Chapters 1 & 2) • LaTeX (pronounced lahtekh or laytekh) is a typesetting program, not a word processor. • It is written on an ordinary text editor and translated by means of a program into a finalized version, usually in pdf format. • Formatting codes are embedded in the text. • Equations, symbols, tables, etc. are created by means of formatting codes.

  3. History(Latex, pp. 9-10) • 1977: Donald Knuth devised “TeX”, a markup language for the purpose of attractively typesetting technical documents. • LaTeX was then developed by Leslie Lamport as an overlay to the TeX language, enabling easier use, especially for including math formulas.

  4. Downloads(Latex, p. 11) • Dedicated LaTeX editor (including tex, pdftex, latex, pdflatex, dvi2ps, dvipdf or dvipdfm, and possibly others) • Downloads are available for PC, Mac, Unix, Linux from http://www.tug.org/texlive/ • There is no cost.

  5. Recommended programs • These are all free of charge and available online.

  6. LaTeX Wikibook • An excellent Wikibook for LaTeX is available, free of charge, at http://en.wikibooks.org/wiki/LaTeX • Download the pdf version for convenient reference.

  7. Using a Template • The easiest way to begin using LaTeX is to use an existing template. • A basic template for an article format is provided with this workshop.

  8. General Structure of a File(Latex, p. 15) • Every LaTeX file begins with \documentclass{...} • This begins a section called the “preamble”, which contains global instructions for the file. \usepackage{...} commands and others are placed here. • After the preamble, the body of the text begins with \begin{document}. • At the end of the file is \end{document}.

  9. [...] vs. {...} • [...] contains an optional argument. • {...} contains a required argument.

  10. Fussy, fussy, fussy • LaTeX is very unforgiving of errors. Everything must be exactly right in order for it to work. • If you type ( instead of {, or if you use a reserved character such as _, it will crash or do something unintended. • This is one reason why a well tested template is very helpful.

  11. Preamble • After %, LaTeX ignores the rest of the line. • \documentclass{article} causes LaTeX to format the text as an article with set formatting rules. • \usepackage{...} specifies an exception or addition to the set formatting rules. Multiple packages can be used. • (See LaTeX, p. 28 for an example.)

  12. Body: Top Matter • Look at the example on page 28 of LaTeX • \begin{document} • \title{...} • \author{...} • \date{...} (Put % in front of it to suppress.) • \maketitle (Title and name appear here.) • \end{document]

  13. Abstract(Latex, p. 30) • \documentclass{article} • \begin{document} • \begin{abstract} • . . . • \end{abstract} • \end{document}

  14. Sectioning(Latex, pp. 30-31) • \section{...} • \subsection{...} • \subsubsection{...} • (These will be numbered: 1., 1.1., 1.1.1.)

  15. Bibliography(Latex, p. 33) • Manual bibliography • Automated bibliography (BibTeX) • (BibTeX will be demonstrated at the end of the workshop.)

  16. Manual Bibliography • \begin{thebibliography}{99} • \bibitem{lam94} • Leslie Lamport, • \textsl{LaTeX: A Document Preparation System}(2nd ed.), • Boston: Addison-Wesley, • 1994. • \end{thebibliography}

  17. \begin{thebibliography}{99} • Place this command at the place where you want the bibliography to begin. • Use “99” if you have more than 9 references but fewer than 100. • Use “9” if you have fewer than 10 references.

  18. \bibitem{lam94} • This command introduces a reference. In the braces, put an identifier that LaTeX can use to refer to your item. (A common choice is the first three letters of the author’s name and the last two digits of the year. But any abbreviation will work.) • After this, put the information for the reference. Separate the parts by commas. Use whatever style you wish (APA, IEEE, etc.). • You may type the parts on one line or separate lines. LaTeX will automatically format them. • Note: \textsl{...} puts the text within the braces into italics.

  19. Type all your references, beginning each one with the \bibitem code. • When you are finished, put the \end{thebibliography} code on a separate line. • In the text, use \cite{...} to refer to the source. For example, if the book by Lamport is the third book in your list, \cite{lam94} will insert [3] in your text. • If you insert other references in the the middle of the bibliography, LaTeX will automatically adjust all the numbers in the bibliography and in the text.

  20. Footnotes(Latex, p. 114) • Insert a footnote in the text with • \footnote{...} • Numbering is automatic.

  21. Bulleted Lists(Latex, p. 110) • Insert a bulleted list with: • \begin{itemize} • \item ... • \item ... • \item... • \end{itemize}

  22. Numbered Lists(Latex, p. 110) • Insert a numbered list with: • \begin{enumerate} • \item ... • \item ... • \item... • \end{enumerate}

  23. Ellipsis(Latex, p. 103) • An ellipsis (...) is inserted with the code: • \ldots • This will space the dots properly.

  24. Page breaks • \newpage breaks the page at that point without stretching the content. • \pagebreak is like \newpage but stretches the content to fit the page. • \clearpage is like \newpage but in addition typesets all the remaining figures and tables. If figures and tables interrupt a sequence such as the bibliography, put \clearpage immediately before the sequence.

  25. Graphics(Latex, Chapter 9) • Import a graphics file with: • \includegraphics[width=...cm]{filename} • A graphics package must be called in the preamble. • e.g. \usepackage{graphicx}

  26. Tables(Latex, Chapter 8) • Study the table on p. 65 (top). • Note: \begin{tabular}{l*{6}{c}r} • l stipulates a left-justified column. • r stipulates a right-justified column. • *{6}{c} stipulates six identical columns, each centre-justified. • \hline gives a horizontal line. • Remember to end with \end{tabular} • All size calculations are done automatically.

  27. Table Float(Latex, Chapters 10 & 15) • To create a table float that will be automatically placed in the text by LaTeX, embed the table codes within the following codes: • \begin{table} • \end{table} • To create a reference, place the code \label{marker} within the environment. “Marker” is a short text or abbreviation. Place /ref{marker} in the text at the place where you want the reference number to appear. (See the table in the template.) • Other floats (e.g. figure floats) are created in a similar way.

  28. Math(Latex, Chapter 13) • For any serious use of math formulas: • \usepackage{amssymb} • in the preamble. • This is a package created by the American Mathematical Society. It provides a large set of extra math symbols to LaTeX. • Note: If equation numbers appear on the left and you want them to appear on the right, add the argument {reqno} to the document class options. (See the first line of the template.)

  29. Math example • To set Gauss’ Law for Electricity in LaTeX, use the following coding: • $$ \oint \vec E \vec{dA} = {q \over \varepsilon_0} = 4\pi k q $$

  30. See the table on p. 130 for an explanation of the $$ codes. These codes may be used to display an equation, which means to put it on a separate line and give it an equation number. • Single $ codes around an equation will embed the equation in the current line of text. • However, note the warning about $ codes on p. 130. • An additional option is \begin{equation}...\end{equation}.

  31. \int gives an integral sign. • \oint gives an closed line integral sign (an integral sign with a circle on it). • \vec gives a vector notation. If the vector contains two or more characters, enclose them in {...}. • There are a few ways to make a fraction bar (vinculum). \over is the simplest. • \varepsilon gives the correct version of the Greek letter epsilon. • _ gives a subscript. (^ gives a superscript.) • \pi gives the small Greek letter pi.

  32. Most of the math symbols are shown in tables near the end of Chapter 13. • Chapter 13 also contains many examples of equations.

  33. Introduction to BibTeX

  34. Recommended programs • Mac: BibDesk • PC: JabRef 2.6

  35. Procedure (Mac) • Download and open program “BibDesk”. • Enter all bibliography items as indicated. • Save repeatedly. Choose any convenient name..

  36. Procedure (PC) • Be sure Java is available. • Download and open JabRef2.6 • Choose BibTeX • New Entry • Select entry type • Fill in relevant fields • Save. Choose any convenient name.

  37. Creating the File • Create LaTeX file as usual, inserting citation keys as desired. • Typeset it. • Switch to “BibTex”. • Typeset repeatedly until citation numbers appear in place of question marks.

More Related