LATEX for Philosophers - University of Calgary
LATEX for Philosophers - University of Calgary
LATEX for Philosophers - University of Calgary
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
L A TEX <strong>for</strong> <strong>Philosophers</strong><br />
Richard Zach<br />
November 7, 2013<br />
1 What is L A TEX?<br />
L A TEX is a Typesetting System<br />
• L A TEX is a progam that takes a plain text file containing text and markup<br />
instructions and turns it into a typeset document (usually in PDF <strong>for</strong>mat).<br />
• (Actually, TEX does the typesetting, and L A TEX works through TEX.)<br />
• L A TEX is open source, cross-plat<strong>for</strong>m, and almost 30 years old.<br />
• L A TEX comes with hundreds <strong>of</strong> packages dealing with anything from producing<br />
presentation slides (such as this) to dealing with bibliographical<br />
references to typesetting musical scores.<br />
L A TEX is a Markup Language<br />
• L A TEX documents do not contain <strong>for</strong>matting—all <strong>for</strong>matting, sectioning,<br />
special symbols and <strong>for</strong>mulas, etc., are coded using plain text.<br />
• For instance:<br />
– an emphasized piece <strong>of</strong> text is coded as \emph{emphasized},<br />
– a <strong>for</strong>mula such as<br />
as<br />
– a bulleted list as<br />
∃x(φ(x) ∧ ψ(x))<br />
$\exists x(\phi(x) \land \psi(x))$,<br />
\begin{itemize}<br />
\item \LaTeX{} documents do not contain ...<br />
\item ...<br />
\end{itemize}<br />
1
L A TEX is a Programming Language<br />
• The commands <strong>of</strong> L A TEX (and the underlying TEX system) are also a fullfledged<br />
programming language.<br />
• This allows you to customize your typesetting environment <strong>for</strong> special<br />
purposes.<br />
• It makes L A TEX extremely flexible and powerful.<br />
• It also makes it very complex, and sometimes very frustrating.<br />
A Simple L A TEX Document<br />
\documentclass[11pt]{article}<br />
\usepackage[citestyle=authoryear,style=authoryear]{biblatex}<br />
\addbibresource{latex4phi.bib}<br />
\usepackage[greek,english]{babel}<br />
\title{A Simple \LaTeX{} Document}<br />
\author{Richard Zach}<br />
\begin{document}<br />
\maketitle<br />
A Simple L A TEX Document<br />
\section{Introduction}<br />
\LaTeX{} was originally developed in 1985, based on the<br />
\TeX{} typesetting system released by Don Knuth in 1979<br />
\parencite{Lamport1986,Knuth1986}. You can \emph{easily}<br />
set <strong>for</strong>mulas like $\exists x(\phi(x) \land \psi(x))$, or<br />
greek text, e.g., when discussing Aristotle’s<br />
\textgreek{>’apeiron}.<br />
\printbibliography<br />
\end{document}<br />
2
A Simple L A TEX Document<br />
Richard Zach<br />
November 6, 2013<br />
1 Introduction<br />
L A TEX was originally developed in 1985, based on the TEX typesetting system<br />
released by Don Knuth in 1979 (Lamport 1986; Knuth 1986). You can<br />
easily set <strong>for</strong>mulas like ∃x(φ(x) ∧ ψ(x)), or greek text, e.g., when discussing<br />
Aristotle’s ἄπειρον.<br />
References<br />
Knuth, Donald E. (1986). The TeXbook. Boston: Addison-Wesley.<br />
Lamport, Leslie (1986). LaTeX: A Document Preparation System. Reading,<br />
Mass.: Addison-Wesley.<br />
BibTEX Bibliography Files<br />
1<br />
• Bibiographic references can be generated and <strong>for</strong>matted automatically<br />
• Format <strong>of</strong> BibTEX databases is simple and support is widespread<br />
@article{Thomson1971,<br />
author = {Thomson, Judith Jarvis},<br />
title = {A Defense <strong>of</strong> Abortion},<br />
journal = {Philosophy \& Public Affairs},<br />
3
pages = {47--66},<br />
volume = {1},<br />
year = {1971}}<br />
2 Who Should Use L A TEX?<br />
Use L A TEX if . . .<br />
• Your writing includes lots <strong>of</strong> <strong>for</strong>mulas (logic or mathematics).<br />
– logicians<br />
– <strong>for</strong>mal epistemologists<br />
– philosophers <strong>of</strong> physics<br />
– philosophers <strong>of</strong> mathematics<br />
• You have to include text in other languages or alphabets, code, or diagrams,<br />
or you need sophisticated typesetting<br />
– philosophers <strong>of</strong> language (phrase structure trees)<br />
– ancient philosophers (greek text with diacritics)<br />
– historians (<strong>for</strong> scholarly apparatus)<br />
Use L A TEX if . . .<br />
• You want no control (and hence not have to worry about) the layout <strong>of</strong><br />
your writing.<br />
If you use L A TEX and stay away from <strong>for</strong>matting commands, your typeset<br />
output will basically be guaranteed to look good. You can change the<br />
look <strong>of</strong> your paper very easily and without having to <strong>for</strong>mat every single<br />
paragraph. This can be done in Word, but is much more cumbersome<br />
than in L A TEX.<br />
There are very man styles that make sure your typeset document has the<br />
right appearance: type size, margins, numbering <strong>of</strong> headers, etc. This can<br />
make it very easy to prepare certain kinds <strong>of</strong> documents—e.g., manuscripts<br />
<strong>for</strong> journals or presses that have a L A TEX house style, or a dissertation<br />
(most universities have a thesis style including the <strong>University</strong> <strong>of</strong> <strong>Calgary</strong>.<br />
• You want complete control over the layout <strong>of</strong> your writing and produce<br />
pr<strong>of</strong>essionally typeset output.<br />
On the other hand, if you want to typeset your writing pr<strong>of</strong>essionally,<br />
L A TEX is about as capable as pr<strong>of</strong>essional typesetting s<strong>of</strong>tware. Packages<br />
like memoir are designed to produce print-ready books according to traditional<br />
publishing standards. This is hard to do in Word.<br />
4
• You want to stop worrying about bibliographies.<br />
L A TEX comes with sophisticated bibliography handling. You can keep your<br />
bibliography in a separate BibTEX file (which is also a simple text file),<br />
refer to bibliography entries in your text (e.g., as \cite{Quine1951} and<br />
L A TEX will not only print “Quine (1951)” in the text but also include the<br />
correct entry in your bibliography, <strong>for</strong>matted according to your preferred<br />
<strong>for</strong>mat.<br />
• You want reliable tables <strong>of</strong> contents, cross-references, and maybe even<br />
indexes.<br />
Because a L A TEX is logically marked up (e.g., using section commands)<br />
and not visually <strong>for</strong>matted directly, it will always be clear what’s a chapter<br />
heading and what’s a section. Producing a table <strong>of</strong> contents is as easy as<br />
typing \table<strong>of</strong>contents.<br />
• You are fussy about typography.<br />
Word processors such Word have come a long way in turning text into type<br />
on the page—in part because <strong>of</strong> the sophisticated algorithms that underly<br />
the TEX system. L A TEX understands kerning, line spacing, hyphenation, its<br />
typefaces have ligatures, its small caps aren’t just scaled-down capitals,<br />
and it makes it easy to keep your hyphens, en, and em-dashes straight.<br />
Use L A TEX if . . .<br />
• You have financial or ideological objections against commercial s<strong>of</strong>tware.<br />
L A TEX and basically everything around L A TEX is free because it’s all open<br />
source. To do the same kinds <strong>of</strong> things you can do with L A TEX <strong>for</strong> free,<br />
you’d need Word, PowerPoint (or Keynote), EndNote, Acrobat Pro, and<br />
maybe InDesign.<br />
• You want your work to be future-pro<strong>of</strong>.<br />
L A TEX documents are plain text documents. Proprietary document <strong>for</strong>mats<br />
change and become obsolete.<br />
• You want your work to be available consistently across plat<strong>for</strong>ms.<br />
A Word file or PowerPoint presentation may lose fonts or <strong>for</strong>matting, and<br />
page breaks might shift if you open it on a Mac or with a program other<br />
then the very version <strong>of</strong> Word you generated it on. A L A TEX document<br />
compiles the same on a Windows, Mac, or Unix machine. A PDF presentation<br />
generated by L A TEX will display the same on any computer, but<br />
you might not even be able to open a Keynote presentation.<br />
5
Don’t Use L A TEX if . . .<br />
• Other people who don’t use L A TEX have to work with your document.<br />
– Non-L A TEX-using supervisors who want to comment on your electronic<br />
document<br />
– Non-L A TEX-using collaborators who want to see what their changes<br />
will looklike<br />
– Publishers who insist on Word files.<br />
• . . . but if you are committed, there are ways around these problems:<br />
– Supervisors can comment on PDFs or, old-school, on paper.<br />
– Online editors do allow collaboration and preview <strong>of</strong> documents without<br />
having to install L A TEX.<br />
– There are conversion programs.<br />
Don’t Use L A TEX if . . .<br />
• You think it’s just ridiculous that you should have to debug a document<br />
be<strong>for</strong>e printing it.<br />
Every L A TEX document is a program, and L A TEX won’t give you a shiny<br />
PDF unless your document compiles without errors. That means you<br />
might have to spendsome time ironing out the kinks in your document.<br />
Mostly it’ll just be typos or a <strong>for</strong>gotten “}.” Sometimes it’ll make you<br />
want to rip your hair out.<br />
• You have better things to do than to learn a word processing program.<br />
L A TEX, like much <strong>of</strong> open-source s<strong>of</strong>tware written by Comp Sci types, isn’t<br />
exactly user friendly. If you don’t want to read a manual, learn commands,<br />
or shudder at the thought <strong>of</strong> using a command-line terminal <strong>for</strong> anything<br />
(or don’t know what that is!) then think twice be<strong>for</strong>e installing L A TEX.<br />
Maybe stick with the online editors or LyX.<br />
• You have better things to do than spend half a day on the internet to<br />
figure out how to change the page margins <strong>of</strong> your document.<br />
L A TEX is very powerful and can do lots <strong>of</strong> things—but it’s <strong>of</strong>ten hard to<br />
figure out how to do them. You might end up spending lots <strong>of</strong> time<br />
searching the internet to figure things out. On the upside, because L A TEX<br />
is so widely used, it’s also likely that you’ll find the answer (maybe even<br />
among your facebook friends.)<br />
• You are in danger <strong>of</strong> getting sidetracked by nerdy techy things.<br />
If you’re the kind <strong>of</strong> person who has to understand the inner workings<br />
<strong>of</strong> things, is tempted to take things apart, improve them, or repurpose<br />
6
them—then be prepared to spend a lot <strong>of</strong> time tinkering with L A TEX. You<br />
may find yourself writing your own package files, or wasting weeks on<br />
making your documents be just a little bit more beautiful. This is not a<br />
good idea if you have a dissertation to finish.<br />
3 Setting Up L A TEX<br />
Getting Started with L A TEX without Hassles<br />
• There are online L A TEX editors, e.g.,<br />
– WriteLaTeX and<br />
– ShareLaTeX<br />
Nothing to install, documents live in the cloud, share and collaborate.<br />
• LyX is an open-source WYSIWYG editor that uses L A TEX and runs on<br />
Windows, Mac, and Linux.<br />
Installing the L A TEX System<br />
• When you want more speed, control, a better editor, or advanced options,<br />
install it on your computer<br />
• For Mac, get MacTex<br />
• For everything else, get TeX Live<br />
Useful Tools: Editors<br />
• A good L A TEX-awareeditor is important:<br />
– Help you learn commands and save typing<br />
– Useful <strong>for</strong> previewing and debugging<br />
– Spell checker has to go around commands<br />
• TeXShop seems to be the most widely used editor <strong>for</strong> Mac (included in<br />
MacTeX).<br />
• TeXworks is an editor modelled after TeXShop but available <strong>for</strong> Mac,<br />
Windows, and Linux (included in MacTeX and TeXLive <strong>for</strong> Windows)<br />
• There are many others!<br />
7
Useful Tools: Bibliography Management<br />
• BibDesk is a bibliography manager which will even keep track <strong>of</strong> the corresponding<br />
PDFs <strong>for</strong> you (Mac only, included in MacTeX)<br />
• JabRef is cross-plat<strong>for</strong>m, so works on Windows and Linux as well.<br />
• Other reference managers like CiteULike, Mendeley, and Zotero can import<br />
and export BibTEX files.<br />
Conversion Tools<br />
• l2rtf is an online tool to convert L A TEX to RTF<br />
• pandoc can convert to and from dozens <strong>of</strong> <strong>for</strong>mats (and it’s written by<br />
philosopher John MacFarlane!)—including L A TEX<br />
• TeX4HT is way <strong>for</strong> L A TEX to output HTML instead<strong>of</strong> PDF—and it also<br />
can output OpenDocument <strong>for</strong>mat.<br />
• Write2LaTeX is an extension that lets LibreOffice export to L A TEX<br />
• Use these and Word/LibreOffice to do a word count, or directly using<br />
texcount.<br />
4 Packages You Should Look At<br />
Layout: memoir<br />
• memoir is a document class <strong>for</strong> producing anything from articles to books<br />
• It provides ability to customize layout <strong>of</strong> your document, chapter and<br />
section headings, etc.<br />
• It includes many useful packages which relate to layout <strong>of</strong>:<br />
– tables<br />
– tables <strong>of</strong> contents<br />
– page headers<br />
– endnotes<br />
Linking: hyperref<br />
• Put hyperlinks to websites in your documents<br />
• Automatically put in-document links from TOC to sections, citations to<br />
bibliography, etc.<br />
• Also lets you set options in the final PDF such as bookmarks, pagemode,<br />
title, author, etc.<br />
8
Bibliographies: natbib<br />
• The “standard” way to do bibliographic references<br />
• Supports author-year style:<br />
– \citep{Quine1951} produces a parenthetical citation: (Quine 1951)<br />
– \citet{Quine1951} produces an in-text citation: Quine (1951)<br />
• Works with BibTEX to turn bibliography databases into bibliographies <strong>for</strong><br />
your document<br />
• Most journals have bibliography styles that work with natbib<br />
Bibliographies: biblatex<br />
• The modern way to do bibliographies in L A TEX<br />
• Supports not only author-year style but also in-text citations and footnoted<br />
references (footnotes contain bibliographic in<strong>for</strong>mation, no separate<br />
bibliography)<br />
• Supports bibliography databases in the cloud<br />
• Journals unlikely to support biblatex yet<br />
• Most conversion programs don’t work<br />
Presentations: beamer<br />
• Produces presentations as PDFs (use full-screen mode)<br />
• Comes with many predefined themes<br />
• Lets audience track progress through presentation<br />
• Generate handout and presentation from same document<br />
• Supports overlays<br />
5 Conclusion<br />
Conclusion<br />
• It’s good to know what L A TEX is—even if you don’t want to use it—and<br />
now you do<br />
• You might have to or want to use it some or most <strong>of</strong> the time<br />
– Lots <strong>of</strong> people use it, even some publishers<br />
9
– It makes really pretty documents<br />
– It might give you an edge <strong>for</strong> a job<br />
– Once you’ve learned to use it, it can be a big time saver<br />
– If your documents are simple, using L A TEX can be simple too<br />
• You know the pitfalls and dangers<br />
More Reading<br />
– It’s rough around the edges<br />
– Don’t get sucked in—your work is more important!<br />
• Everything L A TEX related can be found on the Comprehensive TEX Archive<br />
Network CTAN<br />
• WikiBooks: L A TEX<br />
• L A TEX <strong>for</strong> Luddites (An Ancient Philosopher’s Guide)<br />
• L A TEX<strong>for</strong> Logicians<br />
• Need a symbol in L A TEX? Try Detexify<br />
10