Student Learning Service: Introduction to Latex

Similar documents
Researcher Development Unit: Introduction to Latex

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

Introduction to LATEX

An Introduction to LATEX

Learning L A TEX. Patrick Lam

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

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

Environments, Equations, and Tables

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

Latex Tutorial. CIS400 Senior Design 9/5/2013

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

LATEX Seminar Week 2 Jonathan Blair & Evan Ott. Document classes, basic math formatting, basic pictures, tables and matrices

Mikkel Madsen

Intro to LATEX I. Aaron Erlich POLS/CSSS 510, Why LATEX? Programming Document Structure Floats Tables Lists Math

An introduction to L A TEX for students

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

LaTeX A Tutorial. Mohsen Alimomeni, 2010

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

Intro to LaTeX Workshop

Guide to using L A TEX

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

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

Introduction to LaTeX. Paul Fodor Stony Brook University

Introduction to L A TEX

Introduction to Math in LaTeX

An Introduction to L A T E X

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

Introduction to Latex. A workshop by Dr. Ala Eshmawi

L A TEX examples. a b c a b c b b a c b c c b a. This table was typeset with the following commands.

An Introduction to LATEX

An Introduction to L A TEX

Outline. A Sneak Peek

Introduction to L A TEX

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

Word Template Instructions

Aalborg October 2014

Exercises in LaTeX IDA on AAU

Introduction to L A T E X

1 Obtaining LyX and L A TEX

A brief introduction to L A TEX

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

Introduction to LaTex 2ε. Based on The Not So Short Introduction to LaTeX 2ε by Tobias Oetiker et al., April 2001

Learn how to [learn] LATEX

PRISM Introduction to L A TEX

Become a L A TEX Guru

L A TEXcourse. Carmen Alonso Montes. 30th May-2nd June, 2016

Assessments for CS students:

Mikkel Madsen

Getting started General Tables Figures Math Wrap up. UCLA Department of Statistics Statistical Consulting Center. LaTeX Bootcamp

Introduction to L A TEX

Introduction to L A TEX

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

L A TEX and Basic Text Editing

Math 235: Introduction to LaTeX

عمادة البحث العلمي جامعة الملك سعود

L A TEX for Psychological Researchers

Learning LaTeX: The Basics

Dec. 27 th, 2010 University of Isfahan

Mingxi Liu Energy & Resources Group University of California, Berkeley CONTENTS

GENERAL INFORMATION INSTRUCTIONS FOR MANUSCRIPT SUBMISSION

L A TEX for Psychological Researchers

Getting Started with L A TEX

Workshop: A Simple Introduction to L A TEX

L A TEXday, morning session Discovering L A TEX

Word Processing for Dissertations

An introduction. C.D. Emmery & M.M. van Zaanen. October 22, Tilburg University

How to Prepare Your Paper in L A T E X for IOE Graduate Conference 2017

LATEX TYPESETTING SYSTEM. CAAM 519, CHAPTER 3

Math 291: Lecture 5. Dr. Fagerstrom. Minnesota State University Moorhead web.mnstate.edu/fagerstrom

LaTeX is essentially a markup language

Helen Cameron. A Brief Overview of LATEX

Tools Course: Part 2

Introduction to L A TEX

TUTORIAL 10: ARRAYS AND MATRICES. 1. Welcome. Hello. My name is Dr. Christopher Raridan (Dr. R). I want to welcome you to the L A TEX Tutorial Series.

An Introduction to. Andrew G. West, Jian Chang CIS400 Senior Design Tutorial September 15, 2009

How to get started in L A TEX

Creating Tables and Figures with L A T E X

Homework # You ll want to use some LaTeX editor to edit and compile your.tex files

L A TEX for psychological researchers

Introduction to L A TEX beamer

Formatting with LaTeX

Typesetting in wxmaxima

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

Introduction to typesetting with L A TEX

Getting started with Latex

An Introduction to L A TEX

Homework # (Latex Handout) by Laura Parkinson

How to L A TEX. George Wong, David Mykytyn. 6 October 2016

Alex Milbrand. September 8, Graduate Student Seminar. Introduction to L A TEX. Alex Milbrand. History. Software. Basic Set-Up and Construction

