Formatting with LaTeX Zuyuan Wang School of Mechanical Engineering Purdue University wang1707@purdue.edu June 23, 2016 Seminar @ SURF 2016
About the SURF GAs Formatting with LaTeX (02/35) 06/23/2016 Purdue University Zuyuan Wang
Formatting with LaTeX (03/35) 06/23/2016 Purdue University Zuyuan Wang About the speaker 08/2006-07/2010 09/2003-06/2006 08/2010-07/2012 08/2012 - present
Formatting with LaTeX (04/35) 06/23/2016 Purdue University Zuyuan Wang Outline What is LaTeX? History, work flow Why LaTeX? Choosing the appropriate tool, MS Word v.s. LaTeX How to use LaTeX? Installing LaTeX packages on Windows and Mac: Some instructions General matter: Document type, page size, page layout, base font size, packages Front matter: Title, author(s), affiliation(s), date Main matter: Chapter, section, subsection, subsubsection Abstract, introduction, method, results and discussion, conclusions, acknowledges Paragraph, list, special font/symbol, verbatim Figure, table, equation, reference, hyperlink Appendix: Special chapters of supplemental information (not covered) Some tips and useful resources Some tips: Use of comments and \end{document}, style of writing, file management, Google Useful resources: Books, websites
Formatting with LaTeX (05/35) 06/23/2016 Purdue University Zuyuan Wang Outline What is LaTeX? History, work flow Why LaTeX? Choosing the appropriate tool, MS Word v.s. LaTeX How to use LaTeX? Installing LaTeX packages on Windows and Mac: Some instructions General matter: Document type, page size, page layout, base font size, packages Front matter: Title, author(s), affiliation(s), date Main matter: Chapter, section, subsection, subsubsection Abstract, introduction, method, results and discussion, conclusions, acknowledges Paragraph, list, special font/symbol, verbatim Figure, table, equation, reference, hyperlink Appendix: Special chapters of supplemental information (not covered) Some tips and useful resources Some tips: Use of comments and \end{document}, style of writing, file management, Google Useful resources: Books, websites
What is LaTeX? TeX LaTeX Description: A typesetting language Description: A TeX macro package, Developer: Dr. Donald Knuth (1938 - ) simplifying the use of TeX Professor Emeritus of Computer Developer: Dr. Leslie Lamport (1941 - ) Science at Stanford University Computer Scientist at Initial release: 1978 Microsoft Research Stable release: 3.14159265 (01/2014) Initial release: 1985 Expected release: π (after Dr. Knuth s death) Current release: LaTeX2e (10/01/2015) Website: http://tug.org/ Website: https://latex-project.org/ LaTeX source file (plain text) Compiler PDF output file (formatted document) References: Wikipedia. TeX. Donald Knuth. LaTeX. Leslie Lamport. Microsoft Office. Formatting with LaTeX (06/35) 06/23/2016 Purdue University Zuyuan Wang
Formatting with LaTeX (07/35) 06/23/2016 Purdue University Zuyuan Wang Outline What is LaTeX? History, work flow Why LaTeX? Choosing the appropriate tool, MS Word v.s. LaTeX How to use LaTeX? Installing LaTeX packages on Windows and Mac: Some instructions General matter: Document type, page size, page layout, base font size, packages Front matter: Title, author(s), affiliation(s), date Main matter: Chapter, section, subsection, subsubsection Abstract, introduction, method, results and discussion, conclusions, acknowledges Paragraph, list, special font/symbol, verbatim Figure, table, equation, reference, hyperlink Appendix: Special chapters of supplemental information (not covered) Some tips and useful resources Some tips: Use of comments and \end{document}, style of writing, file management, Google Useful resources: Books, websites
Formatting with LaTeX (08/35) 06/23/2016 Purdue University Zuyuan Wang Why LaTeX? --- Choosing the appropriate tool Drawing a gas turbine Formatting a document http://web.engr.oregonstate.edu/~sva/gt.html https://en.wikipedia.org/wiki/latex Can we draw a gas turbine with PowerPoint? Yes. Should we draw a gas turbine with PowerPoint? Probably No, because there are more advanced tools (e.g., SolidWorks, Pro/E) for this purpose. Can we format this document with MS Word? Yes. Should we format this document with MS Word? Probably No, because LaTeX could be a better option for this purpose.
Why LaTeX? --- MS Word v.s. LaTeX Components of writing a document: Author: Prepare contents, e.g., texts, figures, tables, equations, references, etc. Designer: Design page layout, margins, headers, footers, page numbers, etc. Typewriter: Specify font size, font style, line spacing, layout/numbering/cross-referencing of figures/tables/equations/references, etc. MS Word v.s. LaTeX: MS Word: Author + Designer + Typewriter LaTeX: Author + Partly Designer + Partly Typewriter LaTeX effectively separates content from formatting. The author focuses on the content. LaTeX takes care of the formatting via the many environments, which are well designed by many smart scientists and artists. Formatting with LaTeX (09/35) 06/23/2016 Purdue University Zuyuan Wang
Why LaTeX? --- MS Word v.s. LaTeX MS Word Advantages: Easy to learn WYSIWYG Large user group (> 1 billion) Disadvantages: Not free Poor file compatibility Large file size Hard to deal with large files (prone to crash) http://programmers.stackexchange.com/questions/47402/ what-is-the-best-toolkit-for-writing-long-technical-texts LaTeX Advantages: Free and open-source Professional documents Small file size Easy to modify file types Easy to deal with large files (barely crash) Good file management Disadvantages: Steep learning curve Hard to customize (trust) Small user group (< 1 million) Formatting with LaTeX (10/35) 06/23/2016 Purdue University Zuyuan Wang
Formatting with LaTeX (11/35) 06/23/2016 Purdue University Zuyuan Wang Outline What is LaTeX? History, work flow Why LaTeX? Choosing the appropriate tool, MS Word v.s. LaTeX How to use LaTeX? Installing LaTeX packages on Windows and Mac: Some instructions General matter: Document type, page size, page layout, base font size, packages Front matter: Title, author(s), affiliation(s), date Main matter: Chapter, section, subsection, subsubsection Abstract, introduction, method, results and discussion, conclusions, acknowledges Paragraph, list, special font/symbol, verbatim Figure, table, equation, reference, hyperlink Appendix: Special chapters of supplemental information (not covered) Some tips and useful resources Some tips: Use of comments and \end{document}, style of writing, file management, Google Useful resources: Books, websites
How to use LaTeX? --- Installing LaTeX package (TeXworks) Formatting with LaTeX (12/35) 06/23/2016 Purdue University Zuyuan Wang www.tug.org/texworks/
How to use LaTeX? --- Underlying Mechanism of LaTeX Formatting Formatting with LaTeX (13/35) 06/23/2016 Purdue University Zuyuan Wang S U R F
How to use LaTeX? --- Basic components of LaTeX source files Space: Spacebar, tab, \\ (line break), \newline (new line), \newpage (new page); \hspace{value} (horizontal space), \vspace{value} (vertical space); $\quad$, $\;$, $\!$, $\,$, etc. (space in mathematical expressions). Commands: Preceded by a backslash \, such as \textit{italic texts}, which produces italic texts. Could take no or some required and/or optional arguments. Many available environments \begin{ } \end{ }, similar to HTML. Contents: Including texts, mathematical expressions, figures, tables, references, appendices, headers, footers, page numbers, etc. Comments: Preceded by a percentage sign %. Formatting with LaTeX (14/35) 06/23/2016 Purdue University Zuyuan Wang
How to use LaTeX? --- General structure of LaTeX source files Formatting with LaTeX (15/35) 06/23/2016 Purdue University Zuyuan Wang % General information about the file: This is my first LaTeX file. % The purpose is to show what a LaTeX file looks like. % Created by Zuyuan Wang, 06/23/2016. \documentclass[option, option, ]{class} % Preamble: List packages, declarations, new commands/environments, etc. \begin{document} % Front matter: Title, author(s), affiliation(s), date, etc. % Main matter: Texts, equations, figures, tables, references, etc. % Appendix: Additional information \end{document} % Ignored content
How to use LaTeX? --- Document class \documentclass[option, option, option, ]{class} Document classes: Class options: Article: Report: Book: Letter: Slides: 10pt, 11pt, 12pt: twocolumn: titlepage: leqno: fleqn: twoside: openright: for simple or short documents, including journal articles, and short reports. A good all-purpose class. for small books and longer reports containing chapters. for books. for letters, either business or personal. for making transparencies for projection on a screen. Specify the font size for the main text. The default is 10pt. Produces two-column pages. Causes the \maketitle to generate the title page on a separate page for the article class. Default for the book and report classes. Puts equation numbers on left side. They are on the right by default. Left-aligns equations. They are centered by default. Formats for printing on both sides of paper. Default for the book class, but not for any of the other classes. If the twoside option is used, chapters will begin on right hand pages. Default for the book class. The opposite of openright is openany. Formatting with LaTeX (16/35) 06/23/2016 Purdue University Zuyuan Wang
How to use LaTeX? --- Exercise 1: Hello World! Formatting with LaTeX (17/35) 06/23/2016 Purdue University Zuyuan Wang Compare your output file with the provided output file.
How to use LaTeX? --- Preamble Placed between \documentclass and \begin{document}. Affects the entire document. Possible contents: Packages: e.g., \usepackage {amsmath} (for mathematical expressions), \usepackage{graphicx} (for figures), \usepackage{hyperref} (for hyperlinks); New commands: e.g., \renewcommand{\thesection}{\roman{section}} (for redefining section numbering); Declarations: e.g., \centering (for center-aligning the entire document). Formatting with LaTeX (18/35) 06/23/2016 Purdue University Zuyuan Wang
How to use LaTeX? --- Front matter Placed right after \begin{document}. Put \maketitle after \begin{document} and before the other texts to generate the front matter. Possible contents: Title, author(s), affiliation(s), date, etc. % Front matter: Title, author(s), affiliation(s), date \title{2016 Summer Undergraduate Research Fellowship (SURF) Program} \author{zuyuan Wang} \date{june 23, 2016} Formatting with LaTeX (19/35) 06/23/2016 Purdue University Zuyuan Wang
How to use LaTeX? --- Main matter --- Organization of contents Formatting with LaTeX (20/35) 06/23/2016 Purdue University Zuyuan Wang Use the star version (e.g., \section*{2016 SURF}) to remove numbering.
How to use LaTeX? --- Main matter --- References Formatting with LaTeX (21/35) 06/23/2016 Purdue University Zuyuan Wang The thebibliography Environment: The option specifies the maximum number of references. Each reference is entered with a \bibitem{label}. Cite the reference by using ~\cite{ref:example}.
Formatting with LaTeX (22/35) 06/23/2016 Purdue University Zuyuan Wang How to use LaTeX? --- Main matter --- Mathematical expressions In-line mode: $...$ Display mode: \begin{equation} \end{equation} Cite the equation by using ~\ref{eq:1d_heat}. Use Google to figure out specific usages.
How to use LaTeX? --- Exercise 2: An Introduction to Purdue University (1) Formatting with LaTeX (23/35) 06/23/2016 Purdue University Zuyuan Wang
How to use LaTeX? --- Exercise 2: An Introduction to Purdue University (2) Formatting with LaTeX (24/35) 06/23/2016 Purdue University Zuyuan Wang
How to use LaTeX? --- Exercise 2: An Introduction to Purdue University (3) Formatting with LaTeX (25/35) 06/23/2016 Purdue University Zuyuan Wang
How to use LaTeX? --- Exercise 2: An Introduction to Purdue University (4) Formatting with LaTeX (26/35) 06/23/2016 Purdue University Zuyuan Wang Compare your output file with the provided output file.
Formatting with LaTeX (27/35) 06/23/2016 Purdue University Zuyuan Wang How to use LaTeX? --- Main matter --- Figures Package: \usepackage{graphicx} Cite the figure by using ~\ref{fig:fig1_purduecampus}.
How to use LaTeX? --- Main matter --- Tables Formatting with LaTeX (28/35) 06/23/2016 Purdue University Zuyuan Wang LaTeX Table Generator: http://www.tablesgenerator.com/ Cite the table by using ~\ref{table:purdue_facts}.
How to use LaTeX? --- Exercise 3: Writing a Research Paper with LaTeX (1) Formatting with LaTeX (29/35) 06/23/2016 Purdue University Zuyuan Wang
How to use LaTeX? --- Exercise 3: Writing a Research Paper with LaTeX (2) Formatting with LaTeX (30/35) 06/23/2016 Purdue University Zuyuan Wang
How to use LaTeX? --- Exercise 3: Writing a Research Paper with LaTeX (3) Formatting with LaTeX (31/35) 06/23/2016 Purdue University Zuyuan Wang Finish formatting the remaining parts of the document, and compare your output file with the provided output file.
Formatting with LaTeX (32/35) 06/23/2016 Purdue University Zuyuan Wang Outline What is LaTeX? History, work flow Why LaTeX? Choosing the appropriate tool, MS Word v.s. LaTeX How to use LaTeX? Installing LaTeX packages on Windows and Mac: Some instructions General matter: Document type, page size, page layout, base font size, packages Front matter: Title, author(s), affiliation(s), date Main matter: Chapter, section, subsection, subsubsection Abstract, introduction, method, results and discussion, conclusions, acknowledges Paragraph, list, special font/symbol, verbatim Figure, table, equation, reference, hyperlink Appendix: Special chapters of supplemental information (not covered) Some tips and useful resources Some tips: Use of comments and \end{document}, style of writing, file management, Google Useful resources: Books, websites
Some tips Formatting with LaTeX (33/35) 06/23/2016 Purdue University Zuyuan Wang (1) Read a few documents on LaTeX before getting started; (2) Learn LaTeX through using it in real settings; (3) Use templates if available; (4) Use comments (preceded by % ) or the \end{document} to format a document part by part; (5) Use Google to find out solutions to problems or errors; (6) Focus on the outcome of formatting; (7) Keep a style of writing and file management.
Useful resources Formatting with LaTeX (34/35) 06/23/2016 Purdue University Zuyuan Wang [1] Allin Cottrell, A Short Introduction to LaTeX. (12/1995, 8 pages). http://ricardo.ecn.wfu.edu/~cottrell/ecn297/latex_tut.pdf. [2] Michael Downes, Short Math Guide for LaTeX. (v1.09, 03/22/2002, 17 pages). ftp://ftp.ams.org/pub/tex/doc/amsmath/short-math-guide.pdf. [3] Text Formatting with LaTeX: A Tutorial. (2007, 62 pages). http://www.rpi.edu/dept/arc/docs/latex/latex-intro.pdf. [4] Tobias Oetiker, Hubert Partl, Irene Hyna, and Elisabeth Schlegl. The Not So Short Introduction to LaTeX 2e. (v5.05, 07/18/2015, 171 pages). http://tug.ctan.org/info/lshort/english/lshort.pdf. [5] Nicola L. C. Talbot, LaTeX for Complete Novices. (v1.4, 09/25/2012, 273 pages). http://www.dickimaw-books.com/latex/novices/novices-report.pdf. [6] Scott Pakin, The Comprehensive LaTeX Symbol List. (11/30/2015, 331 pages). http://tug.ctan.org/info/symbols/comprehensive/symbols-a4.pdf. [7] https://en.wikipedia.org/wiki/latex.
Formatting with LaTeX (35/35) 06/23/2016 Purdue University Zuyuan Wang Thank you Q & A wang1707@purdue.edu