Introduction to L A TEX for MCS-236

Similar documents
Introduction to MCS 220 and L A TEX

L A TEX Primer. Randall R. Holmes. August 17, 2018

Math 395 Homework #1 Due Wednesday, April 12

1. Welcome. (1) Hello. My name is Dr. Christopher Raridan (Dr. R). (3) In this tutorial I will introduce you to the amsart documentclass.

Guide to using L A TEX

Meeting One. Aaron Ecay. February 2, 2011

An Interactive Introduction to L A TEX

An Interactive Introduction to L A TEX. Part 1: The Basics. John Lees-Miller. writel A TEX

Using L A TEX. A numbered list is just that a collection of items sorted and labeled by number.

Math 235: Introduction to LaTeX

Introduction to Math in LaTeX

Homework # You ll want to use some LaTeX editor to edit and compile your.tex files

L A TEX Tutorial. 1 Introduction. 2 Running L A TEX. J. E. Rice. May 2010

Learning LaTeX: The Basics

INSTALLING AND USING L A TEX

LATEX Primer. 1 Introduction (Read Me)

Guidelines for Writing Mathematical Proofs

Part II Composition of Functions

Introduction to Scientific Typesetting Lesson 1: Getting Started

Mr G s Java Jive. #11: Formatting Numbers

Simple Math. Adam Dishaw 2011 September 21. Suppose you want to include some math in your documents. Just follow these basics steps:

L A TEX: Online module 2

L A TEX. COMPSCI 111 / 111G Mastering Cyberspace: An introduction to practical computing. LaTeX. Development. Why?

1 Obtaining LyX and L A TEX

9. MATHEMATICIANS ARE FOND OF COLLECTIONS

AXIOMS FOR THE INTEGERS

Outline. Installing LaTeX. Opening TeXShop. Intro to LaTeX. Intro to LaTeX interface Working with text Tabbing and tables Figures Math and equations

VERY VERY SHORT GUIDE TO LATEX

Typing Mathematics. Darrin Doud

My Mathematical Thesis

Typesetting with TEX

The name of our class will be Yo. Type that in where it says Class Name. Don t hit the OK button yet.

Effective Programming Practices for Economists

Course A, Part 1 Basic Formatting in L A TEX

Getting started with Latex

Writing Guidelines for

Trombone players produce different pitches partly by varying the length of a tube.

What is LaTeX. Is a document markup language and document preparation system for the TeX typesetting program

Become a L A TEX Guru

Intro to LATEX I. Aaron Erlich POLS/CSSS 510, Why LATEX? Programming Document Structure Floats Tables Lists Math


CIS220 In Class/Lab 1: Due Sunday night at midnight. Submit all files through Canvas (25 pts)

Boolean Expressions. Is Equal and Is Not Equal

A Short Introduction to L A TEX

An introduction to L A TEX for students

Boolean Expressions. Is Equal and Is Not Equal

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #43. Multidimensional Arrays

Typesetting in wxmaxima

Comments on drafts of final paper

Section 1.1 Definitions and Properties

LaTeX A Tutorial. Mohsen Alimomeni, 2010

Latex Tutorial. CIS400 Senior Design 9/5/2013

TUTORIAL 10: ARRAYS AND MATRICES. 1. Welcome. Hello. My name is Dr. Christopher Raridan (Dr. R). I want to welcome you to the L A TEX Tutorial Series.

L A TEX for Psychological Researchers

Lecture 1: Overview

Introduction to TURING

Lecture 05 I/O statements Printf, Scanf Simple statements, Compound statements

Formatting with LaTeX

L A TEX and Basic Text Editing

An Introduction to. Rado Ivanov CIS400 Senior Design Tutorial September 18, 2014

MTH 122 Calculus II Essex County College Division of Mathematics and Physics 1 Lecture Notes #11 Sakai Web Project Material

LATEX Workshop. Yi Liu Chen SUNY Geneseo PRISM Math Club. February 6, Wordmark Reversed Geneseo Wordmark Style Guide 4

n! = 1 * 2 * 3 * 4 * * (n-1) * n

Lab1: Communicating science

Grade 6 Math Circles November 6 & Relations, Functions, and Morphisms

(Refer Slide Time 6:48)

Imagery International website manual

Interdisciplinary Journal of Best Practices in Global Development Final Manuscript Preparation Guidelines

Formal Methods of Software Design, Eric Hehner, segment 24 page 1 out of 5

COMP496/901: Academic Presentation and Writing Skills Using LaTeX

Section 1. The essence of COBOL programming. Mike Murach & Associates

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Priority Queues / Heaps Date: 9/27/17

Getting Started with L A TEX

The MathType Window. The picture below shows MathType with all parts of its toolbar visible: Small bar. Tabs. Ruler. Selection.

2SKILL. Variables Lesson 6. Remembering numbers (and other stuff)...

Java/RealJ Troubleshooting Guide

