1 / 32

Introduction to Latex Workshop

Introduction to Latex Workshop. November 2006 California State University Northridge Jennifer Wright. Why use Latex?. Compared to WYSIWYG Superior typographical quality Output device independent Portability Document longevity Macros and other programmatic features

Download Presentation

Introduction to Latex Workshop

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. Introduction to LatexWorkshop November 2006 California State University Northridge Jennifer Wright

  2. Why use Latex? • Compared to WYSIWYG • Superior typographical quality • Output device independent • Portability • Document longevity • Macros and other programmatic features • Mathematical typesetting

  3. Drawbacks of Latex • More moving parts • Difficult to remember commands • Preview delay • Syntax errors • Adding new font

  4. What if I wanted to type this in my document or Maybe a schematic Or a Lemma

  5. Preamble Body Basics • Two minimum parts needed for a .tex document • Preamble • Global commands and page layout • Body • Everything else • Example • \documentclass{article} • \begin{document} • \end{document}

  6. First .tex Document • Start editor • TeXnicCenter • Type • Save • E Drive, somename • Run –Build, current • Latex => PS => PDF • View – pdf, dvi, ps • \documentclass{article} • \begin{document} • Type something in the body of the document. • \end{document}

  7. The Preamble Some basics in the Preamble

  8. Commonly used Document Classesdocumentclass for layout and sectioning • Article: Ideal for a short paper (divided into sections, subsections, etc). Typeset to be printed double-sided. • Book: Class to be used to typeset a book (chapters, sections, etc). Typeset to be printed double-sided. • Report: (Almost) identical to the book class but for single-sided printing. • Other classes include letter, slides, beamer, etc.

  9. Document Class Options Example: • \documentclass[12pt, twoside, fleqn}{article} • %Quick comment - anything after % doesn’t show-up in final document • Default - 10pt, one sided, centered equations • -Order of options is unimportant

  10. Packages \usepackage{package} Packages – a set of LaTex commands stored in a file with extension .sty • Two packages and their usage – there are hundreds!! : • amsmath • Adds a variety of typesetting for math beyond basic LaTex • Added fonts – provides hundreds of symbols • graphicsx • Allows basic import of graph pictures \usepackage{amscd, amsmath, amsthm, amssymb} \usepackage[dvips]{graphicx}

  11. Page Formatting in Preamble • \pageheight, \pagewidth - Height and width of the page to create (i.e. size of paper you'd print on). • \topmargin - Margin at top of page above all printing. Add 1 inch (so that, for example, setting \topmargin to 0.25in would produce a top margin of 1.25 inches). • \evensidemargin - Left margin on even numbered pages. Add 1 inch (as with \topmargin). • \oddsidemargin - Left margin on odd numbered pages. Add 1 inch (as with \topmargin). • \headheight - Height of the header (the header is text that appears atop all pages). • \headsep - Distance from bottom of header to the body of text on a page. • \topskip - Distance from top of main text box to the baseline of the first line of text in the main text box. • \textheight, \textwidth - Height and width of main text box. • \footskip - Distance from bottom of body to the bottom of the footer (the footer is the text at the bottom of each page). • \parskip - Distance between paragraphs. • \parindent - Amount of indentation at the first line of a paragraph.

  12. Example Preamble \documentclass{article} \pagestyle{empty} % this is mostly for headers and footers %options: empty, plain, headings, myheadings \topmargin= -0.25in %plus 1inch \oddsidemargin= -0.25in %plus 1inch \evensidemargin= -0.25in %plus 1inch \textheight=9in \textwidth=6.5in \parindent= -.5in %paragraph indent %\noindent, \indent \usepackage{amsmath, amssymb} \usepackage[dvips]{graphicx} \begin{document} Testing different styles of page set-up \end{document}

  13. The Body! Anatomy of Article Class

  14. Title Page Option – Top Matter \documentclass[titlepage]{article} \begin{document} \title{How to Start a Latex File – or whatever you want to call you paper} \author{Your Name\\ School CSUN\\ Northridge\\} \date{\today} \maketitle this is a test \end{document} [titlepage] option creates a separate page for the title The \\ double backslashes indicate a new line \date{you can put anything here} \maketitle, to create the title page

  15. Adding the Abstract: \begin{abstract} This abstract is just 6 words long \end{abstract}

  16. Equation Display Math equations in a sentence using $ $ My first integral: $ \int x^2 dx $ Math equations independent using \[ \] or $$ $$ My first integral: \[ \int x^2 dx \] Some Others: \begin{math} x^2 \end{math} \begin{displaymath} some ~ math ~ thing \end{displaymath} \begin{equation} equation ~ is ~ numbered \end{equation} \begin{eqnarray} spaces ~ aren’t ~ noticed \end{eqnarray}

  17. Spacing in Math Modeas well as regular mode $$ \begin{aligned} x+y \\ x+\,y \\ x+~ y \\ x+\:y \\ x+\;y\\ x+\quad y\\ x+\qquad y \\ x+\!y \\ \end{aligned} $$

  18. Example Section and Subsections \section{1st Section}This is the first section. $a^2 + b^2 = c^2$ \subsection{1st Subsection}First subsection. \[ \sqrt{4}=2 \] \paragraph{Paragraph} A notable paragraph, maybe. \subparagraph{Subparagraph}Notable, maybe not. \section{2nd Section} \subsection{ 2nd Subsection}

  19. Adding a Bibliography: Try this \cite{test} reference. %put this in the body \begin{thebibliography}{9} %put this at the end of the document before it ends \bibitem{test} Jens test, Latex Workshop, November 2006. \end{thebibliography}

  20. Formatting the Body

  21. I Need Some Space! \begin{document}This is a sample to illustrates how \LaTeX\ treats space.\end{document} What happens? Basically, all the spacing is ignored, except new paragraph indent \hspace – horizontal spacing of your choice \vspace – vertical spacing of your choice, need line space after command I \hspace{2in} like \hspace{1in} space.\vspace{.5in} In every direction. I\hfill like a lot of\hfill space.\vfillIn every direction. \hfil – uses as much horizontal space as possible on the page \vfil – uses as much vertical space Using \\ forces a line beak \\[10cm] Use ~ stops from being broken across lines and adds a space. Ex: Prof.~Horn \\ ~ \newline There are more space options

  22. Font Size and Style Exercise in size: When I was born, I was {\tiny tiny}. When I got older, I thought some day I would be {\Huge huge}. But instead, {\small I'm still small.} From smallest to largest Styles \tiny \scriptsize\footnotesize \small\normalsize \large\Large \LARGE\huge \Huge \emph{text} – italicizes the text \textbf{text} – bold face \underline{text} - underline \textsl{text} – slant - And on and on Exercise in style: When something is \emph{really}, \textbf{really} important, you can \underline{underline it}. If you \underline{\textbf{\emph{must do all three}}}, then you can nest them.

  23. Justification - Centering, etc. \begin{flushleft} I feel skewed\end{flushleft} \begin{flushright} I feel off center \end{flushright} We can center text using - \begin{center} I’m Well Balanced\end{center} We can justify it left or right with -

  24. Itemize list If I want a list with numbers \begin{enumerate} \item $b\in B$ \item $2^{\alpha}$ \end{enumerate} If I want a list with bullets \begin{itemize} \item $\int_3^{t}xdx$ \item $\sum_{i=0}^n i$ \end{itemize} If I want a list with titles of my choice \begin{description} \item[1st option] $\frac{1}{2}$ \item[2nd option] $\sqrt{\pi}$ \end{description}

  25. So, How Do I Make This? The Math

  26. Simply Math Formulas $\sqrt{x}$ $x^2$ $\sqrt[6]{n+3}$ $x_2$ $\frac{x^2}{y}$ $x^{n+2}$ $x_{n+2}$ $\int^t_0 xdx$ $x_{n+2}^{n+2}$ $\int xdx$ $ \sum_{n=0}^\infty n$

  27. \begin{equation} I(z) = \sim (\frac{\pi}{2} z^2 ) \sum_{n=0}^\infty \frac{(-1)^n \pi^{2n}}{1 \cdot 3 \cdots (4n+1) } z^{4n+1}-\cos(\frac{\pi}{2} z^2) \sum_{n=0}^\infty \frac{(-1)^n \pi^{2n+1}}{1\cdot 2 \cdots (4n+1)}z^{4n+3}\end{equation}

  28. \[\sum_{p_1<p_2<\cdots,p_{n-k}}^{(1,2,\ldots,n)}\Delta_{\begin{array}{l}p_1p_2\cdots p_{n-k}\\p_1p_2\cdots p_{n-k}\end{array}} \sum_{q_1<q_2<\cdots q_k}\left |\begin{array}{llcl}a_{q_1q_1} &a_{q_1q_2} & \cdots & a_{q_1q_k}\\ a_{q_2q_1} &a_{q_2q_2} & \cdots & a_{q_2q_k}\\ \multicolumn{4}{c}\dotfill\\ a_{q_kq_1} &a_{q_kq_2} & \cdots & a_{q_kq_k}\\ \end{array}\right| \]

  29. \[\begin{CD} \mathbb{C} @>H_{1}>> \mathbb{C} @>>H_{2}>> \mathbb{C}\\ @VP_{c,3}VV @VP_{\bar{c},3}VV @VVP_{-c,3}V\\ \mathbb{C} @>H_{1}>> \mathbb{C} @>>H_{2}>> \mathbb{C}\\ \end{CD} \]

  30. Theorems and Axioms \newtheorem{theorem}{Name Theorem} % type in preamble \begin{theorem}[Weierstrass] Every $\cdots$ \end{theorem} % type in body \begin{theorem}[2nd Theorem] Every $\cdots$ \end{theorem} % type in body \newtheorem{axiom}{Axiom} % type in preamble \begin{axiom}[Test]Every $\cdots$ \end{axiom} % type in body

  31. \begin{lemma} Let $\Theta$ be a complete congruence relation of $D^{\langle 2 \rangle}$ such that \begin{equation}\label{E:rigid}\langle 1, d \rangle \equiv \langle 1, 1 \rangle \pmod{\Theta}, \end{equation} for some $d \in D$ with $d < 1$. Then $\Theta =\iota$. \end{lemma}

More Related