The Not So Short Introduction to LATEX 2ε - PDF

Description
The Not So Short Introduction to LATEX 2ε Or L A TEX 2ε in 157 minutes by Tobias Oetiker Hubert Partl, Irene Hyna and Elisabeth Schlegl Version 5.04, October 29, 2014 ii Copyright Tobias Oetiker

Please download to get full document.

View again

of 21
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Information
Category:

Presentations & Public Speaking

Publish on:

Views: 31 | Pages: 21

Extension: PDF | Download: 0

Share
Transcript
The Not So Short Introduction to LATEX 2ε Or L A TEX 2ε in 157 minutes by Tobias Oetiker Hubert Partl, Irene Hyna and Elisabeth Schlegl Version 5.04, October 29, 2014 ii Copyright Tobias Oetiker and Contributors. All rights reserved. This document is free; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This document is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this document; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Thank you! Much of the material used in this introduction comes from an Austrian introduction to L A TEX 2.09 written in German by: Hubert Partl Zentraler Informatikdienst der Universität für Bodenkultur Wien Irene Hyna Bundesministerium für Wissenschaft und Forschung Wien Elisabeth Schlegl in Graz no If you are interested in the German document, you can find a version updated for L A TEX 2ε by Jörg Knappen at CTAN://info/lshort/german iv Thank you! The following individuals helped with corrections, suggestions and material to improve this paper. They put in a big effort to help me get this document into its present shape. I would like to sincerely thank all of them. Naturally, all the mistakes you ll find in this book are mine. If you ever find a word that is spelled correctly, it must have been one of the people below dropping me a line. Eric Abrahamsen, Lenimar Nunes de Andrade, Eilinger August, Rosemary Bailey, Barbara Beeton, Marc Bevand, Connor Blakey, Salvatore Bonaccorso, Pietro Braione, Friedemann Brauer, Markus Brühwiler, Jan Busa, David Carlisle, Neil Carter, Carl Cerecke, Mike Chapman, Pierre Chardaire, Christopher Chin, Diego Clavadetscher, Wim van Dam, Benjamin Deschwanden Jan Dittberner, Michael John Downes, Matthias Dreier, David Dureisseix, Hans Ehrbar, Elliot, Rockrush Engch, William Faulk, Robin Fairbairns, Johan Falk, Jörg Fischer, Frank Fischli, Daniel Flipo, Frank, Mic Milic Frederickx, David Frey, Erik Frisk, Hans Fugal, Robert Funnell, Greg Gamble, Andy Goth, Cyril Goutte, Kasper B. Graversen, Arlo Griffiths, Alexandre Guimond, Neil Hammond, Rasmus Borup Hansen, Joseph Hilferty, Daniel Hirsbrunner, Martien Hulsen, Björn Hvittfeldt, Morten Høgholm, Werner Icking, Eric Jacoboni, Jakob, Alan Jeffrey, Martin Jenkins, Byron Jones, David Jones, Johannes- Maria Kaltenbach, Nils Kanning, Andrzej Kawalec, Christian Kern, Alain Kessi, Axel Kielhorn, Sander de Kievit, Kjetil Kjernsmo, Tobias Klauser, Jörg Knappen, Michael Koundouros, Matt Kraai, Tobias Krewer, Flori Lambrechts, Mike Lee, Maik Lehradt, Rémi Letot, Axel Liljencrantz, Jasper Loy, Johan Lundberg, Martin Maechler, Alexander Mai, Claus Malten, Kevin Van Maren, Pablo Markin, I. J. Vera Marún, Hendrik Maryns, Chris McCormack, Aleksandar S. Milosevic, Henrik Mitsch, Stefan M. Moser, Philipp Nagele, Richard Nagy, Manuel Oetiker, Urs Oswald, Hubert Partl, Marcelo Pasin, Martin Pfister, Lan Thuy Pham, Breno Pietracci, Demerson Andre Polli, Maksym Polyakov, Nikos Pothitos, John Refling, Mike Ressler, Brian Ripley, Kurt Rosenfeld, Bernd Rosenlecher, Chris Rowley, Young U. Ryu, Risto Saarelma, András Salamon, José Carlos Santos, Christopher Sawtell, Gilles Schintgen, Craig Schlenter, Hanspeter Schmid, Baron Schwartz, Jordi Serra i Solanich, Miles Spielberg, Susan Stewart, Matthieu Stigler, Geoffrey Swindale, Laszlo Szathmary, Boris Tobotras, Josef Tkadlec, Scott Veirs, Didier Verna, Carl-Gustav Werner, Fabian Wernli, Matthew Widmann, David Woodhouse, Chris York, Rick Zaccone, Fritz Zaucker, and Mikhail Zotov. Preface L A TEX [1] is a typesetting system that is very suitable for producing scientific and mathematical documents of high typographical quality. It is also suitable for producing all sorts of other documents, from simple letters to complete books. L A TEX uses TEX [2] as its formatting engine. This short introduction describes L A TEX 2ε and should be sufficient for most applications of L A TEX. Refer to [1, 3] for a complete description of the L A TEX system. This introduction is split into 6 chapters: Chapter 1 tells you about the basic structure of L A TEX 2ε documents. You will also learn a bit about the history of L A TEX. After reading this chapter, you should have a rough understanding how L A TEX works. Chapter 2 goes into the details of typesetting your documents. It explains most of the essential L A TEX commands and environments. After reading this chapter, you will be able to write your first documents. Chapter 3 explains how to typeset formulae with L A TEX. Many examples demonstrate how to use one of L A TEX s main strengths. At the end of the chapter are tables listing all mathematical symbols available in L A TEX. Chapter 4 explains indexes, bibliography generation and inclusion of EPS graphics. It introduces creation of PDF documents with pdfl A TEX and presents some handy extension packages. Chapter 5 shows how to use L A TEX for creating graphics. Instead of drawing a picture with some graphics program, saving it to a file and then including it into L A TEX, you describe the picture and have L A TEX draw it for you. Chapter 6 contains some potentially dangerous information about how to alter the standard document layout produced by L A TEX. It will tell you how to change things such that the beautiful output of L A TEX turns ugly or stunning, depending on your abilities. vi Preface It is important to read the chapters in order the book is not that big, after all. Be sure to carefully read the examples, because a lot of the information is in the examples placed throughout the book. L A TEX is available for most computers, from the PC and Mac to large UNIX and VMS systems. On many university computer clusters you will find that a L A TEX installation is available, ready to use. Information on how to access the local L A TEX installation should be provided in the Local Guide [5]. If you have problems getting started, ask the person who gave you this booklet. The scope of this document is not to tell you how to install and set up a L A TEX system, but to teach you how to write your documents so that they can be processed by L A TEX. If you need to get hold of any L A TEX related material, have a look at one of the Comprehensive TEX Archive Network (CTAN) sites. The homepage is at You will find other references to CTAN throughout the book, especially pointers to software and documents you might want to download. Instead of writing down complete urls, I just wrote CTAN: followed by whatever location within the CTAN tree you should go to. If you want to run L A TEX on your own computer, take a look at what is available from CTAN://systems. If you have ideas for something to be added, removed or altered in this document, please let me know. I am especially interested in feedback from L A TEX novices about which bits of this intro are easy to understand and which could be explained better. Tobias Oetiker OETIKER+PARTNER AG Aarweg Olten Switzerland The current version of this document is available on CTAN://info/lshort Contents Thank you! Preface iii v 1 Things You Need to Know The Name of the Game TEX L A TEX Basics Author, Book Designer, and Typesetter Layout Design Advantages and Disadvantages L A TEX Input Files Spaces Special Characters L A TEX Commands Comments Input File Structure A Typical Command Line Session The Layout of the Document Document Classes Packages Page Styles Files You Might Encounter Big Projects Typesetting Text The Structure of Text and Language Line Breaking and Page Breaking Justified Paragraphs Hyphenation Ready-Made Strings Special Characters and Symbols viii CONTENTS Quotation Marks Dashes and Hyphens Tilde ( ) Slash (/) Degree Symbol ( ) The Euro Currency Symbol (e) Ellipsis (... ) Ligatures Accents and Special Characters International Language Support Support for Portuguese Support for French Support for German Support for Korean Writing in Greek Support for Cyrillic Support for Mongolian The Unicode option The Space Between Words Titles, Chapters, and Sections Cross References Footnotes Emphasized Words Environments Itemize, Enumerate, and Description Flushleft, Flushright, and Center Quote, Quotation, and Verse Abstract Printing Verbatim Tabular Floating Bodies Protecting Fragile Commands Typesetting Mathematical Formulae The AMS-L A TEX bundle Single Equations Math Mode Building Blocks of a Mathematical Formula Single Equations that are Too Long: multline Multiple Equations Problems with Traditional Commands IEEEeqnarray Environment Common Usage Arrays and Matrices CONTENTS ix 3.7 Spacing in Math Mode Phantoms Fiddling with the Math Fonts Bold Symbols Theorems, Lemmas, Proofs and End-of-Proof Symbol List of Mathematical Symbols Specialities Including Encapsulated PostScript Bibliography Indexing Fancy Headers The Verbatim Package Installing Extra Packages Working with pdfl A TEX PDF Documents for the Web The Fonts Using Graphics Hypertext Links Problems with Links Problems with Bookmarks Source Compatibility Between L A TEX and pdfl A TEX Working with X L A TEX The Fonts Compatibility Between X L A TEX and pdfl A TEX Creating Presentations E 5 Producing Mathematical Graphics Overview The picture Environment Basic Commands Line Segments Arrows Circles Text and Formulas \multiput and \linethickness Ovals Multiple Use of Predefined Picture Boxes Quadratic Bézier Curves Catenary Rapidity in the Special Theory of Relativity The PGF and TikZ Graphics Packages E x CONTENTS 6 Customising L A TEX New Commands, Environments and Packages New Commands New Environments Extra Space Commandline L A TEX Your Own Package Fonts and Sizes Font Changing Commands Danger, Will Robinson, Danger Advice Spacing Line Spacing Paragraph Formatting Horizontal Space Vertical Space Page Layout More Fun With Lengths Boxes Rules A Installing L A TEX 137 A.1 What to Install A.2 Cross Platform Editor A.3 TEX on Mac OS X A.3.1 TEX Distribution A.3.2 OSX TEX Editor A.3.3 Treat yourself to PDFView A.4 TEX on Windows A.4.1 Getting TEX A.4.2 A L A TEX editor A.4.3 Document Preview A.4.4 Working with graphics A.5 TEX on Linux Bibliography 141 Index 144 List of Figures 1.1 A Minimal L A TEX File Example of a Realistic Journal Article Example fancyhdr Setup Sample code for the beamer class Example Package Layout parameters for this book List of Tables 1.1 Document Classes Document Class Options Some of the Packages Distributed with L A TEX The Predefined Page Styles of L A TEX A bag full of Euro symbols Accents and Special Characters Preamble for Portuguese documents Special commands for French German Special Characters Preamble for Greek documents Greek Special Characters Bulgarian, Russian, and Ukrainian Float Placing Permissions Math Mode Accents Greek Letters Binary Relations Binary Operators BIG Operators Arrows Arrows as Accents Delimiters Large Delimiters Miscellaneous Symbols Non-Mathematical Symbols AMS Delimiters AMS Greek and Hebrew Math Alphabets AMS Binary Operators AMS Binary Relations AMS Arrows AMS Negated Binary Relations and Arrows xiv LIST OF TABLES 3.19 AMS Miscellaneous Key Names for graphicx Package Index Key Syntax Examples Fonts Font Sizes Absolute Point Sizes in Standard Classes Math Fonts TEX Units Chapter 1 Things You Need to Know The first part of this chapter presents a short overview of the philosophy and history of L A TEX 2ε. The second part focuses on the basic structures of a L A TEX document. After reading this chapter, you should have a rough knowledge of how L A TEX works, which you will need to understand the rest of this book. 1.1 The Name of the Game TEX TEX is a computer program created by Donald E. Knuth [2]. It is aimed at typesetting text and mathematical formulae. Knuth started writing the TEX typesetting engine in 1977 to explore the potential of the digital printing equipment that was beginning to infiltrate the publishing industry at that time, especially in the hope that he could reverse the trend of deteriorating typographical quality that he saw affecting his own books and articles. TEX as we use it today was released in 1982, with some slight enhancements added in 1989 to better support 8-bit characters and multiple languages. TEX is renowned for being extremely stable, for running on many different kinds of computers, and for being virtually bug free. The version number of TEX is converging to π and is now at TEX is pronounced Tech, with a ch as in the German word Ach 1 or in the Scottish Loch. The ch originates from the Greek alphabet where X is the letter ch or chi. TEX is also the first syllable of the Greek word τεχνική (technique). In an ASCII environment, TEX becomes TeX. 1 In german there are actually two pronounciations for ch and one might assume that the soft ch sound from Pech would be a more appropriate. Asked about this, Knuth wrote in the German Wikipedia: I do not get angry when people pronounce TEX in their favorite way... and in Germany many use a soft ch because the X follows the vowel e, not the harder ch that follows the vowel a. In Russia, tex is a very common word, pronounced tyekh. But I believe the most proper pronunciation is heard in Greece, where you have the harsher ch of ach and Loch. 2 Things You Need to Know L A TEX L A TEX enables authors to typeset and print their work at the highest typographical quality, using a predefined, professional layout. L A TEX was originally written by Leslie Lamport [1]. It uses the TEX formatter as its typesetting engine. These days L A TEX is maintained by Frank Mittelbach. L A TEX is pronounced Lay-tech or Lah-tech. If you refer to L A TEX in an ASCII environment, you type LaTeX. L A TEX 2ε is pronounced Lay-tech two e and typed LaTeX2e. 1.2 Basics Author, Book Designer, and Typesetter To publish something, authors give their typed manuscript to a publishing company. One of their book designers then decides the layout of the document (column width, fonts, space before and after headings,... ). The book designer writes his instructions into the manuscript and then gives it to a typesetter, who typesets the book according to these instructions. A human book designer tries to find out what the author had in mind while writing the manuscript. He decides on chapter headings, citations, examples, formulae, etc. based on his professional knowledge and from the contents of the manuscript. In a L A TEX environment, L A TEX takes the role of the book designer and uses TEX as its typesetter. But L A TEX is only a program and therefore needs more guidance. The author has to provide additional information to describe the logical structure of his work. This information is written into the text as L A TEX commands. This is quite different from the WYSIWYG 2 approach that most modern word processors, such as MS Word or LibreOffice, take. With these applications, authors specify the document layout interactively while typing text into the computer. They can see on the screen how the final work will look when it is printed. When using L A TEX it is not normally possible to see the final output while typing the text, but the final output can be previewed on the screen after processing the file with L A TEX. Then corrections can be made before actually sending the document to the printer Layout Design Typographical design is a craft. Unskilled authors often commit serious formatting errors by assuming that book design is mostly a question of aesthetics If a document looks good artistically, it is well designed. But 2 What you see is what you get. 1.2 Basics 3 as a document has to be read and not hung up in a picture gallery, the readability and understandability is much more important than the beautiful look of it. Examples: The font size and the numbering of headings have to be chosen to make the structure of chapters and sections clear to the reader. The line length has to be short enough not to strain the eyes of the reader, while long enough to fill the page beautifully. With WYSIWYG systems, authors often generate aesthetically pleasing documents with very little or inconsistent structure. L A TEX prevents such formatting errors by forcing the author to declare the logical structure of his document. L A TEX then chooses the most suitable layout Advantages and Disadvantages When people from the WYSIWYG world meet people who use L A TEX, they often discuss the advantages of L A TEX over a normal word processor or the opposite. The best thing to do when such a discussion starts is to keep a low profile, since such discussions often get out of hand. But sometimes there is no escaping... So here is some ammunition. The main advantages of L A TEX over normal word processors are the following: Professionally crafted layouts are available, which make a document really look as if printed. The typesetting of mathematical formulae is supported in a convenient way. Users only need to learn a few easy-to-understand commands that specify the logical structure of a document. They almost never need to tinker with the actual layout of the document. Even complex structures such as footnotes, references, table of contents, and bibliographies can be generated easily. Free add-on packages exist for many typographical tasks not directly supported by basic L A TEX. For example, packages are available to include PostScript graphics or to typeset bibliographies conforming to exact standards. Many of these add-on packages are described in The L A TEX Companion [3]. L A TEX encourages authors to write well-structured texts, because this is how L A TEX works by specifying structure. 4 Things You Need to Know TEX, the formatting engine of L A TEX 2ε, is highly portable and free. Therefore the system runs on almost any hardware platform available. L A TEX also has some disadvantages, and I guess it s a bit difficult for me to find any sensible ones, though I am sure other people can tell you hundreds ;-) L A TEX does not work well for people who have sold their souls... Although some parameters can be adjusted within a predefined document layout, the design of a whole new layout is difficult and takes a lot of time. 3 It is very hard to write unstructured and disorganized documents. Your hamster might, despite some encouraging first steps, never be able to fully grasp the concept of Logical Markup. 1.3 L A TEX Input Files The input for L A TEX is a plain text file. On Unix/Linux text files are pretty common. On windows, one would use Notepad to create a text file. It contains the text of the document, as well as the commands that tell L A TEX how to typeset the text. If you are working with a L A TEX IDE, it will contain a program for creating L A TEX input files in text format Spaces Whitespace characters, such as blank or tab, are treated uniformly as space by L A TEX. Several consecutive whitespace characters are treated as one space. Whitespace at the start of a line is generally ignored, and a single line break is treated as whitespace. An empty line between two lines of text defines the end of a paragraph. Several empty lines are treated the same as one empty line. The text below is an example. On the left hand side is the text from the input file, and on the right hand side is the formatted output. It does not matter whether you enter one or several spaces after a word. An empty line starts a new paragraph. It does not matter whether you enter one or several spaces after a word. An empty line starts a new paragraph. 3 Rumour says that this is one of the key elements that will be addressed in the upcoming L A TEX3 system. 1.3 L A TEX Input Files Special Char
Related Search
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks