Getting started with Latex

Similar documents
Math 235: Introduction to LaTeX

LaTeX A Tutorial. Mohsen Alimomeni, 2010

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

An Interactive Introduction to L A TEX

An introduction to L A TEX for students

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

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

Guide to using L A TEX

Helen Cameron. A Brief Overview of LATEX

Learn how to [learn] LATEX

Become a L A TEX Guru

MATLAB for the Sciences

COMP496/901: Academic Presentation and Writing Skills Using LaTeX

Introduction to L A TEX

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

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

Introduction to MCS 220 and L A TEX

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.

Helen Cameron. A Brief Overview of LATEX

Introduction to LaTeX. Paul Fodor Stony Brook University

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.

Math 395 Homework #1 Due Wednesday, April 12

(Yet Another) Introduction to L A TEX 2ε (V3)

L A TEX for Psychological Researchers

Learning LaTeX: The Basics

An Introduction to L 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 LATEX

LaTeX. Information Literacy II EN(IL2) Course

Introduction to L A TEX

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

LATEX Primer. 1 Introduction (Read Me)

Using L A TEX Tom Edgar

1. The Joy of TEX. Check out this example!

Mikkel Madsen

CSCE 222 Discrete Structures for Computing. LaTeX. Dr. Hyunyoung Lee. !!!!! Based on slides by Andreas Klappenecker

Introduction to L A TEX for MCS-236

Dec. 27 th, 2010 University of Isfahan

Assessments for CS students:

Introduction to L A TEX

Using LaTex and BibTex to Write Academic Documents. Ligang He Department of Computer Science University of Warwick

Introduction to LAT E X

Introduction to Scientific Typesetting Lesson 1: Getting Started

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

Began as TeX, in 1982 (Knuth). Purely a typesetting tool. LaTeX added macros, maintaining TeX as it s typesetting engine (Lamport).

1 Obtaining LyX and L A TEX

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

Document Preparation Using L A TEX

VERY VERY SHORT GUIDE TO LATEX

Introduction to L A TEX

Introduction to LAT E X

COMS 6100 Class note

An Introduction to LATEX

Introduction to L A TEX

LaTeX: Scientific Document Writing

Research Method and Report Writing Lecture 4: An Introduction to L A TEX

Homework # (Latex Handout) by Laura Parkinson

NAVIGATING UNIX. Other useful commands, with more extensive documentation, are

A Brief Introduction to L A TEX

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

An Introduction to L A TEX

Introduction to LATEX

Getting ready for L A TEX. Alexis Dimitriadis. Version: March 28, 2013

Not-So-Frequently Asked Questions for L A TEX

Intro to LaTeX Workshop

عمادة البحث العلمي جامعة الملك سعود

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

A Beginner s Guide to LATEX. Last Revised: August 21, 2013

Basics. Options. Commands

Latex Tutorial 1 L A TEX. 1.1 Text

LaTeX Seminar III: Environments and More Advanced Mathematical Typesetting

L A TEX minicourse. dstowell, mag, sar, scannell,... September Typeset by FoilTEX

Course A, Part 1 Basic Formatting in L A TEX

Getting Started with L A TEX

Introduction to L A TEX

Getting Funky: Headers, Tables, Abstracts etc.

Square cells: an array cooking lesson

How to L A TEX. George Wong, David Mykytyn. 6 October 2016

WYSIWYG Systems. CSCM10 Research Methodology Lecture 4 (11/2/16): A Taster of L A TEX WYSIWYM. Advantages/Disadvantages of WYSIWYG Systems

A Short L A TEX Introduction

Introduction to Latex. A workshop by Dr. Ala Eshmawi

An Introduction to LATEX

L A TEXInstallation and Introduction

CSCM10 Research Methodology A Taster of L A TEX

An Introduction to L A T E X

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- Advanced Topics

Meeting One. Aaron Ecay. February 2, 2011

Introduzione a LaTex. Fabrizio Messina

An introduction to LaTeX

L A TEX for psychological researchers

How To Get Your Word Document. Ready For Your Editor

Math 291: Lecture 2. Justin A James. Minnesota State University Moorhead web.mnstate.edu/jamesju/

INSTALLING AND USING L A TEX

Lab1: Communicating science

Excellent support for mathematical formatting. Automatically downloads/installs missing components as needed Updates somewhat frequently

Learning L A TEX. Patrick Lam

Paul Gartside. March 2, 2013

Effective Programming Practices for Economists

Transcription:

Getting started with Latex Robert G. Niemeyer University of New Mexico, Albuquerque October 15, 2012

What is Latex? Latex is a mathematical typesetting language. Essentially, when you are using Latex to produce a document, you are writing code that is then understood by a compiler. There are various forms of output.

What is Latex? Latex is a mathematical typesetting language. Essentially, when you are using Latex to produce a document, you are writing code that is then understood by a compiler. There are various forms of output. Once the Latex code is compiled, the output is either in the form of a what is called a dvi file, ps file or pdf file.

What is Latex? Latex is a mathematical typesetting language. Essentially, when you are using Latex to produce a document, you are writing code that is then understood by a compiler. There are various forms of output. Once the Latex code is compiled, the output is either in the form of a what is called a dvi file, ps file or pdf file. The important thing to realize is that Latex is a tool for creating polished documents for immediate distribution. Yes, one can use other word-processors for producing mathematical documents, but the end-product is not always as polished as a document compiled by a Latex compiler.

What is Latex good for? EVERYTHING! (It even makes you coffee in the morning, does your gardening and balances your checkbook).

What is Latex good for? EVERYTHING! (It even makes you coffee in the morning, does your gardening and balances your checkbook). Not Really. But it s really awesome.

What is Latex good for? EVERYTHING! (It even makes you coffee in the morning, does your gardening and balances your checkbook). Not Really. But it s really awesome. Why it s awesome for you: Well-crafted cover letters and vitas Homework assignments Presentations in a format other than Powerpoint, Keynote or similar product Immense amount of control over how your mathematics is presented in an article, thesis and other professional documents you will be typing

What is Latex good for? Why it s awesome for your students: Notes from class can be provided as a PDF Quizzes and quiz solutions can be typed in a format/style that the students are use to from their text book(s) Exams can also be prepared using Latex

The various file types you need to know about And none that you don t The tex file: this is your source code The dvi file: this is what the Latex compiler produces The ps/pdf file: additional compilers can be used (and are typically part of a Latex front-end)

Latex front-ends and what you need first First, you will need either MikTex (Windows) or MacTex (Apple OS) To get MikTex: Go to http://www.miktex.org and download the MikTex Package (admin rights may be required) Go to http://pages.cs.wisc.edu/ ghost/ and download the viewer and converter Ghostscript and Ghostview (resp.)

Latex front-ends and what you need first First, you will need either MikTex (Windows) or MacTex (Apple OS) To get MacTex: Go to http://www.tug.org/mactex/ and download the MacTex Package (admin rights may be required) Once the download is finished, load the disk image (if it doesn t happen automatically) and run the installer (MacTeX-2010.mpkg) contained within.

Latex front-ends and what you need first Once you ve downloaded and installed either MikTex or MacTex, you are ready to install the front-end program.

Latex front-ends and what you need first Once you ve downloaded and installed either MikTex or MacTex, you are ready to install the front-end program. NOTE: IF YOU RE USING WINDOWS, MAKE SURE YOU VE ALSO INSTALLED THE Ghostscript and Ghostview PROGRAMS YOU DOWNLOADED.

Latex front-ends and what you need first Once you ve downloaded and installed either MikTex or MacTex, you are ready to install the front-end program. NOTE: IF YOU RE USING WINDOWS, MAKE SURE YOU VE ALSO INSTALLED THE Ghostscript and Ghostview PROGRAMS YOU DOWNLOADED. Both MikTex and MacTex come with a front-end program that isn t very spectacular: TexShop or some variant of it.

Latex front-ends and what you need first Once you ve downloaded and installed either MikTex or MacTex, you are ready to install the front-end program. NOTE: IF YOU RE USING WINDOWS, MAKE SURE YOU VE ALSO INSTALLED THE Ghostscript and Ghostview PROGRAMS YOU DOWNLOADED. Both MikTex and MacTex come with a front-end program that isn t very spectacular: TexShop or some variant of it. Why do you need a front-end program? Because without it, you re basically using the most rudimentary methods of Latex-ing: typing in a text file with a *.tex extension and compiling using DOS or some Unix variant.

Latex front-ends and what you need first Once you ve downloaded and installed either MikTex or MacTex, you are ready to install the front-end program. NOTE: IF YOU RE USING WINDOWS, MAKE SURE YOU VE ALSO INSTALLED THE Ghostscript and Ghostview PROGRAMS YOU DOWNLOADED. Both MikTex and MacTex come with a front-end program that isn t very spectacular: TexShop or some variant of it. Why do you need a front-end program? Because without it, you re basically using the most rudimentary methods of Latex-ing: typing in a text file with a *.tex extension and compiling using DOS or some Unix variant. Yeah, I did it. It sucks.

Latex front-ends and what you need first Once you ve downloaded and installed either MikTex or MacTex, you are ready to install the front-end program. NOTE: IF YOU RE USING WINDOWS, MAKE SURE YOU VE ALSO INSTALLED THE Ghostscript and Ghostview PROGRAMS YOU DOWNLOADED. Both MikTex and MacTex come with a front-end program that isn t very spectacular: TexShop or some variant of it. Why do you need a front-end program? Because without it, you re basically using the most rudimentary methods of Latex-ing: typing in a text file with a *.tex extension and compiling using DOS or some Unix variant. Yeah, I did it. It sucks. Get a front-end program.

Latex front-ends and what you need first Below are a few different front-end programs that are either free or cost only a small amount. Windows WinEdt (small price) TexnicCenter (free) Texpad (small price) - Apple Gmacs (free) - Linux/Unix These are definitely not the only front-end programs available, but they are the ones I have had the most experience with.

Installing a front-end program Once you ve decided on a front-end program, you will want to install it. Now this is where it can get a bit tricky.

Installing a front-end program Once you ve decided on a front-end program, you will want to install it. Now this is where it can get a bit tricky. Depending on what front-end program you ve downloaded, the wizard will be either really helpful or not so helpful.

Installing a front-end program Once you ve decided on a front-end program, you will want to install it. Now this is where it can get a bit tricky. Depending on what front-end program you ve downloaded, the wizard will be either really helpful or not so helpful. The wizard is a small little part of the program that helps you set up everything if you re a first-time user. Mainly, the wizard helps you get the front-end program to locate your various compilers.

Installing a front-end program Once you ve decided on a front-end program, you will want to install it. Now this is where it can get a bit tricky. Depending on what front-end program you ve downloaded, the wizard will be either really helpful or not so helpful. The wizard is a small little part of the program that helps you set up everything if you re a first-time user. Mainly, the wizard helps you get the front-end program to locate your various compilers. NOTE: If you don t know exactly what a compiler is, that s no big deal. What you do need to know is what to do when Latex asks.

Installing a front-end program Luckily, each front-end program I have listed for either Windows or Apple has a great page on what to do when the wizard asks you to supply certain information. WinEdt - http://winedt.com/installing.html TexnicCenter - http://texniccenter.sourceforge.net/configuration.html Texpad - the configuration is automatic, I think...yeah, pretty sure

Your first Latex document Since we are programming, isn t it only appropriate that our first program somehow output hello world!?

Your first Latex document Since we are programming, isn t it only appropriate that our first program somehow output hello world!? Yes, it is very appropriate. So, start up your Latex front-end program and create a new document. In this document, type the following as shown: \documentclass{article} \begin{document} hello world! \end{document}

Your first Latex document Since we are programming, isn t it only appropriate that our first program somehow output hello world!? Yes, it is very appropriate. So, start up your Latex front-end program and create a new document. In this document, type the following as shown: \documentclass{article} \begin{document} hello world! \end{document} Then compile your document.

