What is T E X? T E X and L A T E X Document preparation tools. Setting and casting type. What Knuth was setting. Setting and casting type

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

A brief introduction to L A TEX

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

COMP496/901: Academic Presentation and Writing Skills Using LaTeX

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

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

Introduction to Scientific Typesetting Lesson 7: Graphics and Floats

An Introduction to L A TEX

Introduction to LaTeX. Paul Fodor Stony Brook University

LaTeX. Information Literacy II EN(IL2) Course

Basic L A TEX. what is LaTeX?

Introduzione a LaTex. Fabrizio Messina

Word-to-L A TEX specification

WYSIWYG Systems. CSCM10 Research Methodology Lecture 4 (11/2/16): A Taster of L A TEX WYSIWYM. Advantages/Disadvantages of WYSIWYG Systems

Introduction to Latex. A workshop by Dr. Ala Eshmawi

Math 235: Introduction to LaTeX

CSCM10 Research Methodology A Taster of L A TEX

Dec. 27 th, 2010 University of Isfahan

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

Very Short Introduction to LaTeX

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.

Helen Cameron. A Brief Overview of LATEX

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

Introduction to L A TEX

Formatting with LaTeX

Helen Cameron. A Brief Overview of LATEX

Latex Tutorial. CIS400 Senior Design 9/5/2013

CSCM10 Research Methodology A Taster of L A TEX

WYSIWYG Systems. CSCM10 Research Methodology A Taster of L A TEX WYSIWYM. Advantages/Disadvantages of WYSIWYG Systems.

A quick guide to L A TEX

Square cells: an array cooking lesson

COMS 6100 Class note

Document Preparation Word Processors

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

L A TEX: Eh? What is it, what isn t it, who cares? Andy Caird. LATEX: Eh? p.1/13

SOFTWARE ARCHITECTURE 4. TEXT FORMATTING SYSTEM

Mikkel Madsen

L A TEX. COMPSCI 111 / 111G Mastering Cyberspace: An introduction to practical computing. LaTeX. Development. Why?

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

Introduction to LaTeX. Christoph Pickl

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

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

Getting Started with L A TEX

Began as TeX, in 1982 (Knuth). Purely a typesetting tool. LaTeX added macros, maintaining TeX as it s typesetting engine (Lamport).

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

Learning L A TEX. Patrick Lam

Absolute L A TEX Beginner

Electronic Production Guidelines

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

A Short Introduction to L A TEX

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

L A TEX for psychological researchers

Pimp your thesis: a minimal introduction to L A T E X.

Assessments for CS students:

L A T E X Week 11, Other Document Classes

Typesetting with TEX

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

Tools Course: Part 2

Meeting One. Aaron Ecay. February 2, 2011

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

In another markup scheme it will be like as given hereunder:

An Introduction to L A T E X

How to get started in L A TEX

Introduction to L A TEX

Using L A TEX. A numbered list is just that a collection of items sorted and labeled by number.

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

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

David Helmbold, October 2005, Revised October 2007

L A TEX From The Ground Up

Advanced High Graphics

Getting Started with L A T E X for a Technical Document or Thesis

PHYS-4007/5007: Computational Physics

Introduction to Scientific Typesetting Lesson 1: Getting Started

VERY VERY SHORT GUIDE TO LATEX

Image coding and compression

A DEMONSTRATION OF THE UNIVERSITY OF KENTUCKY MATHEMATICS DEPARTMENT DISSERTATION DOCUMENT CLASS

Introduction to LAT E X

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

Latex Manually Set Font Size For Tables

Mikkel Madsen

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

Outline. A Sneak Peek

Data Representation From 0s and 1s to images CPSC 101

L A TEX: Online module 6

A LAT E X Tutorial. Evangelos Milios. March 15, 2004

LATEX Primer. 1 Introduction (Read Me)

Getting started with Latex

Final Study Guide Arts & Communications

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

Introduction to L A TEX

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

Getting Started in L A TEX

LATEX TYPESETTING SYSTEM. CAAM 519, CHAPTER 3

A L A TEX-Package for IEEE PES Transactions

A demonstration of the L A TEX2ε class file for the International Journal of Network Management

Image Types Vector vs. Raster

1 Introduction. 2 About L A TEX. Page 1(6) Why LATEX is used for review report typesetting within the TDB. project

A Grasshopper s Approach to L A TEX

Introduction to LATEX

LA T EX is a Document Preparation System which is useful for the preparation of all Abstract kinds of reports. It is particularly suited, but not limi

Transcription:

