Presentation is loading. Please wait.

Presentation is loading. Please wait.

BRIEF A BRIEF Introduction to L A T E X For Physics Graduate Students Prof. L. S. Pinsky Physics Department University of Houston.

Similar presentations


Presentation on theme: "BRIEF A BRIEF Introduction to L A T E X For Physics Graduate Students Prof. L. S. Pinsky Physics Department University of Houston."— Presentation transcript:

1 BRIEF A BRIEF Introduction to L A T E X For Physics Graduate Students Prof. L. S. Pinsky Physics Department University of Houston

2 This Talk Will… Give you a VERY BRIEF Introduction to L A T E X. Point you to the resources you can consult to learn more and to answer specific questions… Explain the broadest concepts of L A T E X. This Talk will NOT make you a L A T E X Expert… This Talk will NOT teach you how to run L A T E X on any arbitrary platform (or OS). 2 © 2009 L. Pinsky LATEX for Physics Graduate Students Summer 2009 PHYS 6340

3 TeX TYPESETTING TeX is a TYPESETTING Language… TeX is actually used by typesetting machines to set type to print everything from textbooks to newspapers… TeX is to a typesetting machine basically like machine language is to a Computer CPU. Ultimately, you should keep in mind that what TeX does is to position each character or graphic like an individual piece of printer’s type at a precise location on the page… 3 © 2005 L. Pinsky LATEX for Physics Graduate Students Summer 2009 PHYS 6340

4 …and L A T E X L A T E X is a compiler language like C or Fortran is to a computer. It allows the programmer to use a higher order, more user-friendly language format to set up the instructions for TeX. COMPILED …AND, like Fortran or C, L A T E X must be COMPILED into a TeX file… TeX outputs a special “machine language” like file called a “Device Independent” or “.dvi” file. 4 © 2005 L. Pinsky LATEX for Physics Graduate Students Summer 2009 PHYS 6340

5 What Good is a “.dvi” FILE? Well, if you have a typesetting machine, you can submit the “.dvi” file directly to it to print the pages you set up. More to the point and for our applications, there are translator routines available to convert “.dvi” files into “.pdf” and “.ps” files, as well as print drivers for most printers to allow you to print a “.dvi” file directly without having to view it on the screen… 5 © 2005 L. Pinsky LATEX for Physics Graduate Students Summer 2009 PHYS 6340

6 Real Men Do It Right… You need 5 things to use L A T E X to make a viewable document: 1. A Text Editor to create the and L A T E X file.  This is a Text File, typically with a “.txt” extension COMPILE 2. A L A T E X Program to COMPILE the Text File.  The L A T E X program outputs a “.tex” file. 3. A TeX Program to execute the “.tex” File.  The TeX program outputs a “.dvi” file. 4. A Converter Program to make a viewable File  Linux comes with “dvi2ps” to make “.ps” files 5. An appropriate Viewer Program… (e.g. Gimp) 6 © 2005 L. Pinsky LATEX for Physics Graduate Students Summer 2009 PHYS 6340

7 Smart Men Use Modern Tools… Composite L A T E X Tools exist for virtually all platforms (e.g. LATEXIT), and ancillary tools (e.g. Excalibur) which provides a spell checker… These “tools” typically combine the 5 items in one complete package with multiple windows. Some, have automatic simultaneous compliers to show you what your “code” produces as you type, and others require you to click a button to update the viewer window… 7 © 2005 L. Pinsky LATEX for Physics Graduate Students Summer 2009 PHYS 6340

8 Document Classes L A T E X includes several standard “Document Classes.” These are organized with a preset list of constituent “sub-sections” appropriate to the type of Document. Other “Style-Files” can be created externally to specify a new document class with its own unique structure. You can create your own such document classes with their associated “Style-Files,” but the typical situation is that, as noted on the next slide, a publisher or conference organizer will provide the “Style-File” to be used. 8 © 2005 L. Pinsky LATEX for Physics Graduate Students Summer 2009 PHYS 6340

9 Moving on to the L A T E X Text File The L A T E X input file has 2 major parts: 1. A Header, which contains general formatting information (e.g. fonts, spacing, alignment) and like C, a list of packages to be included.  The Header information can be automatically read-in from an external file, called a “Style-File”…  Most technical publishers (Journals) provide style-files that you can download.  NS&M has a style file for Ph.D. theses in this college!!! 2. The Body of the document, which contains the actual content of the document to be rendered.  This is what we will focus on now… 9 © 2005 L. Pinsky LATEX for Physics Graduate Students Summer 2009 PHYS 6340

10 Entering the Actual Content: Some Basics… The format for L A T E X is similar in philosophy to HTML in that there are “Escape” characters to signal commands within the normal content text. The general “Escape” character is the “\”. Also similar to HTML, the ”Escape” sequence can be used to change the “Environment”… e.g. \begin{textbf} Text to be in bold font. \end{textbf}, or \textbf{Text to be in bold font.} produces the same thing, namely: Text to be in bold font. 10 © 2005 L. Pinsky LATEX for Physics Graduate Students Summer 2009 PHYS 6340

