The v er y shor t guide to typesetting with L A T E X
SilmarilConsultants TextualTherapyDivision latex.silmaril.ie October2009
W hat’ s this all about? W hat’ s L
AT E X? L
AT E X is a document pr epar ation system for the
T E
X typesetting pr ogr am. It enables y ou to pr oduce publication-quality output with gr eat accur acy and consistency . L
AT E X wor ks on any computer and pr oduces industr y-standar d PS or PDF documents . It is av ailable both in fr ee (open-sour ce) and commer cial implementations . L
AT E X can be used for any kind of do cument, but it is especially suited to those with a complex str uctur e , repetitiv e for matting, or notations like mathematics
1; or wher e technical stability , dimensional accur acy , or a persistent and non-pr opr ietar y file for mat ar e needed. S yntax (ho w to type L
AT E X commands — these ar e the rules) All L
AT E X commands begin with a backslash .
Example:\tableofcontents If a command needs text to w or k with, it goes in cur ly braces .
Example:\title{Irisches Tagebuch}\author{Heinrich Böll} If options ar e used, they go in squar e brackets first .
Example:\documentclass[a4pap er,11pt]{book} S pace after commands
withoutbraces gets suppr essed .
Example:Copyright \copyr ight 2009 !
Copyright©2009 !T o pr ev ent this , put empty curly br aces after the command.
Example:Copyright \copyr ight{} 2009 !
Copyright©2009 "C ur ly braces ar e also used to restr ict the scope of effects inside them .
Example:Some {\tiny l ittle} word !
SomelittlewordC reating and typesetting your document 1. C reate y our document using any suitable plain-text editor with L
AT E X contr ols , eg
T EXshop
(M ac),
T EXnicCenter
(W in),
Kile(Linux),
Emacs(all); 2. S av e the file with a name ending in
.tex(
neveruse spaces in filenames!); 3. U se the toolbar buttons or menu items in y our editor to ty peset and display the document; 4. M ake any changes needed in y our or iginal doc ument and repeat step 3.
ANote.ThisguideshowsonlyatinyfractionofLT EX’spower.Forinformation,visittheT EXUsersGroupsite(www.tug.org).Forhelp,seetheFAQ(www.tex.ac.uk/faq)andthe Usenetnewsgroupcomp.text.tex.Forpackages,usetheComprehensiveT EXArchive Network(www.ctan.org).Fordocumentation,usethesourcesintheReferences[2]. 1Forreasonsofspacethisguidedoesnotcoverdetailsofmathematicstypesetting.
T ables and F igur es ,
continued \begin{figure} \caption{SwissandDutchMennonitemigrationsofthe1700sand1800s}\label{lmig} \centering(graphicsmustbeEPSfilesforstandardLAT EX;butJPG,PNG,orPDFforpdfLAT EX) \includegraphics[width=.8\columnwidth]{menno-a} \\\scriptsizeCourtesyofPaulC.Adams,DepartmentofGeographyandthe Environment,UniversityofTexasatAustin.\cite{adams}\end{figure} Figure1:SwissandDutchMennonitemigrationsofthe1700sand1800s CourtesyofPaulC.Adams,DepartmentofGeographyandtheEnvironment,UniversityofTexasatAustin.[1]F ootnotes, citations, refer ences, and index es (back matter) Y ou do footnotes with a simple command,
2see belo w . Citations using BIB
T E X (P atashnik, 1988) ar e also easy (see [2], §7.4.2) and ther e ar e packages for mor e complex for mats for jour nals and publishers . Y ou can add indexes with the
\indexcommand and the
makeindexpr ogr am.
Youdofootnoteswithasimplecommand,\footnote{Likethis.}seebelow.Citations usingBIB\TeX{}\citeauthoryear{oren}arealsoeasy(see\cite[§7.4.2]{flynn}and therearepackagesformorecomplexformatsforjournalsandpublishers.Youcan addindexeswiththe\verb‘\index‘commandandthe\textsf{makeindex}program. addthefollowingattheendofyourdocumentandcreatemyrefs.bib(seeBIBT EXmanual[3]) \bibliography{myrefs}\bibliographystyle{apalike}
R efer ences
1.Adams,PaulC.LinguisticChaosinMontreal,www.utexas.edu/depts/grg/adams/chaos.ppt, 2/59,Oct2006. 2.Flynn,P.FormattingInformation,2005,atlatex.silmaril.ie/formattinginformation/ 3.Patashnik,O.BIBT E
Xing,TEXUsersGroup,1988(distributedwithallcopiesofLAT EX). 4.Sherington,J.exampletablein‘InformativePresentationofTables,GraphsandStatistics’,4.2, StatisticalServicesCentre,UniversityofReading,www.reading.ac.uk/ssc/publications/ guides/toptgs.html 5.
T E
XUsersGroup,for
T E
XLive(www.tug.org/texlive/)andCTAN(Comprehensive
T E
X ArchiveNetwork)fordownloads(www.ctan.org). Note.CommercialimplementationsofT EXwithbusinesssupportareavailablefrom Personal
T EX,Inc(PCTBlueSkyResearch(Textures[Mac]);MacKichanSoftware,IncEX); (ScientificWord);Micropress,Inc(VT EX),TrueTSoftware(TrueTandothers.EXEX), 2Likethis.
Dozensofothersareavailable,including mathematicalanddecorativefonts.To switchtoasans-seriftypefamily(egHel- vetica,AvantGarde),use\sffamilyinyour text.Tochangefontforawordorphrase, usethesecommands(theycanbenested— seebelow): Italics\textit{Hello}Hello Boldface\textbf{Hello}Hello Smallcaps\textsc{Hello}Hello Sans-serif\textsf{Hello}Hello Monospace\texttt{Hello}Hello Example:\textit{\textbf{\textsf {bolditalsans}}}bolditalsans Fontsizingisautomaticfortitles,head- ings,andfootnotes.Therearesomenamed step-sizecommands(inpoints,relativeto thebasesize): \normalsize101112 \tiny567 \scriptsize678 \footnotesize789 \small91011 \large111214 \Large121417* \LARGE1417*20* \huge17*20*24* \Huge20*24*28*
*siz esr oundedher eto save space
butyoucanspecifyanexactsizewith thefix-cmpackageandthecommand \fontsize{pp}{bb}\selectfontforany point-size(pp)onanybaseline(bb). Group(enclose)thecommandwithits applicabletextincurlybracestopre- ventitaffectingtherestofthedocument. Forwiderline-spacing(egintheses)use thesetspacepackage.Youcanalsouse colourwiththe xcolorpackageand
G o o g l e
the\color{name}command.Lists
Therearethreebasickinds:itemizedlists (bulleted);enumeratedlists(numberedor lettered);anddescriptivelists(topic-and-explanationformat).Otherscanbede- fined,ordownloadedfromCTAN[5]. \begin{itemize} \item1lbSugar \item½ptCream \itemChocolate \end{itemize}
\begin{enumerate} \itemMixtogether \itemBoilto112°C \itemStirandcool \end{enumerate}
\begin{description} \item[Fudge]isfun... \item[Broccoli]sucks... \item[Exercise]isgood \end{description} •1lbSugar •½ptCream •Chocolate
1.Mixtogether 2.Boilto112°C 3.Stirandcool
Fudgeisfunbutnotif madetoooften. Broccolisucks,period. Exerciseisgoodforyou iftakendailyandnot toextremes. Youcannestlistsinsideeachother.See packageslikeparalistandmdwlisttocontrol listformatting.
T ables and figur es
Formaltablesandfiguresfloat(changepo- sitiontofillavailablespace)sotheymay notbeprintedwhereyoutypedthem. \begin{table} \caption{Meangrowthrateandintakes ofsupplement,milk,andwaterfor4 diets.} \label{dietgrowth}\centering \begin{tabular}{|l|r|r|r|r|}\hline &Growth&Supplement&Milk&Water\\ Supplement&rate&intake&intake&intake\\ &(g/day)&(g/day)&(ml/kg$^{0.75}$)& (ml/kg$^{0.75}$)\\\hline Lucerne&145&450&10.5&144\\\hline Sesbania&132&476&9.2&128\\\hline Leucaena&128&364&8.9&121\\\hline None&89&0&9.8&108\\\hline \end{tabular} \end{table} Table2:Meangrowthrateandintakesofsupplement, milk,andwaterforfourdiets(afterSherington,J,undated) GrowthSupplementMilkWater Supplementrateintakeintakeintake (g/day)(g/day)(ml/kg0.75)(ml/kg0.75) Lucerne14545010.5144 Sesbania1324769.2128 Leucaena1283648.9121 None8909.8108 Packageslikelongtableandarraycanhelp withmorecomplextableformats. Forhelp,seethelinksonthefrontandbackpages. Thereisasummaryofcommoncommandsat www.stdout.org/~winston/latex/latexsheet.pdf andacomprehensivelistatcomputing.ee.ethz.ch/ .soft/latex/green/ltx-2.html.B asic document str uctur e
Here’stheskeletonofaLAT EXdocument. Thesethreelinesarecompulsory:your documentwillnotworkwithoutthem: \documentclass{article} yourpreamblegoeshere(extrasetups,ifany) \begin{document} yourdocumenttextgoeshere \end{document}!
Thedocumentclassnamemustbe oneofbook,article,orreport,oran extraoneyouhavedownloadedand installed(egthesis,memoir,etc).!
Therearepapersizeoptionsa4paper (210mm×297mm)andletterpaper (8½′′×11′′)andothers(ega5paper).!
Therearebasetypesizeoptions10pt (thedefault),11pt,and12pt.F ront matter
Thepreambleiswhereyouspecifyanyex- trapackages(LAT EXplugins)suchastype- facesorspecialformattingrequirements, andwhereyouputanychangestostan- dardfeatures. \documentclass[a4paper,11pt]{book} \usepackage{charter,graphicx} \setlength{\parindent}{1em} \begin{document} \title{yourdocumenttitle} \author{yourname} \date{dateofpublication} \maketitle \begin{abstract} theparagraphsoftheabstractgohere \end{abstract} \tableofcontents restofthedocumentgoeshere \end{document} Inatypicalreportorarticle,thetitle,au- thor,date,abstract(summary),andtable ofcontents(optional)allgoatthestart,fol- lowedbyyourtext.Leaveablanklinebetweenparagraphsas youtype.Thismeans‘startanewpara- graph’,not‘leaveablankline’.Youcan controlspacingandindentationbysetting \parskipand\parindent(seeexamples), orwiththeparskippackage.