Effective Programming Practices for Economists

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

LaTeX A Tutorial. Mohsen Alimomeni, 2010

1 Obtaining LyX and L A TEX

Introduction to MCS 220 and L A TEX

Introduction to L A TEX

Effective Programming Practices for Economists. 7. Version Control, Part II: Git with a Shared Repository

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

Effective Programming Practices for Economists. 17. Regular Expressions

Math 235: Introduction to LaTeX

An Interactive Introduction to L A TEX

An Interactive Introduction to L A TEX. Part 1: The Basics. John Lees-Miller. writel A TEX

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

1. The Joy of TEX. Check out this example!

Introduction to L A TEX for MCS-236

Effective Programming Practices for Economists. 13. Documenting (the code of) research projects

Introduction to L A T E X

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

Typing Mathematics. Darrin Doud

Introduction to Scientific Typesetting Lesson 1: Getting Started

L A TEX for Psychological Researchers

COMP496/901: Academic Presentation and Writing Skills Using LaTeX

Latex Tutorial. CIS400 Senior Design 9/5/2013

Introduction to L A T E X

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

LaTeX. Information Literacy II EN(IL2) Course

A Very Brief Introduction to L A T E X MAT 3535

Guide to using L A TEX

L A TEX. The Logo. Introduction to L A TEX. Overview. Primary Benefits. Kinds of Documents. Bill Slough and Andrew Mertz

Lecture 1: Short summary of LaTeX basics

Citation guide. Carleton College L A TEX workshop. You don t have to keep track of what sources you cite in your document.

An introduction to L A TEX for students

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

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

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

LATEX Primer. 1 Introduction (Read Me)

Typesetting with TEX

Helen Cameron. A Brief Overview of LATEX

Become a L A TEX Guru

Introduction to L A TEX

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

Helen Cameron. A Brief Overview of LATEX

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

A Brief Introduction to L A TEX

An Introduction to L A TEX

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

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

Introduction to LaTeX. Paul Fodor Stony Brook University

Course A, Part 1 Basic Formatting in L A TEX

Getting started with Latex

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

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

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

Assessments for CS students:

Mikkel Madsen

Using L A TEX Tom Edgar

1. The Joy of TEX. Check out this example!

Beginning and Intermediate Algebra Chapter 0: Arithmetic

An Introduction to LATEX

Introduction to LATEX

Introduction to Latex. A workshop by Dr. Ala Eshmawi

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

TUTORIAL 5: LIST ENVIRONMENTS. 1. Welcome. (1) Hello. My name is Dr. Christopher Raridan (Dr. R).

LATEX. Leslie Lamport. Digital Equipment Corporation. Illustrations by Duane Bibby. v ADDISON-WESLEY

Dec. 27 th, 2010 University of Isfahan

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

George Grätzer. Practical L A TEX

Learning LaTeX: The Basics

TUGboat, Volume 33 (2012), No

Introduction to LAT E X

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

Tools for Scientific Writing with LAT E X. Johan Carlson

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.

L A TEX From The Ground Up

LAT E X week 2: Basics for Writing a Document

COMS 6100 Class note

Effective Programming Practices for Economists. 10. Some scientific tools for Python

Math 395 Homework #1 Due Wednesday, April 12

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.

Square cells: an array cooking lesson

Homework # (Latex Handout) by Laura Parkinson

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

A Document Preparation System. User's Guide and Reference Manual. Leslie Lamport

Introduzione a LaTex. Fabrizio Messina

Workshop: A Simple Introduction to L A TEX

AL A TEX Fledgling Struggles to Take Flight

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

INSTALLING AND USING L A TEX

An Introduction to LATEX

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

L A TEX for Philosophers

Introduction to LAT E X

epub WU Institutional Repository

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

Beginning and Intermediate Algebra Chapter 2: Graphing

Basic L A TEX. what is LaTeX?

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

Introduction to L A TEX

Very Short Introduction to LaTeX

Transcription:

