Making Friends With LATEX - Ctan.math.utah.edu

Transcription

Making Friends with LATEXVersion 2.00Rohit Vishal KumarReaderDepartment of Marketing & FinanceXavier Institute of Social ServiceP.O. Box No: 7, Purulia RoadRanchi - 834001, Jharkhand, IndiaEmail: rohitvishalkumar@yahoo.comOctober 9, 2006c Rohit Vishal Kumar 2006MFwL Ver 2.0 – 1 / 64

contentscontentsFront MatterFront MatterIntroduction to LATEXOur First LATEX SourceLATEX Document StructureSome EnvironmentsComplex EnvironmentsIntroduction to LATEXOur First LATEX SourceLATEX Document StructureSome EnvironmentsFloating EnvironmentsWorking with MathsWorking with BIBTEXMiscellaneousComplex EnvironmentsFloating EnvironmentsWorking with MathsInstalling LATEXIn the endWorking with BIBTEXMiscellaneousInstalling LATEXIn the endc Rohit Vishal Kumar 2006MFwL Ver 2.0 – 2 / 64

contentsFront n to LATEXOur First LATEX SourceLATEX Document StructureFront MatterSome EnvironmentsComplex EnvironmentsFloating EnvironmentsWorking with MathsWorking with BIBTEXMiscellaneousInstalling LATEXIn the endc Rohit Vishal Kumar 2006MFwL Ver 2.0 – 3 / 64

acknowledgementcontentsFront MatterMany hours of work has gone in to making this presentation. But most of all, thispresentation has benefitted from the criticisms and comments from various on to LATEXOur First LATEX SourceLATEX Document StructureSubha Natarajan for proof reading the earlier version of the document without knowing aniota of LATEX . Dan Luecking for a detailed list of erratta which proved extremely helpful indeveloping this version of the document. Kenneth Jacker for his encouraging words andPhil M Perry for his slide by slide comment on the earlier version of the document. DVenu Gopal for sending me his excellent presentation on LATEX.Some EnvironmentsComplex EnvironmentsFloating EnvironmentsWorking with MathsWorking with BIBTEXThanks are also due to Hendri Adriaens and Christopher Ellison for the powerdotpackage and Denis Girou, Sebastian Rahtz and Timothy Van Zandt for the fancyvrbpackage.Finally, thanks are due to my wife, Neerajakshi, and my son, Devansh, who tolerated myMiscellaneousInstalling LATEXIn the endlate nights on computer with the outmost of patience. I could not have done this withoutyour support. And of course, to everyone, who downloaded MFwL Version 1 and found ituseful. Of course, errors will remain and the only person responsible for them, to quoteHarry Potter, is “you-know-who”.c Rohit Vishal Kumar 2006MFwL Ver 2.0 – 4 / 64

licensecontentsFront MatteracknowledgementlicenseconventionsThis document is released under the LATEX Project Public License (LPPL) Version1.3c or any newer version that may be released by the LATEX3 Project.A copy of the license can be found here: LATEX Project.Introduction to LATEXOur First LATEX SourceLATEX Document StructureSome EnvironmentsComplex EnvironmentsFloating EnvironmentsWorking with MathsWorking with BIBTEXMiscellaneousInstalling LATEXIn the endc Rohit Vishal Kumar 2006MFwL Ver 2.0 – 5 / 64

conventionscontentsThis document is primarily focussed on new users of LATEX on Windows platform.The reason is that most of the computer users are first exposed to MS Windowsand therefore to MS Word. This in turn leads to sloppy writing skills, where moretime is spent on choosing fonts, colours and what-not; than on writing.Front n to LATEXThere are some conventions used in this presentation:Our First LATEX SourceLATEX Document StructureCode: Code is presented in a frame with line numbers as follows:Some EnvironmentsBegin CodeComplex EnvironmentsCode Line.Code Line1Floating Environments2Working with Maths3Working with BIBTEXEnd CodeMiscellaneousInstalling LATEXIn the endOutput: Output is presented below the following marker: c:\output Links: Hyperlinks are in blue like thisc Rohit Vishal Kumar 2006MFwL Ver 2.0 – 6 / 64

contentsFront MatterIntroduction to LATEXthe history of TEX & LATEXword processors vs. LATEXpros of LATEXcons of LATEXOur First LATEX SourceLATEX Document StructureIntroduction to LATEXSome EnvironmentsComplex EnvironmentsFloating EnvironmentsWorking with MathsWorking with BIBTEXMiscellaneousInstalling LATEXIn the endc Rohit Vishal Kumar 2006MFwL Ver 2.0 – 7 / 64

the history of TEX & LATEXcontentsFront Matter TEXwas created by Prof. Donald Knuth He was dissatisfied with the final proof of his Magnum Opus “The Art ofIntroduction to LATEXthe history of TEX & LATEXword processors vs. LATEXpros of LATEXcons of LATEXOur First LATEX SourceLATEX Document StructureSome Environments Complex EnvironmentsComputer Programming”Started work on TEX in 1977 and the first version was released in 1982His efforts were supported by American Mathematical SocietyHowever, the TEX was not a user friendly softwareIn 1985, Leslie Lamport created the LATEX interface for TEXLATEX was further developed by a group of people - Frank Mittelbach, DavidCarlisle et. al. and was released as LATEX 2ε in 1994Floating EnvironmentsWorking with MathsWorking with BIBTEXMiscellaneousInstalling LATEXIn the endc Rohit Vishal Kumar 2006MFwL Ver 2.0 – 8 / 64

word processors vs. LATEXcontentsWriting a large document has four basic stages:Front MatterIntroduction to LATEXthe history of TEX & LATEXword processors vs. LATEXpros of LATEXcons of LATEXOur First LATEX SourceLATEX Document StructureSome EnvironmentsComplex EnvironmentsFloating Environments Writing the draft Typesetting Proof reading Making the final copyUsers of Word Processors — which are WYSIWYG in nature — normally end upwriting, typesetting and to an extent, proof reading simultaneously. For example,changing the font size for headings, or spending time on trying to correct apresumed grammatical error or spelling mistake. This distracts from the main taskof translating the thoughts into words.Working with MathsWorking with BIBTEXMiscellaneousLATEX minimizes the distraction by taking away (almost) the task of typesetting andforcing the user to think in terms of the logical structure of the document.Installing LATEXIn the endc Rohit Vishal Kumar 2006MFwL Ver 2.0 – 9 / 64

pros of LATEXcontentsLATEX provides the following advantages:Front MatterIntroduction to LATEXthe history of TEX & LATEXword processors vs. LATEXpros of LATEXcons of LATEXOur First LATEX SourceLATEX Document StructureSome EnvironmentsComplex EnvironmentsFloating EnvironmentsWorking with MathsWorking with BIBTEXMiscellaneousInstalling LATEXIn the end1. Structured Documents: LATEX forces the user to think in terms of the structure of thedocument. So the user has to think in terms of chapters, sections, subsections etc.This leads to more organised presentation of thoughts.2. Consistent Formatting: LATEX documents are formatted consistently. All chapter,section, subsection style would be the same through out the document.3. Professional Output: LATEX produces it output in formats which render same acrosscomputers and operating systems. The default output is in DVI (Device Independent)format. It can also produce PS (Postscript) or PDF (Portable Document Format)4. Reusable Source: LATEX documents can be thought of as source-code which iscompiled to get the output. As the source-code is in plain text it can be used acrossany operating system where LATEX is available5. Extremely Extensible: LATEX can be extended using packages. Packages exist fordoing any possible task. If none exist, user can write his own package with a littleprogramming knowledge, thus providing flexibility to meet all possible user needs6. Free: LATEX is freely available, freely distributable and free to usec Rohit Vishal Kumar 2006MFwL Ver 2.0 – 10 / 64

cons of LATEXcontentsFront MatterIntroduction to LATEXPersonally, since I discovered LATEX I have stopped using word processors —except in office where people still require it. However it does has certaindisadvantages:the history of TEX & LATEXword processors vs. LATEXpros of LATEXcons of LATEXOur First LATEX Source1. Not Easy to Configure: Configuring LATEX is not an easy task. If you wish to changestyles, shapes etc. you may have to use low level commands2. Requires Patience: Yes. LATEX requires patience to learn and use. If you are addictedto the click-select-change method of Word Processors you may find it hard workLATEX Document StructureSome EnvironmentsComplex EnvironmentsFloating EnvironmentsWorking with MathsWorking with BIBTEXMiscellaneousInstalling LATEXIn the endc Rohit Vishal Kumar 2006MFwL Ver 2.0 – 11 / 64

contentsFront MatterIntroduction to LATEXOur First LATEX Sourceour first LATEX documentcompiling the LATEX Sourceour first LATEX outputLATEX Document StructureSome EnvironmentsOur First LATEX SourceComplex EnvironmentsFloating EnvironmentsWorking with MathsWorking with BIBTEXMiscellaneousInstalling LATEXIn the endc Rohit Vishal Kumar 2006MFwL Ver 2.0 – 12 / 64

our first LATEX documentcontentsFront MatterIntroduction to LATEXOur First LATEX Sourceour first LATEX documentcompiling the LATEX Sourceour first LATEX outputLATEX Document StructureSome EnvironmentsComplex EnvironmentsFloating Environments1Begin document}456789Working with Maths10Working with BIBTEX11Miscellaneous12Installing LATEX13In the end14c Rohit Vishal Kumar 2006Let D be a subset of \bf R and let f \colon D\to \mathbf{R} be a real-valued function on D .The function f is said to be \emph{continuous}on D if, for all \epsilon 0 and for all x\in D , there exists some \delta 0 (which maydepend on x ) such that if y \in D satisfies\[ y - x \delta \] then \[ f(y) - f(x) \epsilon. \]\end{document}End CodeMFwL Ver 2.0 – 13 / 64

compiling the LATEX SourcecontentsAssuming that you are in a Windows environment and already have MiKTEX youwill need to do the following:Front MatterIntroduction to LATEX Our First LATEX Sourceour first LATEX documentcompiling the LATEX Sourceour first LATEX outputLATEX Document StructureType the source in a text file using any text editorSave the file and give it a name, say, myfile.texThe default extension of LATEX source file is .texNow go to the command prompt and type:Begin CommandSome EnvironmentsComplex EnvironmentsFloating Environmentsc:\ latex myfile.texc:\ yap myfile.dvi1516End CommandWorking with MathsWorking with BIBTEXMiscellaneousInstalling LATEXIn the endThe first line tells LATEX to process the source. If there are no errors, LATEXproduces a DVI (DeVice Independent) file which can be viewed using theprogram YAP (Yet Another Previewer). Under Linux, the steps are the same,except that you would probably use XDVI to preview the .dvi file.c Rohit Vishal Kumar 2006MFwL Ver 2.0 – 14 / 64

our first LATEX outputcontentsThe Output of the above code would be as follows:Front MatterIntroduction to LATEXc:\output Our First LATEX Sourceour first LATEX documentcompiling the LATEX Sourceour first LATEX outputLATEX Document StructureLet D be a subset of R and let f : D R be a real-valued function on D . Thefunction f is said to be continuous on D if, for all ǫ 0 and for all x D , thereexists some δ 0 (which may depend on x) such that if y D satisfiesSome Environments y x δComplex EnvironmentsFloating EnvironmentsthenWorking with MathsWorking with BIBTEX f (y) f (x) ǫ.MiscellaneousInstalling LATEXIn the endc Rohit Vishal Kumar 2006MFwL Ver 2.0 – 15 / 64

contentsFront MatterIntroduction to LATEXOur First LATEX SourceLATEX Document Structuredocument structurepreambledocumentclass: optionalargumentsLATEX Document Structurepreamble: other optionspreamble: the final formbodyparagraph modeentering special charactersSome EnvironmentsComplex EnvironmentsFloating EnvironmentsWorking with MathsWorking with BIBTEXMiscellaneousInstalling LATEXIn the endc Rohit Vishal Kumar 2006MFwL Ver 2.0 – 16 / 64

document structurecontentsA LATEX document is divided in to two parts:Front MatterIntroduction to LATEXOur First LATEX SourceLATEX Document StructureP REAMBLE : Contains all formatting information, declarations about whichpackages to use, title of the document, authorship etc. B ODY: contains the material that is to be typeset. document structurepreambledocumentclass: optionalargumentspreamble: other optionspreamble: the final formbodyparagraph modeentering special charactersSome EnvironmentsComplex EnvironmentsFloating EnvironmentsWorking with MathsWorking with BIBTEXMiscellaneousInstalling LATEXIn the endc Rohit Vishal Kumar 2006MFwL Ver 2.0 – 17 / 64