11 The Basics, Continued… There are 10 special characters that are used as part of L A T E X commands: # $ % & ~ _ ^ \ { } When you need to use these as actual characters, 7 are easy to reproduce: just type: \# \$ \% \& \_ \{ \} The other three have to be reproduced with the “verbatim” environment command”: \verbatim{\}, \verbatim{^} and \verbatim{~} 11 © 2005 L. Pinsky LATEX for Physics Graduate Students Summer 2009 PHYS 6340

12 Commands All commands are preceded by the Escape character “\”. The following Commands are considered to be “Fragile”: \ \begin \end \footnote Fragile Commands cannot be placed within other commands. e.g. \begin{textbf /end} 12 © 2005 L. Pinsky LATEX for Physics Graduate Students Summer 2009 PHYS 6340

13 Comments The “%” symbol indicates a Comment that will not be included in the final text or interpreted as a command. Everything on a line after the “%” symbol is ignored by L A T E X. Note that placing the “%” symbol on a line, makes the next line continuous with any text prior to the “%” symbol… That is the is ignored as well… 13 © 2005 L. Pinsky LATEX for Physics Graduate Students Summer 2009 PHYS 6340

14 Sectioning Commands The following “Sectioning” commands can be used to indicate internal divisions within a Document: \part{Any Title Information} \chapter{Any Title Information} \section{Any Title Information} \subsection{Any Title Information} \subsubsection{Any Title Information} \paragraph{Any Title Information} \subparagraph{Any Title Information} 14 © 2005 L. Pinsky LATEX for Physics Graduate Students Summer 2009 PHYS 6340

15 Spacing Within Paragraphs Words are separated by spaces, but L A T E X will choose the actual spacing, so multiple spaces in the input text are the same as one space. A period followed by a space (or spaces) and a capital letter, is presumed to be the end of a sentence. To add space in other situations, type “.\ ☐ ” ( ☐ means “space”). The exception to this rule is when a period follows an upper case letter. In rare cases where a sentence Does end that way, type “.\@” to indicate the end of a sentence. 15 © 2005 L. Pinsky LATEX for Physics Graduate Students Summer 2009 PHYS 6340

16 Spacing of Paragraphs One or more BLANK lines indicates the end of a paragraph. (The style commands in the header determine how that will be dealt with in general within each type of sub-component of the document). You can add additional vertical space between paragraphs by using the \vspace{distance} command, where “distance” can be in mm or in. e.g. \vspace{7mm} or \vspace{.25in}. You can use this command in the midst of a paragraph as well, but this is very unusual. 16 © 2005 L. Pinsky LATEX for Physics Graduate Students Summer 2009 PHYS 6340

17 Special Characters and Symbols L A T E X has a virtually complete collection of all symbols and characters. It is not possible (or desirable) to try and list them here, but many references that do list them are available among the various L A T E X tools… \copyright© \PsiΨ \psiψ \”{o}ö \oeœ \pounds£ …etc. 17 © 2005 L. Pinsky LATEX for Physics Graduate Students Summer 2009 PHYS 6340

18 Bibliographies and Citations Typically, one has a list of sources at the end of a document that are numbered, then those are “cited” by reference in the text to their Bibliography Number. The \cite{Pinsky:2008} command would insert a reference in the text to the corresponding Bibliography item with the “Citation Key” = “Pinsky:2008”. The “Citation Key” may be any sequence of letters, digits and punctuation, except that it may not contain a comma. BIBTEX To set up the Bibliography itself, one uses a separate program called BIBTEX… BIBTEX Bibliographies are imported from BIBTEX with the command: \bibliography{alpha,beta}, which will cause L A T E X to import the files: alpha.bib and beta.bib during compilation. BIBEX To use BIBEX, the following command must appear anywhere after the \begin{document} command: \bibliographystyle{plain}. There are many different styles available besides “plain.” 18 © 2005 L. Pinsky LATEX for Physics Graduate Students Summer 2009 PHYS 6340

19 Mathematical Expressions There are 2 types of Mathematical Expressions: Inline and Separate. The command for an INLINE Mathematical Expression is: \(expression) The command for a SEPARATE Mathematical Expression is: \[expression] Fractions are set up with the \fract{numerator}{denominator} command… Exponents are set up with the base^{exponent} command… Subscripts with the base_{subscript} commnd Integrals and Sums are set up with the \int{} and \sum{} commands: e.g. \[\sum_{i=1}^{n} x_{i} = \int_{0}^{\infinity} f(x) dx.] Overlines are created with the \overline command… Similar commands exist to create matrices and arrays… 19 © 2005 L. Pinsky LATEX for Physics Graduate Students Summer 2009 PHYS 6340

20 Embedding Graphics There are several ways to embed graphics in a document, (including the Graphics Package), but the most common is to use the \begin{figurename} command: \begin{figure} \includegraphics{mygraphics.jpg} \caption{caption text} \end{figure} 20 © 2005 L. Pinsky LATEX for Physics Graduate Students Summer 2009 PHYS 6340

21 Some Tools to Consider… Latexit… 21 © 2005 L. Pinsky LATEX for Physics Graduate Students Summer 2009 PHYS 6340


Download ppt "BRIEF A BRIEF Introduction to L A T E X For Physics Graduate Students Prof. L. S. Pinsky Physics Department University of Houston."

Similar presentations


Ads by Google