Writing a Thesis with L A TEX

Math 395 Homework #1 Due Wednesday, April 12

An Interactive Introduction to L A TEX

OER Publishing with LaTeX and GitHub

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

1 Different Document Classes

LYX with Beamer and Sweave

L A TEXInstallation and Introduction

Written & Oral Presentation: Computer Tools

MATLAB for the Sciences

L A TEX minicourse. dstowell, mag, sar, scannell,... September Typeset by FoilTEX

Transcription:

Student Learning Service: Introduction to Latex Dr Morgiane Richard, Oana Matei and Florin Nedelea m.richard@abdn.ac.uk Student Learning Service Updated June 2018 Richard, Matei, Nedelea (U.of Aberdeen) Introduction to Latex Updated June 2018 1 / 40

Outline 1 Introduction 2 Structure of a L A T E X Document 3 Floats: Inserting Figures and Tables 4 Writing Mathematics 5 Bibliography 6 A word on Bigger Documents 7 Softwares and Readings Richard, Matei, Nedelea (U.of Aberdeen) Introduction to Latex Updated June 2018 2 / 40

What is L A T E X? L A T E X is a package based on the T E X programming language It is used to write documents (including presentations) You write a.tex file, which you compile to produce the output (.pdf or.dvi file) We will use Texworks to write and compile our.tex files Other available pieces of software are TexMaker, LyX (higher level) Richard, Matei, Nedelea (U.of Aberdeen) Introduction to Latex Updated June 2018 3 / 40

Pros and Cons Steep learning curve, particularly for those who have no programming background You can not see immediately your output Editing the document is difficult for multi-author documents However: Access to formatting commands helps keeping the formatting consistent throughout the document Large documents can be managed more easily Mathematics writing is very neat.pdf output is cross-platform and prints consistently Talk to your supervisor before you embark on writing your dissertation in L A T E X! Richard, Matei, Nedelea (U.of Aberdeen) Introduction to Latex Updated June 2018 4 / 40

Preamble A L A T E X document consists in a preamble and a document environment. The preamble is a piece of coding which contains information of the overwhole organisation of the document, and libraries that need included. Within the document environment, you write your text! This is the bit: \begin{document}... \end{document} Richard, Matei, Nedelea (U.of Aberdeen) Introduction to Latex Updated June 2018 5 / 40

Using the Engineering Template We will be working from the School of Engineering template. The preamble is already written for you, all you need is fill in the blanks. Richard, Matei, Nedelea (U.of Aberdeen) Introduction to Latex Updated June 2018 6 / 40

Creating a L A T E X Document Download the zip folder Examples for PGTs from the L A T E X section in Toolkit abdn.ac.uk/toolkit ; unzip and save on your H-drive; Go the the folder Physical Sciences\Natural and Computing Sciences\Mathematical Sciences ; Open Texworks and File -> Open to open the file Dissertation.tex ; Remember: whenever you make changes to your.tex file, re-run the file by clicking the green arrow at the top-left in order to update the pdf file; Richard, Matei, Nedelea (U.of Aberdeen) Introduction to Latex Updated June 2018 7 / 40

Creating a L A T E X Documents It is best practise to locate you.tex file in a folder: L A T E X produces many intermediate files during compilation. These files contain various types of information, used for referencing in particular. Compilation errors will usually be explained in the bottom window. alongside the error line. To add the line number in the.tex file: Format - Line Numbers. To add colouring to the.tex file: Format - Syntax Coloring - LaTeX. Try producing your first pdf by compiling the Dissertation.tex file (i.e. press the green arrow). Richard, Matei, Nedelea (U.of Aberdeen) Introduction to Latex Updated June 2018 8 / 40

Text Formatting Some useful formatting commands: Italic: \textit{your text}; Bold: \textbf{your text}; changing the color : \textcolor{name of the colour} {your text}; (available colors in this template: red, green, blue, cyan, magenta, yellow, black, white) To force a new line: \\; To start a new paragraph: skip a line in the code; Richard, Matei, Nedelea (U.of Aberdeen) Introduction to Latex Updated June 2018 9 / 40