preamblecontentsThe Preamble is the contains the following commands:Begin kage[option-list]{package-name}\title{Name of the Article}\author{Name of the Author(s)}\date{17th November, 2005}End CodeFront MatterIntroduction to LATEX17Our First LATEX Source18LATEX Document Structure19document structurepreambledocumentclass: optional2021argumentspreamble: other optionspreamble: the final formbodyparagraph mode \documentclass[.]{class-name] is mandatory. In LATEX the following are valid document classes:entering special characters Some EnvironmentsComplex Environments Floating EnvironmentsWorking with MathsWorking with BIBTEXMiscellaneous Installing LATEXIn the endc Rohit Vishal Kumar 2006book: This class is used for typesetting booksreport: This class is used for typesetting reportsarticle: This is used for typesetting articlesletter: This is used for writing lettersslides: This is used for making presentations[.] encloses the optional arguments, which may or may not be given. Ifoptional arguments are not given LATEX uses the default parameters.MFwL Ver 2.0 – 18 / 64

documentclass: optional argumentscontentsLATEX provides lots of optional parameters for the documentclass.Front MatterArgumentTypeface SizePaper SizeIntroduction to LATEXOur First LATEX SourceLATEX Document Structuredocument structurepreambledocumentclass: optionalPaper OrientationTitle PageEquation NumberingEquation AlignmentOutput TypeLayout TypeChapter OpeningColumnsargumentspreamble: other optionspreamble: the final formbodyparagraph modeentering special charactersSome EnvironmentsComplex EnvironmentsFloating EnvironmentsWorking with MathsWorking with BIBTEXMiscellaneousPossible Values10pt, 11pt, 12pta4paper, a5paper,letterpaper, legalpaperexecutivepaper b5paperportrait, landscapetitlepage, notitlepageleqnofleqndraft, finaloneside, twosideopenright, openanyonecolumn, twocolumnDefault Value10ptletterpaperportraittitlepageRight sideCenteredfinalonesideopenrightonecolumnNOTE: The slides class does not accepts all the above mentioned arguments.Layout Type, Chapter Opening, Columns are not available to slides class.Installing LATEXIn the endc Rohit Vishal Kumar 2006MFwL Ver 2.0 – 19 / 64

preamble: other optionscontents Front MatterIntroduction to LATEXOur First LATEX Source LATEX Document Structuredocument structurepreambledocumentclass: optionalargumentspreamble: other optionspreamble: the final formbodyparagraph modeentering special characters Some EnvironmentsComplex Environments \usepackage[option-list]{package-name} is used to include thevarious packages that control the layout of various elements in the document.Packages normally have the extension .sty for styleVarious packages are available from CTAN (Comprehensive TEX ArchiveNetwork). Read the package documentation carefully before attempting touse a package\title{.} is used to insert the title of the document\author{.} is used to insert the name of the author(s) and affiliation\\ is used to insert a new lineMultiple authors are separated by \and\date{.} is used to insert the date. If date is not specified, LATEX usesthe current system date% introduces a comment till the end of the lineFloating EnvironmentsWorking with MathsWorking with BIBTEXMiscellaneousInstalling LATEXIn the endc Rohit Vishal Kumar 2006MFwL Ver 2.0 – 20 / 64

preamble: the final formcontentsHere is the preamble in all its glory.Front MatterIntroduction to LATEXOur First LATEX Source22LATEX Document Structure23document structure24preambledocumentclass: optional25argumentspreamble: other optionspreamble: the final form2627body28paragraph modeentering special characters29Some Environments30Complex Environments31Floating Environments32Working with Maths33Working with BIBTEX34MiscellaneousBegin e}\usepackage{graphicx}% use package graphicx\usepackage{setspace}% use package setspace.% add more packages\title{This is my Thesis} % This is the title\author{My Name\\% This is my nameMy Institution\\% This is my Intitute.\\% Address (if you wish)\and Another Author \\% Another author’s nameHis Institution\\% This is his institute.\\% His Address}% End of author block\date{14 Sept 1972}% This gives the dateEnd CodeInstalling LATEXIn the endc Rohit Vishal Kumar 2006MFwL Ver 2.0 – 21 / 64

