lecture latex short

Upload: ehsan

Post on 08-Mar-2016

221 views

Category:

Documents


0 download

DESCRIPTION

latex

TRANSCRIPT

  • Latex - a Typesetting SystemTypesetting

    VERY VERY SHORT GUIDE TO LATEX

    Dr P. V. Johnson

    School of Mathematics

    2012

    Dr P. V. Johnson Latex

  • Latex - a Typesetting SystemTypesetting

    Advantages...Disadvantages...The Basics

    THE BASIC IDEA

    A word processor allows the user to design the documenton screen whilst the text they type appears inside itIn LATEX, when writing, you will not see the final document...LATEXwill design the document for you.You can help with the design by using LATEX commands.You will see this idea everywhere:

    Computer codinghtmlxmlpostscriptsvg

    Dr P. V. Johnson Latex

  • Latex - a Typesetting SystemTypesetting

    Advantages...Disadvantages...The Basics

    THE BASIC IDEA

    in an ACSII fileWrite your document

    COMPILE

    Compile the fileusing LaTeX

    for printing or viewingDocument ready

    If not satisfactorychange settings

    file.tex latex file.tex file.dvi

    Dr P. V. Johnson Latex

  • Latex - a Typesetting SystemTypesetting

    Advantages...Disadvantages...The Basics

    THE GOOD POINTS

    Professionally crafted layouts are available, which make adocument really look as if printed.The typesetting of mathematical formulae is supported in aconvenient way.Users only need to learn a few easy-to-understandcommands that specify the logical structure of a document.They almost never need to tinker with the actual layout ofthe document.Even complex structures such as footnotes, references,table of contents, and bibliographies can be generatedeasily.

    Dr P. V. Johnson Latex

  • Latex - a Typesetting SystemTypesetting

    Advantages...Disadvantages...The Basics

    THE GOOD POINTS

    Free add-on packages exist for many typographical tasksnot directly supported by basic LATEX. For example,packages are available to include Postscript graphics or totypeset bibliographies conforming to exact standards.LATEXencourages authors to write well-structured texts,because this is how LATEXworks - by specifying structure.TEX, the formatting engine of LATEX 2, is highly portableand free. Therefore the system runs on almost anyhardware platform available.

    Dr P. V. Johnson Latex

  • Latex - a Typesetting SystemTypesetting

    Advantages...Disadvantages...The Basics

    THE BAD POINTS

    LATEXdoes not work well for people who have sold theirsouls. . .Although some parameters can be adjusted within apredefined document layout, the design of a whole newlayout is difficult and takes a lot of timeIt is very hard to write unstructured and disorganizeddocuments.Your hamster might, despite some encouraging first steps,never be able to fully grasp the concept of Logical Markup.

    Dr P. V. Johnson Latex

  • Latex - a Typesetting SystemTypesetting

    Advantages...Disadvantages...The Basics

    GETTING STARTED

    The easiest way to create latex documents is to use an IDEThere are many of these programs available for allplatformsFollow the guide for

    WinEdt on windowsKile on linux

    depending on which platform you prefer.

    Dr P. V. Johnson Latex

  • Latex - a Typesetting SystemTypesetting

    Advantages...Disadvantages...The Basics

    A SIMPLE LATEXDOCUMENT

    Every file must start with the command

    \documentclass{...}

    Like every good book it must have a start. . .

    \begin{document}

    and an end

    \end{document}

    Dr P. V. Johnson Latex

  • Latex - a Typesetting SystemTypesetting

    Advantages...Disadvantages...The Basics

    HELLO WORLD!

    So the Hello World! tex file looks like

    \documentclass{article}\begin{document}Hello World!!\end{document}

    On unix machines, if this file is called helloworld.texwe can compile it with the command

    latex helloworld.tex

    Dr P. V. Johnson Latex

  • Latex - a Typesetting SystemTypesetting

    TextMaths

    SPACES, LINE BREAKS AND PARAGRAPHS

    Several consecutive white spaces, and single carriagereturns are treated as a single spaceWe must use a special command to make a newline \\An empty line starts a new paragraph

    A line break \\Another line break \\A large spacecounts as a singlewhilst an empty line.

    Makes a new paragraph.

    A line breakAnother line breakA large space counts asa single whilst an emptyline.

    Makes a newparagraph.

    Dr P. V. Johnson Latex

  • Latex - a Typesetting SystemTypesetting

    TextMaths

    TITLES, CHAPTERS AND SECTIONS

    A good document will be divided into appropriate sectionsIn LATEXwe use the following commands\section{}\subsection{}\paragraph{}\subparagraph{}

    LATEXwill also create a table of contents with the followingcommand: \tableofcontents

    Dr P. V. Johnson Latex

  • Latex - a Typesetting SystemTypesetting

    TextMaths

    TITLES, CHAPTERS AND SECTIONS

    A good document will be divided into appropriate sectionsIn LATEXwe use the following commands\section{}\subsection{}\paragraph{}\subparagraph{}

    LATEXwill also create a table of contents with the followingcommand: \tableofcontents

    Dr P. V. Johnson Latex

  • Latex - a Typesetting SystemTypesetting

    TextMaths

    CROSS-REFERENCING

    One of the most powerful tools of LATEXis the crossreferencingWrite the label commmand after the equation, section,figure or table we want to referenceCommands are:\label{key}, \ref{key}, \pageref{key}

    Use descriptive names for the key, for example\begin{equation}a^2 + b^2 = c^2\label{eqn:pythags-rule}

    \end{equation}

    Dr P. V. Johnson Latex

  • Latex - a Typesetting SystemTypesetting

    TextMaths

    CROSS-REFERENCING

    One of the most powerful tools of LATEXis the crossreferencingWrite the label commmand after the equation, section,figure or table we want to referenceCommands are:\label{key}, \ref{key}, \pageref{key}

    Use descriptive names for the key, for example\begin{equation}a^2 + b^2 = c^2\label{eqn:pythags-rule}

    \end{equation}

    Dr P. V. Johnson Latex

  • Latex - a Typesetting SystemTypesetting

    TextMaths

    EQUATIONS

    Use the amsmath is the standard package to typesetmaths in LATEXPut the following at the top of your document:\usepackage{amsmath}

    We can put mathematical expression within text:

    Paul was runningat $5ms^{-1}$. Paul was running at 5ms1.

    Or in its own paragraph

    Pauls running speedwas $$v=5ms^{-1}$$.

    Pauls running speed was

    v = 5ms1.

    Dr P. V. Johnson Latex

  • Latex - a Typesetting SystemTypesetting

    TextMaths

    BUILDING BLOCKS OF MATHS

    Inside the math environment we can easily build complexequations using the commands \frac, \sum, \int, etc.and superscript and subscript commands ^ and _. Forexample

    $$\frac{\sum_i i^2}{N}$$

    i i

    2

    Nor

    $$ \int_0^\inftye^{x^2} dx $$

    0

    ex2dx

    Dr P. V. Johnson Latex

  • Latex - a Typesetting SystemTypesetting

    TextMaths

    SUMMARY

    This should be just enough to get you startedRead through the not so short guideTry the examples and check against the solutionsTry to follow the tutorial on writing a School of Mathsthesisand using bibtex for referencing

    Dr P. V. Johnson Latex

    Latex - a Typesetting SystemAdvantages...Disadvantages...The Basics

    TypesettingTextMaths