\documentclass{beamer} \usepackage[latin1]{inputenc} \usepackage[T1]{fontenc} \usepackage{fixltx2e} \usepackage{graphicx} \usepackage{longtable} \usepackage{float} \usepackage{wrapfig} \usepackage{soul} \usepackage{textcomp} \usepackage{marvosym} \usepackage{wasysym} \usepackage{latexsym} \usepackage{amssymb} \usepackage{hyperref} \tolerance=1000 \usepackage[english]{babel} \usepackage{ae,aecompl} \usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet} \usepackage{listings} \lstset{ language=TeX, basicstyle=\ttfamily\bfseries, commentstyle=\ttfamily\color{blue}, stringstyle=\ttfamily\color{orange}, showstringspaces=false, breaklines=true, postbreak = \space\dots } \newcommand{\typ}[1]{\lstinline{#1}} \mode { \usetheme{Warsaw} \useoutertheme{infolines} \setbeamercovered{transparent} } \title{\LaTeX} \author[FOSSEE] {FOSSEE} \institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay} \date{} %% Delete this, if you do not want the table of contents to pop up at %% the beginning of each subsection: \AtBeginSubsection[] { \begin{frame} \frametitle{Outline} \tableofcontents[currentsection,currentsubsection] \end{frame} } \AtBeginSection[] { \begin{frame} \frametitle{Outline} \tableofcontents[currentsection,currentsubsection] \end{frame} } \begin{document} % Document title \begin{frame} \maketitle \end{frame} \section{Introduction} \begin{frame} \frametitle{{\LaTeX} - Introduction} \begin{itemize} \item Typesetting program \begin{itemize} \item What is typesetting? \end{itemize} \item Excellently Typeset Documents - specially Math \item Anything from one page articles to huge books \item Pronounced \emph{Lah-tech} or \emph{Lay-tech} \end{itemize} \end{frame} \begin{frame} \frametitle{Why \LaTeX?} \begin{itemize} \item Excellent visual quality! \item Handles the typesetting; Lets you focus on content \item Makes writing math extremely simple \item It is a standard -- widely used in Scientific community \end{itemize} \begin{block}{} \[\tilde{N}_{\mathbf{x}}\times \mathbf{r}(\mathbf{x}) f_{1k}(\mathbf{x},t) - \frac{1}{2} \tilde{N} \tilde{N}:\mathbf{BB}^{T}P(\mathbf{x},t) = -m_{k}f_{1k}(\mathbf{x},t) + 2 \mathop{\mathbf{\aa}}_{j=1}^{K} f_{1j}(\mathbf{x},t)m_{j}P_{k|j} \] \end{block} \end{frame} \begin{frame} \frametitle{Course Outline} \begin{itemize} \item Look at the sample document - \typ{sample.pdf} \begin{itemize} \item Title, Author, Date \item Abstract \item Sections \& Subsections \item Appendix \item References/Bibliography \item Tables \item Figures \item Math \end{itemize} \item The document will be produced by the end of the course. \item First Hour - Basic Structure \item Second Hour - Text, Tables, Figures, References \item Third Hour - Math, Bibliography, Presentations \end{itemize} \end{frame} \begin{frame}[fragile] \frametitle{\LaTeX~ as a Mark-up} \begin{itemize} \item {\LaTeX} is a document based mark-up \item Mark-up --- a system of annotating text, adding extra information to specify structure and presentation of text \item Document based markup $\rightarrow$ you don't have to worry about each element individually \item Allows you to focus on content, rather than appearance. \end{itemize} \end{frame} \begin{frame}[fragile] \frametitle{Typesetting a minimal document} \begin{itemize} \item Write the sample code into the file \typ{draft.tex}\\ {\tiny See \typ{hg} rev0 of draft} \item To compile, (in terminal) \\ \begin{lstlisting}[language=bash] $ pdflatex draft.tex \end{lstlisting} %%$ \item This produces the output file \typ{draft.pdf} \item \alert{Note:} \typ{latex} vs. \typ{pdflatex} \end{itemize} \end{frame} \begin{frame}[fragile] \frametitle{Commands \& Environments} \begin{itemize} \item {\LaTeX} is case sensitive \item Commands begin with a \typ{\\} \item Environments have a \typ{\\begin} and \typ{\\end} \item Any content after the \typ{\\end\{document\}} is ignored \end{itemize} \end{frame} \begin{frame}[fragile] \frametitle{Comments \& Special Characters} \begin{itemize} \item Anything that follows a \typ{\%} symbol till end of the line is a comment \item Special characters (\typ{\~ \# \$ \^ \& \_ \{ \}}) are escaped by a \typ{\\} \item \typ{\\} symbol is inserted using \typ{\\textbackslash} command \end{itemize} \end{frame} \begin{frame}[fragile] \frametitle{Spacing} \begin{itemize} \item \typ{\\\\} inserts a new line in the output \item An empty line marks the beginning of a new paragraph \item Multiple spaces (or empty lines) are equivalent to a single space (or empty line) \end{itemize} \end{frame} \section{Adding Structure} \begin{frame}[fragile] \frametitle{\typ{documentclass}} \begin{itemize} \item Used to select the \emph{class} of our document \item Some available classes - \typ{article}, \typ{proc}, \typ{report}, \typ{book}, \typ{slides}, \typ{letter}. \item For example: \typ{\\documentclass\[12pt,a4paper,draft\]\{report\}}\\ The parameters within \typ{\[ \]} are optional. \begin{itemize} \item \typ{12pt} -- sets the font size of main font and others are relatively, adjusted. \typ{10pt} is the default. \item \typ{a4paper} -- specify paper size \item \typ{draft} -- marks hyphenation and justification problems in typesetting with a square in the margin \end{itemize} \end{itemize} \end{frame} \begin{frame}[fragile] \frametitle{Top Matter} Let's add the title, author's name and the date. \begin{itemize} \item Add title, author and date. \item Compile. \item Nothing changes. \end{itemize} {\tiny See \typ{hg} rev1 of draft.} \end{frame} \begin{frame}[fragile] \frametitle{Top Matter \ldots} \begin{itemize} \item \lstinline{\maketitle} command inserts the top-matter. \item Add the command to the document \& compile again. \item If no date is specified, today's date is automatically inserted. \end{itemize} \tiny{See \typ{hg} rev2 of draft.} \end{frame} \begin{frame}[fragile] \frametitle{Abstract} \begin{itemize} \item \typ{abstract} environment inserts abstract. \item Place it at the location where you want your abstract. \end{itemize} \tiny See rev3 of \typ{hg} \end{frame} \begin{frame}[fragile] \frametitle{Sectioning} \begin{itemize} \item \lstinline{\section}, \lstinline{\subsection} \lstinline{\subsubsection} \item Auto numbered sections! \item \typ{*} to prevent numbering of a section \end{itemize} \tiny See rev4 of \typ{hg} \end{frame} \begin{frame}[fragile] \frametitle{Sectioning \ldots} \begin{itemize} \item Longer documents, use \lstinline{report} or \lstinline{book} class \item Chapter can be added using \lstinline{\chapter} \end{itemize} \begin{lstlisting} \documentclass{report} \chapter{One} \end{lstlisting} \begin{itemize} \item subsections do not get numbering \item Change \lstinline{secnumdepth} \end{itemize} \begin{lstlisting} \setcounter{secnumdepth}{3} \end{lstlisting} \tiny See rev5 of \typ{hg} \end{frame} \begin{frame}[fragile] \frametitle{Appendices} \begin{itemize} \item \lstinline{\appendix} command indicates the beginning of Appendices. \item Any content after \lstinline{\appendix}, will be added to the appendix \item Use sectioning commands to add sections \end{itemize} \tiny See rev7 of \typ{hg} \end{frame} \begin{frame}[fragile] \frametitle{Table of Contents [TOC]} \begin{itemize} \item Our document is short, but let's learn to add a TOC \item Add \lstinline{\tableofcontents} where you want TOC to appear \item Compile \item Only headings appear. No page numbers \item A \lstinline{.toc} file is generated \item Re-compile \item Any numbered section/block automatically appears \end{itemize} \tiny See rev8 of \typ{hg} \end{frame} \begin{frame}[fragile] \frametitle{TOC \ldots} \begin{itemize} \item Un-numbered sections are added to TOC using \lstinline{\addcontentsline} \item For instance, \lstinline+\addcontentsline{toc}{section}{Intro}+ \end{itemize} \tiny See rev9 of \typ{hg} \end{frame} \begin{frame} \frametitle{Bibliography} We shall look at Bibliographies, later in the course. \end{frame} \section{Typesetting Text} \begin{frame}[fragile] \frametitle{Quotation Marks} \begin{itemize} \item Use \`~ (accent) for left quote \item Use \'~ (apostrophe) for right quote \item For double quotes, use them twice \end{itemize} \tiny See rev11 of \typ{hg} \end{frame} \begin{frame}[fragile] \frametitle{Fonts - Emphasis, Fixed width, \ldots} \begin{itemize} \item \lstinline{\emph} gives emphasized or italic text \item \typ{flushleft} to have text left aligned \item \typ{flushright}, \typ{center} \end{itemize} \tiny See rev12 of \typ{hg} \end{frame} \begin{frame}[fragile] \frametitle{Fonts - Emphasis, Fixed width, \ldots} \begin{itemize} \item \lstinline{\texttt} gives fixed width font \item \lstinline{\textbf} bold face font \item \lstinline{--} en dash (--); \lstinline{---} em dash (---). \end{itemize} \tiny See rev13 of \typ{hg} \end{frame} \begin{frame}[fragile] \frametitle{Lists} \begin{itemize} \item \lstinline{enumerate} environment is used for numbered lists \item \lstinline{itemize} environment gives un-numbered lists \item Each item in the list is specified using \lstinline{\item} \item Nested lists are also easily handled, as expected \end{itemize} \tiny See rev14 of \typ{hg} \end{frame} \begin{frame}[fragile] \frametitle{Footnotes} \begin{itemize} \item \typ{\\footnote} command adds a footnote \end{itemize} \tiny See rev15 of \typ{hg} \end{frame} \begin{frame}[fragile] \frametitle{Labels and References} \begin{itemize} \item \lstinline+\label{labelname}+ is used to label an element \item \lstinline+\ref{labelname}+ is used to refer to that element \item Compile twice \end{itemize} \tiny See rev15 of \typ{hg} \end{frame} \begin{frame}[fragile] \frametitle{Including code} \begin{itemize} \item Instead of using \lstinline{\texttt} we could use \lstinline{\verbatim} \item \lstinline+listings+ is a powerful package \item \lstinline+\usepackage{listings}+ needs to be added \item Tell {\LaTeX} the language to be used, using \typ{\\lstset} \end{itemize} \tiny See rev16 of \typ{hg} \end{frame} \begin{frame}[fragile] \frametitle{Including code} \begin{itemize} \item Use \lstinline+\lstlisting+ for a block of code \item \typ{\\lstinline} for inline code \end{itemize} \tiny See rev16 of \typ{hg} \end{frame} \section{Figures, Tables \& Floats} \begin{frame}[fragile] \frametitle{Figures} \begin{itemize} \item The \typ{graphicx} package allows us to insert graphics \item \lstinline+\usepackage{graphicx}+ \item To add a graphic, use \lstinline{\includegraphics} command \item Use relative path to the image \end{itemize} \tiny See rev17 of \typ{hg} \end{frame} \begin{frame}[fragile] \frametitle{\lstinline{includgraphics}} It takes following optional arguments \begin{itemize} \item \lstinline+scale+ --- specifies the factor by which to scale the image \item \lstinline+height+, \lstinline+width+ --- If only one of them is specified, aspect ratio is maintained \item \lstinline+keepaspectratio+ --- boolean value to keep aspect ratio or not \item \lstinline+angle+ --- specify by what angle the image should be rotated \end{itemize} \end{frame} \begin{frame}[fragile] \frametitle{Floats} \begin{itemize} \item Graphics (\& Tables) are special because they cannot be broken across pages \item They are ``floated'' to the next page, if they don't fit in the current page \item Enclose graphic within \lstinline+figure+ environment to make it float \item Figure environment takes additional parameter for location of float \end{itemize} \begin{table} \caption{Permission Specifiers} \begin{tabular}{|c|c|} Specifier & Permission\\\hline t & Top of page\\ b & Bottom of page\\ p & Separate page for floats\\ h & here (the same place where command appears in source)\\ ! & override \LaTeX's internal parameters for good position \end{tabular} \end{table} \end{frame} \begin{frame} \frametitle{Captions and References} \begin{itemize} \item Figure environment allows us add a caption \item To place the image in the center we enclose it in the \lstinline+center+ environment \item We can label images too \item label should be added after the caption command \item Figures are auto numbered \end{itemize} \tiny See rev17 of \typ{hg} \end{frame} \begin{frame}[frame] \frametitle{Tables} \begin{itemize} \item \lstinline+tabular+ is used to typeset a table \item It is enclosed in a \lstinline+table+ environment to make it a float \item \lstinline+table+ environment also gives captions, auto numbering \end{itemize} \end{frame} \begin{frame}[fragile] \frametitle{\lstinline+tabular+} \begin{itemize} \item tabular takes formatting of each column as argument \end{itemize} \begin{table} \caption{tabular environment} \begin{tabular}{|l|l|} \lstinline+l+ & left justified column content\\\hline \lstinline+r+ & right justified column content\\\hline \lstinline+c+ & centered column content\\\hline \lstinline+|+ & produces a vertical line\\ \end{tabular} \end{table} \begin{itemize} \item also takes an optional parameter for specifying position of table \item \lstinline+t+ for top, \lstinline+b+ for bottom, \lstinline+c+ for center \item each column of table is separated by \& \item each row is separated by newline \lstinline{\\} \item \lstinline+\hline+ give a horizontal line between two rows \end{itemize} \tiny See rev18 of \typ{hg} \end{frame} \begin{frame}[fragile] \frametitle{List of Tables, Figures} \begin{itemize} \item \lstinline+\listoftables+ -- to add a list of tables \item \lstinline+\listoffigures+ -- to add a list of figures \end{itemize} \end{frame} \section{Typesetting Math} \begin{frame}[fragile] \frametitle{Math in \LaTeX} \begin{itemize} \item Math is enclosed in a pair of \lstinline{$} signs or %%$ \lstinline+\( \)+ \item Used for typesetting inline Math. \item \lstinline+\usepackage{amsmath}+ \item Let's now move on to matrices. \end{itemize} \end{frame} \begin{frame}[fragile] \frametitle{Matrices} \begin{itemize} \item \lstinline+\bmatrix+ is used to typeset the matrix A \item It works similar to the tabular environment \item \lstinline+&+ for demarcating columns \item \lstinline+\\+ for demarcating rows \item Other matrix environments \begin{table} \center \begin{tabular}{c|c} \lstinline+matrix+ & none\\ \lstinline+pmatrix+ & \lstinline+(+\\ \lstinline+Bmatrix+ & \lstinline+{+\\ \lstinline+vmatrix+ & \lstinline+|+\\ \lstinline+Vmatrix+ & \lstinline+||+ \end{tabular} \end{table} \end{itemize} \tiny See rev19 of \typ{hg} \end{frame} \begin{frame}[fragile] \frametitle{Superscripts \& Subscripts} \begin{itemize} \item \lstinline+^+ for superscripts \item \lstinline+_+ for subscripts \item Enclose multiple characters in \lstinline+{ }+ \end{itemize} \end{frame} \begin{frame}[fragile] \frametitle{Summation \& integration} \begin{itemize} \item \lstinline+\sum+ command gives the summation symbol \item The upper and lower limits are specified using the \lstinline+^+ and \lstinline+_+ symbols. \item Similarly the integral symbol is obtained using \lstinline+\int+ command. \end{itemize} \end{frame} \begin{frame}[fragile] \frametitle{\lstinline+displayed+ math} \begin{itemize} \item Display equations are the other type of displaying math \item \LaTeX~ or \lstinline+amsmath+ has a number of environments for ``displaying'' equations, with minor differences. \item In general, enclose math in \lstinline+\[+ and \lstinline+\]+ to get displayed math. \item \lstinline+\begin{equation*}+ is equivalent to this. \item Use \lstinline+\begin{equation}+ to get numbered equations. %%\end{equation} \end{itemize} \tiny See rev20 of \typ{hg} \end{frame} \begin{frame}[fragile] \frametitle{Groups of equations} \begin{itemize} \item The \lstinline+equation+ environment allows typesetting of just 1 equation. \item \lstinline+eqnarray+ allows typesetting of multiple equations \item It is similar to the \lstinline+table+ environment \item The parts of the equation that need to be aligned are indicated using \& symbol. \item Each equation is separated by a \lstinline+\newline+ command \end{itemize} \tiny See rev21, 22 of \typ{hg} \end{frame} \begin{frame}[fragile] \frametitle{Fractions \& Surds} \begin{itemize} \item Fractions are typeset using \lstinline+\frac+ command \item \lstinline+\frac{numerator}{denominator}+ is typeset as $\frac{numerator}{denominator}$ \item Surds are typeset using \lstinline+\sqrt[n]+ command \end{itemize} \end{frame} \begin{frame}[fragile] \frametitle{Greek characters \& Spacing} \begin{itemize} \item Typesetting Greek characters is simple \item \lstinline+\alpha+, \lstinline+\beta+, \lstinline+\gamma+, \ldots \lstinline+\Alpha+, \lstinline+\Beta+, \lstinline+\Gamma+ \ldots \item To get additional spacing in Math environments --- \begin{center} \begin{tabular}{|l|l|l|} \hline Abbrev. & Spelled out & Example \\ \hline \lstinline+\,+ & \lstinline+\thinspace+ & $A\,B$ \\ \hline \lstinline+\:+ & \lstinline+\medspace+ & $A\:B$ \\ \hline \lstinline+\;+ & \lstinline+\thickspace+ & $A\;B$ \\ \hline & \lstinline+\quad+ & $A \quad B$ \\ \hline & \lstinline+\qquad+ & $A \qquad B$ \\ \hline \lstinline+\!+ & \lstinline+\negthinspace+ & $A!B$ \\ \hline & \lstinline+\negmedspace+ & $A \negmedspace B$ \\ \hline & \lstinline+\negthickspace+ & $A \negthickspace B$ \\ \hline \end{tabular} \end{center} \end{itemize} \end{frame} \section{Bibliography} \begin{frame}[fragile] \frametitle{Bibliography} \begin{itemize} \item \lstinline+thebibliography+ environment provides a clean and simple way to add a bibliography to \LaTeX documents. \item \lstinline+\begin{thebibliography}+ takes as argument the maximum width of the label that references will have. \item Each item of the Bibliography is similar to an item in a list. \item \lstinline+\bibitem[label]{name}+ followed by the actual reference info. \item label replaces auto enumeration numbers \item \lstinline+\cite{name}+ is used to \lstinline+cite+ the \lstinline+bibitem+ \item You will need to compile twice. \end{itemize} \tiny See rev23 of \typ{hg} \end{frame} \section{Presentations - Beamer} \begin{frame}[fragile] \frametitle{Beamer} \begin{itemize} \item Use beamer since your report's \LaTeX~ would be re-usable. \item It is recommended to start with one of the beamer templates. \item Let's look at speaker introduction template. \item \lstinline+\documentclass{beamer}+ tells \LaTeX~ to start a beamer presentation. \item A beamer document is very similar to any other \LaTeX~ document except that content is divided into slides. \end{itemize} \end{frame} \begin{frame}[fragile] \frametitle{Beamer \ldots} \begin{itemize} \item \lstinline+\usetheme+ command is used to specify the theme of the presentation. \item \lstinline+\usecolortheme+ command is used to specify the color theme. \item The content of a slide is enclosed within \lstinline+\begin{frame}{Title}{Subtitle}+ and \lstinline+\end{frame}+ \item If the slide contains \lstinline+verbatim+ \lstinline+lstlisting+ environments, the \lstinline+\begin{frame}+ should be passed an additional argument \lstinline+[fragile]+ \item Overlays can be achieved using the \lstinline+\pause+ command. \item To achieve more with beamer, it is highly recommended that you look at the \texttt{beameruserguide} \end{itemize} \end{frame} \begin{frame}[fragile] \frametitle{} \begin{center} \Huge{Thank You!} \end{center} \end{frame} \end{document}