Variables, expressions and statements

Using ShareLaTeX to make Trees

Template and Tutorial for Math Modelers

Preparation for Precalculus

CONNECTED SPACES AND HOW TO USE THEM

Section 0.3 The Order of Operations

Table of Laplace Transforms

Structures of Expressions

Homework # (Latex Handout) by Laura Parkinson

Foundations, Reasoning About Algorithms, and Design By Contract CMPSC 122

Intro. Scheme Basics. scm> 5 5. scm>

Notes on Turing s Theorem and Computability

LaTeX, automata,computability, and notation. CS154 Chris Pollett Jan. 25, 2006.

6.001 Notes: Section 8.1

Programming for Engineers Introduction to C

A Brief Introduction to L A TEX

LaTeX Seminar III: Environments and More Advanced Mathematical Typesetting

An Introduction to LATEX

Abstract A quick intro by examples to the document preparation language L A TEX.

LaTeX and Turing Machines. CS254 Chris Pollett Aug. 30, 2006.

C++ Reference NYU Digital Electronics Lab Fall 2016

Full file at

(Refer Slide Time: 01.26)

Only to be used for arranged hours. Order of Operations

Transcription:

Introduction to L A TEX for MCS-236 Max Hailperin, based on a version by Tom LoFaro September 14, 2011 1 Why L A TEX? L A TEX is a very strange document formatting system. Actually, it is a combination of two layers. The fundamental layer is called TEX. It is essentially a compiler for a specialized programming language. You write a program for generating your document and run it through the compiler; out comes your document, ready to view or print. The L A TEX system was built on top of TEX. It is a carefully constructed library of predefined TEX procedures, so that you can write your document-program more readily. Like every piece of software, L A TEX has its advantages and disadvantages, which depend on the purpose you have in mind. For a lot of document preparation purposes, other software might be more suitable. I certainly wouldn t recommend that you design a concert poster using L A TEX. But for mathematical text, L A TEX has no equal. It takes getting used to initially, but that effort is rewarded by all the details it takes care of for you. For example, consider an equation like 2 + x = 3. In properly formatted math text, the variable x is italic, but the digits and other symbols aren t. Also, although this may not be obvious to you, the spacing around the equal sign is a bit bigger than the spacing around the plus sign. When you use L A TEX, all of these issues are taken care of for you. To an extremely good first approximation, every professional mathematician uses L A TEX (or some other version of TEX). So does every theoretical computer scientist and even most non-theoretical computer scientists in academic institutions and industrial research centers. So do lots of physicists. And so will you. 1

2 Getting L A TEX We have L A TEX on all of the computers in the lab so you can always work there. If you want, you can also download it as free software. I ve got the links on the course web page. For Windows and Linux systems, I recommend you use the TeX Live distribution, whereas under Mac OS X, you are better off with Mac TeX. The easiest way to use L A TEX is in an integrated environment that lets you edit your source file, compile it, and view the result. No matter whether you use Linux, Windows, or Mac OS X, one good option is to use TeXworks. Under Mac OS X, there is a slightly slicker option called TeXShop; whether you use it or TeXworks is likely to depend on whether you want to move seamlessly between operating systems. Both applications are included in Mac TeX. Only TeXworks is included in TeX Live. If you have any questions about installing any of this software see Aaron Nienow, who manages the MCS Department computer resources. I can also try to help. 3 Using L A TEX 3.1 Basics As indicated in Section 1, you write your L A TEX document as a source file in a specialized programming language and then run it through a compiler. The source file has a name ending in.tex and compiling it normally produces a corresponding.pdf file. I am providing this document to you in both forms, so that you can compare the two. You can see what source constructs are used to produce each visual result. You also can copy and paste from the source file as a starting point for your own documents. I ll provide other documents throughout the course in the same dual form for the same reason. Lots of the features I use in the document, I don t explain. Moreover, there are lots of features I don t use, even though some of them will prove useful at some point in the semester. Sometimes it will surely feel like I am telling you enough to be confusing but too little to be helpful. Please be patient with me. Ask me lots of questions. If you email me a question, I can send the reply to the whole class, so that everyone benefits. You can also find lots of information on the web, as well as in the books in our lab. Last but not least, I would encourage you to help each other. Every L A TEX document begins with a \documentclass statement that tells the compiler the type of document being produced and some default 2