Text Formatting The itemize environment allows you to create a list (like this one): \begin{itemize} \item your first bullet point; \item your second bullet point; \end{itemize} The enumerate environment works in the same way and creates a numbered list. You can nest itemize and enumerate environments. Richard, Matei, Nedelea (U.of Aberdeen) Introduction to Latex Updated June 2018 10 / 40

Creating a Title The title is generated within the bit: \begin {titlepage }.. \end {titlepage } You can fill in the blank. The list of content, list of figures and list of tables are generated automatically. Richard, Matei, Nedelea (U.of Aberdeen) Introduction to Latex Updated June 2018 11 / 40

Sections In this template, the structure is: chapters, sections and subsections. chapters: \chapter{chapter s title} sections: \section{your section title} subsection: \subsection{your subsection title}. Richard, Matei, Nedelea (U.of Aberdeen) Introduction to Latex Updated June 2018 12 / 40

Exercise Exercise 2: Modify your.tex file to add your title and name, your chapters titles, try different formatting commands, etc... You may want to save you.tex file under a different name. Remember that whenever you make alterations to your.tex file you need to compile it (click the green arrow). To make comments, you can start a line with the command: % Richard, Matei, Nedelea (U.of Aberdeen) Introduction to Latex Updated June 2018 13 / 40

Inserting Figures To insert a figure saved as an image file, you need to use the following command: \includegraphics[some attributes]{name of the file} Some of the common attributes are: width and height: \includegraphics[width=3cm, height=4cm]{file name} the length can be in cm, mm, pt; scale: \includegraphics[scale=0.5]{ }; angle: \includegraphics[angle=90]{ } Image files can be.eps,.jpg,.png or.pdf. Richard, Matei, Nedelea (U.of Aberdeen) Introduction to Latex Updated June 2018 14 / 40

Inserting Figures However, inserting figures in this way has very limited flexibility... Include the command within a figure environment: \begin{figure}[placement spec] \includegraphics[width=... ]{figure.eps} \end{figure} If you want the figure to be centered, add the command \centering before the includegraphics command. \begin{figure}[placement spec] \centering \includegraphics[width=... ]{figure.eps} \end{figure} Richard, Matei, Nedelea (U.of Aberdeen) Introduction to Latex Updated June 2018 15 / 40

Inserting Figures The placement specifiers are: Specifier t b p h Effect places the float at the top of the page places the float at the bottom of the page places the float on a special float page places the float at the point where the source code appears (or approximately)! overrides internal L A T E X rules for good positioning of floats H places the float precisely at this point (requires the float package). This is useful in multicolumn documents. Richard, Matei, Nedelea (U.of Aberdeen) Introduction to Latex Updated June 2018 16 / 40

Exercise Exercise 3: Insert a figure to your L A T E X document. You can use the figures in the Figures folder or choose one of your own. Note: if your.tex file and your figure are not in the same folder, you must indicate the path to the figure in the includegraphics command: \includegraphics[width=8cm]{figures/figure1.jpg} Richard, Matei, Nedelea (U.of Aberdeen) Introduction to Latex Updated June 2018 17 / 40

Inserting Tables To create a table, you need the tabular environment: \begin{tabular} {column spec} First row: first item & second item &... \\ Second row: first item & second item &... \\ etc... \end{tabular} There must be as many column specifiers as there are columns in the table, all added within the same pair of curly brackets. Richard, Matei, Nedelea (U.of Aberdeen) Introduction to Latex Updated June 2018 18 / 40

Inserting Tables Specifier l c r p{some width} Effect creates a left-justified column creates a centered column creates a right-justified column creates a column of specified width with text aligned at the top Richard, Matei, Nedelea (U.of Aberdeen) Introduction to Latex Updated June 2018 19 / 40

Inserting Tables Again, things become a lot more flexible if you embed your table in a float environment, i.e. a table environment in this case: \begin{table}[placement spec] \begin{tabular} {column spec} etc... \end{tabular} \end{table} Richard, Matei, Nedelea (U.of Aberdeen) Introduction to Latex Updated June 2018 20 / 40

Exercises Exercise 4: Insert a table to your L A T E X document. You can add horizontal lines with the command \hline and vertical lines with the character between column specifiers. Richard, Matei, Nedelea (U.of Aberdeen) Introduction to Latex Updated June 2018 21 / 40

