An Interactive Introduction to L A TEX

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

HTML and LaTeX Workshop MATT CHARNLEY BECKY COULSON

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

Math 235: Introduction to LaTeX

Become a L A TEX Guru

Learning LaTeX: The Basics

Getting started with Latex

LaTeX A Tutorial. Mohsen Alimomeni, 2010

L A TEX for Psychological Researchers

An Interactive Introduction to L A TEX. Part 2: Structured Documents & More. Dr John D. Lees-Miller. writel A TEX.

Guide to using L A TEX

Introduction to L A TEX for MCS-236

Typing Mathematics. Darrin Doud

Introduction to MCS 220 and L A TEX

Meeting One. Aaron Ecay. February 2, 2011

An introduction to L A TEX for students

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

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

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

LaTeX Workshop. While you re waiting, please make an account at

Introduction to L A TEX

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

An Introduction to L A TEX

COMP496/901: Academic Presentation and Writing Skills Using LaTeX

Introduction to L A T E X

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

An Interactive Introduction to L A TEX. Part 3: Not Just Papers: Presentations & More. John Lees-Miller. writel A TEX

Lecture 1. MA2730: Analysis I. Lecture slides for MA2730 Analysis I. Study and Assessment Components. MA L A TEX: topics for Lecture 1

Introduction to LAT E X

Helen Cameron. A Brief Overview of LATEX

Introduction to L A TEX beamer

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

Basics. Options. Commands

Introduction to L A TEX

VERY VERY SHORT GUIDE TO LATEX

Introduction to LATEX

Effective Programming Practices for Economists

Introduction to LAT E X

Learn how to [learn] LATEX

1 Obtaining LyX and L A TEX

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

Introduction to L A TEX

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

COMS 6100 Class note

L A TEX. The Logo. Introduction to L A TEX. Overview. Primary Benefits. Kinds of Documents. Bill Slough and Andrew Mertz

Helen Cameron. A Brief Overview of LATEX

Getting Started with L A T E X for a Technical Document or Thesis

Intro to LaTeX Workshop

L A TEX for Psychological Researchers

David Helmbold, October 2005, Revised October 2007

Basic L A TEX. what is LaTeX?

A Very Brief Introduction to L A T E X MAT 3535

Introduction to L A TEX

Course A, Part 1 Basic Formatting in L A TEX

L A TEX Overview. Jiayi Liu. January 31, Colorado School of Mines

LaTeX. Information Literacy II EN(IL2) Course

Introduction to L A TEX

Introduction to LATEX

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.

NCSU Linguistics Eric Wilbanks & Jeff Mielke. November 21, An open-source typesetting language used for document mark-up

Formatting with LaTeX

Introduction to LaTex 2ε. Based on The Not So Short Introduction to LaTeX 2ε by Tobias Oetiker et al., April 2001

Assessments for CS students:

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

Introduction to LaTeX. Paul Fodor Stony Brook University

An Introduction to LATEX

The Name of the Game. An Introduction to LATEX. Why L A TEX? The Name of the Game

LaTeX Seminar III: Environments and More Advanced Mathematical Typesetting

COMS 6500 Notes. Ashlin Harris. 30 August MT vs. Alabama A&M this Saturday (3 September)

Pimp your thesis: a minimal introduction to L A T E X.

An Introduction to LATEX

Introduzione a LaTex. Fabrizio Messina

My Mathematical Thesis

Introduction to LaTeX. M&S Talk Series August 16 th, 2016 AH Sheikh


A Brief Introduction to L A TEX

INSTALLING AND USING L A TEX

Workshop: A Simple Introduction to L A TEX

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

An Introduction to L A TEX

A Beginner s guide to L A TEX for CSCA67/MATA67. Kohilan Mohanarajan

Not-So-Frequently Asked Questions for L A TEX

MATLAB for the Sciences

Homework # (Latex Handout) by Laura Parkinson

Lecture 1: Short summary of LaTeX basics

EBESS and MESS Presents: Learn to LaTeX. Presented by Joshua Tambunan 13 February 2018

The basics of LaTeX. Cédric Buron. April 25, 2016

A Short L A TEX Introduction

L A TEX: Online module 2

Using L A TEX Tom Edgar

PRISM Introduction to L A TEX

Introduction to L A TEX

1 Different Document Classes

Workshop on LATEX 2ε. Asst. Prof. Dr. Kemal Bagzibagli Department of Economics. 20 May 2015

Getting started General Tables Figures Math Wrap up. UCLA Department of Statistics Statistical Consulting Center. LaTeX Bootcamp

Latex Tutorial 1 L A TEX. 1.1 Text

PHYS 87. Check that it works by typesetting the tripple ensted list of the pervious exercise.

Introduction to L A T E X

L A TEX examples. a b c a b c b b a c b c c b a. This table was typeset with the following commands.

L A TEX From The Ground Up

Transcription:

An Interactive Introduction to L A TEX Part 1: The Basics Dr John D. Lees-Miller December 2, 2017

Why L A TEX? It makes beautiful documents Especially mathematics It was created by scientists, for scientists A large and active community It is powerful you can extend it Packages for papers, presentations, spreadsheets,...

How does it work? You write your document in plain text with commands that describe its structure and meaning. The latex program processes your text and commands to produce a beautifully formatted document. The rain in Spain falls \emph{mainly} on the plain. latex The rain in Spain falls mainly on the plain.

More examples of commands and their output... \begin{itemize} \item Tea \item Milk \item Biscuits \end{itemize} Tea Milk Biscuits \begin{figure} \includegraphics{gerbil} \end{figure} \begin{equation} \alpha + \beta + 1 \end{equation} Image license: CC0 α + β + 1 (1)

Attitude adjustment Use commands to describe what it is, not how it looks. Focus on your content. Let L A TEX do its job.

Getting started A minimal L A TEX document: \documentclass{article} \begin{document} Hello World! % your content goes here... \end{document} Commands start with a backslash \. Every document starts with a \documentclass command. The argument in curly braces { } tells L A TEX what kind of document we are creating: an article. A percent sign % rest of the line. starts a comment L A TEX will ignore the

Getting started with Overleaf Overleaf is a website for writing documents in L A TEX. It compiles your L A TEX automatically to show you the results. Click here to open the example document in Overleaf For best results, please use Google Chrome or a recent FireFox. As we go through the following slides, try out the examples by typing them into the example document on Overleaf. No really, you should try them out as we go!

Typesetting Text Type your text between \begin{document} and \end{document}. For the most part, you can just type your text normally. Words are separated by one or more Words are separated by one spaces. or more spaces. Paragraphs are separated by one or more blank lines. Paragraphs are separated by one or more blank lines. Space in the source file is collapsed in the output. The rain in Spain The rain in Spain falls falls mainly on the plain. mainly on the plain.

Typesetting Text: Caveats Quotation marks are a bit tricky: use a backtick ` on the left and an apostrophe on the right. Single quotes: `text'. Double quotes: ``text''. Single quotes: text. Double quotes: text. Some common characters have special meanings in L A TEX: % percent sign # hash (pound / sharp) sign & ampersand $ dollar sign If you just type these, you ll get an error. If you want one to appear in the output, you have to escape it by preceding it with a backslash. \$\%\&\#! $%&#!

Handling Errors L A TEX can get confused when it is trying to compile your document. If it does, it stops with an error, which you must fix before it will produce any output. For example, if you misspell \emph as \meph, L A TEX will stop with an undefined control sequence error, because meph is not one of the commands it knows. Advice on Errors 1. Don t panic! Errors happen. 2. Fix them as soon as they arise if what you just typed caused an error, you can start your debugging there. 3. If there are multiple errors, start with the first one the cause may even be above it.

Typesetting Exercise 1 Typeset this in L A TEX: 1 In March 2006, Congress raised that ceiling an additional $0.79 trillion to $8.97 trillion, which is approximately 68% of GDP. As of October 4, 2008, the Emergency Economic Stabilization Act of 2008 raised the current debt ceiling to $11.3 trillion. Click to open this exercise in Overleaf Hint: watch out for characters with special meanings! Once you ve tried, click here to see my solution. 1 http://en.wikipedia.org/wiki/economy_of_the_united_states

Typesetting Mathematics: Dollar Signs Why are dollar signs $ mathematics in text. % not so good: Let a and b be distinct positive integers, and let c = a - b + 1. % much better: Let $a$ and $b$ be distinct positive integers, and let $c = a - b + 1$. special? We use them to mark Let a and b be distinct positive integers, and let c = a - b + 1. Let a and b be distinct positive integers, and let c = a b + 1. Always use dollar signs in pairs one to begin the mathematics, and one to end it. L A TEX handles spacing automatically; it ignores your spaces. Let $y=mx+b$ be \ldots Let $y = m x + b$ be \ldots Let y = mx + b be... Let y = mx + b be...

Typesetting Mathematics: Notation Use caret ^ for superscripts and underscore for subscripts. $y = c_2 x^2 + c_1 x + c_0$ y = c 2 x 2 + c 1 x + c 0 Use curly braces { } to group superscripts and subscripts. $F_n = F_n-1 + F_n-2$ % oops! F n = F n 1 + F n 2 $F_n = F_{n-1} + F_{n-2}$ % ok! F n = F n 1 + F n 2 There are commands for Greek letters and common notation. $\mu = A e^{q/rt}$ $\Omega = \sum_{k=1}^{n} \omega_k$ µ = Ae Q/RT Ω = n k=1 ω k

Typesetting Mathematics: Displayed Equations If it s big and scary, display it on its own line using \begin{equation} and \end{equation}. The roots of a quadratic equation are given by \begin{equation} x = \frac{-b \pm \sqrt{b^2-4ac}} {2a} \end{equation} where $a$, $b$ and $c$ are \ldots The roots of a quadratic equation are given by x = b ± b 2 4ac 2a where a, b and c are... (2) Caution: LATEX mostly ignores your spaces in mathematics, but it can t handle blank lines in equations don t put blank lines in your mathematics.

Interlude: Environments equation is an environment a context. A command can produce different output in different contexts. We can write $ \Omega = \sum_{k=1}^{n} \omega_k $ in text, or we can write \begin{equation} \Omega = \sum_{k=1}^{n} \omega_k \end{equation} to display it. We can write Ω = n k=1 ω k in text, or we can write Ω = to display it. n ω k (3) Note how the Σ is bigger in the equation environment, and how the subscripts and superscripts change position, even though we used the same commands. k=1 In fact, we could have written $...$ as \begin{math}...\end{math}.

Interlude: Environments The \begin and \end commands are used to create many different environments. The itemize and enumerate environments generate lists. \begin{itemize} % for bullet points \item Biscuits \item Tea \end{itemize} Biscuits Tea \begin{enumerate} % for numbers \item Biscuits \item Tea \end{enumerate} 1. Biscuits 2. Tea

Interlude: Packages All of the commands and environments we ve used so far are built into L A TEX. Packages are libraries of extra commands and environments. There are thousands of freely available packages. We have to load each of the packages we want to use with a \usepackage command in the preamble. Example: amsmath from the American Mathematical Society. \documentclass{article} \usepackage{amsmath} % preamble \begin{document} % now we can use commands from amsmath here... \end{document}

Typesetting Mathematics: Examples with amsmath Use equation* ( equation-star ) for unnumbered equations. \begin{equation*} \Omega = \sum_{k=1}^{n} \omega_k \end{equation*} Ω = n ω k L A TEX treats adjacent letters as variables multiplied together, which is not always what you want. amsmath defines commands for many common mathematical operators. \begin{equation*} % bad! min_{x,y} (1-x)^2 + 100(y-x^2)^2 \end{equation*} \begin{equation*} % good! \min_{x,y}{(1-x)^2 + 100(y-x^2)^2} \end{equation*} You can use \operatorname for others. \begin{equation*} \beta_i = \frac{\operatorname{cov}(r_i, R_m)} {\operatorname{var}(r_m)} \end{equation*} k=1 min x,y (1 x) 2 +100(y x 2 ) 2 min (1 x,y x)2 + 100(y x 2 ) 2 β i = Cov(R i, R m) Var(R m)

Typesetting Mathematics: Examples with amsmath Align a sequence of equations at the equals sign with the align* environment. (x + 1) 3 = (x + 1)(x + 1)(x + 1) = (x + 1)(x 2 + 2x + 1) = x 3 + 3x 2 + 3x + 1 \begin{align*} (x+1)^3 &= (x+1)(x+1)(x+1) \\ &= (x+1)(x^2 + 2x + 1) \\ &= x^3 + 3x^2 + 3x + 1 \end{align*} An ampersand & separates the left column (before the =) from the right column (after the =). A double backslash \ \ starts a new line.

Typesetting Exercise 2 Typeset this in L A TEX: Let X 1, X 2,..., X n be a sequence of independent and identically distributed random variables with E[X i ] = µ and Var[X i ] = σ 2 <, and let n S n = 1 n i X i denote their mean. Then as n approaches infinity, the random variables n(s n µ) converge in distribution to a normal N(0, σ 2 ). Click to open this exercise in Overleaf Hint: the command for is \infty. Once you ve tried, click here to see my solution.

End of Part 1 Congrats! You ve already learned how to... Typeset text in L A TEX. Use lots of different commands. Handle errors when they arise. Typeset some beautiful mathematics. Use several different environments. Load packages. That s amazing! In Part 2, we ll see how to use L A TEX to write structured documents with sections, cross references, figures, tables and bibliographies. See you then!