Packages Packages are additional modules of code that make your life a WHOLE lot easier. Think of packages like add-ons and upgrades that come for free. \usepackage{amsmath} \usepackage{amssymb} \usepackage{mathrsfs} \usepackage{graphicx}

Packages Packages are additional modules of code that make your life a WHOLE lot easier. Think of packages like add-ons and upgrades that come for free. \usepackage{amsmath} \usepackage{amssymb} \usepackage{mathrsfs} \usepackage{graphicx} We will discuss these in more detail later (hopefully).

Essential environments Now that we have made our first program, let s figure out how to put in more complicated features.

Essential environments Now that we have made our first program, let s figure out how to put in more complicated features. Itemized and enumerated lists Mathematics Equations Aligned equations

Essential environments Itemized and enumerated lists \begin{itemize} \item{itemized and enumerated lists} \item{mathematics} \item{equations} \item{aligned equations} \end{itemize}

Essential environments Itemized and enumerated lists \begin{enumerate} \item{itemized and enumerated lists} \item{mathematics} \item{equations} \item{aligned equations} \end{enumerate}

Essential environments Itemized and enumerated lists 1. Itemized and enumerated lists 2. Mathematics 3. Equations 4. Aligned equations

Mathematics! Finally, what we ve all be waiting for! How do we get something of the form 3x^2+2x-5+sin(pi/2) to look like this: 3x 2 + 2x 5 + sin ( π 2).

Mathematics! Finally, what we ve all be waiting for! How do we get something of the form 3x^2+2x-5+sin(pi/2) to look like this: 3x 2 + 2x 5 + sin ( π 2). Like this: $3x^2+2x-5+\sin\left(\frac{\pi}{2}\right)$ The dollar sign on the left indicates where the math begins and the dollar sign on the right indicates where the math ends.

Mathematics! Finally, what we ve all be waiting for! Using $...$ to put math into your document is great for when you want mathematics part of the text. But when you want your mathematics to be centered and apart from the text, there are ways to accomplish this.

Mathematics! Finally, what we ve all be waiting for! Using $...$ to put math into your document is great for when you want mathematics part of the text. But when you want your mathematics to be centered and apart from the text, there are ways to accomplish this. \begin{equation} 3x^2+2x-5+\sin\left(\frac{\pi}{2}\right) \end{equation}

Mathematics! Finally, what we ve all be waiting for! Using $...$ to put math into your document is great for when you want mathematics part of the text. But when you want your mathematics to be centered and apart from the text, there are ways to accomplish this. \begin{equation} 3x^2+2x-5+\sin\left(\frac{\pi}{2}\right) \end{equation} This looks like,

Mathematics! Finally, what we ve all be waiting for! Using $...$ to put math into your document is great for when you want mathematics part of the text. But when you want your mathematics to be centered and apart from the text, there are ways to accomplish this. \begin{equation} 3x^2+2x-5+\sin\left(\frac{\pi}{2}\right) \end{equation} This looks like, ( π 3x 2 + 2x 5 + sin 2) (1)

Mathematics! Finally, what we ve all be waiting for! But what if we want to have more than one line? The equation environment is not the best to use. We should use the align environment. \begin{align} 3x^2+2x-5+\sin\left(\frac{\pi}{2}\right) &= \tan\left(5y\right)\\ 3x^2+2x-5+\sin\left(\frac{\pi}{2}\right) -\tan\left(5y\right)&=0 \end{align} ( π 3x 2 + 2x 5 + sin = tan(5y) (2) ( 2) π 3x 2 + 2x 5 + sin tan(5y) = 0 (3) 2)

Mathematics! Finally, what we ve all be waiting for! Notice how the equations are aligned along the equal signs. We could just have well placed the & symbol anywhere to align each line as we so pleased. ( π 3x 2 + 2x 5 + sin = tan(5y) (4) ( 2) π 3x 2 + 2x 5 + sin tan(5y) = 0 (5) 2)

