190 likes | 313 Views
Seminar. Sam Panzer. Good Evening, and Welcome. First, an overview of what these seminars will cover Topics: What you need to get started What LaTeX is (and what it isn’t) A bit of history (if you’re interested) Basic concepts Writing simple documents
E N D
Seminar Sam Panzer
Good Evening, and Welcome First, an overview of what these seminars will cover • Topics: • What you need to get started • What LaTeX is (and what it isn’t) • A bit of history (if you’re interested) • Basic concepts • Writing simple documents • With a special addendum for the CIS 160 proof tree templates
Start Your Browsers • LaTeXis a fairly large system (a few hundred MB) • First, download and install TeX Live from http://mirror.ctan.org/systems/texlive/tlnet/install-tl.zip (unless you’re on Linux) • Windows users, install the TeXNic Center from http://sourceforge.net/projects/texniccenter/files/TeXnicCenter/1.0%20Stable%20RC1/TXCSetup_1StableRC1.exe/download • Mac users, install the TeXShop IDE from http://www.uoregon.edu/~koch/texshop/texshop.zip • Linux users, install the texlive package
About LaTeX • LaTeX is a document markup language • According to Wikipedia • LaTeX documents describe the layout and content for the typesetting program TeX • You describe the presentation of a document, and LaTeX makes it look pretty
A Bit of History • LaTeX is a high-level front-end to the TeX typesetting system • It was originally written in the early 1980s • Many contemporary academic papers are typeset in LaTeX
LaTeX Input • Three common types of input: • Commands • Start with a backslash • Text • Just typed! • Math • Enclosed in dollar signs • All LaTeX will be displayed in this font for this presentation
On Structure • Each LaTeX document begins by stating which type of output it generates • Article, report, book, letter, slides • Usually use article \documentclass{article} • The contents of the document reside between \begin{document} and \end{document} • All other examples are assumed to be between \begin{document} and \end{document}
A Simple Sample Latex Document \documentclass{article} \title{Evil Plans} \author{Sam Panzer} \begin{document} \maketitle Tonight, we take over the world! \end{document}
Commands • As before, they start with backslashes • \noindent • Two backslashes start a new line • Required arguments are placed in braces\textbf{Bold Text} • \emph{Italicized Text} • \hspace{3mm} • Optional arguments go in brackets • \documentclass[twoside,10pt]{article} • There is a command for just about anything! Check http://detexify.kirelabs.org/classify.html
Example, with commands \noindent \textbf{Homework 5} \\\noindent CIS 260 \hspace{5mm} Pf. Gallier Intuitionistic logic differs from classical logic in that proof-by-contradiction (\emph{RAA}) is disallowed.
Math • Inline expressions are enclosed in dollar signs $f(x_1,x_2) = x_1^2 + 2x_2$ Results in • Use double dollar signs to place an equation on its own line • Carets (^) are used for superscripts, and underscores (_) for subscripts
Math II • Common Commands • \frac{numerator}{denominator} • \sqrt{inside} • \sum_{subscript}^{superscript} • \int_{lower bound}^{upper bound}{integral} • \infty • \cdot • \leq and \geq • \( and \) • \Rightarrow • Any Greek letter is \lettername • E.g. \pi, \Gamma • For uppercase, capitalize the first letter • Unless the uppercase looks like English…
Math example \section{The Algebraic-Geometric Infinite Series} We often see series in the form $S = a+ ar + ar^2 + ...,$ and are familiar with the formula for evaluating them, given that $|r| < 1.$ In this case, the series is slightly different - the numerators follow an algebraic series, and the denominators a geometric series. $$S = \frac{1}{1} + \frac{2}{4} + \frac{3}{16} + \frac{4}{64} + ... = \sum_{k=0}^\infty{\frac{k + 1}{4^k}}$$ The trick used to solve a geometric series was to multiply the entire series by the common ratio, then subtract the result from the original series. Here, $$4S = 4 + \frac{2}{1} + \frac{3}{4} + \frac{4}{16} + ... $$ Subtracting the original, we have reduced the original problem to a geometric series, $$4S - S = 4 + \frac{1}{1} + \frac{1}{4} + \frac{1}{16} + ....$$ Finally, $$3S = 4 + \sum_{k=0}^\infty{\frac{1}{4^k}} = 4 + \frac{4}{3},$$ so $S = \frac{16}{9}$
Setting up your math homework \documentclass{article} \usepackage{amsmath} \begin{document} \section{Problem 1} From Theorem 7.2, we know that $|<v,w>|^2 \leq||v||\cdot ||w||.$ \end{document}
Example math-heavy excerpt(Copied from an old homework) \section{The Fibonacci Numbers} $F_0 = 1, F_1 = 1, F_{n+2} = F_{n+1} + F_{n}$ if $n \geq 0.$ \vspace{3mm} \\\textbf{Base case for induction}: $n = 0$ Then $F_{n+2} = \binom{2}{0} + \binom{1}{1} + \binom{0}{2} = 2.$ According to the recursive definition, $F_2 = F_1 + F_0 = 1 + 1 = 2.$ Inductive case: Assume the (complete) induction hypothesis, for all $n \geq m \geq 2,$ $$F_m = \sum_{k=0}^m \binom{m-k}{k},$$ we try to show that $$F_{n+1} = \sum_{k=0}^{n+1} \binom{n + 1 -k}{k}.$$ Consider $F_{n+1}.$ By the recursive definition of $F,$ we have $F_{n+1} = F_n + F_{n-1}.$ By the inductive hypothesis, we have that $$F_{n+1} = \sum_{k=0}^n\binom{n-k}{k} + \sum_{k=0}^{n-1}\binom{n-1-k}{k}.$$ Now recall that $\binom{-1}{n+1} = \binom{-1}{n} = 0,$ so we can add these into the summations. $$F_{n+1} = \sum_{k=0}^{n + 1}\binom{n - k}{k} + \sum_{k=0}^{n}\binom{n -1 -k}{k}.$$ To combine the summations, we remove the first item from the first summation then adjust the indices. $$F_{n+1} = \binom{n}{0} + \sum_{k=1}^{n + 1}\binom{n -k}{k} + \sum_{k=0}^{n}\binom{n - 1 -k}{k} = \binom{n}{0} + \sum_{k=1}^{n+1}\binom{n -k}{k} + \sum_{k=1}^{n + 1}\binom{n -k}{k - 1}.$$ Combining the summations and applying $\binom{k-1}{p} + \binom{k-1}{p-1} = \binom{k}{p},$ $$F_{n+1} = \binom{n}{0}+\sum_{k=1}^{n + 1} \binom{n - k + 1}{k} = \sum_{k=0}^{n + 1} \binom{n - k + 1}{k}$$ as desired.
Some useful LaTeX tidbits • LaTeX ignores single line breaks • You need a blank line to start a new paragraph • LaTeX collapses whitespace • Multiple consecutive blank lines are treated exactly as a single blank line • Multiple spaces between words are handled as if they were a single space • LaTeX ignores all characters on a line after it sees a % • This is called commenting • Useful for removing bits of work you don’t want to be shown but don’t want to delete • Underscores (_) and carets (^) only affect the next character • Place everything that needs to be affected within braces • E.g. $x^{-1} = a_1b_1$ results in
That’s all for now! • This session covered the basics • Though some of the example code might be complicated • I included extra slides for the CIS 160 people