t x l
play

T X L A E http://en.wikipedia.org/wiki/LaTeX COMPSCI 111/111G - - PowerPoint PPT Presentation

What%is%LaTeX?% A%document%prepara6on%system% Used'to'typeset'a'document' COMPSCI'111'/'111G' Mastering*Cyberspace:*** LaTeX An*introduc5on*to*prac5cal*compu5ng* Compiler T X L A E http://en.wikipedia.org/wiki/LaTeX COMPSCI


  1. What%is%LaTeX?% • A%document%prepara6on%system% – Used'to'typeset'a'document' COMPSCI'111'/'111G' Mastering*Cyberspace:*** LaTeX An*introduc5on*to*prac5cal*compu5ng* Compiler T X L A E http://en.wikipedia.org/wiki/LaTeX COMPSCI 111/111G - LaTeX 01 2 History%of%LaTeX% Why?% • Donald%Knuth%created%TeX%in%1978% • Why%use%LaTeX%when%we%have%word%processors?% – Aim'was'to'make'it'easy'to'create'books' – Results'look'beKer' and'to'ensure'that'documents'looked'the' – Focus'on'structure'helps'document'development' same'on'any'computer' – Excellent'tool'for'mathemaNcal'layout' – TeX'files'can'be'typeset'into'PDF'files' – Works'well'for'large'documents' – AutomaNcally'generates:' • Table'of'contents' • Leslie%Lamport%created%LaTeX%in%1985% • Lists'of'figures' – LaTeX'='Lamport'TeX' • Lists'of'tables' – Introduced'a'number'of'extensions'to'TeX' • Index' which'made'it'faster'and'easier'to'use' • Glossaries' – Soon,'LaTeX'became'the'standard'way'to' • Bibliographies' use'TeX' – Free'and'runs'on'many'plaSorms' COMPSCI 111/111G - LaTeX 01 3 COMPSCI 111/111G - LaTeX 01 4

  2. Commands% Comments% • Used%to%tell%LaTeX%how%to%typeset%something% • Used%to%annotate%the%document% – Commands'are'case'sensiNve' – Ignored'by'the'compiler' – OpNonal'parts'are'in'square'brackets' – Aimed'at'other'humans' – Compulsory'parts'are'in'curly'braces' \commandname[options]{argument} % Comments starts with a percentage sign % All text is ignored until the end of the % line is reached. \documentclass[a4paper]{article} \documentclass[a4paper,twocolumn]{article} \documentclass[a4paper,twocolumn]{article}{} COMPSCI 111/111G - LaTeX 01 5 COMPSCI 111/111G - LaTeX 01 6 Whitespace% Special%characters% • Whitespace%characters% • Characters%that%are%used%in%the%syntax%of%the%language% – Space' – Can't'type'these'characters'directly' – Tab' – Need'a'special'way'to'print'them' – Line'break' – 10'characters' • White%space%is%largely%ignored%apart%from:% – Space'between'words.' \ $ % ^ & _ ~ # { } – Blank'lines'between'blocks'of'text'that'are'used'to'make'paragraphs.' % • Two%or%more%consecu6ve%whitespace%characters% – Reduced'to'a'single'space' A B C D E F A B C D E F COMPSCI 111/111G - LaTeX 01 7 COMPSCI 111/111G - LaTeX 01 8

  3. Environments% Crea6ng%a%LaTeX%document% • Apply%a%change%to%the%content%within%the%environment% • \documentclass% – New'environments'start'new'paragraphs' – Defines'the'type'of'document' – Book' – Report' – ArNcle' – LeKer' \begin{center} \begin{environmentname} Content within the center • The%document%environment%encloses%the%contents%of%the% ... Environment, is centered on document% The page. \end{environmentname} \end{center} • The%space%between%the%document%class%command%and%the%start% of%the%document%environment%is%called%the%preamble.% – Contains'commands'that'affect'the'enNre'document.' COMPSCI 111/111G - LaTeX 01 9 COMPSCI 111/111G - LaTeX 01 10 Crea6ng%a%LaTeX%document% Adding%a%6tle% • Require%four%commands%to%create%a%6tle% – \title{ put the title here } – \author{ author goes here } – \date{ date goes here } \documentclass[a4paper]{article} • will put today’s date if date not specified Preamble' \begin{document} • Once%the%informa6on%has%been%defined,%insert%the%6tle% ... Document'environment' – \maketitle ... \begin{document} \end{document} \title{A very short document} \author{Damir Azhar} Document'contents' \date{2017} \maketitle This is the document. \end{document} COMPSCI 111/111G - LaTeX 01 11 COMPSCI 111/111G - LaTeX 01 12

  4. Structuring%a%document% Table%of%contents% • Table%of%contents%is%automa6cally%generated%using%the% • \part{part name goes here} \tableofcontents%command.%% – place'aZer'\makeNtle'–'someNmes'need'to'recompile' • \chapter{chapter name goes here} – Parts' – Only books and reports – Chapters' – SecNons' • \section{section name goes here} – SubsecNons' – Bold, larger, numbered automatically • Each%command%has%a%table%of%contents%op6on% • \subsection{subsection name goes here} – Displays'a'different'name'in'the'table'of'contents' \section[Introduction]{An introduction • \subsubsection{subsubsection name goes here} to typesetting using the LaTeX language} COMPSCI 111/111G - LaTeX 01 13 COMPSCI 111/111G - LaTeX 01 14 Footnotes% Paragraphs%and%line%breaks% • Footnotes%are%created%in%the%text%as%you%type%them% • LaTeX%will%remove%excess%whitespace% – Need'to'explicitly'include'paragraphs'and'line'breaks' – \footnote{footnote text goes here} • Paragraph% \documentclass[a4paper]{article} – Leave'a'blank'line'in'the'input' • Line%break% \begin{document} \title{A very short article} – Use'the'command' \\ \author{Damir Azhar} \date{2017} \maketitle This is the document \footnote{Note that the document is an article} that I am using as an example. \end{document} COMPSCI 111/111G - LaTeX 01 15 COMPSCI 111/111G - LaTeX 01 16

  5. Quote%marks% Dashes% • Unidirec6onal%quotes%(")%are%inadequate% • Hyphen%(Z)% – Use'the'symbols'`'and'''for'single'quotes' – Short'dash'to'join'different'words'together' – Use'the'symbols'``'and'''''for'double'quotes' merry+go+round' • Single%quotes% • En%dash%(ZZ)% – Open'using'`'character'and'close'using'''character' – Longer'dash'used'to'indicate'a'range'of'values' `Hello'' pages'45++50' • Double%quotes% – Open'using'``'characters'and'close'using''''character' • Em%dash%(ZZZ)% – Very'long'dash'between'words'or'phrases' ``Hello''' the'start'+++'the'finish' COMPSCI 111/111G - LaTeX 01 17 COMPSCI 111/111G - LaTeX 01 18 Ellipsis% Spaces% • Three%dots%in%a%sequence% • Lines%have%to%be%broken%to%wrap%text% – Used'to'indicate'text'that'...'has'been'removed' – Try'to'break'at'a'space' – Or'an'unfinished'...' – Try'to'break'at'a'syllable' • Can't%just%use%three%full%stops%in%a%row% • Some%spaces%we%don't%want%to%be%broken% – LaTeX'will'use'incorrect'spacing' – E.g.'between'iniNals'and'surnames' – Use'the' \ldots 'command' The lecturer for this course is Bad layout A. J. Luxton-Reilly There'is'\ldots'missing' • Use%a%6lde%~%to%signify%a%space%that%we%can't%break% The lecturer for this course is A.~J.~Luxton-Reilly COMPSCI 111/111G - LaTeX 01 19 COMPSCI 111/111G - LaTeX 01 20

  6. Basic%Forma_ng% Exercise% • \emph%command%emphasises%the%enclosed%text% • What%is%the%LaTeX%code%that%would%generate%the%following% document?% This'was'a'\emph{long}'lecture' % • \textbf%command%makes%the%enclosed%text%bold% This'was'a'\textbf{cool}'lecture' COMPSCI 111/111G - LaTeX 01 21 COMPSCI 111/111G - LaTeX 01 22 Answer% References% \documentclass[a4paper]{ar6cle}% • There%are%many%LaTeX%tutorials%on%the%Internet% % – hKp://www.tug.org/interest.html' \begin{document}% – hKp://www.latex`project.org/' \6tle{Pythagoras}% – hKp://www.ctan.org' \author{A.%Professor}% \date{2017}% • Web%site%that%allows%you%to%try%it%out% \make6tle% – hKp://sciencesoZ.at/index.jsp?link=latex&size=1280&js=1&lang=en'' % Around%530%BC,%Pythagoras%moved%to%\textbf{Croton}%ZZZ%a%Greek%colony%in% • Tutorial%documents% southern%Italy%ZZZ%and%a%set%up%a%religious%sect.% – The'(not'so)'short'guide'to'LaTeX' % \begin{center}% • Online%course%reference%manual% This%is%where%Pythagoras%earned%his%reputa6on%as%a%mys6c.% \end{center}% % Pythagoras%was%also%a%skilled%mathema6cian\ldots% % % COMPSCI 111/111G - LaTeX 01 23 COMPSCI 111/111G - LaTeX 01 24

Recommend


More recommend