Presentation is loading. Please wait.

Presentation is loading. Please wait.

C151 Multiuser Operating Systems Introduction to LaTeX.

Similar presentations


Presentation on theme: "C151 Multiuser Operating Systems Introduction to LaTeX."— Presentation transcript:

1 C151 Multiuser Operating Systems Introduction to LaTeX

2 What is LaTex 2 LaTeX is a document markup language and document preparation system.

3 Why LaTeX? 3 LaTeX Separate contents from style Word WYSIWYG

4 Why not MS Word?

5 Why LaTeX? 5 Portable and free Professionally crafted layouts are available The typesetting of mathematical formulae is supported in a convenient way Output: many different formats Users need only to learn a few simple commands, which specify the logical structure of a document Complex structures such as footnotes, references, table of contents, and bibliographies can be generated easily

6 Required Tools 6 Editor: TeXnic Winedt Input file: The input for LaTeX is a plain text file with extension “.tex” You can create it with any text editor. It contains: the text of the document and commands which tell LaTeX how to typeset the text. Compiler ( www.miktex.org) www.miktex.org Standard installation for Linux Windows Mac

7 Output Formats.dvi Device Independent.psPost Script.pdfPDF.rtfRich Text Format.htmlHTML

8 Compile LaTeX Generate a dvi file: >latex file_name.tex Generate a pdf file >pdflatex file_name.tex

9 9 Documents Structure (1) Every LaTeX document must contain the following three components: \documentclass{article} \begin{document} \end{document}

10 Document Structure (2) Every input file starts with the command: \documentclass{...} When all the setup work is done, you start the body of the text with the command: \begin{document} Now you enter the text mixed with some useful LaTeX commands. At the end of the document you use the \end{document}

11 \documentclass[options]{class} First line of all LaTeX documents specifies the {type} of the document and the [stylesheet] used. book report article letter Ready templates: IEEETrans, ACM, etc. In general, required information is included in LaTeX commands in braces {}, while optional information is included in square brackets []. \documentclass[ieee]{article}

12 \documentclass{article} 12

13 \documentclass[twocolumn]{article} 13

14 \documentclass{report} 14

15 LaTeX Document Example (1) \documentclass{article} \begin{document} This is some sample text. \end{document}

16 LaTeX Document Example (2) \documentclass{article} \begin{document} During the 1960s, many large software development efforts encountered severe difficulties. Software schedules were typically late, costs greatly exceeded budgets and the finished products were unreliable. \vspace{10 mm} \noindent People began to realize that software development was a far more complex activity than they had imagined. \end{document}

17 LaTeX Document Example (2): result

18 LaTeX Document Example (3) To add a title to a document use \title and \maketitle \title defines the title and \maketitle inserts it into the document \maketitle must come after \begin{document} \maketitle usually comes before any other text \title must come before \maketitle To add an author and date and use \author and \date \documentclass{article} \begin{document} \title{Hello, World! In Latex} \author{Marc Corliss} \date{2/15/2006} \maketitle Hello, World!\\ \end{document}

19 LaTeX Document Example (3): result

20 20 Abstracts To create an abstract, place your text in an abstract environment, i.e., between \begin{abstract} and \end{abstract} commands. The abstract should come immediately after your \maketitle command, but before any \tableofcontents command.

21 Sections \section{Section Title} \subsection{Title} \subsubsection{Title}

22 LaTeX Document Example (4) \documentclass{article} \begin{document} \title{Hello, World! In Latex} \author{Marc Corliss} \date{2/15/2006} \maketitle \begin{abstract} This is example 4. \end{abstract} \section{Hello, World!} Hello Everyone!\\ \end{document}

23 LaTeX Document Example (4): result

24 Spaces Whitespace characters (e.g. blank, tab, single linebreak) are treated uniformly as “space” by LaTeX. Several consecutive whitespace characters are treated as one “space”. An empty line between two lines of text defines the end of a paragraph. Several empty lines are treated in the same way as one empty line.

25 Spaces \documentclass{article} \begin{document} It does not matter whether you enter one or several spaces after a word. An empty line starts a new paragraph. \end{document}. Editor view Document view

26 Special Characters The following symbols are reserved characters, that have a special meaning in LaTeX $ & % # _ { } ~ ^ \ Some of these characters can be used in your documents by adding a prefix backslash (escape character): \$ \& \% \# \_ \{ \} The other symbols (and many more!) can be printed with special commands in mathematical formulae.

27 LaTeX Commands LaTeX commands are case sensitive and start with a backslash \ \documentclass{article} \begin{document} This is \emph{emphasized} text. \end{document} Editor view Document view

28 Comments When LaTeX encounters a % character while processing an input file, it ignores the rest of the present line. This is useful for adding notes to the input file, which will not show up in the printed version. \documentclass{article} \begin{document} This text is processed. % A comment isn’t \end{document} Editor view Document view

29 Page Styles LaTeX supports three predefined header/footer combinations. These are known as page styles. The style parameter of the \pagestyle{style} command defines which one to use: plain prints the page numbers on the bottom of the page in the middle of the footer (default page style) headings prints the current chapter heading and the page number on each page header. empty - both header and footer empty

30 30 Hyphenation There are four hyphens in LaTeX : 1. - (a single dash) is for hyphenating words. 2. -- (two dashes) is for ranges of numbers. 3. --- (three dashes) is for an honest-to-goodness dash between words. 4. $-$ is a minus sign in math mode.

31 31 Hyphenation \documentclass{article} \begin{document} My cousin-in-law lived in Germany in 1995--2006; he speaks French--- really, he does. His favorite number is $-2$. \end{document} Editor view Document view

32 32 The LaTeX Logo You can typeset the LATEX logo with the \LaTeX command. As with most commands, it consumes any space behind it, so if it isn't at the end of a sentence, use \LaTeX\ instead.

33 33 Appearance of Words \underline{phrase} to underline a phrase, \textbf{phrase} to print a phrase in boldface, and \emph{phrase} to italicize a phrase.

34 34 Centering Text By default, LaTeX will start all text at the left margin. If you want to center a title, a table, etc., surround what you want centered with the commands: \begin{center} and \end{center}.

35 LaTeX Example (5) \documentclass{article} \begin{document} \title{\LaTeX\ 1, 2, 3} \author{Liguo Yu} \maketitle \section{Introduction} \begin{center} This is an intruduction! \end{center} \section{Conclusion} Thanks for reading this \textbf{article}. \end{document}

36 LaTex Example (5): Result

37 37 Bulleted Lists To create a bulleted list, surround the information with a \begin{itemize} and an \end{itemize}, and begin each item with an \item. \documentclass{article} \begin{document} \begin{itemize} \item A bulleted item. \item Another bulleted item. \begin{itemize} \item A nested bulleted item. \end{itemize} \item You get the idea. \end{itemize} \end{document} Editor view Document view

38 38 Numbered Lists To create a numbered list, surround the information with a \begin{enumerate} and an \end{enumerate}, and begin each item with an \item. \documentclass{article} \begin{document} \begin{enumerate} \item A numbered item. \item Another numbered item. \item You get the idea. \end{enumerate} \end{document} Editor view Document view

39 Typesetting Mathematics LaTeX has a Math mode for typesetting mathematics. Within a paragraph, math mode is entered between $ characters, or by using the \begin{math} and \end{math} commands \documentclass{article} \begin{document} Add a squared to b squared to find c squared, e.g. $a^2 + b^2 = c^2$. It’s as easy as that! \end{document} Editor view Document view

40 Typesetting Mathematics Greek Symbols \alpha, \beta, \gamma Superscript, Subscript x^yx_yx_y^z Calculus \int_0^\infty\int{\int} \frac{\partial u}{\partial x}

41 Typesetting Mathematics x = \frac{-b \pm \sqrt{b^2-4ac} } {2a}

42 Figures \begin{figure} \includegraphics{sample.jpg} \caption{A sample figure.} \end{figure}

43 Example \documentclass{article} \usepackage[pdftex]{graphicx} \begin{document} \begin{figure} \centering \includegraphics{Figure1.jpg} \caption{Depiction of the production of kernel-based software} \end{figure} \end{document} Compile: pdflatex file_name Compile: pdflatex file_name

44 Result

45 Columns \begin{tabular}{|…|…|} \end{tabular} Rows & - Split text into columns \\ - End a row \hline - Draw line under row Two Columns l = automatically adjust size, left justify r = automatically adjust size, right justify p = set size e.g p{4.7cm} c = centre text Tabular

46 Example of table \documentclass{article} \begin{document} \begin{tabular}{|l|r|c|} \hline Date & Price & Size \\ \hline Yesterday & 5 & Big \\ \hline Today & 3 & Small \\ \hline \end{tabular} \end{document} Editor view Document view

47 Bibliographies Articles can be referred to in the text using the \cite command The details of the cited articles are stored in BibTeX format, in a “.bib” file. BibTeX resolves the citations in the LaTeX file and generates the required bibliography

48 Bibliographies Example entries from test.bib file: @book{AhR1975, author ={N. Ahmed and K. Rao}, title ={Digital signal processing}, publisher ={Springer-Verlag}, year ={1975}, address ={New York}, } @inproceedings{Aus1989, author ={James Austin and A. Phantom and B. Nom}, title ={High Speed Neural Networks}, booktitle ={IEE Image Processing and Applications}, year ={1989}, pages ={28--32}, }

49 test.tex file \documentclass[12]{article} \begin{document} \title{Work Study 1, 2, 3} \author{Liguo Yu} \date{\today} \maketitle \section{Introduction} This is an intruduction! \section{Result} By far the most commonly used feature is presented by \cite{Aus1989} and \cite{Ahr1975}. \section{Conclusion} Thanks for reading this article. \bibliographystyle{abbrv} \bibliography{test} \end{document}

50 Compile LaTeX We need to compile.tex and.bib separately and combine the output together to generate a PDF file >latex test (compile.tex file) >bibtex test (compile.bib file) >pdflatex test (geberate.pdf file) Might need to run several rounds to successfully combine them

51 Result: test.pdf


Download ppt "C151 Multiuser Operating Systems Introduction to LaTeX."

Similar presentations


Ads by Google