an introduction to l a t ex
play

An introduction to L A T EX Emma McCoy Course Notes: Emma - PowerPoint PPT Presentation

Introduction A first L A T EX document Maths mode Tables and Figures Writing complex documents An introduction to L A T EX Emma McCoy Course Notes: Emma McCoy/Phillip Kent November 1, 2017 Emma McCoy An introduction to L A T EX


  1. Introduction A first L A T EX document Maths mode Tables and Figures Writing complex documents An introduction to L A T EX Emma McCoy Course Notes: Emma McCoy/Phillip Kent November 1, 2017 Emma McCoy An introduction to L A T EX

  2. Introduction A first L A T EX document Maths mode Tables and Figures Writing complex documents Resources This course is for L A T EX “2 ε ” (current standard). The previous version “2.09” works slightly differently - beware! Course website : http://www.ma.ic.ac.uk/~ejm/LaTeX/Website/ References : L A T EX User Guide & Reference Manual by Leslie Lamport (Second edition, Addison-Wesley, 1994). EX by Kopka & Daly (Third edition, A Guide to L A T Addison-Wesley, 1999) (details more advanced features). Emma McCoy An introduction to L A T EX

  3. Introduction A first L A T EX document Maths mode Tables and Figures Writing complex documents Course contents 1 Introduction 2 A first L A T EX document 3 Maths mode 4 Complex documents 5 Figures, tables, etc... Emma McCoy An introduction to L A T EX

  4. Introduction A first L A T EX document Maths mode Tables and Figures Writing complex documents Pros Great for typing mathematics Great for complex documents – cross-referencing, labelling, bibliographies... L A T EX output is beautiful – virtually of professional-typeset quality The basic L A T EX system is FREE. L A T EX makes typing “easy”: formatting is automatic emphasis on content over formatting L A T EX is written as plain text compact, portable transferable across the internet/email accepted by all major academic publishers speeds up the publishing process reduces the chance of printing errors Emma McCoy An introduction to L A T EX

  5. Introduction A first L A T EX document Maths mode Tables and Figures Writing complex documents Cons When is it not appropriate? Many L A T EX users make their CVs, presentations and even address their letters in L A T EX but it’s not great for: documents with little text and lots of pictures. incorporating spreadsheets etc. into text. Emma McCoy An introduction to L A T EX

  6. Introduction A first L A T EX document Maths mode Tables and Figures Writing complex documents Where? Free versions of L A T EX exist across all platforms – Microsoft Windows, Linux, Unix and Apple Macintosh. Commercial (non-free) versions offer some extra features, e.g. WYSIWYG package Scientific Word or BaKoMa TeX Word . Power users should use Emacs. We will use MiKT EX: http://miktex.org/ Emma McCoy An introduction to L A T EX

  7. Introduction A first L A T EX document Maths mode Tables and Figures Writing complex documents About T EX L A T EX is a super-set (macro package) of the typesetting language T EX created by Donald Knuth Plain T EX needs programming skills – deliberate policy L A T EX (originally created by Leslie Lamport) adds functionality Originally other T EX macro packages – e.g. AMS T EX and AMS L A T EX – now, incorporated into L A T EX L A T EX and T EX are not two different languages Most T EX commands work in L A T EX Sometimes a conflict where L A T EX has re-defined a T EX command The T EXbook by Donald Knuth – standard reference for T EX Emma McCoy An introduction to L A T EX

  8. Introduction A first L A T EX document Maths mode Tables and Figures Writing complex documents Writing L A T EX Writing L A T EX is like writing computer programs in, say, Fortran or C – and there will be similar frustrations L A T EX s ource file: contains plain (ASCII) text and formatting commands Commands are preceded by a “ \ ”. Nine reserved characters: \ % $ ^ _ & # ~ { } If you want a “%”, type: \% Source file must end in “ .tex ” Emma McCoy An introduction to L A T EX

  9. Introduction A first L A T EX document Maths mode Tables and Figures Writing complex documents The steps of writing in L A T EX TeX|(TeX) COMPILE ❩❩❩❩ ❃ ✚ ✚✚✚✚ ⑦ ❩ EDIT PRINT View+Print ❩ ⑥ ❃ ✚ ❩ ✚✚✚✚ ❩ ❄ ❩ ❩ PREVIEW View|(View) Emma McCoy An introduction to L A T EX

  10. Introduction A first L A T EX document Commands that affect the whole document Maths mode Writing in L A T EX Tables and Figures Writing complex documents A skeleton source file % the essential components of a LaTeX file % (N.B. % is the comment character, everything to % the right of it on a line is IGNORED.) \documentclass{article} % **** PREAMBLE **** % title/author/date information % definitions, short-hands, macros etc. BUT NO text \begin{document} % **** BODY OF DOCUMENT **** % ...the text itself % N.B. the RESERVED CHARACTERS: % \ % $ ^ _ & # ~ { } \end{document} Emma McCoy An introduction to L A T EX

  11. Introduction A first L A T EX document Commands that affect the whole document Maths mode Writing in L A T EX Tables and Figures Writing complex documents Document class \documentclass[options]{style} style: book report article letter options: 11pt 12pt a4paper Emma McCoy An introduction to L A T EX

  12. Introduction A first L A T EX document Commands that affect the whole document Maths mode Writing in L A T EX Tables and Figures Writing complex documents Sectioning Commands \chapter \section \subsection \subsubsection Example: \chapter{title} Emma McCoy An introduction to L A T EX

  13. Introduction A first L A T EX document Commands that affect the whole document Maths mode Writing in L A T EX Tables and Figures Writing complex documents Margin sizes If you are not happy with margin sizes they can be adjusted: \setlength{\textwidth}{5.7cm} \setlength{\oddsidemargin}{0.6in} \setlength{\topmargin}{-0.5in} \setlength{\textheight}{246mm} alternatively use: \addtolength{\topmargin}{-5mm} Emma McCoy An introduction to L A T EX

  14. Introduction A first L A T EX document Commands that affect the whole document Maths mode Writing in L A T EX Tables and Figures Writing complex documents Font size \small \normalsize \large \Large \LARGE \huge \Huge Example: {\Large this will be large} Emma McCoy An introduction to L A T EX

  15. Introduction A first L A T EX document Commands that affect the whole document Maths mode Writing in L A T EX Tables and Figures Writing complex documents Font style Bold: \bf Example: {\bf this will be bold} Italics: \it There are usually several command to achieve the same result: {\em italic} \textit{italic} \emph{italic} {\it italic} will all produce: italic Emma McCoy An introduction to L A T EX

  16. Introduction A first L A T EX document Commands that affect the whole document Maths mode Writing in L A T EX Tables and Figures Writing complex documents Numbered list For a numbered list: \begin{enumerate} \item This is the first item \item here’s the second \begin{enumerate} \item this will be part 1 of number 2 \item this is part 2 \end{enumerate} \end{enumerate} Output of above commands: This is the first item 1 here’s the second 2 this will be part 1 of number 2 1 this is part 2 2 Replace enumerate with itemise for bullet points Emma McCoy An introduction to L A T EX

  17. Introduction A first L A T EX document Commands that affect the whole document Maths mode Writing in L A T EX Tables and Figures Writing complex documents Extra critical commands to go to a new page use: \newpage to go to a new line use: \newline or \\ to start a new paragraph: leave a blank line to prevent indenting use: \noindent For double spacing, in the preamble: \renewcommand{\baselinestretch}{1.6} Emma McCoy An introduction to L A T EX

  18. Introduction A first L A T EX document Commands that affect the whole document Maths mode Writing in L A T EX Tables and Figures Writing complex documents Other useful commands Quotation marks: use ‘‘a’’ to produce “a” Accents: use \’e, \"e , \^e to produce ´ e, ¨ e, ˆ e. Dashes: use -- , --- to produce – and — Emma McCoy An introduction to L A T EX

  19. Introduction A first L A T EX document Commands that affect the whole document Maths mode Writing in L A T EX Tables and Figures Writing complex documents Preliminary Exercise Open T EXworks Follow the instructions on the sheet Emma McCoy An introduction to L A T EX

  20. Introduction A first L A T EX document Commands that affect the whole document Maths mode Writing in L A T EX Tables and Figures Writing complex documents Exercise 1 http://www2.imperial.ac.uk/~ejm/ LaTeX/Website/exercises/exercise1.html Emma McCoy An introduction to L A T EX

  21. Introduction A first L A T EX document Basic typesetting of maths Maths mode New commands Tables and Figures Writing complex documents Math mode Maths is “expensive”: or $$ – displayed formula \[ \] $$ \( \) or $ $ – in-text formula E.g. I could put $x = y+2z+3w$ in the text or as a displayed equation: \[x = y+2z+3w\] gives: I could put x = y + 2 z + 3 w in the text or as a displayed equation: x = y + 2 z + 3 w Emma McCoy An introduction to L A T EX

Recommend


More recommend