Effective Programming Practices for Economists 4. A L A T E X primer Hans-Martin von Gaudecker Department of Economics, Universität Bonn

The case for plain L A T E X Version control works best with simple text files so use those for writing papers as well L A T E X is the de-facto standard Will see later that it is also very useful for getting closer to that red button What about the middle ground between plain L A T E X and MS Word Scientific Workplace, LyX? Also format source code difficult to track changes Not designed for making the source readable by humans merging conflicts is a pain in the Licensed under the Creative Commons Attribution License 2/23

The case for plain L A T E X More control over what is going on Makes you worry about structure, not design Learning curve is steep But shortly, your mind will ignore the markup commands when reading L A T E X source code Licensed under the Creative Commons Attribution License 3/23

What is L A T E X? T E X Special-purpose programming language for use in typesetting publication-quality mathematics Developed by Donald Knuth (the Kenneth Arrow of CS) L A T E X Extension of T E X that makes it easier to use (by adding commands) Licensed under the Creative Commons Attribution License 4/23

Tools for writing L A T E X and producing pdf s A text editor See introductory slides A T E X distribution MikT E X or T E XLive are the standards Licensed under the Creative Commons Attribution License 5/23

Design follows structure You are responsible for the structure L A T E X will do the design based on that structure Concept also called markup Licensed under the Creative Commons Attribution License 6/23

The L A T E X markup language Introduction Standard text is interpreted as usual Multiple whitespace is interpreted as one space Exception: An empty line starts a new paragraph Commands: Start with backslash, options in square brackets, arguments in curly braces: \command[options]{argument} E.g. for main structure: \section{section name} \subsection{subsection name} Licensed under the Creative Commons Attribution License 7/23

The L A T E X markup language Source code for simple text \section{of the division of labour} The greatest improvement in the productive powers of labour, and the greater part of the skill, dexterity, and judgment with which it is anywhere directed, or applied, seem to have been the effects of the division of labour. The effects of the division of labour, in the general business of s Licensed under the Creative Commons Attribution License 8/23

The L A T E X markup language Resulting text 1 Of the division of labour The greatest improvement in the productive powers of labour, and the greater part of the skill, dexterity, and judgment with which it is anywhere directed, or applied, seem to have been the effects of the division of labour. The effects of the division of labour, in the general business of society, will be more easily understood by considering in what manner it operates in some particular manufactures. Licensed under the Creative Commons Attribution License 9/23

The L A T E X markup language Environments Environments add, remove, or change behaviour of commands: \begin{enumerate} \item First point. \item Second point. \end{enumerate} Some important environments: document Where you write your text, required in every document enumerate A numbered list itemize A bulleted list equation Numbered formula align Formulas spanning several lines (Madsen, 2006) Licensed under the Creative Commons Attribution License 10/23

The L A T E X markup language Source code for simple environments \begin{document} The first lectures of the course will be: \begin{enumerate} \item Introduction. \begin{itemize} \item Prologue with motivating example. \item Reproducibility. \item Tools used in the course. \end{itemize} \item Version Control. \end{enumerate} \end{document} Licensed under the Creative Commons Attribution License 11/23

The L A T E X markup language Resulting text The first lectures of the course will be: 1. Introduction. Prologue with motivating example. Reproducibility. Tools used in the course. 2. Version Control. Licensed under the Creative Commons Attribution License 12/23

The L A T E X markup language Math environments Math has special environment delimiters \(... \) for inline math \[... \] for single-line math Subscripts via underscores, superscripts via circumflex in math environments... Strange errors in usual text use \_ and \ˆ Escape characters Curly braces delimit groups (e.g. what goes in a subscript or denominator) Greek letters via commands in math mode: \alpha, \Delta Licensed under the Creative Commons Attribution License 13/23

