Introduction to LATEX

5 downloads 153994 Views 89KB Size Report
With LATEX file in window, press green arrow at top left. ▷ For a new file, we are ... Double dollars display the mathematics: $$ \sqrt{3} $$ →. √. 3 ... Greek letters: \alpha, \beta, \gamma → α,β,γ, etc. ... Fractions, square roots: \frac{a}{b} → a b.
Introduction to LATEX A simple LATEX file \documentclass{article} \begin{document} Here is what we say what we want to say. \end{document}

Notes I

Backslash for LATEX commands.

I

File must start with \documentclass command – tells LATEX how to format document.

I I

Braces (curly brackets) – used frequently in LATEX Environments – \begin{} . . . \end{}.

I

File must contain a document environment.

TEXWorks

Log in to the University Desktop Service. Start TEXWorks by going to All Programs → HW Programs → MikTeX 2.9 → TeXWorks File → Open to open an existing LATEX file, or File → New to start a new file. In practice, it is usually easiest to create new LATEX files by copying and editing existing files. Typeset → pdfLaTeX to select output type.

TEXWorks

I

With LATEX file in window, press green arrow at top left. For a new file, we are prompted for a filename to save.

I

Then we get PDF output in a separate window.

I

Experiment: edit text and hit green button again.

I

I LATEX

errors produce red cross in place of green arrow, and error message in console - edit file to correct.

I

Repeat.

Experiment by downloading some of the sample LATEX files from the VISION page and amending them.

Mathematics

The dollar sign $ is used by LATEX to toggle between ordinary text mode and math mode: √ $ \sqrt{3} $ → 3 Double dollars display the mathematics: $$ \sqrt{3} $$ → √ 3

Recommendation: always include \usepackage{amssymb} between the \documentclass and \begin{document} commands for more mathematical symbols.

Some useful Mathematics commands I

Greek letters: \alpha, \beta, \gamma → α, β, γ, etc.

I

Arrows: \rightarrow, \leftarrow, \leftrightarrow, \Rightarrow → →, ←, ↔, ⇒ √ Fractions, square roots: \frac{a}{b} → ba , \sqrt{a} → a

I I

Subscripts and superscripts: aˆb → ab , aˆ{long} → along ; a b → ab , a {long} → along

I

Blackboard bold letters \mathbb{R}, \mathbb{C} for R, C etc.

I

I

Set theory: \{. . . \} for {. . . } ; \cup, \cap for ∪, ∩; \in, \notin for ∈, ∈, / \subset, \subseteq for ⊂, ⊆ \equiv, \sim, \cong for ≡, ∼, ∼ =

I

\le, \ge, \ll, \gg, \pm, \mp for ≤, ≥, , , ±, ∓

Example The input A quadratic equation of the form $ axˆ2+bx+c=0 $ can be solved by the quadratic formula $$ x=\frac{ -b \pm \sqrt{ bˆ2 - 4ac} }{2a} $$ Gives the output A quadratic equation of the form ax 2 + bx + c = 0 can be solved by the quadratic formula √ −b ± b 2 − 4ac x= 2a