Download presentation
Presentation is loading. Please wait.
Published byChristopher Jackson Modified over 9 years ago
1
1 Lecture 4 A Brief Introduction to LaTeX Introduction to Information Technology Dr. Ken Tsang 曾镜涛 Email: kentsang@uic.edu.hk kentsang@uic.edu.hk http://www.uic.edu.hk/~kentsang/IT/IT3.htm Room E408 R9
2
2 What is TeX? TeX is a typesetting system ( 排版系统 ) written by Donald E. Knuth in 1976, who says that it is “intended for the creation of beautiful books — and especially for books that contain a lot of mathematics”
3
3 How to Pronounce TeX? The X is really the Greek letter Chi, and is pronounced by English-speakers like ‘k’. It definitely is not pronounced ‘ks’ (the Greek letter with that sound doesn’t look remotely like the Latin alphabet X) The name comes from the Greek word for “art” or “craft” (“techni”), which is the root of the English word technology
4
4 What is LaTeX? LaTeX is a free high-quality document processing system that is based on TeX LaTeX was originally written by Leslie Lamport in 1980s
5
5 Lamport never announced how one he thought people should pronounce LaTeX How to Pronounce TeX? A lot of people pronounce it “Lay TeX” or “Lah TeX”
6
6 Why LaTeX ? It is the premier typesetting package in the world! It's free!!! It's available for many machines (Linux, Mac, Windows) LaTeX files are ASCII Therefore, they are very portable You can use the editor of your choice (Some people even use MS Word)
7
7 Why LaTeX ? The typesetting is better especially the maths Style changes are neater in LaTeX Style files for many periodicals exist Many MS Word users don't use styles or templates, so there's a limit to what they can do LaTeX is extensible If you want a new feature, find a free add-on or write one yourself
8
8 Disadvantages LaTeX encourages (almost insists on) structured writing and the separation of style from content This is not the way that many people (especially non-programmers) are used to working Without a WYSIWYG (What You See Is What You Get), it's not always easy to find out how to do things
9
9 LaTeX vs MS Word If you are writing a document with lots of maths, tables, cross-references, etc, and you need to format the document and bibliography to suit various publications, then LaTeX is clearly the best choice! If your document contains many equations / figures / tables, MS Word easily runs out of memory and shows a nice blue screen of death or prints red crosses instead of your equations
10
10 LaTeX vs MS Word LaTeX encourages authors not to worry too much about the appearance of their documents but to concentrate on getting the right content LaTeX is based on the idea that it is better to leave document design to document designers, and to let authors get on with writing documents
11
11 “Hello World” Suppose we want to produce the following document:
12
12 In MS Word To produce this in most typesetting or word-processing systems, the author would have to decide what layout to use, so would select (say) 18pt Times Roman for the title, 12pt Times Italic for the name, and so on This has two results: Authors wasting their time with designs A lot of badly designed documents!
13
13 In LaTeX \documentclass{article} \title{Introduction to LaTeX} \author{Bill Gates} \date{November 2007} \begin{document} \maketitle Hello world! \end{document}
14
14 Or In English This document is an article Its title is An Introduction to LaTex Its author is Bill Gates It is written in November 2007 The document consists of a title followed by the text Hello world!
15
15 LaTeX Features Typesetting journal articles, technical reports, books, and slide presentations Control over large documents containing sectioning, cross- references, tables and figures Typesetting of complex mathematical formulas Advanced typesetting of mathematics with AMS-LaTeX
16
16 LaTeX Features Automatic generation of bibliographies and indexes Multi-lingual typesetting Inclusion of artwork, and process or spot color Using PostScript or Metafont fonts
17
17 Obtaining LaTeX Linux Your system distribution or vendor has probably provided a TeX system including LaTeX. Check your usual software source for a TeX package MacOS X A full TeX system including LaTeX, called MacTeX, is available for installation with i-Installer http://www.tug.org/mactex/ Windows Check out the proTeXt system; this allows you to install a full TeX system, including LaTeX, while reading about the basics of the installation http://www.tug.org/protext/ Chinese TeX: http://www.ctex.org
18
18 A Quick Start (1) The LaTeX Source: reproduce the following text in any text-editor and save it as hello.tex \documentclass{article} \begin{document} Hello World! \end{document}
19
19 A Quick Start (2) Generating the documents Type the command: latex hello.tex Various bits of info about LaTeX and its progress will be displayed. If all went well, the last two lines displayed in the console will be: Output written on hello.dvi (1 page, xxx bytes) Transcript written on hello.log This means that your source file has been processed and the resulting document is called hello.dvi, which takes up 1 page and xxx bytes of space.
20
20 A Quick Start (3) Viewing the documents LaTeX has now done its job, so we can view the output The default format is DVI (device independent), of which viewers exist freely for most platforms However, the chances are that you would prefer to have a postscript file or PDF Fortunately, there exist tools that can convert DVI to PS (and PDF) easily
21
21 A Quick Start (4) To Convert the document into a postscript (PS) file Type the command: dvips hello.dvi -o hello.ps dvips is the utility that actually performs the conversion. The first argument hello.dvi is the DVI file to be converted. The -o argument says that you want the output to be saved as a file. And the argument immediately after, hello.ps, is the name you wish to call it.
22
22 A Quick Start (5) To Convert the document into a PDF file Type the command: dvipdf hello.dvi hello.pdf Note that there is no -o with this command, because although the utilities look almost identical, they have slightly differing syntax) If you already have a postscript version, then type: ps2pdf hello.ps hello.pdf Now it is simply a matter of using your preferred PS or PDF viewer to see the output What you should see at the top left of the page are the words Hello World! and at the bottom is the current page number. All in a standard times font
23
23 LaTeX Document Structure % A simple article to illustrate document % structure. \documentclass[12pt]{article} \usepackage{times} \begin{document} …… \end{document}
24
24 %: comments \documentclass[12pt]{article} The type of document we want to produce: article Other classes that exist are book, report, thesis etc 12pt: the font \usepackage{times} It tells Latex to utilise some external macros \begin{document} … \end{document} LaTeX Document Structure
25
25 Top Matter \title{How to Structure a \LaTeX{} Document} \author{ Bill Gates\\ Computer Science and technology Program,\\ United International College,\\ Zhuhai, China\\ \texttt{billgates@webmail.uic.edu.hk}} \date{\today} \maketitle
26
26 Output
27
27 Abstract \begin{abstract} In this article, I shall introduce to you \LaTeX{}, a typesetting software that is much better than Microsoft Word. I shall discuss some of the fundamental topics in producing a structured document. This document itself does not go into much depth, but is instead the output of an example of how to implement structure. \end{abstract}
28
28 Output
29
29 Sectioning Commands \section{Introduction} This section's content... \section{Structure} This section's content... \subsection{Top Matter} This subsection's content... \subsubsection{Article Information} This subsubsection's content...
30
30 Output
31
31 Bulleted List \begin{itemize} \item \texttt{\textbackslash address} - The author's address. Use the new line command (\texttt{\textbackslash\textbackslash}) for line breaks. \item \texttt{\textbackslash thanks} - Where you put any acknowledgments. \item \texttt{\textbackslash email} - The author's email address. \item \texttt{\textbackslash urladdr} - The URL for the author's web page. \end{itemize}
32
32 Output
33
33 The Bibliography \begin{thebibliography}{9} \bibitem{lamport94} Leslie Lamport, \emph{\LaTeX: A Document Preparation System}. Addison Wesley, Massachusetts, 2nd Edition, 1994. \end{thebibliography}
34
34 Citation In the text, This small document is designed to illustrate how easy it is to create a well structured document within \LaTeX\cite{lamport94}. You should quickly be able to see how the article looks very professional, despite the content being far from academic. Titles, section headings, justified text, textformatting etc., is all there, and you would be surprised when you see just how little markup was required to get this output.
35
35 Output
36
36 The Tabular Environment \begin{tabular}{ l c r } 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \\ \end{tabular} \begin{tabular}{|l|l|} \hline stuff & stuff \\ \hline \end{tabular}
37
37 Rows spanning multiple columns
38
38 Columns spanning multiple rows
39
39 Mathematics Environments text formulae \begin{math}...\end{math} $...$ displayed formulae \begin{displaymath}...\end{displaymath} \[...]\ \begin{equation}...\end{equation}
40
40 Fraction
41
41 Powers and Indices
42
42 Roots
43
43 Matrices
44
44 Equations
45
45 Multi-lined equations
46
46 Summary This lecture has given a very brief introduction to the facilities provided in LaTeX There are many other features and packages that have not been covered The best way to improve your LaTeX skills is to use it for ALL your assignments and papers!
47
47 References for Further Study http://www.tug.org/ http://www.latex-project.org http://www.latex-project.org/guides/usrguide.pdf LaTeX: an introduction (http://www.techscribe.co.uk/ta/latex- introduction.pdf) The (Not So) Short Introduction to LaTeX2e (http://ctan.tug.org/tex- archive/info/lshort/english/lshort.pdf)
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.