1 / 36

Course on Latex

Mikkel Madsen, 5th semester Data/Electronics. Course on Latex. Welcome. Copy content from DVD to your PC and pass it on You can install while I talk ( see the ” Install Help ” link from the DVD) I will help with installs in ~10 minutes About me : Mikkel Madsen, D/E 5th semester

atira
Download Presentation

Course on Latex

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. Mikkel Madsen, 5th semester Data/Electronics Courseon Latex

  2. Welcome • Copycontent from DVD to your PC and pass it on • Youcaninstallwhile I talk (see the ”InstallHelp” link from the DVD) • I willhelpwithinstalls in ~10 minutes • Aboutme: Mikkel Madsen, D/E 5th semester • Youcan not learnLaTeX in 1 evening latex.mikkl.dk – latex@antistof.dk

  3. CourseWiki • LATEX.MIKKL.DK • Objective – aimed at students here at AAUE, getyoustartedonreportwriting • Use the site to quickly find examples • In case of errorsorifyouwouldlikesomethingadded to the site, contactusonlatex@antistof.dk • Youarealwayswelcome to send us an e-mail ifyou have a LaTeXissue (wemight not beable to help, but wewilltry) • These slides areavailableon the site latex.mikkl.dk – latex@antistof.dk

  4. Program • Intro – WhyuseLaTeX? – (5 min.) • Installation of software – (25 min.) • LaTeX (1): Syntax, sections, figures, formula and tables – (30 min.) • Short break – (15 min.) • Reportstructure and template – (15 min.) • Version control / SVN – (15 min.) • LaTeX (2): Preamble, bibtex, cross-references and FiXme – (30 min.) • Break (Sandwich + soda) / Installation help / Questions – (30 min.) • Practiceassignments for thoseinterested – (30-60 minutes) latex.mikkl.dk – latex@antistof.dk

  5. What is LaTeX? • Documentswithout WYSIWYG (Whatyousee is whatyouget) • Pronounced ”Lah-tech” • Basedon the ”TeX” typesetlanguage from 1982 • Popular for technicalreports and books latex.mikkl.dk – latex@antistof.dk

  6. latex.mikkl.dk – latex@antistof.dk

  7. Program • Intro – WhyuseLaTeX? – (5 min.) • Installation of software – (25 min.) • LaTeX (1): Syntax, sections, figures, formula and tables – (30 min.) • Short break – (15 min.) • Reportstructure and template – (15 min.) • Version control / SVN – (15 min.) • LaTeX (2): Preamble, bibtex, cross-references and FiXme – (30 min.) • Break (Sandwich + soda) / Installation help / Questions – (30 min.) • Practiceassignments for thoseinterested – (30-60 minutes) latex.mikkl.dk – latex@antistof.dk

  8. Installation • LaTeX distribution • Windows: MiKTeX (Basic Installation) • Mac: MacTex • Text editor • Windows: TeXnicCenter • Mac: TeXShop • PDF viewer • PDF X-Changerecommended • Adobe/otherpdf-viewer is fine latex.mikkl.dk – latex@antistof.dk

  9. Program • Intro – WhyuseLaTeX? – (5 min.) • Installation of software – (25 min.) • LaTeX (1): Syntax, sections, figures, formula and tables – (30 min.) • Short break – (15 min.) • Reportstructure and template – (15 min.) • Version control / SVN – (15 min.) • LaTeX (2): Preamble, bibtex, cross-references and FiXme – (30 min.) • Break (Sandwich + soda) / Installation help / Questions – (30 min.) • Practiceassignments for thoseinterested – (30-60 minutes) latex.mikkl.dk – latex@antistof.dk

  10. LaTeXSyntax • LaTeX is written in ”.tex” files • ”\” (backslash) before a command • ”{}” (curlybraces) around the text the command is applied to. • E.g.:”\textit{Italic font}” = Italic font”\textbf{Bold font}” = Bold font • Some editors have buttonsthatwillinsertcommands for you. • ”%” (percent sign) beforecomments. Commentsdon’t show up in the compiled PDF. latex.mikkl.dk – latex@antistof.dk

  11. A LaTeXdocumentconsists of: • Preamble – defines the style, whatpackages to beused (packagesareused for certaincommands and styles – more onthis in LaTeX part 2} • \begin{Document}Contentgoeshere!\end{document} latex.mikkl.dk – latex@antistof.dk

  12. Sections • Numberedsections:\part{Part} (-1) I. Part \chapter{Chapter} (0) 1 Chapter\section{Section} (1) 1.1 Section\subsection{Subsection} (2) 1.1.1 Subsection • Non-numberedsections:\section*{Section}\subsection*{Subsection}Just add ”*” before{} latex.mikkl.dk – latex@antistof.dk

  13. Figures • Basicfloat:\begin{figure}[htb] \includegraphics{images/chap1/image.jpg} \end{figure} • h – Heret – topb – bottomp – ”page of floats”H – HERE! Must placefigurehere! (usesparingly) latex.mikkl.dk – latex@antistof.dk

  14. Figures • With more options:\begin{figure}[htb] \centering \includegraphics{images/chap1/image.jpg} \caption{This is mycaption} \end{figure} • Captioncanbeabove image as well • EasywithTeXnicCenter • Manyexamplesonlatex.mikkl.dk latex.mikkl.dk – latex@antistof.dk

  15. Formula • ”Inlineformula” – togetherwith the text:dollar sign ($) before and afterformula.$2*\pi*r$ • Numbered/Non-numberedformula:\begin{displaymath} 2*\pi*r \end{displaymath}\begin{equation} 2*\pi*r \end{equation} • See ”The comprehensive latex symbol list (PDF)” for symbols (link on course wiki) latex.mikkl.dk – latex@antistof.dk

  16. Tables • One of the harderthings in LaTeX • Basictable:\begin{tabular}{ l | c || r | }  1 & 2 & 3 \\  4 & 5 & 6 \\  7 & 8 & 9 \\\end{tabular} • Column adjusting & - change columnl – left \\ - changerowc – center \hline – horizontal line betweenrowsr – right | - Vertical line between columns latex.mikkl.dk – latex@antistof.dk

  17. Tables • Numberedtable:\begin{table} \centering\begin{tabular}{|l|c|c|c|}\hline& Firma 1 & Firma 2 & Firma 3 \\\hline Grundpris & 3000 & 2800 & 3100 \\\hline Liftkort & 1000 & 1100 & 1000 \\\hlineSkileje& 750 & 750 & 700 \\\hline Samlet & 4750 & 4650 & 4800 \\\hline\caption{Pris for skiferie}\end{table} latex.mikkl.dk – latex@antistof.dk

  18. Program • Intro – WhyuseLaTeX? – (5 min.) • Installation of software – (25 min.) • LaTeX (1): Syntax, sections, figures, formula and tables – (30 min.) • Short break – (15 min.) • Reportstructure and template – (15 min.) • Version control / SVN – (15 min.) • LaTeX (2): Preamble, bibtex, cross-references and FiXme – (30 min.) • Break (Sandwich + soda) / Installation help / Questions – (30 min.) • Practiceassignments for thoseinterested – (30-60 minutes) latex.mikkl.dk – latex@antistof.dk

  19. Program • Intro – WhyuseLaTeX? – (5 min.) • Installation of software – (25 min.) • LaTeX (1): Syntax, sections, figures, formula and tables – (30 min.) • Short break – (15 min.) • Reportstructure and template – (15 min.) • Version control / SVN – (15 min.) • LaTeX (2): Preamble, bibtex, cross-references and FiXme – (30 min.) • Break (Sandwich + soda) / Installation help / Questions – (30 min.) • Practiceassignments for thoseinterested – (30-60 minutes) latex.mikkl.dk – latex@antistof.dk

  20. “Includes” • \include{path/to/file}insert all content of ”file.tex” (do not include ”.tex”) • Path is relative to root .tex file • E.g.: Ourroot file ”report.tex is in C:/reportMakeincludes from index.tex in ”content” folder to chap1.tex in the same folder. • WRONG: \include{C:/report/content/chap1} • WRONG: \include{chap1} • CORRECT: \include{content/chap1} latex.mikkl.dk – latex@antistof.dk

  21. Reportstructure latex.mikkl.dk – latex@antistof.dk

  22. Reportstructure • Make up yourownstructure to fityourneeds and style • Rules of thumb: • Remember to make \includeswheneveryouadd a file to the report • Pathsare relative to the ROOT file (report.tex) • Avoid long file and pathnames • Avoidvery large .tex files (problematicwithseveralauthors) latex.mikkl.dk – latex@antistof.dk

  23. Reporttemplate • http://latex.mikkl.dk/index.php?title=Fil:Rapportskabelon.zip • Containts the folder structurewe just discussed, alongwithpreamble, frontpage and a .tex file with a range of examples. • Let’s test if it compilescorrectly! latex.mikkl.dk – latex@antistof.dk

  24. Program • Intro – WhyuseLaTeX? – (5 min.) • Installation of software – (25 min.) • LaTeX (1): Syntax, sections, figures, formula and tables – (30 min.) • Short break – (15 min.) • Reportstructure and template – (15 min.) • Version control / SVN – (15 min.) • LaTeX (2): Preamble, bibtex, cross-references and FiXme – (30 min.) • Break (Sandwich + soda) / Installation help / Questions – (30 min.) • Practiceassignments for thoseinterested – (30-60 minutes) latex.mikkl.dk – latex@antistof.dk

  25. Version control • Referred to as ”SVN” or ”Subversion” • Awesometool for cooperativeauthoring • SVN terms: • ”Update” – Updatemylocalcopy so I have the newest version • ”Commit” – Create a new version withmychanges • ”History” – Lists versions (whochangedwhat file and when) • ”Merge” – If severalauthors have edited the same file • ”Conflict” – If severalauthors have edited the same lines of a file • ”Revert” – Rollback to a previous version (file or folder) latex.mikkl.dk – latex@antistof.dk

  26. Version control • SVN explainedgraphically: http://aliensystems.ic.cz/svn.swf • Demo of Commit/UpdatewithTortoiseSVN • Handling an SVN conflict • SVN server? latex.mikkl.dk – latex@antistof.dk

  27. Program • Intro – WhyuseLaTeX? – (5 min.) • Installation of software – (25 min.) • LaTeX (1): Syntax, sections, figures, formula and tables – (30 min.) • Short break – (15 min.) • Reportstructure and template – (15 min.) • Version control / SVN – (15 min.) • LaTeX (2): Preamble, bibtex, cross-references and FiXme – (30 min.) • Break (Sandwich + soda) / Installation help / Questions – (30 min.) • Practiceassignments for thoseinterested – (30-60 minutes) latex.mikkl.dk – latex@antistof.dk

  28. Preamble • The preamble is everything from the start of the Latex source file until the \begin{document} command • Defines commands, styles, etc. • Some basic preamble settings: • \documentclass[a4paper,openright,final]{memoir} • \usepackage[danish]{babel} • \setcounter{secnumdepth}{2} • \usepackage{graphicx} • \usepackage{tabularx} latex.mikkl.dk – latex@antistof.dk

  29. Labels and Cross-references • \label{my_label_name} • \ref{my_label_name} • E.g.: \begin{figure}[htb] **** Image centering, path, caption *** \label{img:duck}\end{figure} • Image ~\ref{img:duck} is a picture of a duck! • Output willbe: ”Figure 1 is a picture of a duck!” latex.mikkl.dk – latex@antistof.dk

  30. Labels and Cross-references • Agreeon a namingscheme for your labels, e.g.:fig:label, tab:label, img:label, math:label, sec:label etc. • Labels arecase-sensitive - easier to use all lower case letters • Youcan NOT have 2 of the same labels • References to an unknown label willresult in ”??” • Files must becompiledseveral times – LaTeXcan’tknowabout all labels on the firstrun-through • See the latex.mikkl.dk page on ”TeXnicCenter” for setup of a buildprofilethatcompiles latex, bibtex, latex, latex. latex.mikkl.dk – latex@antistof.dk

  31. Labels and Cross-references • Reference to section:\section{My Section}\label{sec:my_section}Hello!\section{AnotherSection}In section~\ref{sec:my_section} I said ”Hello!”. latex.mikkl.dk – latex@antistof.dk

  32. Bibtex and Citations • Sourcesarestored in a ”.bib” file withentrieslike: @article{latexarticle1,author = ”Mikkel Madsen", title = ”The LaTeXCookbook", year = ”2010", pages = "342--351" } • Citing a source:\cite{latexarticle1}will output ”[X]” with x being the number of the source. • The bibliographywill list yoursources under theirownnumber, so readerscanconsult it for details latex.mikkl.dk – latex@antistof.dk

  33. Bibtex and Citations • See the LaTeXwikibook for bibtexexampleshttp://en.wikibooks.org/wiki/LaTeX/Bibliography_Management • Inserting the bibliography (bib.bib): \bibliography{bib} • Changingstyle (put thisbefore \bibliography{}):\bibliographystyle{ieeetr}”ieeetr” numbers in order of appearance, for otherstylessee:http://www.cs.stir.ac.uk/~kjt/software/latex/showbst.html latex.mikkl.dk – latex@antistof.dk

  34. The FiXmepackage • Add the package in Preamble:\usepackage[footnote,draft,english,silent,nomargin]{fixme} • Add a fixme for stuffthatneeds to betakencare of, orthatotherauthors must look at. • \fxnote{Note here} – inserts a footnotewithyour note • \listoffixmesgenerates a list of fixme’s and their page numbers • For long notes use\anfxnote{summary}{long description}Only the summary appears in \listoffixmes, and the long description is in the footnote. latex.mikkl.dk – latex@antistof.dk

  35. Program • Intro – WhyuseLaTeX? – (5 min.) • Installation of software – (25 min.) • LaTeX (1): Syntax, sections, figures, formula and tables – (30 min.) • Short break – (15 min.) • Reportstructure and template – (15 min.) • Version control / SVN – (15 min.) • LaTeX (2): Preamble, bibtex, cross-references and FiXme – (30 min.) • Break (Sandwich + soda) / Installation help / Questions – (30 min.) • Practiceassignments for thoseinterested – (30-60 minutes) latex.mikkl.dk – latex@antistof.dk

  36. Program • Intro – WhyuseLaTeX? – (5 min.) • Installation of software – (25 min.) • LaTeX (1): Syntax, sections, figures, formula and tables – (30 min.) • Short break – (15 min.) • Reportstructure and template – (15 min.) • Version control / SVN – (15 min.) • LaTeX (2): Preamble, bibtex, cross-references and FiXme – (30 min.) • Break (Sandwich + soda) / Installation help / Questions – (30 min.) • Practiceassignments for thoseinterested – (30-60 minutes) latex.mikkl.dk – latex@antistof.dk

More Related