Mathematics! Finally, what we ve all be waiting for! Notice how the equations are aligned along the equal signs. We could just have well placed the & symbol anywhere to align each line as we so pleased. ( π 3x 2 + 2x 5 + sin = tan(5y) (4) ( 2) π 3x 2 + 2x 5 + sin tan(5y) = 0 (5) 2) For example, ( π 3x 2 + 2x 5+ sin = tan(5y) (6) ( 2) π 3x 2 + 2x 5 + sin tan(5y) = 0 (7) 2)

Mathematics! Finally, what we ve all be waiting for! Also, notice how the lines in our align environment continue to be numbered and that the line in the equation was also numbered. How do we get lines of equation and align environments to not be numbered? Easy! Here s how: \begin{equation*}... \end{equation*} and \begin{align*}... \end{align*}

Mathematics! Finally, what we ve all be waiting for! For example, \begin{align*} 3x^2+2x-5+\sin\left(\frac{\pi}{2}\right) &= \tan\left(5y\right)\\ 3x^2+2x-5+\sin\left(\frac{\pi}{2}\right) -\tan\left(5y\right)&=0 \end{align*} looks like this: ( π 3x 2 + 2x 5 + sin = tan(5y) ( 2) π 3x 2 + 2x 5 + sin tan(5y) = 0 2)

More math! Sometimes you need to make things look really fancy. Black-board fonts Curly braces Left and right $\mathbb{r}$ $\{...\}$ $\left\{\frac{n}{2}\}_{n=0}^\infty$

More math! Sometimes you need to make things look really fancy. Black-board fonts Curly braces Left and right $\mathbb{r}$ $\{...\}$ $\left\{\frac{n}{2}\}_{n=0}^\infty$ R {...} { n } 2 n=0

We could go on and on! There are many more things to be aware in Latex. For example, tables are very nice and using Latex to make diagrams is always a good idea. But, we don t want to cover EVERYTHING about Latex. I hope what I ve covered so far is enough to get you off the ground.

We could go on and on! There are many more things to be aware in Latex. For example, tables are very nice and using Latex to make diagrams is always a good idea. But, we don t want to cover EVERYTHING about Latex. I hope what I ve covered so far is enough to get you off the ground. Luckily, if you re trying to do something in Latex, someone else has already done it, figured it out and wrote all about it on the internet.

We could go on and on! There are many more things to be aware in Latex. For example, tables are very nice and using Latex to make diagrams is always a good idea. But, we don t want to cover EVERYTHING about Latex. I hope what I ve covered so far is enough to get you off the ground. Luckily, if you re trying to do something in Latex, someone else has already done it, figured it out and wrote all about it on the internet. Hence, when you re stuck trying to make something awesome happen in Latex and can t figure it out, turn to the internet. Adding the term latex to any search will usually point in the wrong direction. Of course, I am not liable for any faulty searches that lead you astray!

But before we go... We will discuss how to insert graphics.

But before we go... We will discuss how to insert graphics. First, and foremost, you want to make sure you have the command \usepackage{graphicx} in your preamble, the section of your tex document before \begin{document} and after \documentclass{article}.

Including graphics The basic structure is as follows: \begin{figure} \begin{center} \includegraphics{graphic.eps} \end{center} \caption{an example of a figure.} \label{fig:graphic} \end{figure}

Including graphics Figure: An example of a figure.

Including graphics OH NO! It s too big!

Including graphics OH NO! It s too big! So let s scale it down a bit.

Including graphics OH NO! It s too big! So let s scale it down a bit. \begin{figure} \begin{center} \includegraphics[scale=.75]{graphic.eps} \end{center} \caption{an example of a figure.} \label{fig:graphic} \end{figure}

Including graphics Figure: An example of a figure.

Some common mistakes The most common mistakes are the following (or at least, the common mistakes I make): Leaving off a dollar sign or including too many Not including the \\ at the end of a line of an align environment Not including a or including too many curly braces Misspelling a command All of these mistakes will keep your document from compiling correctly. In most front-end programs, an error message will be displayed, but you ll be left to hunt for the location of the error. Sometimes Latex is helpful in locating the error. Other times it is not.

Thank you!