bodycontents Body is enclosed within the following command:Front MatterIntroduction to LATEXOur First LATEX SourceLATEX Document Structuredocument mbleBegin Code% Start of the Document% Some Matter% End of the DocumentEnd Codedocumentclass: optionalargumentspreamble: other options LATEX works in three different modes within the bodypreamble: the final formbodyparagraph modeentering special charactersSome EnvironmentsComplex EnvironmentsPARAGRAPH M ODE : Used for processing normal textM ATH M ODE : Used for processing Mathematical Equations andFormulas. It has three different sub-modes viz. Math, Displaymath andEquation L EFT-R IGHT M ODE : A special kind of mode used for specific purposes Floating EnvironmentsWorking with MathsWorking with BIBTEXMiscellaneousInstalling LATEXIn the endc Rohit Vishal Kumar 2006MFwL Ver 2.0 – 22 / 64

paragraph modecontentsFront Matter In paragraph mode, LATEX works by defining environments It is a special area in the document which tells LATEX to treat the matterIntroduction to LATEXOur First LATEX Source LATEX Document Structuredocument structurepreambledocumentclass: optionalargumentspreamble: other options present in a separate mannerAny environment is within a \begin{environment} and\end{environment} command.LATEX provides numerous prespecified environmentsEnvironments can be customised or user definedWe shall look at some available environments in the next sectionpreamble: the final formbodyparagraph modeentering special charactersSome EnvironmentsComplex EnvironmentsFloating EnvironmentsWorking with MathsWorking with BIBTEXMiscellaneousInstalling LATEXIn the endc Rohit Vishal Kumar 2006MFwL Ver 2.0 – 23 / 64

entering special characterscontentsThe following special characters cannot be entered directly in the document.Front MatterSpecial Character# (hash) (dollar)% (percent)(underscore){ (left curly brace)} (right curly brace) (tilde) (caret)\ (backslash)Introduction to LATEXOur First LATEX SourceLATEX Document Structuredocument structurepreambledocumentclass: optionalargumentspreamble: other optionspreamble: the final formbodyparagraph modeentering special charactersSome EnvironmentsComplex EnvironmentsFloating Environments Working with MathsWorking with BIBTEX MiscellaneousInstalling LATEX In the endc Rohit Vishal Kumar 2006Type the Following\#\ \%\\{\}\ {}\ {} \backslash Output# %{} ˆ\ is normally used to put tilde accent over the following letter (Ã); hence itneeds the {} to ensure correct display. is normally used to put a superscript in math mode (X A ); hence it needsthe {} to ensure correct display.\ escaped with a \ is a \\ which is a newline insertion. To correctly get the \we use the \backslash MFwL Ver 2.0 – 24 / 64

contentsFront MatterIntroduction to LATEXOur First LATEX SourceLATEX Document StructureSome Environmentsalignmentbullets and listsSome Environmentsbullets and lists (code)quotationquotation (code)verseabstractComplex EnvironmentsFloating EnvironmentsWorking with MathsWorking with BIBTEXMiscellaneousInstalling LATEXIn the endc Rohit Vishal Kumar 2006MFwL Ver 2.0 – 25 / 64

alignmentcontentsAlignments are useful if we want to move a block of text to left right or center. Seethe code and the output below:Front MatterBegin CodeIntroduction to LATEXOur First LATEX Source38LATEX Document Structure39Some Environments\begin{flushleft}This is flushed to the left\end{flushleft}\begin{flushright}This is flushed to the Right\end{flushright}\begin{center}And this is dead center\end{center}End Code40alignmentbullets and listsbullets and lists (code)4142quotation43quotation (code)verseabstractComplex Environments444546Floating EnvironmentsWorking with MathsWorking with BIBTEXMiscellaneousc:\output This is flushed to the leftInstalling LATEXThis is flushed to the RightIn the endc Rohit Vishal Kumar 2006And this is dead centerMFwL Ver 2.0 – 26 / 64

bullets and listscontentsLATEX provides three different methods for itemising your document:Front MatterIntroduction to LATEXOur First LATEX SourceLATEX Document StructureSome Environments alignmentbullets and listsbullets and lists (code) quotationquotation (code)verseitemize environment produces bulletsenumerate environment produces numberdescription environment provides a labelled itemItem within itemize and enumerate environment are preceded with the\item command.Item within description environment are preceded with the\item[label] command. Items can be nested within each otherabstractComplex EnvironmentsFloating EnvironmentsWorking with MathsWorking with BIBTEXMiscellaneousInstalling LATEXIn the endc Rohit Vishal Kumar 2006MFwL Ver 2.0 – 27 / 64