Captions You can include a caption in a float with the command \caption[short]{long}, where short appears in the list of figures (or tables) and long appears beside the float in the document. The short option is optional. The list of figures and list of tables can be generated automatically with the commands (usually just below the \begin{document} command): The list of figures and the list of tables are generated automatically. Richard, Matei, Nedelea (U.of Aberdeen) Introduction to Latex Updated June 2018 22 / 40

Labels It is also possible to create labels to reference floats. Referencing is done as following in L A T E X: Insert: \label{marker} in the float, where marker is a marker (name) you are giving your float. The best is to insert the command in the caption command or after. In the text, you call the float number in this way: Figure \ref{marker}.... The sign creates a space before the reference number. In fact, you may reference any numbered object within your document (float, section, equation...) Richard, Matei, Nedelea (U.of Aberdeen) Introduction to Latex Updated June 2018 23 / 40

Exercise Exercise 5: Add a caption to your table. Add a label to your table and try referencing to it in your text. Richard, Matei, Nedelea (U.of Aberdeen) Introduction to Latex Updated June 2018 24 / 40

Writing Mathematics L A T E X is most useful to write mathematical text. The mathematics command can be used within a math environment, which may be either inline (within the normal text) or displayed (starting a new paragraph). inline math \begin{math}...\end{math} \(...\) \[...\] displayed math \begin{displaymath}... \end{displaymath} $...$ $$...$$ (to avoid) Richard, Matei, Nedelea (U.of Aberdeen) Introduction to Latex Updated June 2018 25 / 40

Writing Mathematics To get numbered equations in displayed mode, use the equation environment: \begin{equation}...\end{equation}. Richard, Matei, Nedelea (U.of Aberdeen) Introduction to Latex Updated June 2018 26 / 40

Maths Symbols There are VERY MANY symbols available in the math environment, and there is a Comprehensive List of LaTeX Symbols. Here are a few common ones: Greek letters: lowercase greek symbols are written $\name$ and uppercase $\Name$ Example: µ, Φ Subscript and upperscript: $_symbol$ and $^symbol$ If your symbol has more than one character you need to include them in curly brackets. Example: 10 3, C 14 6 Richard, Matei, Nedelea (U.of Aberdeen) Introduction to Latex Updated June 2018 27 / 40

Maths Symbols Square root: $\sqrt{number}$ Example: 49 fractions: $\frac{top number}{bottom number}$ or $\dfrac{top number}{bottom number}$ Example: 6 13 Integration $\int$ ( ) Sum (sigma symbol) $\sum$ ( ) Trigonometric functions: $\cos$, $\sin$, $\tan$, $\cotan$ Richard, Matei, Nedelea (U.of Aberdeen) Introduction to Latex Updated June 2018 28 / 40

Matrices There are several environments to write matrices: \begin{matrix}... \end{matrix} creates a matrix with no delimiter; \begin{pmatrix}... \end{pmatrix} creates a matrix within brackets; \begin{bmatrix}... \end{bmatrix} creates a matrix within curly brackets. Richard, Matei, Nedelea (U.of Aberdeen) Introduction to Latex Updated June 2018 29 / 40

Matrices These environments require a displayed maths environment. The layout is similar to a table environment: \[ \begin{pmatrix} first row: first element & second element & etc... \\ second row: first element & second element & etc... \\. \end{pmatrix} \] The commands \vdots:. \dots:... and \ddots:... may be useful. Richard, Matei, Nedelea (U.of Aberdeen) Introduction to Latex Updated June 2018 30 / 40

Systems of Equations For writing systems of equations, or a series of equations, you can use the align environment. If you want none of the equations to be numbered, you can use the starred version: \begin{align*}... \end{align*}, and if some of the equations should not be numbered, then add the command \nonumber at the end of the corresponding line. Each line of equation is ended by a double back-slash (\\) and equations will be align at the position of the commercial-and (&) \begin{align} y &= x 2 2x + 1 \\ & = (x 1) 2 \nonumber \end{align} Richard, Matei, Nedelea (U.of Aberdeen) Introduction to Latex Updated June 2018 31 / 40

Exercises Exercise 6: In the preamble, add the line: \usepackage{amsmath} directly underneath the line: \usepackage{aberdeen-eng} Try some Mathematics. Richard, Matei, Nedelea (U.of Aberdeen) Introduction to Latex Updated June 2018 32 / 40

Spaces in Maths Environment There are usually no space in the maths environment, and to force one you can use either of the following commands: command \quad effect space equal to font size \, space equal to 3/18 of a quad \: space equal to 4/18 of a quad \; space equal to 5/18 of a quad To insert some text within the mathematics environment, you can use the command \text{your text}. Richard, Matei, Nedelea (U.of Aberdeen) Introduction to Latex Updated June 2018 33 / 40

Using BibTex This template uses BibTex to generate the bibliography, which requires that references are stored in a.bib file. This file may be generated from some bibliography softwares (EndNote, RefWorks): items are written in a very particular synthax. At the end of the document, you will see the following commands: \bibliographystyle{apalike} \bibliography{mybibfile} The first command is about choosing the style of the Reference list. The second command indicates which is your.bib file, where you store your references. Richard, Matei, Nedelea (U.of Aberdeen) Introduction to Latex Updated June 2018 34 / 40

Using BibTex Bibliography items will look like this: namexx is the marker which you use for in-text referencing. With this template, you can use one of the following commands for in-text citation: \citet{namexx} to produce a citation as Author (Year) \citep{namexx} to produce a citation as (Author, date) More styles are available: check with your supervisor which style you should use! Richard, Matei, Nedelea (U.of Aberdeen) Introduction to Latex Updated June 2018 35 / 40

Using BibTex When using a.bib file to store your bibliography, you need to: compile the.tex file ( PDFLaTeX compilation) then compile the.bib file ( BibTeX compilation) then compile the.tex file a second time. You will need to do all this whenever you are modifying your.bib file and/or your references in the text. This allows for all bibliographic items and references to be refreshed. Richard, Matei, Nedelea (U.of Aberdeen) Introduction to Latex Updated June 2018 36 / 40

Splitting Your.tex File For big documents such as a thesis, it may be handy to break the document on different.tex files, e.g. write each chapter on a particular.tex file. In this case, you can write a top-level document which will contain the preamble and the document environment, and use the \include command: \documentclass[options]{your class} your packages \begin{document} \include{your chapter file name} \end{document} Richard, Matei, Nedelea (U.of Aberdeen) Introduction to Latex Updated June 2018 37 / 40

Include versus Input The command \include{file name} cannot be nested and forces a new page before and after the document. You can use the \includeonly command in the preamble to compile part of your document only. If you want to nest files, or if you do not wish you.tex file to start on a new page, use \input{file name}. Either command will keep consistent numbering. Only the top-level document contains the preamble. In the subsequent documents, you must start your text directly, e.g.: \section{first Chapter} This is my first chapter. Richard, Matei, Nedelea (U.of Aberdeen) Introduction to Latex Updated June 2018 38 / 40

L A T E X on Personal Machine You will need to install a tex distribution and possibly a L A T E Xeditor. for Windows: you can install the MiKTeX distribution, which includes the TeXworks editor. You can also install the TexMaker editor, or the TeXStudio editor (more advanced editors). for Mac: you can install the MacTex distribution (the full one, NOT the basic one), which includes the TexShop editor. You can also install the TexMaker editor, or the TeXStudio editor (more advanced editors). for Linux: you can install the TexLive distribution, which contains the TeXworks editor, through your repository manager (Synaptic or other). You can also install the more advanced Texmaker or TexStudio editors. Alternatively, you can use on online L A T E X editor, which does not require you to install anything on your computer. Richard, Matei, Nedelea (U.of Aberdeen) Introduction to Latex Updated June 2018 39 / 40

Softwares and Readings There are many freely available L A T E X editors: TexMaker, TeXStudio, LyX. A good place to start is the beginners page of TUG. The L A T E X Wikibook is an excellent resource for information on L A T E X. The CTAN website has information on most (if not all) L A T E X packages. There are also many forums of questions and answers about L A T E X, for instance, the Tex Stack Exchange. Richard, Matei, Nedelea (U.of Aberdeen) Introduction to Latex Updated June 2018 40 / 40