\documentclass{beamer}
% Packages
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{minted}
\usepackage{tikz}
\usepackage{amsmath}
\usepackage{hyperref}
\usepackage{color}
\usepackage{pgfplots}
\usepackage{multicol}

% Preamble
\usetikzlibrary{shapes,arrows,positioning,shadows}
\setminted{
    autogobble=true,
    style=paraiso-dark,
    breakanywhere=true,
	breakautoindent=true,
	breaklines=true,
	tabsize=4,
}

\usecolortheme[background=dark]{metropolis}
\setbeamertemplate{navigation symbols}{}

\newenvironment{exampletwoup}
  {\VerbatimEnvironment
   \begin{VerbatimOut}{example.out}}
  {\end{VerbatimOut}
   \setlength{\parindent}{0pt}
   \fbox{\begin{tabular}{l|l}
   \begin{minipage}{0.55\linewidth}
     \inputminted[fontsize=\small,resetmargins]{latex}{example.out}
   \end{minipage} &
   \begin{minipage}{0.35\linewidth}
     \input{example.out}
   \end{minipage}
   \end{tabular}}}
\newcommand{\cmd}[1]{{\color[HTML]{008000}\texttt{\textbf{{#1}}}}}

\title{How to \LaTeX}
\author{\emph{not} Tom Almeida}
\institute{\emph{not} UWA --- Programming Competition Society}
\titlegraphic{\includegraphics[height=1cm]{pcs_logo.png}}
\date{\emph{not} September 2019}

\pgfplotsset{compat=1.15}

\begin{document}
\begin{frame}
\maketitle    
\end{frame}

\begin{frame}{}
    \centering
    \includegraphics[width=\linewidth]{programming_languages_as_an_essay.jpg}
\end{frame}

\section{Why \LaTeX{}?}
\begin{frame}{Why use \LaTeX?}
    \begin{itemize}
        \item Really nicely formatted text.
        \pause\item Really \emph{really} nicely formatted text.
        \pause\item Nicely done bibliographies.
        \pause\item Really good mathematics.
        \pause\item Very powerful and extensible.
        \pause\item Flexible.
    \end{itemize}
\end{frame}
\begin{frame}{Flexible}
    \begin{itemize}
        \item make documents.
        \item make spreadsheets.
        \item make graphs.
        \item make presentations!
        \item (and more)
    \end{itemize}
\end{frame}
\begin{frame}{Scales Well}
    \centering
    \includegraphics[width=\linewidth]{word_latex_markdown_dark.png}
\end{frame}
\begin{frame}{Who Uses It?}
    Aside from the obvious (Math, CS, Eng\ldots),
    take a look at ``What professions use \TeX/\LaTeX\ besides CS?'' on tex.stackexchange and find:
    % https://tex.stackexchange.com/questions/940/what-professions-use-tex-latex-besides-cs
    \begin{multicols}{2}
        \begin{itemize}
            \item Accountant
            \item Book Writer
            \item Contract Attorney
            \item Gemanwings, a German low-cost airline
            \item Video game producer
            \item Bible publishing
            \item Earth Sciences
            \item Chemist
            \item Philologists
            \item Art Historian
            \item Psychology
            \item Product Catalogues
            \item Linguists
            \item Economics
        \end{itemize}
    \end{multicols}
\end{frame}
\begin{frame}[fragile]{How does it work?}
    \begin{itemize}
        \item write in \texttt{plain text} with some \cmd{commands} that describe its structure and meaning.
        \item \LaTeX processes your text and commands to produce a document.
    \end{itemize}
    \vskip 2ex
    \begin{center}
    \begin{minted}{latex}
    Mandy makes marshmallows \emph{mostly} on Mondays.
    \end{minted}
    \vskip 2ex
    \tikz\node[single arrow,fill=gray,font=\ttfamily\bfseries,%
      rotate=270,align=center]{latex};
    \vskip 2ex
    \fbox{Mandy makes marshmallows \emph{mostly} on Mondays.}
    \end{center}
\end{frame}
\begin{frame}[fragile]{Other examples}
\begin{center}
\begin{exampletwoup}
    \begin{itemize}
        \item Geese
        \item Parades
        \item Bad ideas
    \end{itemize}
\end{exampletwoup}
\vskip 2ex
% \begin{exampletwoup}
%     \begin{figure}
%         \centering
%         \includegraphics[scale=0.05]{pcs_logo.png}
%         \caption{The PCS logo}
%     \end{figure}
% \end{exampletwoup}
\vskip 2ex
\begin{exampletwoup}
    \begin{equation}
        \alpha + e^2 - 1
    \end{equation}
\end{exampletwoup}
\end{center}
\end{frame}
\begin{frame}[fragile]{Other examples}
\begin{center}
    \begin{minted}{latex}
        \begin{tikzpicture}
        \begin{axis}[title={$y=x^2$},
            domain=-3:3,
            xlabel={$x$},
            ylabel={$y$}]
            \addplot {x^2};
        \end{axis}
        \end{tikzpicture}
    \end{minted}
\end{center}
\end{frame}
\begin{frame}[fragile]{Other examples} 
\begin{center}
    \begin{tikzpicture}
    \begin{axis}[title={$y=x^2$},
        domain=-3:3,
        xlabel={$x$},
        ylabel={$y$}]
        \addplot {x^2};
    \end{axis}
    \end{tikzpicture}
\end{center}
\end{frame}
\begin{frame}[fragile]{Other examples}
    \begin{minted}{latex}
\[
\lim_{x\to 0}{\frac{e^x-1}{2x}}
\overset{\left[\frac{0}{0}\right]}{\underset{\mathrm{H}}{=}}
\lim_{x\to 0}{\frac{e^x}{2}}={\frac{1}{2}}
\]
    \end{minted}
\end{frame}
\begin{frame}[fragile]{Other examples}
\[
\lim_{x\to 0}{\frac{e^x-1}{2x}}
\overset{\left[\frac{0}{0}\right]}{\underset{\mathrm{H}}{=}}
\lim_{x\to 0}{\frac{e^x}{2}}={\frac{1}{2}}
\]
\end{frame}
\begin{frame}[fragile]{Other examples: THE IMPORTANT ONE}
    \begin{minted}{latex}
There is this really cool paper on honey bees learning 
how to navigate a maze \cite{Zhang200}
you should check it out. 
While you are there be sure to notice \cite{Neftci2019}
\bibliographystyle{unsrt}
\bibliography{references}
    \end{minted}
\end{frame}
\begin{frame}[fragile]{Other examples: THE IMPORTANT ONE}
    \vspace*{-0.2em} % to prevent end from being clipped
    \inputminted[fontsize=\small]{bibtex}{references.bib}
\end{frame}
\begin{frame}[fragile]{Other examples: THE IMPORTANT ONE}
There is this really cool paper on honey bees learning 
how to navigate a maze \cite{Zhang200}
you should check it out. 
While you are there be sure to notice \cite{Neftci2019}
\bibliographystyle{unsrt}
\bibliography{references}
\end{frame}
\begin{frame}{Attitude adjustment}
    \begin{itemize}
        \item Your commands describe ``what it is'' not ``how it looks''.
        \item Focus on your content.
    \end{itemize}
\end{frame}
\section{Introduction}
\begin{frame}{The structure of a command}
    \begin{itemize}
        \item Commands in \LaTeX{} start with \cmd{\textbackslash}, followed by their name.
        \begin{itemize}
            \item e.g. \cmd{\textbackslash{}newpage}
        \end{itemize}
        \item They have required arguments in curly braces (\texttt{\{\}})
        \begin{itemize}
            \item e.g. \cmd{\textbackslash{}section\{Introduction\}}
        \end{itemize}
        \item Optional arguments are in square braces (\texttt{[]})
        \begin{itemize}
            \item e.g. \cmd{\textbackslash{}includegraphics[scale=0.5]\{file\}}
        \end{itemize}
    \end{itemize}
\end{frame}
\begin{frame}{Environments}
    \begin{itemize}
        \item Environments are commands that started with \cmd{\string\begin} and finished with \cmd{\string\end}.
        \item Environments allow you to use commands you wouldn't otherwise have access to.
    \end{itemize}
\end{frame}
\section{Getting started}
\begin{frame}[fragile]{A minimal \LaTeX{} document}
    \begin{minted}[frame=single]{latex}
\documentclass{article} % What type of document?
% Preamble
\begin{document}
Hello World! % Rest of your content...
\end{document}
    \end{minted}
\end{frame}
\begin{frame}[fragile]{Typesetting Text}
    \begin{exampletwoup}
Just type your text.
\\
Spaces don't     matter.
\\
`single' ``double''
\\
\$\#\%\&\textbackslash!
    \end{exampletwoup}
\end{frame}
\begin{frame}[fragile]{Typesetting Math}
    \begin{itemize}
        \item 
        \begin{minted}{latex}
         To let latex know you want to make things pretty 
         math style you must enclose text with
         \( x^2+\frac{1}{2} \)
        \end{minted}
        This produces \( x^2+\frac{1}{2} \)
        \item \begin{minted}{latex}
         or for a single centered line (not inline)
         \[ x^2+\frac{1}{2} \]
        \end{minted}
        This produces \[ x^2+\frac{1}{2} \]
    \end{itemize}
\end{frame}
\begin{frame}[fragile]{Typesetting Math examples}
\begin{exampletwoup}
symbols can become nice \(xyz\)
\\
access to cool symbols \(X\in Y\)
\\
notation \(\sum_{k=0}^{\infty}x\)
\end{exampletwoup}
\end{frame}
\begin{frame}{Programmers Are Lazy}
    Programmers are lazy. Programmers create IDEs to make their life easier.
    IDEs often support extensions. Extensions exist for \LaTeX\ldots
    \begin{itemize}
        \item Autocompletion
        \item Snippets
        \item Keybindings
        \item and more\ldots
    \end{itemize}
\end{frame}
\section{How to get \LaTeX{}}
\begin{frame}{How to get \LaTeX{}}
    \begin{itemize}
        \pause \item \href{https://www.overleaf.com}{Overleaf}
        \item \href{https://miktex.org}{MikTeX}
        \item \href{https://www.tug.org/mactex}{MacTeX}
        \item TeXLive (\mintinline{shell}{sudo apt install texlive-full})
    \end{itemize}
\end{frame}
\end{document}