bullets and lists (code)Begin CodecontentsFront MatterIntroduction to LATEX48Our First LATEX Source49LATEX Document Structure50Some Environments51alignment\begin{itemize}\item This is the an itemized item\end{itemize}\begin{enumerate}\item This is an enumerated item\end{enumerate}\begin{description}\item[hello] This is a description\end{description}End Code4752bullets and listsbullets and lists (code)quotationquotation (code)535455verseabstractComplex Environmentsc:\output Floating EnvironmentsWorking with MathsWorking with BIBTEX This is the an itemized item1.This is an enumerated itemMiscellaneousInstalling LATEXhelloThis is a descriptionIn the endc Rohit Vishal Kumar 2006MFwL Ver 2.0 – 28 / 64

quotationcontentsLATEX has provided two environment for including quotation.Front MatterIntroduction to LATEX Our First LATEX Source LATEX Document StructureSome Environmentsalignmentbullets and listsbullets and lists (code)quote is used for inserting short quotationquotation is used for inserting longer quotation with a blank lineThere is not much difference between the quote and the quotationenvironment; except that the margins of the quotation environment areindented on the left and right. Text is justified on both the margins and leaving ablank line produces a new paragraphquotationquotation (code)verseabstractComplex EnvironmentsFloating EnvironmentsWorking with MathsWorking with BIBTEXMiscellaneousInstalling LATEXIn the endc Rohit Vishal Kumar 2006MFwL Ver 2.0 – 29 / 64

quotation (code)Begin CodecontentsFront MatterIntroduction to LATEX57Our First LATEX Source58LATEX Document Structure59Some Environments60alignment\begin{quote}Now go forth and conquer the World andkeep on going forth and forth and forthuntil you reach the fjord of the forth\end{quote}\begin{quotation}Now go forth and conquer the World andkeep on going forth and forth and forthuntil you reach the fjord of the forth\end{quotation}End Code5661bullets and listsbullets and lists (code)quotationquotation (code)626364verseabstract65Complex EnvironmentsFloating Environmentsc:\output Working with MathsWorking with BIBTEXMiscellaneousNow go forth and conquer the World and keep on going forth andforth and forth until you reach the fjord of the forthInstalling LATEXIn the endc Rohit Vishal Kumar 2006Now go forth and conquer the World and keep on going forthand forth and forth until you reach the fjord of the forthMFwL Ver 2.0 – 30 / 64

verseLATEX provides the verse environment for typesetting poetry. The margins areintended on the left and right and each line of the stanza is separated with \\.Each stanza is separated from each other by a blank line.contentsFront MatterIntroduction to LATEXBegin CodeOur First LATEX SourceLATEX Document StructureSome Environments\begin{verse}Early in the morning \\come to me \\I will teach you \\A, B, C . \\\end{verse}6667alignmentbullets and listsbullets and lists (code)6869quotation70quotation (code)verse71abstractComplex EnvironmentsEnd Codec:\output Floating EnvironmentsWorking with MathsWorking with BIBTEXMiscellaneousInstalling LATEXEarly in the morningcome to meI will teach youA, B, C .In the endc Rohit Vishal Kumar 2006MFwL Ver 2.0 – 31 / 64

abstractThe abstract environment is to typeset abstracts in books, reports and articles.contentsBegin CodeFront MatterIntroduction to LATEX72Our First LATEX Source73LATEX Document Structure74\begin{abstract}This is the abstract of my pathbreaking paper\end{abstract}End CodeSome Environmentsalignmentbullets and listsc:\output bullets and lists (code)quotationAbstractquotation (code)verseThis is the abstract of my pathbreaking paperabstractComplex EnvironmentsFloating EnvironmentsWorking with MathsWorking with BIBTEXMiscellaneousInstalling LATEXIn the endc Rohit Vishal Kumar 2006MFwL Ver 2.0 – 32 / 64

contentsFront MatterIntroduction to LATEXOur First LATEX SourceLATEX Document StructureSome EnvironmentsComplex EnvironmentstabularComplex Environmentstabular (code)tabbingtabbing (code)Floating EnvironmentsWorking with MathsWorking with BIBTEXMiscellaneousInstalling LATEXIn the endc Rohit Vishal Kumar 2006MFwL Ver 2.0 – 33 / 64