T E X and L A T E X Document preparation tools This lecture will introduce software necessary to produce documents using L A T E X in the School of Computer Science. It will also show the basics of producing a first L A T E X document. What is T E X? A powerful typesetting system designed for scientific documents. Created by Donald Knuth in reaction to the poor phototypesetting of the second edition of his The Art of Computer Programming. Intended to allow production of books with reasonable effort give same result on all computers now and in the future 1 - TeX and LaTeX - 1 1 What Knuth was setting Setting and casting type Books were printed from many individual letters: But the printing technology of the day relied on casting single letters Ordinary text could be set by machine but Knuth s text was not ordinary. 1 - TeX and LaTeX - 1 2 1 - TeX and LaTeX - 1 3 Setting and casting type Books were set by essentially typing the text on a Monotype type setter: This produced instructions on paper tape to a casting machine: Monotype caster in action (but with the volume turned down) Knuth supplied the commands to the caster. 1 - TeX and LaTeX - 1 4 What is T E X? Its particular strengths are in: spacing in setting mathematics its automatic line breaking/justification algorithm It consists of about 300 macros: Example: A trivial T E X document Hello! \end 1 - TeX and LaTeX - 1 5 1

Advantages of T E X Flexibility Full-power programming language allows: automation of typesetting addition of macros built from primitive T E X macros Nicer output - especially for maths Produces nice paragraphs, formulas, tables, Easy global changes 1 - TeX and LaTeX - 1 6 Advantages of T E X Well-programmed - Knuth s literate programming Architecture independent works the same on any hardware/os Free Extended to use any PostScript font Can incorporate PostScript code to add fancy graphics and effects, e.g. rotating and scaling text, including graphic objects 1 - TeX and LaTeX - 1 7 T E X is not WYSIWYG Disadvantages of T E X Designed for traditional typesetting fancy typesetting might get complicated and cumbersome. Not easy to learn needs to memorize many commands but a lot of good documentation is available. 1 - TeX and LaTeX - 1 8 What is L A T E X? A set of T E X macros to make typesetting easier T E X has 300 primitive commands So-called Plain T E X defines 600 basic macros L A T E X is much larger, containing: different structuring macros for typesetting different types of documents: letter, article, report, book,... packages user-defined macros bundles for specific tasks, e.g. creating appendices. 1 - TeX and LaTeX - 1 9 Ubiquity of L A T E X L A T E X has been adopted by scientific and technical publishers as the format to receive manuscripts because L A T E X: is widely available because the style of documents can be easily changed by changing parameters incorporating multiple documents/chapters is very easy indexes, reference lists etc. are easy to create L A T E X2ε Many incompatible versions of L A T E X were developed, causing problems for system maintainers (who had to keep several versions running). It wasn t always clear what version a package had been written for. L A T E X2ε is an attempt at standardisation. It is easy to spot a L A T E X2ε document: it starts with \documentclass not \documentstyle. 1 - TeX and LaTeX - 1 10 1 - TeX and LaTeX - 1 11 2

L A T E X also includes: What does L A T E X do? facility to automatically produce a table of contents, list of figures, list of tables, footnotes, header, title page, bibliography font management macros, e.g. \textit \large, \textsc easy creation of tables easy-to-use macros for complex mathematical formulas excellent cross-referencing macros Developing a L A T E X document Step 0: Ensure that your.login file has L A T E X enabled. Step 1: Prepare an input file for L A T E X using your favourite editor. The input file should be plain text, with.tex as its extension, eg: test1.tex OR: Use Texmaker under linux (see handout) 1 - TeX and LaTeX - 1 12 1 - TeX and LaTeX - 1 13 Developing a L A T E X document Step 2: Run L A T E X under Unix with your input file as the argument to the command, eg: latex test1.tex If errors are reported, return to Step 1 and correct them; otherwise: L A T E X will have produced an output file with the extension.dvi, eg: test1.dvi Developing a L A T E X document Step 3: Convert the.dvi output into a form suitable for viewing or driving a PostScript printer, for instance using the translator: xdvi test1.dvi dvips will produce an PostScript file with the extension ps, eg: test1.ps or dvipdf test1.dvi Step 4: Print the PostScript file on your chosen printer, eg: lpr Prothko test1.{ps,pdf} 1 - TeX and LaTeX - 1 14 1 - TeX and LaTeX - 1 15 A simple L A T E X document - 1 \documentclass[12pt]{article} % Use PS palatino fonts \usepackage{palatino} \begin{document} Hello! \end{document} Compulsory arguments of macros are enclosed in { } Optional arguments are enclosed in [ ] A simple L A T E X document - 2 Commands can have a number of optional arguments. At most one compulsory argument is allowed for each command and follows optional arguments. The macro \documentclass{} is the first thing you have to write. Its only mandatory argument is the type of document. Its optional argument is a list of comma-separated options e.g. a4paper, 1Opt,11pt,12pt, landscape,... 1 - TeX and LaTeX - 1 16 1 - TeX and LaTeX - 1 17 3

