Latex guide pdf

latex manual numbering of theorems and how to work with latex in windows and latex beamer print handouts notes
AnnyPearson Profile Pic
AnnyPearson,Qatar,Researcher
Published Date:03-07-2017
Your Website URL(Optional)
Comment
A LT X Tutorials E A PRIMER Indian T X Users Group E Trivandrum, India 2003 SeptemberCONTENTS I. The Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 A I.1 What is LT X? –7• I.2 Simple typesetting –8• I.3 Fonts –13• I.4 Type size –15 E II. The Document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 II.1 Document class – 17• II.2 Page style – 18• II.3 Page numbering – 19• II.4 Formatting lengths –20• II.5 Parts of a document –20• II.6 Dividing the document –21• II.7 What next? –23 III. Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 III.1 Introduction –27• III.2 natbib –28 IV. Bibliographic Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 IV.1 The BIBT X program – 33• IV.2 BIBT X style files – 33• IV.3 Creating a bibliographic E E database –34 V. Table of contents, Index and Glossary. . . . . . . . . . . . . . . . . . . . . . 39 V.1 Table of contents –39• V.2 Index –41• V.3 Glossary –44 VI. Displayed Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 VI.1 Borrowedwords–47• VI.2 Poetryintypesetting–48• VI.3 Makinglists–48• VI.4 When order matters –51• VI.5 Descriptions and definitions –54 VII. Rows and Columns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 VII.1 Keeping tabs –57• VII.2 Tables –62 VIII. Typesetting Mathematics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 VIII.1 The basics – 77• VIII.2 Custom commands – 81• VIII.3 More on mathematics – 82• VIII.4 Mathematics miscellany – 89• VIII.5 New operators – 101• VIII.6 The many faces of mathematics –102• VIII.7 And that is not all –103• VIII.8 Symbols –103 IX. Typesetting Theorems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 A IX.1 Theorems in LT X – 109• IX.2 Designer theorems—The amsthm package – 111• IX.3 E Housekeeping –118 X. Several Kinds of Boxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 X.1 LR boxes – 119• X.2 Paragraph boxes – 121• X.3 Paragraph boxes with specific height – 122• X.4 Nested boxes –123• X.5 Rule boxes –123 XI. Floats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 XI.1 The figure environment –125• XI.2 The table environment –130 5TUTORIAL I THE BASICS A I.1. WHAT IS LT X? E A The short and simple answer is that LT X is a typesetting program and is an extension E of the original program T X written by Donald Knuth. But then what is a typesetting E program? To answer this, let us look at the various stages in the preparation of a document using computers. 1. The text isentered into the computer. 2. The input text isformatted into lines, paragraphs and pages. 3. The output text isdisplayed on the computer screen. 4. The final output isprinted. In most word processors all these operations are integrated into a single application package. But a typesetting program like T X is concerned only with the second stage E above. So to typeset a document using T X, we type the text of the document and the E necessary formatting commands in a text editor (such as Emacs in GNU/Linux) and then compile it. After that the document can be viewed using a previewer or printed using a printerdriver. T X is also a programming language, so that by learning this language, people can E A write code for additional features. In fact LT X itself is such a (large) collection of extra E features. Andthecollectiveeffortiscontinuing,withmoreandmorepeoplewritingextra packages. I.1.1. A small example A Let us see LT X in action by typesetting a short (really short) document. Start your E favorite text editor and type in the lines belowexactly as shown \documentclassarticle \begindocument This is my \emphfirst document prepared in \LaTeX. \enddocument Be especially careful with the \ character (called the backslash) and note that this is different from the more familiar / (the slash) in and/or and save the file onto the hard disk as myfile.tex. (Instead of myfile you can use any name you wish, but be sure to have .tex at the end as the extension.) The process of compiling this and viewing the output depends on your operating system. We describe below the process of doing this in GNU/Linux. 78 I. THE BASICS At the shell prompt type latex myfile Youwillseeanumberoflinesoftextscrollbyinthescreenandthenyougettheprompt back. To view the output in screen, you must have the X Window running. So, start X if you have not done so, and in a terminal window, type xdvi myfile A window comes up showing the output below A This is myfirst document prepared in LT X. E Now let us take a closer look at the source file (that is, the file you have typed). A The first line \documentclassarticle tells LT X that what we want to produce is an E article. If you want to write a book, this must be changed to \documentclassbook. The whole document we want to typeset should be included between \begindocument and \enddocument. In our example, this is just one line. Now compare this line in the source and the output. The first three words are produced as typed. Then \emphfirst, becomes first in the output (as you have probably noticed, it is a common practice to A emphasize words in print using italic letters). Thus \emph is a command to LT X to E 1 typesetthetextwithinthebracesinitalic . Again,thenextthreewordscomeoutwithout A any change in the output. Finally, the input \LaTeX comes out in the output as LT X. E A Thus our source is a mixture of text to be typeset and a couple of LT X commands E \emph and \LaTeX. The first command changes the input text in a certain way and the second one generates new text. Now call up the file again and add one more sentence given below. This is my \emphfirst document prepared in \LaTeX. I typed it on \today. What do you get in the output? What new text does the command \today generate? A I.1.2. Why LT X? E So, why all this trouble? Why not simply use a word processor? The answer lies in the motivation behind T X. Donald Knuth says that his aim in creating T X is tobeautifully E E typeset technical documents especially those containing a lot of Mathematics. It is very difficult(sometimesevenimpossible)toproducecomplexmathematicalformulasusinga word processor. Again, even for ordinary text, if you want your document to lookreally A beautiful then LT X is the natural choice. E I.2. SIMPLE TYPESETTING A WehaveseenthattotypesetsomethinginLT X,wetypeinthetexttobetypesettogether E A with some LT X commands. Words must be separated by spaces (does not matter how E many) and lines maybe broken arbitrarily. The end of a paragraph is specified by a blank line in the input. In other words, whenever you want to start a new paragraph, just leave a blank line and proceed. For example, the first two paragraphs above were produced by the input 1 This is not really true. For the real story of the command, see the section on fonts.I.2. SIMPLE TYPESETTING 9 We have seen that to typeset something in \LaTeX, we type in the text to be typeset together with some \LaTeX\ commands. Words must be separated by spaces (does not matter how many) and lines maybe broken arbitrarily. The end of a paragraph is specified by a \emphblank line in the input. In other words, whenever you want to start a new paragraph, just leave a blank line and proceed. Note that the first line of each paragraph starts with an indentation from the left margin of the text. If you do not want this indentation, just type \noindent at the start of each paragraph for example, in the above input, \noindent We have seen ... and \noindent The end of ... (come on, try it) There is an easier way to suppress para- graphindentationforallparagraphsofthedocumentinonego,butsuchtrickscanwait. I.2.1. Spaces You might have noticed that even though the length of the lines of text we type in a paragraph are different, in the output, all lines are of equal length, aligned perfectly on the right and left. T X does this by adjusting the space between the words. E In traditional typesetting, a little extra space is added to periods which end sentences and T X also follows this custom. But how does T X know whether a period ends a E E sentence or not? It assumes that every period not following an upper case letter ends a sentence. But this does not always work, for there are instances where a sentence does end in an upper case letter. For example, consider the following Carrots are good for your eyes, since they contain Vitamin A. Have you ever seen a rabbit wearing glasses? The right input to produce this is Carrots are good for your eyes, since they contain Vitamin A\. Have you ever seen a rabbit wearing glasses? Note the use of the command \ before the period to produce the extra space after the period. (Remove this from the input and see the difference in the output.) On the other hand, there are instances where a period following a lowercase letter does not end a sentence. For example Thenumbers1,2,3,etc.arecallednaturalnumbers. AccordingtoKronecker,theyweremade by God; all else being the work of Man. To produce this (without extra space after etc.) the input should be The numbers 1, 2, 3, etc.\ are called natural numbers. According to Kronecker, they were made by God;all else being the works of Man. Here, we use the command \ (that is, a backslash and a space—here and elsewhere, we sometimes use to denote a space in the input, especially when we draw attention to the space). There are other situations where the command \ (which always produce a space in the output) is useful. For example, type the following line and compile it. I think \LaTeX is fun.10 I. THE BASICS You get A I think LT Xis fun. E Whathappenedtothespaceyoutypedbetween \LaTeXand is? Yousee,T Xgobblesup E all spaces after a command. To get the required sequence in the output, change the input as I think \LaTeX\ is fun. Again, the command \ comes to the rescue. I.2.2. Quotes Have you noticed that in typesetting, opening quotes are different from closing quotes? Look at the T X output below E Note the difference in right and left quotes in ‘single quotes’ and “double quotes”. This is produced by the input Note the difference in right and left quotes in ‘single quotes’ and ‘double quotes’’. Moderncomputerkeyboardshaveakeytotypethesymbol`whichproducesaleftquote in T X. (In our simulated inputs, we show this symbol as ‘.) Also, the key ’ (the usual E ‘typewriter’ quote key, which also doubles as the apostrophe key) produces a left quote inT X. Doublequotesareproducedbytypingthecorrespondingsinglequotetwice. The E ‘usual’ double quote key " can also be used to produce aclosing double quote in T X. E Ifyourkeyboarddoesnothavealeftquotekey,youcanuse\lqcommandtoproduce it. The corresponding command \rq produces a right quote. Thus the output above can also be produced by Note the difference in right and left quotes in \lq single quotes\rq\ and \lq\lq double quotes\rq\rq. (Why the command \ after the first \rq?) I.2.3. Dashes In text, dashes are used for various purposes and they are distinguished in typesetting by their lengths; thus short dashes are used for hyphens, slightly longer dashes are used to indicatenumberrangesandstilllongerdashesusedforparentheticalcomments. Lookat the following T X output E X-rays are discussed in pages 221–225 of Volume3—the volume on electromagnetic waves. This is produced from the input X-rays are discussed in pages 221225 of Volume 3-the volume on electromagnetic waves. Note that a single dash character in the input - produces a hyphen in the output, two dashes produces a longer dash (–) in the output and three dashes - produce the longest dash (—) in the output.I.2. SIMPLE TYPESETTING 11 I.2.4. Accents Sometimes, especially when typing foreign words in English, we need to put different A types of accents over the letters. The table below shows the accents available in LT X. E Each column shows some of the accents and the inputs to generate them. o` \‘o o´ \’o oˆ \ˆo o˜ \˜o o¯ \=o o˙ \.o o¨ \"o c¸ \c c o˘ \u o oˇ \v o o˝ \H o o \d o . o \b o oo  \t oo ¯ Thelettersiandjneedspecialtreatmentwithregardtoaccents,sincetheyshouldnot have their customary dots when accented. The commands \i and \j produce dot-less i and j as ı and j. Thus to get ´ El esta´ aquı´ you must type \’El est\’a aqu\’\i A Some symbols from non-English languages are also available in L T X, as shown in E the table below: œ \oe Œ \OE æ \ae Æ \AE \aa \AA ø \o Ø \O ł \l Ł \L ß \ss ¡ ‘ ¿ ?‘ I.2.5. Special symbols A We have see that the input \LaTeX produces LT X in the output and \ produces a space. E Thus T X uses the symbol \ for a special purpose—to indicate the program that what E follows is not text to be typeset but an instruction to be carried out. So what if you want to get\ in your output (improbable as it may be)? The command \textbackslash produces\ in the output. Thus \ is a symbol which has a special meaning for T X and cannot be produced by E directinput. Asanotherexampleofsuchaspecialsymbol, seewhatisobtainedfromthe input below Maybe I have now learnt about 1% of \LaTeX. You only get Maybe I have now learnt about1 What happened to the rest of the line? You see, T X uses the per cent symbol % as the E comment character; that is a symbol which tells T X to consider the text following as E ‘comments’ and not as text to be typeset. This is especially useful for a T X programmer E to explain a particularly sticky bit of code to others (and perhaps to himself). Even for ordinary users, this comes in handy, to keep a ‘to do’ list within the document itself for example. But then, how do you get a percent sign in the output? Just type \% as in12 I. THE BASICS Maybe I have now learnt about 1\% of \LaTeX. The symbols \ and % are just two of the ten charcaters T X reserves for its internal E use. The complete list is ˜ % ˆ & _ \ We have seen how T X uses two of these symbols (or is it four? Did not we use in E one of our examples?) The use of others we will see as we proceed. Also,wehavenotedthat\isproducedintheoutputbythecommand\textbackslash and%isproducedby\%. Whatabouttheothersymbols? Thetablebelowgivestheinputs to produce these symbols. ˜ \textasciitilde & \& \ \_ \ \ \textbackslash % \% \ ˆ \textasciicircum \ You can see that except for three, all special symbols are produced by preceding them with a \. Of the exceptional three, we have seen that \˜ and \ˆ are used for producing accents. So what does \\ do? It is used to break lines. For example, This is the first line.\\ This is the second line produces This is the first line. This is the second line Wecanalsogiveanoptionalargumentto \\toincreasetheverticaldistancebetweenthe lines. For example, This is the first line.\\10pt This is the second line gives This is the first line. This is the second line nd Now there is an extra10points of space between the lines (1point is about1/72 of an inch). I.2.6. Text positioning We have seen that T X aligns text in its own way, regardless of the way text is formatted E in the input file. Now suppose you want to typeset something like this The T Xnical Institute E Certificate ThisistocertifythatMr. N.O.Vicehasundergoneacourseatthisinstitute and is qualified to be a T Xnician. E The Director The T Xnical Institute E This is produced byI.3. FONTS 13 \begincenter The \TeX nical Institute\\.75cm Certificate \endcenter \noindent This is to certify that Mr. N. O. Vice has undergone a course at this institute and is qualified to be a \TeX nician. \beginflushright The Director\\ The \TeX nical Institute \endflushright Here, the commands \begincenter ... \endcenter typesets the text between them exactly at the center of the page and the commands \beginflushright ... \endflushright typesets text flush with the right margin. The corresponding commands \beginflushleft ... \endflushleft places the enclosed text flush with the left margin. (Change the flushright to flushleft and see what happens to the output.) A These examples are an illustration of a LT X construct called anenvironment, which E is of the form \beginname ... \endname wherenameisthenameoftheenvironment. Wehaveseenanexampleofanenvironment attheverybeginningofthischapter(thoughnotidentifiedassuch),namelythe document environment. I.3. FONTS A The actual letters and symbols (collectively called type) that LT X (or any other typeset- E tingsystem)producesarecharacterizedbytheirstyleandsize. Forexample, inthisbook emphasized text is given in italic style and the example inputs are given in typewriter style. We can also produce smaller andbigger type. A set of types of a particular style and size is called afont. I.3.1. Type style A In LT X, a type style is specified by family, series and shape. They are shown in the table E I.1. Anytypestyleintheoutputisacombinationofthesethreecharacteristics. Forexam- A ple, by default we get roman family, medium series, upright shape type style in a LT X E output. The \textit command produces roman family, medium series, italic shape type. Again,thecommand\textbfproducesromanfamily,boldfaceseries,uprightshapetype. Wecan combine thesecommandstoproducea widevarietyof typestyles. Forexam- ple, the input \textsf\textbfsans serif family, boldface series, upright shape \textrm\textslroman family, medium series, slanted shape14 I. THE BASICS Table I.1: STYLE COMMAND roman \textrmroman sans serif \textsfsans serif typewriter \texttttypewriter medium \textmdmedium boldface \textbfboldface upright \textupupright italic \textititalic slanted \textslslanted SMALL CAP \textscsmall cap produces the output shown below: sans serif family, boldface series, upright shape roman family, medium series, slanted shape A Some of these type styles may not be available in your computer. In that case, LT X E gives a warning message on compilation and substitutes another available type style which it thinks is a close approximation to what you had requested. We can now tell the whole story of the \emph command. We have seen that it usually, thatiswhenweareinthemiddleofnormal(upright)text,itproducesitalicshape. Butif the current type shape is slanted or italic, then it switches to upright shape. Also, it uses the family and series of the current font. Thus \textitA polygon of three sides is called a \emphtriangle and a polygon of four sides is called a \emphquadrilateral gives Apolygonofthreesidesiscalledatriangleandapolygonoffoursidesiscalledaquadrilateral while the input \textbfA polygon of three sides is called a \emphtriangle and a polygon of four sides is called a \emphquadrilateral produces Apolygonofthreesidesiscalleda triangleandapolygonoffoursidesiscalleda quadrilateral Each of these type style changing commands has an alternate form as a declaration. For example, instead of \textbfboldface you can also type \bfseries boldface to get boldface. Note that that not only the name of the command, but its usage also is different. For example, to typeset SHAPE SERIES FAMILYI.4. TYPE SIZE 15 By a triangle, we mean a polygon of three sides. if you type By a \bfseriestriangle, we mean a polygon of three sides. you will end up with By a triangle, we mean a polygon of three sides. Thus to make the declaration act upon a specific piece of text (and no more), the decla- ration and the text should be enclosed in braces. The table below completes the one given earlier, by giving also the declarations to produce type style changes. STYLE COMMAND DECLARATION upright \textupupright \upshape upright italic \textititalic \itshape italic slanted \textslslanted \slshape slanted SMALL CAP \textscsmall cap \scshape small cap medium \textmdmedium \mdseries medium boldface \textbfboldface \bfseries boldface roman \textrmroman \rmfamily roman sans serif \textsfsans serif \sffamily sans serif typewriter \texttttypewriter \ttfamily typewriter These declaration names can also be used as environment names. Thus to type- set a long passage in, say, sans serif, just enclose the passage within the commands \beginsffmily ... \endsffamily. I.4. TYPE SIZE Traditionally, type size is measured in (printer) points. The default type that T X pro- E A duces is of10pt size. There are some declarations (ten, to be precise) provided in LT X E for changing the type size. They are given in the following table: size \tiny size size \large size size \scriptsize size size \Large size size \footnotesize size size \LARGE size size \small size size \huge size size \normalsize size size \Huge size Note that the \normalsize corresponds to the size we get by default and the sizes form an ordered sequence with \tiny producing the smallest and \Huge producing the largest. Unlike the style changing commands, there are no command-with-one-argument forms for these declarations. We can combine style changes with size changes. For example, the “certificate” we typed earlier can now be ‘improved’ as follows \begincenter \bfseries\huge The \TeX nical Institute\\1cm \scshape\LARGE Certificate FAMILY SERIES SHAPE16 I. THE BASICS \endcenter \noindent This is to certify that Mr. N. O. Vice has undergone a course at this institute and is qualified to be a \TeX nical Expert. \beginflushright \sffamily The Director\\ The \TeX nical Institute \endflushright and this produces The T Xnical Institute E CERTIFICATE This is to certify that Mr. N. O. Vice has undergone a course at this institute and is qualified to be a T Xnical Expert. E The Director The TXnical Institute ETUTORIAL II THE DOCUMENT II.1. DOCUMENT CLASS Wenowdescribehowanentiredocumentwithchaptersandsectionsandotherembellish- A A mentscanbeproducedwithLT X. WehaveseenthatallLT Xfilesshouldbeginbyspec- E E ifying the kind of document to be produced, using the command \documentclass... . We’vealsonotedthatforashortarticle(whichcanactuallyturnouttobequitelong) we write \documentclassarticle and for books, we write \documentclassbook. There A are other document classes available in LT X such as report and letter. All of them E share some common features and there are features specific to each. A In addition to specifying the type of document (which we must do, since LT X has E no default document class), we can also specify some options which modify the default format.Thus the actual syntax of the \documentclass command is \documentclassoptionsclass Note that options are given in square brackets and not braces. (This is often the A case with LT X commands—options are specified within square brackets, after which E mandatory arguments are given within braces.) II.1.1. Font size We can select the size of the font for the normal text in the entire document with one of the options 10pt 11pt 12pt Thus we can say \documentclass11ptarticle tosetthenormaltextinourdocumentin11ptsize. Thedefaultis 10ptandsothisisthe size we get, if we do not specify any font-size option. II.1.2. Paper size A WeknowthatLT Xhasitsownmethodofbreakinglinestomakeparagraphs. Italsohas E methods to make vertical breaks to produce different pages of output. For these breaks to work properly, it must know the width and height of the paper used. The various options for selecting the paper size are given below: letterpaper 11×8.5in a4paper 20.7×21in legalpaper 14×8.5in a5paper 21×14.8in executivepaper 10.5×7.25in b5paper 25×17.6in Normally, the longer dimension is the vertical one—that is, the height of the page. The default is letterpaper. 1718 II. THE DOCUMENT II.1.3. Page formats There are options for setting the contents of each page in a single column (as is usual) or in two columns (as in most dictionaries). This is set by the options onecolumn twocolumn and the default is onecolumn. Thereisalsoanoptiontospecifywhetherthedocumentwillbefinallyprintedonjust one side of each paper or on both sides. The names of the options are oneside twoside One of the differences is that with the twoside option, page numbers are printed on the right on odd-numbered pages and on the left on even numbered pages, so that when these printed back to back, the numbers are always on the outside, for better visibility. A (Note that LT X has no control over the actual printing. It only makes the formats for E different types of printing.) The default is oneside for article, report and letter and twoside for book. In the report and book class there is a provision to specify the different chapters (we will soon see how). Chapters always begin on a new page, leaving blank space in the previous page, if necessary. With the book class there is the additional restriction that chapters begin only on odd-numbered pages, leaving an entire page blank, if need be. Such behavior is controlled by the options, openany openright The default is openany for reportclass (so that chapters begin on “any” new page) and openright for the book class (so that chapters begin only on new right, that is, odd numbered, page). A There is also a provision in LT X for formatting the “title” (the name of the docu- E ment, author(s) and so on) of a document with special typographic consideration. In the article class, this part of the document is printed along with the text following on the first page, while for report and book, aseparate title page is printed. These are set by the options notitlepage titlepage As noted above, the default is notitlepage for article and titlepage for report and book. As with the other options, the default behavior can be overruled by explicitly specifying an option with the documentclass command. There are some other options to the documentclass which we will discuss in the rele- vant context. II.2. PAGE STYLE Having decided on the overall appearance of the document through the \documentclass commandwithitsvariousoptions,wenextseehowwecansetthestylefortheindividual A pages. In LT X parlance, each page has a “head” and “foot” usually containing such E informationasthecurrentpagenumberorthecurrentchapterorsection. Justwhatgoes where is set by the command \pagestyle... where the mandatory argument can be any one of the followingstyles plain empty headings myheadings The behavior pertaining to each of these is given below:II.3. PAGE NUMBERING 19 plain The page head is empty and the foot contains just the page number, cen- tered with respect to the width of the text. This is the default for the article class if no \pagestyle is specified in the preamble. empty Both the head and foot are empty. In particular, no page numbers are printed. headings This is the default for the book class. The foot is empty and the head contains the page number and names of the chapter section or subsection, depending on the document class and its options as given below: CLASS OPTION LEFT PAGE RIGHT PAGE one-sided — chapter book, report two-sided chapter section one-sided — section article two-sided section subsection myheadings The same as headings, except that the ‘section’ information in the head are not predetermined, but to be given explicitly using the commands \markright or \markboth as described below. Moreover, we can customize the style for thecurrentpage only using the command \thispagestylestyle where style is the name of one of the styles above. For example, the page number may be suppressed for the current page alone by the command \thispagestyleempty. Note thatonlytheprintingofthepagenumberissuppressed. Thenextpagewillbenumbered with the next number and so on. II.2.1. Heading declarations As we mentioned above, in the page style myheadings, we have to specify the text to appear on the head of every page. It is done with one of the commands \markbothleftheadrighthead \markrightrighthead where left head is the text to appear in the head on left-hand pages and right head is the text to appear on the right-hand pages. The \markboth command is used with the twoside option with even numbered pages considered to be on the left and odd numbered pages on the right. With oneside option, all pages are considered to be right-handed and so in this case, the command \markright can be used. These commands can also be used to override the default head set by the headings style. Note that these give only a limited control over the head and foot. since the general A format, including the font used and the placement of the page number, is fixed by LT X. E Better customization of the head and foot are offered by the package fancyhdr, which is A included in most LT X distributions. E II.3. PAGE NUMBERING The style of page numbers can be specified by the command \pagenumbering... Thepossibleargumentstothiscommandandtheresultingstyleofthenumbersaregiven below:20 II. THE DOCUMENT arabic Indo-Arabic numerals roman lowercase Roman numerals Roman upper case Roman numerals alph lowercase English letters Alph uppercase English letters Thedefaultvalueis arabic. Thiscommandresetsthepagecounter. Thusforexample,to number all the pages in the ‘Preface’ with lowercase Roman numerals and the rest of the document with Indo-Arabic numerals, declare \pagenumberingroman at the beginning of the Preface and issue the command \pagestylearabic immediately after the first \chapter command. (The \chapter... command starts a new chapter. We will come to it soon.) We can make the pages start with any number we want by the command \setcounterpagenumber wherenumber is the page number we wish the current page to have. II.4. FORMATTING LENGTHS A Each page that LT X produces consists not only of a head and foot as discussed above E A but also a body (surprise) containing the actual text. In formatting a page, LT X uses E the width and heights of these parts of the page and various other lengths such as the left and right margins. The values of these lengths are set by the paper size options and the page format and style commands. For example, the page layout with values of these lengths for an odd page and even in this book are separately shown below. These lengths can all be changed with the command \setlength. For example, \setlength\textwidth15cm makesthewidthoftext15cm. Thepackagegeometrygiveseasierinterfacestocustomize page format. II.5. PARTS OF A DOCUMENT We now turn our attention to the contents of the document itself. Documents (especially longer ones) are divided into chapters, sections and so on. There may be a title part (sometimes even a separate title page) and an abstract. All these require special typo- A graphic considerations and LT X has a number of features which automate this task. E II.5.1. Title The “title” part of a document usually consists of the name of the document, the name of author(s) and sometimes a date. To produce a title, we make use of the commands \titledocumentname \authorauthornames \datedatetext \maketitle Notethatafterspecifyingtheargumentsof \title, \authorand \date,wemustissuethe command \maketitle for this part to be typeset. Bydefault,allentriesproducedbythesecommandsarecenteredonthelinesinwhich they appear. If a title text is too long to fit in one line, it will be broken automatically. However, we can choose the break points with the \\ command. Ifthereareseveralauthorsandtheirnamesareseparatedbythe \andcommand,then the names appear side by side. ThusII.6. DIVIDING THE DOCUMENT 21 \titleTitle \authorAuthor 1\\ Address line 11\\ Address line 12\\ Address line 13 \and Author 2\\ Address line 21\\ Address line 22\\ Address line 23 \dateMonth Date, Year produces Title Author1 Author2 Address line11 Address line21 Address line12 Address line22 Address line13 Address line23 Month Date, Year If instead of \and, we use (plain old) \\, the names are printed one below another. We may leave some of these arguments empty; for example, the command \date prints no date. Note, however, that if you simply omit the \date command itself, the current date will be printed. The command \thanksfootnotetext can be given at any point within the \title, \author or \date. It puts a marker at this point and places the footnote text as a footnote. (The general method of producing a footnote is to type \footnotefootnotetext at the point we want to refer to.) Asmentionedearlier,the“title”isprintedinaseparatepageforthedocumentclasses book and report and in the first page of the document for the class article. (Also recall that this behavior can be modified by the options titlepage or notitlepage.) II.5.2. Abstract In the document classes article and report, an abstract of the document in special for- mat can be produced by the commands \beginabstract Abstract Text \endabstract A Notethatwehavetotypetheabstractourselves. (ThereisalimittowhatevenLT Xcan E do.) In the report class this appears on the separate title page and in the article class it appears below the title information on the first page (unless overridden by the title page option). This command is not available in the book class. II.6. DIVIDING THE DOCUMENT A book is usually divided into chapters and (if it is technical one), chapters are divided A intosections,sectionsintosubsectionsandsoon. LT Xprovidesthefollowinghierarchy E22 II. THE DOCUMENT ofsectioning commands in the book and report class: \chapter \section \subsection \subsubsection \paragraph \subparagraph Except for \chapter all these are available in article class also. For example, the heading at the beginning of this chapter was produced by \chapterThe Document and the heading of this section was produced by \sectionDividing the document To see the other commands in action, suppose at this point of text I type \subsectionExample In this example, we show how subsections and subsubsections are produced (there are no subsubsubsections). Note how the subsections are numbered. \subsubsectionSubexample Did you note that subsubsections are not numbered? This is so in the \textttbook and \textttreport classes. In the \textttarticle class they too have numbers. (Can you figure out why?) \paragraphNote Paragraphs and subparagraphs do not have numbers. And they have \textitrun-in headings. Though named ‘‘paragraph’’ we can have several paragraphs of text within this. \subparagraphSubnote Subparagraphs have an additional indentation too. And they can also contain more than one paragraph of text. We get II.6.1. Example In this example, we show how subsections and subsubsections are produced (there are no subsubsubsections). Note how the subsections are numbered. Subexample Did you note that subsubsections are not numbered? This is so in the book and report classes. In the article class they too have numbers. (Can you figure out why?) Note Paragraphsandsubparagraphsdonothavenumbers. Andtheyhaverun-in head- ings. Though named “paragraph” we can have several paragraphs of text within this. Subnote Subparagraphshaveanadditionalindentationtoo. Andtheycanalsocon- tain more than one paragraph of text.II.7. WHAT NEXT? 23 II.6.2. More on sectioning commands In the book and the report classes, the \chapter command shifts to the beginning of a newpageandprintstheword“Chapter”andanumberandbeneathit,thenamewehave given in the argument of the command. The \section command produces two numbers (separated by a dot) indicating the chapter number and the section number followed by the name we have given. It does not produce any text like “Section”. Subsections have three numbers indicating the chapter, section and subsection. Subsubsections and commands below it in the hierarchy do not have any numbers. In the article class, \section is highest in the hierarchy and produces single number like \chapter in book. (It does not produce any text like “Section”, though.) In this case, subsubsections also have numbers, but none below have numbers. Eachsectioningcommandalsohasa“starred”versionwhichdoesnotproducenum- bers. Thus \sectionname has the same effect as \sectionname, but produces no number for this section. A Somebooksandlongishdocumentsaredividedintopartsalso. LT Xalsohasa\part E command for such documents. In such cases, \part is the highest in the hierarchy, but it does not affect the numbering of the lesser sectioning commands. A You may have noted that LT X has a specific format for typesetting the section head- E ings,suchasthefontused,thepositioning,theverticalspacebeforeandaftertheheading and so on. All these can be customized, but it requires some T Xpertise and cannot be E addressed at this point. However, the package sectsty provided some easy interfaces for tweaking some of these settings. II.7. WHAT NEXT? A The task of learning to create a document in LT X is far from over. There are other E things to do such as producing a bibliography and a method to refer to it and also at the end of it all to produce a table of contents and perhaps an index. All these can be done A efficiently (and painlessly) in LT X, but they are matters for other chapters. E6 i 2 i 4 i 5 ? ? ? ?Header 6 6 6 6 i 6 Margin i 7 Body Notes i- 9  i - 10 i-  3  i - 8 i 11 ? ? Footer 6  i- 1 1 one inch + \hoffset 2 one inch + \voffset 3 \evensidemargin = 54pt 4 \topmargin = 18pt 5 \headheight = 12pt 6 \headsep = 18pt 7 \textheight = 609pt 8 \textwidth = 380pt 9 \marginparsep = 7pt 10 \marginparwidth = 115pt 11 \footskip = 25pt \marginparpush = 5pt (not shown) \hoffset = 0pt \voffset = 0pt \paperwidth = 597pt \paperheight = 845pt