tabularcontentsFront MatterLATEX allows the creation of tabular output using the tabular environment. Thefollowing should be noted:Introduction to LATEXOur First LATEX Source LATEX Document StructureSome Environments Complex Environmentstabulartabular (code)tabbing tabbing (code)Floating EnvironmentsWorking with Maths Working with BIBTEXMiscellaneous\begin{tabular}{no-of-columns} required the user to specify thenumber of columns the environment should create.This alignment of each column is determined by a single alphabet - l (leftaligned), r (right aligned) or c (centered).Each column entry is separated by & and each row by \\Horizontal lines are entered with the \hline command and vertical lines areinserted by . Vertical lines can be entered only when the number of columnsis specified.\multicolumn{N}{A}{T} command allows us to span columns; where Nindicated the number of columns to span, A indicates the alignment of thecolumn and T indicates the Text of the spanned columnInstalling LATEXIn the endc Rohit Vishal Kumar 2006MFwL Ver 2.0 – 34 / 64

tabular (code)Begin Code\begin{tabular}{ l c r }\hlineCity& State& Population \\\hlineNew Delhi & NCR& 1,279,000 \\\hlineKolkata& WB& 1,322,000 \\\hline\end{tabular}End CodecontentsFront MatterIntroduction to LATEX7576Our First LATEX Source77LATEX Document Structure78Some Environments79Complex Environments80tabular81tabular (code)tabbingtabbing (code)8283Floating EnvironmentsWorking with MathsWorking with BIBTEXc:\output MiscellaneousInstalling LATEXIn the endc Rohit Vishal Kumar 2006CityNew MFwL Ver 2.0 – 35 / 64

tabbingcontentsFront MatterIntroduction to LATEXLATEX allows use of the tabbing environment to align text in columns. It works bysetting tab stops and allow jumping between the tabs as in old fashionedtypewriter. The following are useful in the tabbing environment.Our First LATEX SourceLATEX Document StructureSome EnvironmentsComplex Environmentstabulartabular (code)tabbingtabbing (code)Floating EnvironmentsWorking with MathsWorking with BIBTEXMiscellaneousInstalling LATEXIn the end \ sets a tab stop at the current position\ advances to the next tab stop\ moves the left margin (of the next and all following commands) one tab tothe right \- moves the left margin (of the next and all following commands) one tab tothe left \kill sets the tab stops without producing any text \pushtabs saves all current tab position and allows temporary changing oftab stops position. A subsequent use of \pushtabs restores all previous tabstopsPersonally i have never preferred the tabbing environment. But then, it is prettyuseful at times.c Rohit Vishal Kumar 2006MFwL Ver 2.0 – 36 / 64

tabbing (code)Begin CodecontentsFront MatterIntroduction to LATEX85Our First LATEX Source86LATEX Document Structure87Some Environments88Complex Environments89tabular\begin{tabbing}function \ fact(n : integer) : integer;\\\ begin \ \ \\\ if \ n 1 then \ \\fact : n * fact(n-1) \- \\end;\\\end{tabbing}End Code8490tabular (code)tabbingtabbing (code)c:\output Floating EnvironmentsWorking with MathsWorking with BIBTEXMiscellaneousInstalling LATEXIn the endfunction fact(n : integer) : integer;beginif n 1 thenfact : n * fact(n-1)end;c Rohit Vishal Kumar 2006MFwL Ver 2.0 – 37 / 64

contentsFront MatterIntroduction to LATEXOur First LATEX SourceLATEX Document StructureSome EnvironmentsComplex EnvironmentsFloating EnvironmentsFloating Environmentswhat do you mean: floating?more on floatstabletable (output)figurefigure (output)Working with MathsWorking with BIBTEXMiscellaneousInstalling LATEXIn the endc Rohit Vishal Kumar 2006MFwL Ver 2.0 – 38 / 64

what do you mean: floating?contentsFront MatterIntroduction to LATEXYes. You heard right. LATEX has two environments which it treats as floats —figure and table. Floating bodies are treated in special way following thegiven logic:Our First LATEX SourceLATEX Document Structure Step 1:Try to place the float on the desired pageSome Environments success - carry on and typeset the page no success - place the float

license conventions Introduction to LATEX Our First LATEX Source LATEX Document Structure Some Environments Complex Environments Floating Environments Working with Maths Working with BIBTEX Miscellaneous Installing LATEX In the end c Rohit Vishal Kumar 2006 MFwL Ver 2.0 - 4 / 64 Many hours of work has gone in to making this presentation. But .