Download presentation
Presentation is loading. Please wait.
Published byKristian Myles Carr Modified over 8 years ago
1
LaTeX An Introduction
2
November 2011CS101102 A characterisation of LaTeX ● Very high quality typesetting – For traditional printed output ● Unrivalled mathematical typesetting (ref)ref ● A standard for scientific publications ● Used by publishers ● Based on TeX (faq)faq
3
November 2011CS101103 The production cycle ● Edit (plain text editor) ● Process (perhaps more than once) ● Preview (pdf, usually) ● Repeat as required
4
November 2011CS101104 Editing ● plain text – any editor ● gedit, vim, notepad, gwd, whatever ● Like html in that you use markup – editor may “know” about the mark-up and help
5
November 2011CS101105 Marking it up ● 2 aspects to creating the document – The content ● What you write, diagrams, pictures etc – marking up ● partially structural (headings etc) ● much presentational (bold, italics etc) ● The machine follows the instructions to produce the document
6
November 2011CS101106 Process ● Processing may reveal typos or logical errors in your document – think of this as checking and quality control ● not a hassle – it's a good thing! ● You may need to process the document 2 or even 3 times – some things can't be known the first time through ● e.g. – table of contents with page numbers – “Page n of m” ● LaTeX squirrels such information away in a series of files with different extensions
7
November 2011CS101107 Additional processing ● There is additional processing you might do – Make an index – Use a fully cross referenced bibliography – Spell check
8
November 2011CS101108 Files ● “The” document is in a file with ending.tex ● This is processed to produce a printable file – Traditionally postscript in.ps, via.dvi – Now PDF in a.pdf file ● “By-product” files.log logs the processing.aux auxiliary file – other stuff.toc table of contents is maintained here.lof list of figures (if you asked for one)
9
November 2011CS101109 File naming ● All files have same name (before the extension) – This is the way LaTeX works ● don’t try to change it ● mydoc.tex mydoc.pdf – leaving mydoc.aux, mydoc.log etc. ● Don’t delete by-products until the end – They’re not a problem and they speed up the processing
10
November 2011CS1011010 Anatomy of LaTeX source ● Conventions – Characters with a special meaning ● $ & % # { } ● Of course, there are ways to get these if you need them – \command – {} and [] ● arguments (parameters) and options – environments ● begin and end
11
November 2011CS1011011 A simple example \documentclass{article} % Specifies the % document class \begin{document} % Start of text. \section{A Section Heading} This is a paragraph. This is a \emph{second} paragraph. \end{document} % End of document.
12
November 2011CS1011012 Simple example output ● The source is available – try itavailable
13
November 2011CS1011013 Big message ● Layout in the source has almost no effect on output – except that blank lines start a new paragraph ● Lay out the source for your convenience – Make it readable – Make it editable – You know about doing this by now for HTML, Java etc…
14
November 2011CS1011014 Commands ● Comes with most Linux/UNIX – Just use a command shell – Not with Ubuntu by default – easy to install (install the package tetex-common – and probably tetex-extra too) ● On Microsoft, use the “DOS” prompt – Utilities Command Prompt – On Aber machines, but you'll have to install it if you want it at home (http://miktex.org/)http://miktex.org/ ● pdflatex mydoc – Or pdflatex mydoc.tex ● latex mydoc – Produces.dvi – Must be further processed
15
November 2011CS1011015 Document classes ● Several available – article – report – book – letter ● Others can be written – Journals – Conferences ● Determines presentation ● Controls applicability of constructs – chapter? – abstract? ref
16
November 2011CS1011016 Paragraphs and headings ● Blank lines indicate new paragraph – \par command can be useful occasionally ● \section{title} – \subsection{title} ● \subsubsection{title} – \paragraph{title} ● \subparagraph{title} ● \chapter{title} ● \part{title} ● \appendix{title}
17
November 2011CS1011017 Some commands ● \pagestyle{plain} ● \pagestyle{headings} ● \pagestyle{empty} ● \LaTeX \TeX \LaTeXe ● \footnote{An interesting footnote}
18
November 2011CS1011018 Some environments ● itemize – Bulleted list (the UL of html) ● enumerate – Numbered list (the OL of html) ● Environments “nest” – These will cause other style bullets to be printed – according to the document class
19
November 2011CS1011019 A list example \documentclass{article} \begin{document} \begin{enumerate} \item Eins \item Zwei \begin{itemize} \item this \item is \item nested \end{itemize} \item Drei \end{enumerate} \end{document}
20
November 2011CS1011020 Lists example ● The source is availableavailable
21
November 2011CS1011021 Tables ● tabular environment ● Must specify columns and alignment – And vertical lines ● Cells separated by & ● Rows separated by \\ ● A command for horizontal lines – \hline
22
November 2011CS1011022 Table Example \documentclass{article} \begin{document} \begin{tabular}{|r|l|} \hline Header & Row \\ \hline \hline A & Silly \\ \hline tabular & structure \\ \hline with & some lines missing\\ \end{tabular} \end{document}
23
November 2011CS1011023 Table Example Output The source is availableavailable
24
November 2011CS1011024 The table environment ● The tabular environment merely creates an object which will be treated as a character (i.e. not nicely spaced). ● Use the table environment around it to place table neatly ● e.g. \begin{table}[h] ● h means “put table here” – t for top, b for bottom, p for page of floats – Default is tbp
25
November 2011CS1011025 Additional lessons from the examples ● Commands can have more than one argument ● Source code layout does not influence LaTeX – But it can make source hard to read ● Some things happen automatically – Surprising things need commands ● \backslash, \verb+~+ (not \~), same for ^ ● \^ (etc) used for accenting characters
26
November 2011CS1011026 Document titles and TOC ● \maketitle – Takes info from preamble ● \title{} ● \author{} ● \date{} – Or makes it up ● \date{} ● \tableofcontents – Generated – Needs 2 (or more) runs
27
November 2011CS1011027 Title and TOC example \documentclass{article} \title{The House} \author{A.G. Mason} \begin{document} \maketitle \tableofcontents \section{Roof} \subsection{Loft} \section{Upstairs} \section{Downstairs} \end{document}
28
November 2011CS1011028 Title and TOC example output The source is availableavailable
29
November 2011CS1011029 Inserting pictures, images etc ● \includegraphics{myimage.png} – Need to have \usepackage{graphicx} at the top of the file ● Also possible: \pdfimage ● Can do scaling, positioning etc. ● Google it for options
30
November 2011CS1011030 Running LaTeX ● Free ● Originally UNIX based – Now available for PCs and Macs – … ● MiKTeX (the Windows version) claims to be 100Mb (installed) - download is only about 23 Mb
31
November 2011CS1011031 Documentation ● “The Not So Short Introduction to LaTeX2e” – Or LaTeX2e in 90 minutes ● lshort – Comes with distribution ftp://ftp.tex.ac.uk/tex-archive/info/lshort/english/lshort.pdf IS machines have it at: E:\Programs\Tex\texmf\doc\guides\short-english\lshort.pdf (and I’ve linked it from the CS10110 main page anyway)linked ● Other languages available (see here)here ● See also http://www.latex-project.org/http://www.latex-project.org/
32
November 2011CS1011032 Recommended steps 1.Process the simple example Perhaps also the others 2.Read and process sample2e.texsample2e.tex A nice quick overview 3.Skim “The Not So Short Introduction to LaTeX2e Don’t try to read/learn it Ignore the maths (if not a maths student) 4.Do the practical!
33
November 2011CS1011033 A useful header section (just copy to the top of your own file) \documentclass[a4paper, 12pt]{article} % ******* Set normal page margins ******** \setlength{\oddsidemargin}{0in} \setlength{\evensidemargin}{0in} \setlength{\textwidth}{6.2in} \setlength{\topmargin}{-0.3in} \setlength{\textheight}{9.8in}
34
November 2011CS1011034 Other recommended reading: http://en.wikibooks.org/wiki/LaTeX http://www.latex-project.org/ http://www-h.eng.cam.ac.uk/help/tpl/textprocessing/ http://www.emerson.emory.edu/services/latex/latex2e/latex2e_toc.html Get your own copy for Windows http://miktex.org/ For Ubuntu Install package texlive-latex-base
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.