How does L A TEX work?

Similar documents
Handbook for Further LAT E X

Using Beamer for Presentations

Introduction Beamer Personalization Beamer by Examples Discussion. Beamer by Examples. Powerful Language for Typesetting and Presentation

An introduction to L A TEX for students

Introduction to Latex. A workshop by Dr. Ala Eshmawi

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

Introduction to L A TEX beamer

A Brief Introduction to LaTeX

L A TEX for psychological researchers

Absolute L A TEX Beginner

Beamer By Example. Subtitle: Frankfurt Theme. Willie Dewit 1 Jessie May 2 David Griffiths 3. Conference on Tasteful Presentations, 2009

LaTeX A Tutorial. Mohsen Alimomeni, 2010

Beamer By Example. Willie Dewit 1 Jessie May 2 David Griffiths 3. Conference on Tasteful Presentations, Subtitle: Frankfurt Theme

The basics of LaTeX. Cédric Buron. April 25, 2016

Beamer. Sandeep Kumar. July 23, Shaheed Bhagat Singh College (University of Delhi) Sandeep Kumar Beamer July 23, / 20

Helen Cameron. A Brief Overview of LATEX

Introduzione a LaTex. Fabrizio Messina

An Introduction to L A TEX

Dec. 27 th, 2010 University of Isfahan

LaTeX. Information Literacy II EN(IL2) Course

CS 189 L A TEX and Linux: Document Layout and Organization

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

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

Guide to using L A TEX

Formatting with LaTeX

An Introduction to L A T E X

1. Welcome. (1) Hello. My name is Dr. Christopher Raridan (Dr. R). (3) In this tutorial I will introduce you to the amsart documentclass.

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

Learning L A TEX. Patrick Lam

Introduction to L A TEX

The wkbeamer theme. Wouter Kager. November 1, /11

My Full-Length Title

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

Latex Tutorial. CIS400 Senior Design 9/5/2013

LYX with Beamer and Sweave

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

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

Basic L A TEX. what is LaTeX?

A Beginner s guide to L A TEX for CSCA67/MATA67. Kohilan Mohanarajan

Introduction to LATEX

Introduction to Beamer

Lab1: Communicating science

Introduction to LaTeX. Paul Fodor Stony Brook University

VERY VERY SHORT GUIDE TO LATEX

Introduction to L A TEX

Epyt Theme for Beamer

Getting started with Latex

Lecture 1: Short summary of LaTeX basics

Lecture 1. MA2730: Analysis I. Lecture slides for MA2730 Analysis I. Study and Assessment Components. MA L A TEX: topics for Lecture 1

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

An Introduction to L A T E X

The AES Convention Paper LATEX class Adam H. Lewenberg (October 18, 2008) 1

1 Obtaining LyX and L A TEX

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

Literate programming with R and L A TEX

L A TEX From The Ground Up

Helen Cameron. A Brief Overview of LATEX

Getting started with PowerPoint 2010

Introduction to L A TEX

L A TEX Class Holiday Inn Fisherman s Wharf San Francisco, CA July Cheryl Ponchin Sue DeMerritt

Introduction to L A TEX

The Quickstart Guide to Preparing Your USM Thesis with L A T E X

The talk Document Class

L A TEX for Philosophers

Introduction to L A TEX

A Demonstration of the L A TEX 2ε Class File for the Oxford University Press Ltd Journal. First Author 1 and Second Author 2.

Mikkel Madsen

Latex Manually Set Font Size For Tables

COMP496/901: Academic Presentation and Writing Skills Using LaTeX

An Interactive Introduction to L A TEX. Part 2: Structured Documents & More. Dr John D. Lees-Miller. writel A TEX.

Introduction to LATEX

The wiki2beamer example. October 19, 2012

Introduction to Scientific Typesetting Lesson 5: The Structure of a Document

COMS 6100 Class note

An Introduction to LATEX

The Name of the Game. An Introduction to LATEX. Why L A TEX? The Name of the Game

Introduction to L A T E X

This is the LYX Beamer Template

Researcher Development Unit: Introduction to Latex

Using L A TEX Tom Edgar

Abstract A quick intro by examples to the document preparation language L A TEX.

Mikkel Madsen

T E X and L A T E X Document preparation tools

Math 235: Introduction to LaTeX

A brief introduction to L A TEX

LATEX TYPESETTING SYSTEM. CAAM 519, CHAPTER 3

Math 395 Homework #1 Due Wednesday, April 12

The memoir class. 1 Introduction. Peter Wilson

Introduction to LAT E X

L A TEX- Advanced Topics

