Introduction to L A T EX A Quick Crash Course Amin Mesbah 15 - - PowerPoint PPT Presentation
Introduction to L A T EX A Quick Crash Course Amin Mesbah 15 - - PowerPoint PPT Presentation
Introduction to L A T EX A Quick Crash Course Amin Mesbah 15 April, 2016 A T What is L EX? A document typesetting markup language A tool that can save you a lot of time Commonly used to write research papers, but useful for many other
What is L
AT
EX?
A document typesetting markup language A tool that can save you a lot of time Commonly used to write research papers, but useful for many
- ther things too (resumes, calendars, posters, books, letters,
notes, this slideshow...)
Setup
Windows: MiKTeX Mac: MacTeX Linux: apt-get install texlive Online:
Overleaf ShareLatex
Using Overleaf
Go to overleaf.com and click ”Create a New Paper”. Then click ”Source”
”Hello, World!”
Making our first L
A
T EX document
A L
AT
EX document has two main parts (called environments): Preamble Environment
Set up the rules for how your document will look
Document Environment
The place where you write your document
The Code for helloworld.tex
Making our first L
A
T EX document
% t h i s i s
- ur
preamble \ documentclass [11 pt ]{ a r t i c l e } % t h i s i s
- ur document
environment \ begin {document} Hello , world ! \end{document}
Let’s add a Title!
Making our first L
A
T EX document
\ documentclass [11 pt ]{ a r t i c l e } % t i t l e i n f o r m a t i o n goes here : \ t i t l e { Hello , World !} \ author { your name goes here } \ date {\ today } \ begin {document} % t i t l e gets made here : \ m a k e t i t l e Hello , world ! \end{document}
Adding Graphics from Mathematica
Making our first L
A
T EX document
First add the graphicx package in your documents preamble: \ usepackage { graphicx } Then add the following code to your document’s body: % i n c l u d e a p i c t u r e shrunk to h a l f i t s s i z e \ i n c l u d e g r a p h i c s [ s c a l e =0.5]{ mathematicapic }
Adding a table
Making our first L
A
T EX document
\ begin { c en t er } % c en te r the t a b l e % t a b u l a r environment makes t a b l e s % {| l | l | | r |} makes three columns with borders % adjacent c e l l s are separated by ’& ’ % ’\ hli ne ’ makes a h o r i z o n t a l l i n e % ’\\ ’ ends a row \ begin { t a b u l a r }{| l | l | | r |} \ h l i n e a1 & b1 & c1 \\ a2 & b2 & c2 \\ a3 & b3 & c3 \\ \ h l i n e a4 & b4 & c4 \\ \ h l i n e \end{ t a b u l a r }
The Math Environment
L
AT
EX was originally designed to make it easy to write nice looking mathematical notation. If you want to write math, use the amsmath package. Since math formulas need to look different than normal text, they go in their own special math environment.
Adding Math
Making our first L
A
T EX document
First add the amsmath package in your document’s preamble: \ usepackage {amsmath} Then add the following code to your document’s body: \ s e c t i o n { I n l i n e Math} % Here we use \( and \) to w r i t e math i n l i n e with normal t e x t . One of the t r i g o n o m e t r i c sum i d e n t i t i e s i s \( \ sin ( x ) + \ sin ( y ) = 2 \ sin (\ f r a c {x+y }{2}) \cos (\ f r a c {x−y }{2}) \) . \ s e c t i o n { Separate Math} % Here we use \[ and \] to w r i t e math s ep a ra t e from normal t e x t . \[ \ f o r a l l x \ in X, \quad \ e x i s t s y \ leq \ epsilon \] \ s u b s e c t i o n { Product Rule } % Here we use both techniques I f \( f \) and \( g \) are d i f f e r e n t i a b l e at \( x \) , then \[ \ f r a c {d}{dx }( f ( x ) g ( x ) ) = f ’ ( x ) g ( x ) + f ( x )g ’ ( x ) \]
A More Advanced Example
Start a new project and load basic-example.tex from the examples folder Look at the code. There are some things we’ve already covered, and some other things we haven’t.
Resources
Learning L
AT
EXtakes time. These resources will help: Templates! More Templates! Even More Templates! L
AT
EX Wikibook A quick introduction Mini Tutorial Question and Answer Community Google is your friend: How do I make an integral symbol in latex?
Links to L
AT
EXdocuments
All the example documents used in this presentation can be found
- n overleaf at the following links. Feel free to use them as