settings. You can always use the one at the beginning of this document. Place all the text in the body of the document between \begin{document} and \end{document}. In L A TEX, regular text is generally typed normally. You don t have to worry about word spacing, paragraph spacing, line spacing, etc. One place where you may need to pay some attention is quotation marks; the marks at the beginning of a quotation are different from those at the end. In TeXworks, you can turn on the Smart Quotes preference setting to help with this detail. Every L A TEX command begins with a backslash. If you are reading along in the source form of this document, you surely will have noticed that every time I use the \LaTeX command to generate the L A TEX logo, I put it in curly braces. Curly braces can be used without harm almost anywhere in a L A TEX document, just like adding extra parentheses in mathematical formulas. My reason for putting this command in braces is to avoid a common pitfall: if a command that ends in a letter is immediately followed by a space, the space is ignored. You ll also notice that when I want something to show up verbatim in the output, I put use the \verb command. This command is unusual in that its argument is not enclosed in curly braces. Instead, any character is used before the argument and then the same character afterward. I ordinarily choose to use the vertical bar character for this purpose, unless the material I want to display verbatim happens to include a vertical bar. A new paragraph is preceded with a blank line. In-line mathematics is enclosed in dollar signs such as $x_1=4$ and $f (x)=3x^2-2$, which result in x 1 = 4 and f (x) = 3x 2 2. Note that subscripts are indicated using the underscore (_) and superscripts using the caret (^). Subscripts or superscripts of more than one character must be included in curly braces ($M_{12}$ gives M 12, whereas $M_12$ gives M 1 2). Specially formatted output is often created using a so-called environment, which is a section of code bracketed by \begin{whatever} and \end{whatever} statements. For example, you can produce displayed equations using the equation environment. This environment automatically provides a reference number next to the equation, such as you will see in the PDF version of this identity concerning binomial coefficients: n k=0 ( ) n = 2 n (1) k If you want to display a formula but have no use for the reference number, 3

you can use the equation* variant of the environment. This is so common that L A TEX offers a shorter alternative; you can bracketed the formula with \[ and \]. Here s an example: ( 1 2 n 1 ) 2 n+1. n=0 There are a few other things to note in these examples. Fractions are displayed using the \frac{}{} command. The numerator goes in the first set of braces and the denominator in the second. Binomial coefficients similarly use \binom{}{}. The \left( and \right) commands resize parentheses to match the size of what s inside. You can use \left and \right with any grouping symbols. The command \label{binomial-sum} associates a name in L A TEX s memory with the equation number. (The same feature can also be used for other kinds of numbers, such as section numbers.) This lets you automatically get the correct number when you want to talk about it; in this case, we d make reference to Equation 1. The only glitch is that the first time you compile your document, the numbers come out as question marks; you need to run L A TEX a second time to get them right. Notice that standard writing style dictates capitalizing the word Equation or Section when you are referring to a specific one, just as with such compound proper nouns as President Lincoln. Also, note that in the source file, I used the ~ symbol in place of a space between the word Equation and the reference number. This symbol indicates that a space should go there, but that line breaking is disallowed. Again, that s just a standard stylistic detail; it would apply equally well if you were writing about a flight leaving from Gate 17. Sometimes you may want to display several relationships together as shown below: v i V = {v 1, v 2, v 3,...} v j V (v i, v j ) E V V When reading the source code for the preceding list of relationships, note the following points: 4

Use the eqnarray* environment to create a displayed list of formulas if you don t want each one numbered. Use eqnarray if you do want numbering. In this particular case, the relationships weren t actually equations; they were set memberships. (The first one did have an equation off on the side.) One of my expectations for your writing is that if you refer to a formula as an equation, it better be asserting an equality. But L A TEX isn t that finicky. You can put any formula you want in an equation or eqnarray environment. Put ampersands (&) around whatever you want aligned (in this case, the set membership symbol). Indicate each line break within the list using \\. The letter l on the front of the command \ldots indicates that I wanted low dots. Sometimes centered dots are more appropriate, as in a 0 + + a n. I used a bunch of math symbols in this example. There are lots more. Often a web search is the quickest way to find one you need. 3.2 Proving Theorems The theorem environment brackets the statement of a theorem, but not the proof that usually follows. In the preamble of this document, I defined similar environments for definitions, corollaries, lemmas, etc. The proof goes in a proof envionment. I defined this in the preamble to match our textbook s style; for a different style, only one place would need changing. Here is an example of a theorem and its proof: Theorem 1 Assume a, b, c, and d are not all zero. If ad bc 0, then the system of equations has a unique solution of x = 0, y = 0. ax + by = 0 (2) cx + dy = 0 (3) Proof. Because ad bc 0, at least one of the four constants is non-zero. Without loss of generality assume a 0. Solving Equation 2 for x implies x = b y. (4) a 5

Substituting this into Equation 3 and simplifying gives ad bc y = 0. (5) a Because of the assumption that ad bc 0, Equation 5 implies that y = 0. Equation 4 then implies that x = 0. Hence the system of equations has x = 0, y = 0 as a unique solution. Following our textbook s example, you should generally start your proof with an explicit indication of the method you use, such as direct proof or mathematical induction. For this purpose, I have provided a variant of the proof environment called proofmethod. Here is an example: Proof. [by authority] Because I said so, that s why. Incidentally, the proof of Theorem 1 is a direct proof. However, it is also a proof by cases, because the assumption made without loss of generality is really a shorthand way of saying that there are three other cases that are entirely analogous. 6