A simple L A T E X document - 3 The macro \usepackage{<package-name>} loads additional macros from the file: <package-name>.sty Watch out for reserved characters. These have to be represented by: # \# $ \$ % \% & \& _ \_ \ $\backslash$ A simple L A T E X article - 1 \documentclass[12pt]{article} % The document preamble \usepackage{times} % Use PS times fonts % Details of the titlepage \title{a Very \textsc{simple} Document Indeed} \author{\textit{w. Clinton and M. Lewinsky}} \date{\today} % Use the system date 1 - TeX and LaTeX - 1 18 1 - TeX and LaTeX - 1 19 A simple L A T E X article - 2 \begin{document} \maketitle \section{introduction} This is the first paragraph. Paragraphs must end with an empty line this like this. This is another paragraph. Let's force a line break: \\ Now, we d like to continue with this paragraph. A simple L A T E X article - 3 \noindent This is a non-indented paragraph. \subsection{aim of this lecture} Blah, \dots %'\dots' makes 3 nice dots A footnote looks this \footnote{i'm a footnote.} \section{conclusion} This is it! Easy!!! \end{document} 1 - TeX and LaTeX - 1 20 1 - TeX and LaTeX - 1 21 L A T E X tables - 1 Each table begins with: \begin{tabular}{<table-specification>} Table specification lcr means: 3 columns 1st column: left justified 2nd column: centred 3rd column: right justified L A T E X tables - 2 % A Simple Table \begin{tabular}{lcr} Date & : & \today \\ Time & : & 3 p.m. \\ Venue & : & Computer Science\\ \end{tabular} Column entries separated by & and lines ended by \\ 1 - TeX and LaTeX - 1 22 1 - TeX and LaTeX - 1 23 4

L A T E X tables - 3 The table specification in the following example uses to separate each column by a vertical line \begin{tabular}{ c p{8cm} } the first column is centered. the second column is justified and is 8 cm wide. Horizontal lines in the table are specified by adding \hline after the line ending command \\. L A T E X tables - 4 % A table with border and % fixed column width \begin{tabular}{ c p{8cm} }\hline \textbf Phrasal Verb & \textbf Meaning \\ \hline fish for & If you {\textbf fish for} information or praise, you try and get it from someone in an indirect way. \\ \hline % one entry omitted from slide \end{tabular} 1 - TeX and LaTeX - 1 24 1 - TeX and LaTeX - 1 25 Including figures - 1 The first thing is, of course, to have a figure to insert. \begin{figure}[hbpt] \begin{verbatim} procedure CreateEntry (NextTerm : Termptr; CopyEntry : EntryRec); end; {of CreateEntry} \end{verbatim} \caption{pascal algorithm} \label{pascal_alg} \end{figure} 1 - TeX and LaTeX - 1 26 What does this mean? \begin{figure}[hbpt] Including figures - 2 The following text is a figure. h: place here if there is room b: place at the bottom of a text page p: place on a page of floats t: place at top of next text page The figure isn t inserted at exactly the point in the text where this command is placed. 1 - TeX and LaTeX - 1 27 What do these mean? Including figures - 3 \caption{pascal algorithm} The text that will appear with the figure. Note, you don t have to include (e.g.) Figure 2 \label{pascal_alg} A label by which we can refer to this figure within the document. Including figures - 4 We are certain to want to refer to figures from within our text, but: we may add more figures or remove figures we may move the order of figures around To avoid manually renumbering figures, we use in the text:...given in Figure~\ref{pascal_alg}. This automatically adds (usually) a number into the text. 1 - TeX and LaTeX - 1 28 1 - TeX and LaTeX - 1 29 5

Graphics formats - 1 What if your figure is not text e.g. a photo or line drawing? Resolution-independent vector graphics, e.g. EPS Encapsulated PostScript WMF Windows Meta File for (e.g.) block diagrams flow charts diagrams with text labels Graphics formats - 2 Pixel-based raster-graphic formats, e.g. PNG Portable Network Graphics TIFF Tagged Image File Format JPEG [Joint Photographic Experts Group] GIF Graphics Interchange Format for (e.g.) screen shots photos scanned images of pages 1 - TeX and LaTeX - 1 30 1 - TeX and LaTeX - 1 31 Graphics formats - 3 Note JPEG and GIF are lossy compression formats continual editing can degrade the images. Prefer non-lossy formats, e.g. PNG. Note: stretching JPEGs doesn t work well! but stretching vector graphic images does Adding a PostScript figure - 1 Adding a PostScript file is only a little more complicated than adding a normal figure. Step 1: Prepare a graphic using your favourite package Step 2: Save or convert your graphic in a suitable format, eg: repr_terms.pdf 1 - TeX and LaTeX - 1 32 1 - TeX and LaTeX - 1 33 Adding a PostScript figure - 2 In the preamble, add the following: \usepackage{graphicx} Then the illustration can be added to your text by using \begin{figure} as before: \begin{figure} \includegraphics{repr_terms} \caption{pdf diagram} \label{pdf_diagram} \end{figure} What to do next Copies of the two L A T E X documents used in the lecture are available from the module web page as: example1.tex example2.tex Make copies of these and use your copies to: create.dvi files create.ps or.pdf files print.ps or.pdf files to a printer edit the files to add more text and features. 1 - TeX and LaTeX - 1 34 1 - TeX and LaTeX - 1 35 6

Sources of further information There are numerous sources of information about L A T E X, ranging from the introductory to the obscure. The best places to start are on the School s local guide to using L A T E X and The Not So Short Introduction to L A T E X2ε (both linked from the module web page). 1 - TeX and LaTeX - 1 36 7