NCSU Linguistics Eric Wilbanks & Jeff Mielke. November 21, An open-source typesetting language used for document mark-up

INSTALLING AND USING L A TEX

An Introduction to. Rado Ivanov CIS400 Senior Design Tutorial September 18, 2014

L A T E X Workshop. Bijulal D & Anu Thomas Industrial Engineering and Operations Research Indian Institute of Technology

The Joys of L A T E X

An introduction to LaTeX

The BeamerSubFrame Package Reordering frames in the PDF file without reordering the source

Workshop on LATEX 2ε. Asst. Prof. Dr. Kemal Bagzibagli Department of Economics. 20 May 2015

GNU Emacs as a Front End to L A TEX

Introduction to L A TEX

Transcription:

Course outline and structure 1 Revision L A TEX Level 4 Further document preparation Susan Hutchinson Department of Statistics, University of Oxford. June 2011 2 Planning and managing longer documents Exercise: creating, compiling and viewing simple documents Exercise: managing longer documents 3 Customising L A TEX: creating and changing commands 4 using the Beamer class Exercise: creating and customising commands Exercise: make your own slide show 5 Exploring packages 6 Going further: finding answers, asking good questions Exercises: exploring packages 7 Conclusion Susan Hutchinson (Oxford) Further LATEX June 2011 1 / 41 Susan Hutchinson (Oxford) Further LATEX June 2011 2 / 41 Our L A TEX environment Revision We will use MiKTEX and TEXnicCenter in Windows. If you prefer to use the Command Prompt and Wordpad or Notepad then do so. Susan Hutchinson (Oxford) Further LATEX June 2011 3 / 41 How does L A TEX work? Revision In order to use L A TEX two components are needed. 1 A L A TEX engine or distribution In Windows the most commonly used distribution is MiKTEX. It provides all the infrastructure for creating documents such as fonts, style files, compilation and previewing commands and much else. Another popular distribution is TEXLive which is widely used in Linux; Mac users generally use MacTEX. 2 An editor or IDE (Integrated Development Environment) This is used to edit, compile and preview L A TEX documents. There are many editors and IDEs available. Emacs is a popular editor which is available for both Windows and Linux; Lyx is available for both too and Texworks runs on Windows, Linux and Macs. Several other platform-dependent editors are available such as Kile in Linux, TeXNicCenter, WinEDT and Winshell in Windows and Aquamacs for Macs. In Linux a simple text editor such as gedit can be a good option. Susan Hutchinson (Oxford) Further LATEX June 2011 4 / 41

Revision Revision Developing L A TEX documents A simple L A TEX file When using TEXnicCenter remember that L A TEX works on an edit compile view cycle. You must save your file after making changes You must recompile [ Build and view current file ] after any change. Use the build profile [ LaTeX => PDF ] to compile. After a successful compilation Adobe Reader will display the contents of the file. Image files plots, graphs, pictures can cause confusion. Documents with images in PostScript format (.eps or.ps) are compiled using [ LaTeX => DVI ]. Documents with images in PDF, PNG, or JPG format are compiled with [ LaTeX => PDF ]. This is what we ll be using today. \documentclass[a4paper,12pt]{report} \begin{document} \chapter{introduction} Hello there. This is the first paragraph. Goodbye now. That s it. \end{document} Susan Hutchinson (Oxford) Further LATEX June 2011 5 / 41 Susan Hutchinson (Oxford) Further LATEX June 2011 6 / 41 Revision A simple L A TEX file explained Planning and managing longer documents Planning a longer document The text of the document is surrounded by commands. \documentclass[a4paper,12pt{report}... This bit is called the preamble... \begin{document}... This bit is called the body... \end{document} When writing a longer document such as a thesis there are many advantages to breaking your document into separate files. Imposes a structure on the document as a whole. Allows you to focus on each part separately. Conditional compilation can speed up the compile edit preview cycle. It is also possible to create a standard preamble which can be used whenever you start a new L A TEX document. Susan Hutchinson (Oxford) Further LATEX June 2011 7 / 41 Susan Hutchinson (Oxford) Further LATEX June 2011 8 / 41

Planning and managing longer documents Structuring a longer document Planning and managing longer documents How to break up a long document When dividing up a longer document into separate files you need to do the following. Create a root file which is the file you use when compiling. This file contains markup which points to the files you want to include. When including files the.tex suffix is not needed. When using TEXnicCenter you will have many files open. Make sure you always compile your root file. Compiling any others will fail with many errors. \documentclass[a4paper,12pt]{report} \begin{document} \title{my long document} \author{my Name} \date \maketitle \include{intro} \include{theory} \include{research} \include{results} \include{conclusion} \end{document} In this case the document is organised into five separate files called intro.tex, theory.tex and so on, each of which will contain the text of a single chapter. Susan Hutchinson (Oxford) Further LATEX June 2011 9 / 41 Susan Hutchinson (Oxford) Further LATEX June 2011 10 / 41 Planning and managing longer documents Conditional compilation Planning and managing longer documents Revision: labels and cross-references There are many reasons why you may want to compile only one or two chapters. It is particularly useful if one chapter contains a lot of images and is slow to compile. Make sure that one compilation is done with all the chapters. Add the line \includeonly{intro,theory} in the preamble and recompile. Only the first two chapters will appear, but cross-referencing will be preserved, even to the chapters that have been left out. Alternatively the \excludeonly command can be used to exclude one or more files. L A TEX makes it easy to create cross-references to other parts of your document. You can create references to equations, figures, chapters, sections, pages, tables and so on. To create a reference to a chapter and page use the following: Add the following markup \label{ch:intro} at the beginning of the chapter. Labels are case-sensitive so INTRO is different from intro. Then when you want to make reference to the chapter add In Chapter \ref{ch:intro} on \pageref{ch:intro} when to reference the chapter and the page number. Remember that you may need to compile your L A TEX file twice (at least) to get references right. Susan Hutchinson (Oxford) Further LATEX June 2011 11 / 41 Susan Hutchinson (Oxford) Further LATEX June 2011 12 / 41

Exercises Planning and managing longer documents Exercise: managing longer documents Customising LATEX: creating and changing commands Customising L A TEX Now do the following exercises. Creating, compiling and viewing a simple document using TEXnicCenter Managing longer documents It is possible to define new commands and redefine existing ones. You may want to do this for several reasons. To save typing. If you keep typing the same markup it makes sense to define a command in the preamble and use the shortened version in the document. To keep a consistent style. It is possible to create new commands that are shortcuts to existing commands. \newcommand{\bi}{\begin{itemize}} \newcommand{\ei}{\end{itemize}} Susan Hutchinson (Oxford) Further LATEX June 2011 13 / 41 Susan Hutchinson (Oxford) Further LATEX June 2011 14 / 41 Customising LATEX: creating and changing commands Creating your own commands For example instead of writing {\textrm {\slshape{department of Statistics}}} every time I want to write Department of Statistics I can define a new command in the preamble using \newcommand{\dos}{\textrm {\slshape Department of Statistics}} and use \DOS instead. It is easy to change your mind later the change would only need to be made in once in the preamble. In slides the default font is sans serif so in order to make my new command clearer I am using a Roman font. In documents it is the other way round so use \textsf instead. Customising LATEX: creating and changing commands Defining a new command with an argument The syntax of the command to define a new command is \newcommand{cmd}[n-args][default]{text} where cmd is the name you decide to use for the new command. n-args [optional] is the number of arguments your new command will have. default [optional] what to use as a default argument. text what L A TEX should do with when this command is used. To define a command called keyword which typesets a word or phrase in bold using a typewriter font and coloured blue add to the preamble \newcommand{\keyword}[1]{\texttt{\slshape\color{blue}#1}} So to typeset the word section as a keyword use \keyword{section} which would appear as section. Susan Hutchinson (Oxford) Further LATEX June 2011 15 / 41 Susan Hutchinson (Oxford) Further LATEX June 2011 16 / 41

Customising LATEX: creating and changing commands Customising an existing command Customising LATEX: creating and changing commands Advice on customising commands Using \renewcommand the behaviour of existing commands can be changed. For example to change the page with your table of contents to say Table of Contents rather than Contents you would use \renewcommand*{\contentsname}{table of Contents} There are many predefined names which can be changed. \contentsname \listfigurename \listtablename \figurename \chaptername Note that some names will only apply to some documentclasses. For example there is no Chapter command when using the article class. The use of an asterisk (star) in a \renewcommand indicates that the command is short and unlikely to include a paragraph break. Customisation needs to be done with care. L A TEX imposes good typesetting rules on your document so you need to make sure your changes are necessary. L A TEX does not allow you to create new commands with the same name as existing commands. Check that there isn t a package which will achieve the effect you are looking for, before trying to make extensive customisations to an existing command. If you do end up creating many customisations your preamble may become rather long; it is relatively simple to bundle them all up into your own package which can then be invoked with \usepackage{mypackage}. Susan Hutchinson (Oxford) Further LATEX June 2011 17 / 41 Susan Hutchinson (Oxford) Further LATEX June 2011 18 / 41 Why use a L A TEX slide-making environment? hows... when there s Microsoft Powerpoint? It is straightforward to include mathematics. It is possible to link to bibliographies. Customisation is possible, so that the environment can be tailored to suit your needs. So the same considerations apply. If you have chosen to use L A TEX to write your thesis then you will probably need to be able to create presentations in L A TEX too. There are several slide-making document classes. Originally there were several classes that were suited to creating transparencies and foils. SliTeX A separate program, written by Leslie Lamport for creating transparencies. slides Early L A TEX slide-making document class. It is not widely used now as it lacks many more complex features. It was good for creating transparencies; less so for online presentations. seminar and foils Originally developed to produce acetate foils, but can produce output suitable for an overhead projector. Not much used. Powerpoint changed everything. The expectation was that a presentation, as well as containing useful information would also be colourful, include dynamic effects such as animations and pausing between bullet points. Susan Hutchinson (Oxford) Further LATEX June 2011 19 / 41 Susan Hutchinson (Oxford) Further LATEX June 2011 20 / 41

Current slide-making classes What Beamer provides Several new slide-making environments were produced in response. prosper Based on seminar and includes the ability to produce dynamic effects. Now superceded largely by powerdot. beamer Relatively powerful and easy to learn; creating dynamic effects is relatively straightforward. talk Again, easy to learn. It doesn t impose a particular slide-style on you. We will be using Beamer today. Early distributions of L A TEX did not always include Beamer; but if you are using an up-to-date version then it should be available. Beamer will produce output in PDF format which makes it very portable. PDF format presentations will just work on most systems. Beamer extensions There are several additional environments and commands that are specific to Beamer. New environments include block, column and animate. There are also several mathematical environments such as theorem, proof and definitions. Transitions, pauses and overlays are easily managed. That was a pause. beamercolorbox allows you to change both the background and foreground colour of a part of a slide. Susan Hutchinson (Oxford) Further LATEX June 2011 21 / 41 Susan Hutchinson (Oxford) Further LATEX June 2011 22 / 41 A simple beamer file The components of a slide \documentclass[pdf]{beamer} \usetheme{warsaw} \begin{document} \title{my first slideshow} \subtitle{i hope you like it} \author{susan Hutchinson} \institute{university of Oxford} \date\maketitle \tableofcontents \section{introduction} \frame{my first slide} \end{document} 1 a headline and a footline 2 a left and right sidebar 3 navigation bars 4 navigation symbols 5 a logo 6 a frametitle 7 a background 8 some frame contents Not all slides have all these components. The first three are usually set up by the theme you choose. The contents are your problem! Susan Hutchinson (Oxford) Further LATEX June 2011 23 / 41 Susan Hutchinson (Oxford) Further LATEX June 2011 24 / 41

Beamer themes and colours The appearance of your slides depends on the theme you have chosen. There is a smaller range than with powerpoint but there is much scope for customisation. To change the theme and colour use \usetheme{paloalto} \usecolortheme{albatross} Some popular themes are AnnArbor Berkeley Berlin Boadilla CambridgeUS Copenhagen Darmstadt Frankfurt Hanover Luebeck Malmoe PaloAlto Pittsburgh Rochester Singapore Warsaw Some popular colours are albatross beaver beetle crane dolphin dove fly orchid rose seagull seahorse wolverine I am using the Luebeck theme and rose. The layout of a slide Each slide has the format \begin{frame} \frametitle{} The contents of the slide go here. \end{frame} The contents of the slide can include L A TEX commands, pictures, tables and so on. Beamer restrictions The depths of itemize,enumerate and description environments are limited. Pictures and figures need careful handling. Using bibtex is rather fiddly. Susan Hutchinson (Oxford) Further LATEX June 2011 25 / 41 Susan Hutchinson (Oxford) Further LATEX June 2011 26 / 41 The title page Add the following to the preamble \title[short title]{my long title} \subtitle[short subtitle]{my long subtitle} \author{my Name} \date{november 2007} \institute{my University} and then include \begin{frame} \frametitle{outline} \maketitle \end{frame} after \begin{document}. A short version of the text has been included between [ and ] which will appear at the foot of each slide. Effects can be included such a pauses and overlays. For example to pause between items like this: use Mount Everest grows by 1cm a year A new planet is discovered every day. \begin{itemize} \item Mount Everest grows by 1cm a year \pause \item A new planet is discovered every day. \end{itemize} \pause Susan Hutchinson (Oxford) Further LATEX June 2011 27 / 41 Susan Hutchinson (Oxford) Further LATEX June 2011 28 / 41

Creating overlays The markup for overlays Overlays allow you to determine in what order items appear. For example Theorem There is no largest prime number. Proof. 1 Suppose p where the largest prime number. 2 Let q be the product of the first p numbers. 3 Then q + 1 is not divisible by any of them. 4 Thus q + 1 is also prime and greater than p. Proved using reduction ad absurdum. Susan Hutchinson (Oxford) Further LATEX June 2011 29 / 41 \begin{theorem} There is no largest prime number. \end{theorem} \begin{proof} \begin{enumerate} \item<1-> Suppose $p$ where the largest prime number. \item<2-> Let $q$ be the product of the first $p$ numbers. \item<3-> Then $q + 1$ is not divisible by any of them. \item<1-> Thus $q + 1$ is also prime and greater than $p$. \qedhere \end{enumerate} \end{proof} \uncover<4->{proved using \textit{reduction ad absurdum}.} Note the use of <1->, <2-> to determine the order in which information is revealed. Susan Hutchinson (Oxford) Further LATEX June 2011 30 / 41 Exercise: make your own slide show Adding some structure Exercises The \section and \subsection commands are used to add structure to the slides. These are used outside frames. They can contain a long and short version. The long version appears in the table of contents, the short version in the header line. \section[slide creation]{ using Beamer} Add a slide that contains \begin{frame} \frametitle{outline} \tableofcontents \end{frame} and a slide which includes all the section and subsections headings will be generated. Finally navigation symbols can be added which allow you to find your way around the presentation when it is being given. Now do the following exercises. Creating and customising commands Make your own slide show Susan Hutchinson (Oxford) Further LATEX June 2011 31 / 41 Susan Hutchinson (Oxford) Further LATEX June 2011 32 / 41

Exploring packages Exploring packages What are packages More about packages Packages are used to alter or add to basic L A TEX behaviour. For example to change the way paragraphs are separated add \usepackage{parskip} to the preamble. \documentclass{article} \usepackage{parskip} \begin{document} \section{introduction} Hello there. This is the first paragraph. Finding and configuring packages to do what you want is a key skill for L A TEX users. Packages extend existing functions. Packages add extra functions. There are hundreds of packages, many of which will be installed with your L A TEX distribution. Goodbye now. That s it. \end{document} Susan Hutchinson (Oxford) Further LATEX June 2011 33 / 41 Susan Hutchinson (Oxford) Further LATEX June 2011 34 / 41 Exploring packages Some commonly-used packages Exploring packages Some more commonly used packages amsmath,amssymb Additional mathematical characters fancyhdr Extends headers and footers on the page graphicx More configuratable picture environment longtable Allows tables to extend over more than one page lscape Change the orientation of a page natbib Add a bibliography tocloft Changes Table of Contents format babel Allows you to choose the language of key words. color, xcolor Change the colour of text and other features. fancyvrb Enhances the verbatim environment. Useful if you need to make text appear exactly as it is typed. glossaries Create a glossary of key words. hyperref Make your references, tables of contents, lists of figures and tables links. Susan Hutchinson (Oxford) Further LATEX June 2011 35 / 41 Susan Hutchinson (Oxford) Further LATEX June 2011 36 / 41

Learning a new package Exploring packages Going further: finding answers, asking good questions Solving your own problems Once you have found the package you want, you will need to understand how it works. Read the documentation. Most packages have a guide which can be read with the texdoc command if you are using a Unix/Linux system. Use Google. Create a small working example to help you become familiar with the features. These slides and exercises are designed to get you started. At some point you will hit a problem (I do all the time) which you can t solve immediately. Move \end{document} further up the file. This may isolate the problem. If the error reports a line number make sure you look for errors before that. Use Google to search for the error. Or look at a guide. Create a minimal example. This helps you narrow the problem down. Either subscribe to comp.text.tex via a news reader like Thunderbird or use Google groups. Susan Hutchinson (Oxford) Further LATEX June 2011 37 / 41 Susan Hutchinson (Oxford) Further LATEX June 2011 38 / 41 Going further: finding answers, asking good questions Exercises: exploring packages Conclusion Exercises Useful links Now do the following exercise. Exploring packages. If you have problems check that you have used the suggestions in the previous slide. http://www.ctan.org Download L A TEX and other resources. http://www.tug.org TEX Users group. http://theoval.cmp.uea.ac.uk/~nlct/latex/index.html Lots of useful advice and teaching material. detexify.kirelabs.org/classify.html Find the markup for mathematical symbols. Susan Hutchinson (Oxford) Further LATEX June 2011 39 / 41 Susan Hutchinson (Oxford) Further LATEX June 2011 40 / 41

Conclusion The last slide Good luck! I hope you will all now write beautiful documents. Susan Hutchinson (Oxford) Further LATEX June 2011 41 / 41