0% found this document useful (0 votes)
22 views18 pages

MTH4201 Software Package

LaTeX Handout for mathematics students of level 400
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
22 views18 pages

MTH4201 Software Package

LaTeX Handout for mathematics students of level 400
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 18
1 Introduction 1.1 What is BEX? LTE (pronounced lay-tek) is a typesetting program for producing professional-looking doc- uments, it is not a word processor. It is particularly suited to producing long, structured documents, and is very good at typesetting equations. It is available as free software for most ‘operating systems. But then what is a typesetting program? To answer this, Jet us look at the various stages im the preparation of a document using computers 1. The text is enterod into the computer, 2, The input text is formatted into lines, paragraphs and pages 3, The output text is displayed on the computer screen. 4. The final output is printed In most word processors all these operations are integrated into a single application package But a typesetting program like TpX is concerned only with the second stage above, DIX is based on TEX, a typesetting system designed by Donald Knuth in 1978 for hight ality digital typesetting. TEX is a low-level language that computers can work with, but jost people would find dificult to use; so ISTEX has been developed! to make it easier If you are used to procucing documents with Mierosoft Word, you will Gd that BTpX is a very diferent style of working. Microsoft Word is What You See ts What You Get’ (WYSI- WYG). this means that you see how the final document will look as you are typing, When working in this way, you will probably make changes to the docuient’s appearance (such as line spaci lings, page breaks) as you type. With TEX you do not sew how the final document will look while you are typing itz this allows you to concentrate ov the content rather ‘than appearance. ‘A UT_Xdocument is a plain text fle with a tex fle extension. It cau be typed in sim ple text editor such as Notepad, but most people find itis easier to use a dedicated TEX editor, As you typeyyou mark the document structure (ttle, chapters, subheadings, lists ete.) ‘vith tags. When the document is fnished)you compile it this means converting it into another format. Several different output formats are avilable, but probably the most useful is Portable Document Format (PDE), which appears as it will be printed and can be transferred easily bhetwcen computers. 1.2 Before You Start ‘The following conventions are used throughout this workbook: «¢ Actions for you to carry out are bulleted with an arrose 1 © Text you type 1s written in this font. ‘© Menu commands and button names are shown in bold, ‘The code in this workbook should work in any EITEX editor, however, MIkTEX 2.9.5872 is to be used for all our practical, Chapter 2 Document Structure 2.1 Essentials 2 Start TeXworks, A new document will automatically open. > Go to the Format mem: and select Line Numbers, Line numbers are not essential, but will make it easier to compare your code with the screenshots and fiud errors, 2 Go to the Format menu aud select Syntax Coloring, then LaTeX Syntax colouring will highlight commands in blue and can make it spot mistakes, > Type the following \documentclass [adpaper, 12pt] {article} \begin(docunent} A sentence of text \end{docunent} ag Chapter 2 Document Structure 2.1 Essentials 2D Start TeXworks. A new document will automatically open > Go to the Format menu and select Line Numbers. Line numbers are not essential, but will make it easier to compare your code With the screenshots and find errors, > Go to the Format menu aud seleet Syntax Coloring, then LaTeX. Syntax colouring will highlight commands in blue and can make spot mistakes. it easier to D Type the following: \docunentclass ladpaper ,12pt] {article} \begin{docunent)} A sentence of text. \end{docunent) ‘The \documentclass command must appear at the start of every ESTEX document. The text in the curly brackets specifies the document class. ‘The article document class is suitable for shorter documents such as journal articles and short reports. Other document classes include report (for longer documents with chapters, e.g. PhD theses), proc (conference proceedings), book and slides. The text in the square brackets specifies options — in this case it sets the paper size to Ad and the main font size to 12pt ‘The \begin(docunent} and \end{document} commands enclose the text and commands that make up your document. Anything typed before \begin {docuzent} is known as the preamble, and will affect the whole document. Anything typed after \end{docunent} is ignored The empty line aren't necessary! but they wil make it easier to navigate between the cifeent pat ofthe document a i ges longer Click onthe Save button, Create anew folder called LaTeX cours in Libraries> Documents went Doel and save it as a TeX document in this It is a good idea to keep each of your TEX documents in a separate folder as the compiling process creates multiple files. ‘D Make sure the typeset menu is set to pdfLaTeX. 2 Click on the Typeset button, @ ‘There will be a pause while your document is being converted to a PDF file. When the compiling is complete TeXworks’ PDF viewer will open and display your document. ‘The PDF file is automatically saved in the same folder as the .tex file (See section 3.8 on page 11 for information about how ITEX deals with empty space in the tex file 2.2. Troubleshooting If there is an error in your document and TeXworks eannot ereate the PDF the Typeset button will change to red with a white X (Abort typesetting, button) and the Console output atthe bottom of the sereen will stay open TF this bappens: 2 Clk onthe Abort typesetting button @ > Read the Console output - the last line will probably include a line hhumber and the command that caused the ertor. > Go to the line number in your document and fix the error: > Click on the Typeset button again. 2.3 Creating a Title ‘The \maketitie command creates a ttle the document. If the date is not specified optional You need to specify the title of today’s date is used. Author is > Type the following directly after the \vegin(decunent} command: \eatletty First Docusent} \author (ty Name) \date(\today) \naketitie Your document should now look like figure 21 2 Click on the Typesot button and check the PDF. Points to note: * Ntoday is command that inserts today's date. You can also type in different date, for example \date(loveaber 2013) Article documents start the text ity ow the tite on the vane page. port pt thei ona mre eg book), _ Figure 20 TeSiwarks scone showing the maleic exmomamd iwade your document iano dhupers (if ameded), sections and sb allowing sectioning communds sce avadatie or the article © \aubsectisni...} © \subeubsectian{...} © \paregregnt..} \subpereprepit.. 7 “The tite of the setice replaces the dots between the carly brackets. With the report 204 book clases we aloo have \ckapter{...) 1D Replace “A senteace of vere.” with the following: \soction(Iatroductios} ‘This ie the introduction, \section(Metbods} \wvbsoction(Stage 1} ‘The firet part of the sethods. \subsection(Stage 2} The second part of the methods. \section{Results} Here are ny results Your document should now look like figure 22 igure 2.2: ‘TeXworks screenshot of document with sections, > Click on the Typeset bution and check the PDF. 2.5 Labelling ‘You can label any of the sectioning commands so they ean be referred to in other parts of the document. Label the section with \Label (Labelnane}. ‘Then type \ref(abelnane} or \pageref (Labelnane} refer to the section or page number of the label ‘when you want to 2 Type abel {sect} on a new line directly below \eubsection {Stage 1) Da > Type Reterrs, ; Ang to section Fe 1b Rasulee gear =! ettncet) oy PRES \pageret iseci) Your document shout ow look like figure 2.3 Figure 2.3: TeXworks screenshot of document with label, > Click on the Typeset button and check the PDF. You may need to {yPeset the document twice before the references Appear in the PDE. 2.6 Table of Contents very easy to generate a table of coutents, If you use sectioning commands it is want the table of contents to appear it ‘Type \tableofcontents where you ‘your document — often directly after the title page (You tnay also want to change the page numbering so that roman numerals (iit) are used for pages before the main document starts, This wifcie ensure that the main document starts on page 1. Page numbering can he switched between arabic and roman using \pagenusbering{.- 8 1D Type the following on a new line below \naket tle \pagenusber ing{rosan} \tableofcontents \newpage \pagenunbering(arabich ‘The \nepage command insets a page break so that we can see the effect of the page numbering commands. The first 14 lines of code should now look like figure 24. Figure 24: TeXworks screenshot of document showing table of contents com- mand ‘> Click on the Typeset button and check the PDF. Chapter 3 Typesetting Text 3.1 Font Effects “There are TEX commands fora variety of font effects \eextit(words in atalacs) words in italics \textel{vords slanted) words slanted \eextectvords in ezallcaps} WORDS IN SMALLCAPS \rerrbf{uords in bold) words in bold \texttt{uords an teletype) words in teletype \tertef(eane serif words) sans serif words \toxere(reaan words} roman words \underline(underlined words} underlined words 1D Add some more text to your document and experiment with diferent text ffots 3.2 Coloured Text To put coloured text in your document you need to use a package. There fare many packages that can be used with ETEX to enbance its functionality Packages are included in the preamble (i. before the \begin(docunent} command). Paclages are activated using the \usepackage [opt ions] {package} ‘command, where package is the name of the package and options isan op- tional list of keywords that trigger speeal features inthe package " {Tho basic colour names that \usepackage(color} knows about ate black; red, green, blue, cyan, magenta, yellow and white "The following code to produces colou {\color{colour_nase}text} ‘Where colour_nane isthe name of the colour you want, and text is the text yout want to be coloured D ‘Type \usepackage(color} on the line before \begin{docusent 2 Type (\color(red)fire) in your document D Click on the Typeset button and check the PDF. ‘The word ‘fre’ should appear in red. Its possible to add options that allow \usepackage(color) to understand nore colour names, and even to define your own colours. tis also possible to change the background colour of text (as for white and yellow in the ‘example above), but this is beyond the scope ofthis workbook. If you want rare information about see the Colors chapter in the ITpX Wikibookt 3.3. Font Sizes ‘Phote are TEX commands for a range of font sizes {\tany tiny words) ae) \ecripteize seriptsize vords) sane vort {\footnotenize fovtnoterize vorde) tester wnds ‘(Nstall suall words) smal words ‘{Qoorealeize norsalsize ord} normlsize words (Marge large words} large words (Largo Large words} Large words {\LARGE LARGE words) LARGE words ‘\tuge huge words) huge words (ap on wtribooeeorg/vaia/LaTek/Oatore 2 ‘D Experiment with different font sizes in your docuinent 3.4 Lists LUTpX supports twotypesoflists: enumerate produces numbered lists, while itemize is for bulleted lists. Each list tem 3 defined by \item, Lists can be nested to produce sub-lsts. 'D ‘Type the following to produce a numbered lst ith a bulleted sub-tist \bogin{onumerate} \iten First thing Viton Second thing \bogin(itenize} \iten A sub-thing \iten Another cub-thing \ena{itenize) Viton Third thing. \end(enunerate} ‘D Click on the Typeset button and check the PDF ‘The list should look lke this: 1. Fast hing 2, Second thing © A subvthing, ‘© Another sub-thing 8. Third thing It is easy to change for example, \3 the bullet symbol using square brackets after the \,tem, at wl gv dana the Dll. "Youean even ‘as bullets, for example, \item (One) : os ‘The following code 13 \begintstenize) \iten(-] Firse thing stents} Second thing \oogin(svenize) \sten{Fich] A sub-thing \iten(Ptants) Another sub-vaing \end(itensze) \iteafal Taard thang \end{itenize) Produces = Fist thing + Second thing Fish A substhing Plants Another sub-thing Q Thiet ching 3.5 Comments & Spacing Comments are created using. Wika BTRX encounters 9% character wile Drocaing ate l,i noes the rest of the ine [ni the [Return] key thas ben presed to start a new lie — not tobe confused with ine wrapping in your editor) ‘This ean be used to whte notes i the supa Ble which will ‘ot show up ithe printed version ‘The following code Te Le a truth universally acknovledgod' Yote comic irony in the very faret sentence + that a single aan in possession of good fortune, must Products {isa truth universally acknowledged, that single man in pos secsion ofa good frtune, must in want of «wife, Ak the titer, or hr the tex feof thi work, A ou od bey 18 Multiple consecutive spaces in ITTEX are treated as a single space. Several ‘empty lines aze treated as one empty line. The main funetion of an empty line in ITX is to start a new paragraph, In general, TEX ignores blank fines and other empty space in the tex file. Two backslash (\\) ean be used to start a new line ‘> Experiment with putting comments and blank lines in to your docu- ment, If you want to add blank space into your document use the \vspacet. ..) command. ‘This will add blank vertical space of a height specified in typo- sraphical points (pt). For example, \vspace{12p¢} will add space equivalent to the height of a 12pt font 3.6 Special Characters ‘The following symbols are reserved characters which have a special meaning in BTR: eS) tae oe teases All of these apart from the backslash \ can be inserted as characters in your document by adding a prefix backslash We wow LU Vo Note that you need to type a pair of curly brackets (} after the hat ~ and tilde “, otherwise these will appear as accents ever the following character. For example, "\" ¢” produces “ ‘The above code will produce: PSR gk = Ol ewe ‘The backslash character \ can not be entered by aulding a prefix backslash \\, as this is used for line breaking, Use the \textbackslash command instead. 2 Type cade to produce the following sentence in your document Item #1A\G42 costs $8 & is sold at « “10% profit Ask the tutor, or check the tes file of this workbook, if you need help, Se Chapter 4 Tables {ie tabular command is used to typeset tables, By default, UIEX tables redrawn without horizontal and vertical lines you need eg specify if you Nant lines drawn. BIEX determines the width of the columns arneeece ally ‘This code starts a table: \boginétabular){,..} wen the dots between the curly brackats ave replaced by code defining the columns: + 2/6F column of toate txt (eter el, not number one). * for a column of right-aligned text fora column of centre-aligned text. + I for a vertical line Fer example, 129 (ie. left et left) wi Produce 3 columns of lef-aligned Hines, while (11/2 1e1) (6 efter} wall produce tnd et aligved, the tid snghtaig ot and there ound each eolunin, ‘The tuble data fellows the \begin command * is placed between cohmns, * \\ 4s Dae a the ead ofa ro (io start. new one) ) "7 4 \niane inserts a horizontal line ‘# \cline(t-2) inserts partial horizontal line between column 1 and column 2, ‘The command \end{tabular} finishes the table. Examples of tabular code and the resulting tables: \bogin{tabular}{11111} Apples & Green \\ Strauberries & Red \\ Oranges & Orange \\ \end{tabular} Green | Red Orange Apples Strawberries Oranges \bogin(tabular} {re} Apples _ Green Apples & Green \\ “Simwberrie Red \bline Oranges” Orange Stravberries & Red \\ \cline(i-1} Oranges & Orange \\ \ene(rabaiar} \begin(tabular}{Ir 111) Shere \pline 36 [stult_] 8 & here's \\ \cline(2-2 86 & stuff \\ \nline \bline 2008 & now \\ \nline \ené{tabular} 4.1 Practical 2 Write code to produce the following tables: Quantity | Price (8) Nails 034 ‘Wooden boards 400 Bricks 1150 18 ‘Year 200620072008 London | 45789 46551 51208 Berlin | 34549 32543 29870 Paris | 49835 51009 51970 Ask the tutor, or look at the .tex file of this workbook, if you need help 19

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy