1 / 29

Latex A document preparation system

Latex A document preparation system. All academic staff in Computer Science publish their work using Latex – NOT Microsoft Word. Why? Note to self – press ctrl key to show pointer. Outline. What is latex and why learn it . How does it compare to word processors.

arnaud
Télécharger la présentation

Latex A document preparation system

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. LatexA document preparation system All academic staff in Computer Science publish their work using Latex – NOT Microsoft Word. Why? Note to self – press ctrl key to show pointer

  2. Outline • What is latex and why learn it. • How does it compare to word processors. • The basic method of producing documents • Some basic commands • Where to go for more information…Google

  3. Have you ever….? • Saved a word file at university • Then taken it home and opened it on a different computer, only to find all of the formatting is different. • Latex is platform independent. You can give a tex file to someone to run on any computer. • Latex is for scientific/technical documents.

  4. What is latex • It is a document preparation package • Compare with notepad (a text editor), Microsoft word (a word processor) and e.g. eclipse (a programming environment). • It is a mark up language (like html) • In Internet Explorer go to View Source and you can see the code for a webpage. • http://scottmcpeak.com/latex/whatislatex.html

  5. Why learn latex • Latex is harder to learn that Microsoft word - initially. • In the longer term you will see the benefits. • It will be around for years (and has been). • It produces more professional results compared to WYSIWYG (what you see is what you get) type word processing packages. • There is a strong community of users on the internet (user groups, forums e.g. http://latex-community.org/). • Publishing is often encouraged in latex (rather than MS word). • Lots of good tutorials on-line

  6. Comparison Word vs Latex • MS word is a single file e.g. CV.doc. • Wysiwyg (what you see is what you get) • Latex uses (at least) two files, a source file (input) and a target file (output). E.gCV.tex and CV.pdf • In Word, you highlight text with a mouse and make it bold/underlined/change font size… • In Latex, you surround the text with a command e.g\emph{John} emphasizes the word “John” • http://openwetware.org/wiki/Word_vs._LaTeX

  7. Command line or Icons • It can be run from the command line. • Basic commands are • latex file.tex • bibtexfile.tex • pdflatexfile.tex • It can also be run via software (e.g. http://www.winedt.com/), many of which are freely available.

  8. Special Characters • Most characters on the keyboard, have their usual meaning “abc123”. • However the characters \ { } $ ^ _ % ~ # & are used for special purposes • \# \$ \% \& \_ \{ \} •  \, ^ and ~ cannot be produced simply by preceding them with a backslash. They can however be produced using \char92 (in the \texttt font only), \char94 and \char126 respectively. 

  9. Comments % • You can skip or ignore a line by placing % in front % this line is not printed This line will be printed • Unfortunately there is no way to comment multiple lines except by doing it individually. % line 1 is ignored % line 2 is ignored • However many graphical editors do allow this.

  10. control sequences. • consist of a backslash \ followed by a string of (upper or lower case) letters. • \delta produces the greek letter , • \emph{hi},emphasized (italic font), hi • \to (or \rightarrow) produces the arrow  -->.

  11. mathematics mode • The special character $ is used when embedding mathematical expressions in paragraphs of ordinary text in order to change into and out of `mathematics mode'. • The special characters ^ and _ are used in mathematical expressions to produce superscripts and subscripts respectively. • \begin{equation} f(x) = 4x + 11 \end{equation} • A backslash \ can be obtained in mathematics mode by typing \backslash.

  12. Greek letters and math symbols Just Google “Greek letters latex” or “latex math symbols”. Here are a few I have found. • http://www.maths.tcd.ie/~dwilkins/LaTeXPrimer/MathSymb.html • http://www.maths.tcd.ie/~dwilkins/LaTeXPrimer/GreekLetters.html

  13. Work through the following (eg. 2) • \documentclass[a4paper,12pt]{article} • \begin{document} • \emph{analysis} • $D$ • $\bf R$ • $f \colon D \to \mathbf{R}$ • $\epsilon > 0$ • $x \in D$, • $\delta > 0$ • \end{document}

  14. Producing White Space in LaTeX • “white space” is ignored by latex. • \hspace{20 mm}. Horizontal space of 20 mm • \vspace{10 mm}. Vertical space of 10 mm • \noindentWill not indent the next paragraph. • Mr.\ Smith' • ~represents a blank space at which LaTeX is not allowed to break between lines • To obtain `W. R. Hamilton' it is best to type W.~R.~Hamilton.

  15. List environments LaTeX provides the following list environments: • enumerate for numbered lists, • \begin{enumerate} … \end{enumerate} • itemize for un-numbered lists, • \begin{itemize} ... \end{itemize} • description for description lists • \begin{description}…\end{description}

  16. Tables • \begin{tabular} command • the string {lll} is a format specification for a table with three columns of left-justified text. • \begin{tabular}{|r|r|} two columns of right-justified • the ampersand character & is used to separate columns of text within each row, • the double backslash \\ is used to separate the rows of the table. • the command \hline produces a horizontal line

  17. Accents • There are a variety of control sequences for producing accents. For example, the control sequence \'{o} produces an acute accent on the letter o. Thus typing • Se\'{a}n \'{O} Cinn\'{e}ide. • Again, to find more – I encourage you to just Google “latex accents”

  18. Define Your own commands. • \[ \int_{-\infty}^{+\infty} f(x)\,dx.\] • \newcommand{\inftyint}{\int_{-\infty}^{+\infty}} • \[ \inftyint f(x)\,dx.\] • \newcommand{\intwrtx}[1]{\int_{\infty}^{+\infty} #1 \,dx} • \[ \intwrtx{f(x)}.\] • \newcommand{\intwrt}[2]{\int_{-\infty}^{+\infty} #2 \,d #1} • \[ \intwrt{y}{f(y)}.\]

  19. Theorems, proofs, lemmas, … •  \begin{theorem} … \end{theorem}.  • \begin{lemma} ... \end{lemma} • \begin{proof}….\qed \end{proof} •  \label{name}  •  \ref{name}

  20. Fractions and Roots • To print a fraction we type • \frac{numerator}{denominator}. • To print a square root • \sqrt{expression}. • To print the n-th root • \sqrt[n]{expression}.

  21. Brackets and Norms • (, [ and {, which are obtained by typing (, [ and \{ respectively.  • The corresponding right delimiters are of course obtained by typing ), ] and \}. •  In addition | and || are used as both left and right delimiters, and are obtained by typing | and \| respectively. • large parentheses is to type \left( for the left parenthesis and \right) for the right parenthesis,

  22. Matrices. • Matrices are important for a number of application in engineering. • You will probably use Matlab to do the calculations • But you can use Latex to produce the documentation • http://www.maths.tcd.ie/~dwilkins/LaTeXPrimer/Matrices.html

  23. What to do if you get an error. • PC for John Woodward • you should compile the tex file every few minutes so you can see immediately if you have made a mistake. • Unfortunately, the error is not always where you think it is. Some detective work may be necessary. • Pay attention to the error messages.

  24. Bibtex 1 To cite a work or paper \cite{Narendra_1990} The following two commands go at the end of the docuement To choose a style \bibliographystyle{plain} Put your references in a separate file myref.bib\bibliography{myrefs} "myrefs.bib" \end{document} See http://amath.colorado.edu/documentation/LaTeX/reference/faq/bibstyles.html

  25. Bibtex 2 • You need to compile the bibtex file. • Suppose you have article.tex and article.bib. You need to run: • latex article.tex (this will generate a document with question marks in place of unknown references) • bibtex article (this will parse all the .bib files that were included in the article and generate meta information regarding references) • latex article.tex (this will generate document with all the references in the correct places) • latex article.tex (just in case if adding references broke page numbering somewhere) • Or you could write a script with these commands (see Cygwin lecture)

  26. Document classes You have been article style today but there are other styles • book, • report • letter • http://www.latextemplates.com/

  27. Where to find out more • Just Google latex with different combinations (see the earlier lecture on Google). • http://www.latexeditor.org/ • www.winedt.com/  • miktex.org/

  28. weblinks • http://www.maths.tcd.ie/~dwilkins/LaTeXPrimer/ • http://tobi.oetiker.ch/lshort/lshort.pdf • http://en.wikibooks.org/wiki/LaTeX/Introduction • http://www.miktex.org/ • http://www.tex.ac.uk/cgi-bin/texfaq2html?label=verbfile • http://www-h.eng.cam.ac.uk/help/tpl/textprocessing/

  29. NASA and Love letters • NASA uses latex • http://www.giss.nasa.gov/tools/latex/ltx-2.html • Next time you write a love letter to your girl/boy friend – Don’t handwrite it – don’t use word – use latex 

More Related