The L A T E X markup language Source code for math examples \begin{document} Two important measures for individuals' risk aversion are based on the curvature of a utility function \( u (x) \) over a monetary quantity \( x \). These are absolute risk aversion: \[ r_a (x) = -\frac{u^{''} (x)}{u^{'} (x)} \] and relative risk aversion: \[ r_r (x) = - x \cdot \frac{u^{''} (x)}{u^{'} (x)} \] \end{document} Licensed under the Creative Commons Attribution License 14/23

The L A T E X markup language Resulting text Two important measures for individuals risk aversion are based on the curvature of a utility function u(x) over a monetary quantity x. These are absolute risk aversion: and relative risk aversion: r A (x) = u (x) u (x) r R (x) = x u (x) u (x) Licensed under the Creative Commons Attribution License 15/23

The preamble Commands before the \begin{document} call Need to tell L A T E X several settings for the entire document upfront Type of document, paper size, margins, how to deal with special characters, margins, symbols (e.g. e)... Encodings: \usepackage[utf8]{inputenc} vs. \usepackage[latin1]{inputenc} Save file with appropriate encoding Don t worry, use templates! Licensed under the Creative Commons Attribution License 16/23

Compiling documents to pdf s Use pdflatex Forget about old documentation floating around (dvi s) Specialised editors have extensions or built-in interfaces Might need several runs, other programs to run in between Not yet Use automated tools later Hopefully never need to worry about this Error messages not too helpful Focus on line numbers General feature of L A T E X compilation tools Licensed under the Creative Commons Attribution License 17/23

Tables Best done using the booktabs package Read Fear (2005) for usage Read Fear (2005) for style rules Licensed under the Creative Commons Attribution License 18/23

Bibliographies Bibliographies one of the big strengths of L A T E X Pull everything out of centralised file (database) Has a peculiar format Use manager, e.g. Jabref on all platforms, BibDesk on Mac biblatex (Lehman et al., 2013) is a modern package re-implementing original bibliographic functionality Remove the backend=biber option if you can t get it to work Licensed under the Creative Commons Attribution License 19/23

Annotated references Intro based on http://www.haptonstahl.org/latex Decent book: Kopka and Daly (2004) (disclaimer) Math intro: Grätzer (1996) Very useful resources: http://en.wikibooks.org/wiki/latex/formatting http://en.wikibooks.org/wiki/latex/mathematics Licensed under the Creative Commons Attribution License 20/23

References I Fear, Simon (2005). Publication Quality Tables in L A T E X. Available at http://www.ctan.org/tex-archive/macros/latex/contrib/booktabs/. Grätzer, George A. (1996). Math into L A T E X: An Introduction to L A T E X and AMS-L A T E X. Boston: Birkhäuser. Kopka, Helmut and Patrick W. Daly (2004). Guide to L A T E X. 4th ed. Addison Wesley / Pearson Education. Lehman, Philipp, Philip Kime, Audrey Boruvka, and Joseph Wright (2013). The biblatex Package: Programmable Bibliographies and Citations. Available via http://sourceforge.net/projects/biblatex/. Madsen, Lars (2006). Avoid Eqnarray! In: PracT E X Journal 4. Licensed under the Creative Commons Attribution License 21/23

Acknowledgements This course is designed after and borrows a lot from the Software Carpentry course designed by Greg Wilson for scientists and engineers. The Software Carpentry course material is made available under a Creative Commons Attribution License, as is this course s material. Licensed under the Creative Commons Attribution License 22/23

License for the course material [Links to the full legal text and the source text for this page.] You are free: to Share to copy, distribute and transmit the work to Remix to adapt the work Under the following conditions: Attribution You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work). With the understanding that: Waiver Any of the above conditions can be waived if you get permission from the copyright holder. Public Domain Where the work or any of its elements is in the public domain under applicable law, that status is in no way affected by the license. Other Rights In no way are any of the following rights affected by the license: Your fair dealing or fair use rights, or other applicable copyright exceptions and limitations; The author s moral rights; Rights other persons may have either in the work itself or in how the work is used, such as publicity or privacy rights. Notice For any reuse or distribution, you must make clear to others the license terms of this work. The best way to do this is with a link to this web page.