\documentclass[usenames,dvipsnames]{beamer}

\usepackage{xltxtra}
\usepackage{etoolbox}
\usepackage{comment}
\usepackage{tabularx}
\usepackage{longtable}
\usepackage{polyglossia}
\usepackage[style=american]{csquotes}
\usepackage[backend=biber]{biblatex-chicago}
\usepackage{booktabs}
\usepackage{verse}
\usepackage{tikz}
\usepackage{lipsum}
\usepackage{qtree}
\usepackage[normalem]{ulem}
\usepackage{multicol}
\usepackage[cache=false]{minted}
\usepackage{ragged2e}
\usepackage{indentfirst}
\usepackage{comment}
\usepackage{hyperref}
\usepackage{allrunes}
\usepackage{lingmacros}

\definecolor{burgundy}{HTML}{990000}
\hypersetup{colorlinks,linkcolor=,urlcolor=burgundy}
\setdefaultlanguage{english}
\usefonttheme{serif}
\setmainfont[Ligatures=TeX]{Junicode}
\setsansfont[Ligatures=TeX]{Junicode}
\usetikzlibrary{decorations.text,tikzmark,positioning}
\settowidth{\versewidth}{length of a really really really really long line}
\setlength{\vrightskip}{-2em}
\setlength{\vleftskip}{2em}
\setlength{\vgap}{1em}
\newlength{\rightquotedist}
\setlength{\rightquotedist}{85mm}
\newlength{\rightprosequotedist}
\setlength{\rightprosequotedist}{100mm}
\newlength{\longversewidth}
\settowidth{\longversewidth}{length of a hypermetric or Middle Engl verse line}
\verselinenumbersleft
\newcommand{\caes}{\hspace*{1em}}
\newcommand{\halflinegap}{\hspace*{8em}}
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{bibliography item}{}
\setbeamerfont{quote}{shape=\upshape,family=\rmfamily}
\addbibresource{slides.bib}

\DefineBibliographyStrings{american}{%
  references = {Bibliography},
}

\newcommand*{\openquote}
   {\tikz[xshift=-4ex]
   \node (OQ) {{\color{lightgray}\Huge``}};\kern0pt}

\newcommand*{\closequote}
  {\tikz
   \node (CQ) {{\color{lightgray}\Huge''}};}

\newcommand{\lmr}{\fontfamily{lmr}\selectfont}
\newcommand{\cmr}{\fontfamily{cmr}\selectfont}
\let\oldLaTeX\LaTeX
\renewcommand{\LaTeX}{{\lmr\oldLaTeX}\,}
\let\oldXeLaTeX\XeLaTeX
\renewcommand{\XeLaTeX}{{\lmr\oldXeLaTeX}}
\let\oldTeX\TeX
\renewcommand{\TeX}{{\lmr\oldTeX}}
\let\oldXeTeX\XeTeX
\renewcommand{\XeTeX}{{\lmr\oldXeTeX}}

\let\origquote\quote
\let\endorigquote\endquote
\def\quote{\openquote\\\vspace*{-7mm}\origquote}
\def\endquote{\endorigquote\vspace*{-7mm}\hspace*{\rightprosequotedist}\closequote}

\let\origverse\verse
\let\endorigverse\endverse
\def\verse{\openquote\\\vspace*{-7mm}\origverse}
\def\endverse{\endorigverse\vspace*{-7mm}\hspace*{\rightquotedist}\closequote}


\title{Session 7: \LaTeX and \XeLaTeX}
\date{29 November 2018}
\author{\includegraphics[scale=.44]{by}\newline \href{http://langeslag.org}{P. S. Langeslag}}

\begin{document}

\maketitle

\begin{frame}[fragile]
\frametitle{PCRE Lookaround}

\begin{table}
	\begin{tabular}{ll}
		\toprule
		Positive lookahead	&	\texttt{foo(?=bar)}\\
		Negative lookahead	&	\texttt{foo(?!bar)}\\
			Positive lookbehind	&	\texttt{(?<=bar)foo}\\
			Negative lookbehind	&	\texttt{(?<!bar)foo}\\
		\bottomrule
	\end{tabular}
\end{table}
\end{frame}

\begin{frame}[fragile]
	\frametitle{Vim Lookaround}

	\begin{table}
		\begin{tabular}{ll}
			\toprule
			\bfseries{Function} & \bfseries{Syntax}\\
			\midrule
			Positive lookahead & \mintinline{vim}{\@=}\\
			Negative lookahead & \mintinline{vim}{\@!}\\
			Positive lookback & \mintinline{vim}{\@<=}\\
			Negative lookback & \mintinline{vim}{\@<!}\\
			\bottomrule
		\end{tabular}
	\end{table}

	\begin{table}
		\begin{tabular}{ll}
			\toprule
			\bfseries{Syntax} & \bfseries{Matches}\\
			\midrule
			\mintinline{vim}{/child\(hood\)\@=} & “child” where followed by “hood”\\
			\mintinline{vim}{/child\(hood\)\@!} & “child” where not followed by “hood”\\
			\mintinline{vim}{/\(child\)\@<=hood} & “hood” where preceded by “child”\\
			\mintinline{vim}{/\(child\)\@<!hood}& “hood” where not preceded by “child”\\
			\bottomrule
		\end{tabular}
	\end{table}

	\begin{itemize}
		\item See \mintinline{vim}{:help /\@=} ff.
	\end{itemize}

\end{frame}

\begin{frame}[fragile]
	\frametitle{Zoom Anchors}

A simpler solution to matching part of a pattern.

	\begin{table}
		\begin{tabular}{ll}
			\toprule
			\bfseries{Syntax} & \bfseries{Function}\\
			\midrule
			\mintinline{vim}{\ze} & End the match here\\
			\mintinline{vim}{\zs} & Start the match here\\
			\bottomrule
		\end{tabular}
	\end{table}

	\begin{table}
		\begin{tabular}{l>{\raggedright\arraybackslash}p{45mm}}
			\toprule
			\bfseries{Syntax} & \bfseries{Action}\\
			\midrule
			\mintinline{vim}{:s/child\zehood/mother/g} & Replace “child” with “mother” where followed by “hood”\\
				\mintinline{vim}{:s/child\zshood/lessness/g} & Replace “hood” with “lessness” where preceded by “child”\\
					\bottomrule
				\end{tabular}
			\end{table}
		\end{frame}

\begin{frame}[fragile]
	\frametitle{Vim’s \texttt{global} Command}

\begin{minted}{vim}
:range g[lobal]/pattern/command
\end{minted}

The default range is all lines (\mintinline{vim}{%}).

\begin{block}{Command Options}

	\begin{itemize}
		\item \texttt{s[ubstitute]}
		\item \texttt{co[py]}
		\item \texttt{d[elete]}
		\item etc.
	\end{itemize}
\end{block}

\begin{block}{Examples}
\begin{minted}{vim}
:g/friend/s//foe/g    # same as ":%s/friend/foe/g"
:g/^$/d               # deletes all empty lines
\end{minted}
\end{block}
\end{frame}

\begin{frame}
	\frametitle{Word Processing}
	\begin{figure}
		\includegraphics[scale=0.49]{wp51}
		\caption{WordPerfect 5.1 for DOS (\href{https://en.wikipedia.org/wiki/File:Wordperfect-5.1-dos.png}{public domain})}
	\end{figure}
\end{frame}

\begin{frame}
	\frametitle{WYSIWYG and WYSIWYM}

	\begin{block}{WYSIWYG: What You See Is What You Get}
		Display emulates print output; explicit formatting is hidden from view.

	\begin{itemize}
		\item Pros: intuitive, little training required
		\item Cons: users don't learn to use structural formatting (styles) and wrestle with implicit formatting
	\end{itemize}

	\end{block}

	\pause

	\begin{block}{WYSIWYM: What You See Is What You Mean}
		Display shows text content enriched by structure commands; output not shown.

		\begin{itemize}
			\item Pros: Separation of content and formatting; explicit formatting control; plaintext may be \texttt{grep}ped
			\item Cons: Requires separate viewer for output
		\end{itemize}
	\end{block}
\end{frame}

\begin{frame}
	\frametitle{Formatting and Content}
	\begin{figure}
		\includegraphics[scale=0.22]{viewsiceberg}
		\caption{Views for Content Authoring (CC-BY-SA \href{https://en.wikipedia.org/wiki/File:ViewsIceberg.svg}{WMC user})}
	\end{figure}
\end{frame}

\begin{frame}
	\frametitle{HTML and CSS}
	\begin{figure}
		\includegraphics{wysiwym-wide}
		\caption{HTML and CSS}
	\end{figure}
\end{frame}

\begin{frame}
	\frametitle{\TeX}
	A WYSIWYM typesetting engine intended to produce publication-level design and identical output on any system.
	
	\vspace*{6mm}
	
	Released in 1978 by Donald Knuth along with the {\cmr Computer Modern} font family. (Since supplanted by the {\lmr Latin Modern} font family.)
\end{frame}

\begin{frame}
	\frametitle{\LaTeX}

	A high-level scripting language for preparing documents using the \TeX typesetting engine.

	\vspace*{6mm}

	Ships as a distribution containing \TeX, user-contributed packages, and a management system. (We’ll use \href{https://www.tug.org/texlive/}{\TeX\ Live}.)
\end{frame}

\begin{frame}
	\frametitle{Shortcomings of All \LaTeX}
	Some elements of \LaTeX (e.g. automated citations) cannot be converted to e.g. \texttt{docx}.

	\vspace*{8mm}
	
	This is why we'll learn to write in Pandoc Markdown later this term.
\end{frame}

\begin{frame}[fragile]
	\frametitle{Shortcomings of Plain \LaTeX}
Uses a limited character set, not unicode; diacritics require the use of commands.

\begin{table}
	\begin{tabular}{ll}
		\toprule
		\bfseries{Command} & \bfseries{Glyph}\\
		\midrule
		\mintinline{latex}{\"a} & ä\\
		\mintinline{latex}{\'a} & á\\
		\mintinline{latex}{\ss} & ß\\
		\mintinline{latex}{\dh} & ð\\
	\end{tabular}
\end{table}

\begin{minted}{latex}
Bei der morphologischen Untersuchung der Sagahandschrift
{\it M\"o\dh{}ruvallab\'ok\/} des 14. Jahrhunderts wurde
deutlich, da\ss{} diese Sammlung der Hochbl\"ute der
Isl\"andersagas einen doch ziemlich begrenzten Wortschatz
hat. Das ermuntert!
\end{minted}
\hfill\textcolor{gray}{(Andrea de Leeuw van Weenen, \emph{Grundwortschätz Altisländisch} [1999])}

\end{frame}

\begin{frame}
	\frametitle{\XeLaTeX}
\LaTeX scripting using the \XeTeX\ engine instead of the \TeX\ engine.

\vspace*{6mm}

The \XeTeX\ engine permits any unicode characters to be directly input, and allows the use of any system font.
\end{frame}

\begin{frame}
	\frametitle{\LaTeX Strengths: Kerning and Justification}
\lmr
\justifying
\parindent=1em 
\noindent Once upon a time there was a dear little girl who was loved by every one who looked at her, but most of all by her grandmother, and there was nothing that she would not have given to the child. Once she gave her a little cap of red velvet, which suited her so well that she would never wear anything else; so she was always called `Little Red-Cap.'

One day her mother said to her, `Come, Little Red-Cap, here is a piece of cake and a bottle of wine; take them to your grandmother, she is ill and weak, and they will do her good. Set out before it gets hot, and when you are going, walk nicely and quietly and do not run off the path, or you may fall and break the bottle, and then your grandmother will get nothing; and when you go into her room, don't forget to say, `Good-morning,' and don't peep into every corner before you do it.''

`I will take great care,'' said Little Red-Cap to her mother, and gave her hand on it.\hfill\textcolor{gray}{(Hunt, trans., \emph{Grimm’s Household Tales})}
\end{frame}

\begin{frame}[fragile]
	\frametitle{\LaTeX Strengths: Automated Citations}
	\begin{block}{Syntax}
\begin{minted}{latex}
\autocites[114--125]{hug94the}{cro03med}{kre04med}
 {lin05sum}{nor06sur}{man08pro}{jor09arc}{knu09pal}
 {cro10med}
\end{minted}
\end{block}

\begin{block}{Output}
	\begin{figure}
		\includegraphics[scale=1.15]{citations}
	\end{figure}
\end{block}
\end{frame}

\begin{frame}[fragile]
	\frametitle{\LaTeX Strengths: Formulae}

	\begin{block}{Syntax}
\begin{minted}{latex}
$y = \frac{x}{\pi}\sqrt{\frac{p}{q + 3}}$
\end{minted}
	\end{block}
	\begin{block}{Output}
	\begin{center}
	\Huge
	$y = \frac{x}{\pi}\sqrt{\frac{p}{q + 3}}$
	\end{center}
	\end{block}
\end{frame}

\begin{frame}[fragile]
	\frametitle{\LaTeX Strengths: Trees and Graphs}

	\begin{block}{Syntax}
\begin{minted}{latex}
\Tree [.NP [.Det a ] [.N\1 [.N house ] [.PP [.P of ]
  [.NP [.N cards ] ] ] ] ]
\end{minted}
	\end{block}
		\vspace*{-3mm}
	\begin{block}{Output}
		\vspace*{-9mm}
	\begin{center}
		\Large
		\Tree [.NP [.Det a ] [.N\1 [.N house ] [.PP [.P of ] [.NP [.N cards ] ] ] ] ]
	\end{center}
	\end{block}
\end{frame}

\begin{frame}
	\frametitle{\LaTeX Strengths: Trees and Graphs}
	\centering
	\begin{tikzpicture}
		\node (odn) {Óðinn}[sibling distance=2cm,level distance=13mm]
			child { node (sgi) {Sigi}
				child { node (rer) {Rerir}
					child { node (vls) {Vǫlsungr}[sibling distance=30mm]
						child { node (sgm) {Sigmundr}
							child { node (sfj) {Sinfjǫtli}}
							child { node (sgr) {Sigurðr}
								child { node (asl) {Áslaug}}
								child { node (son) {son}}
								child { node (svn) {Svanhildr}}
						}}
						child { node (sny) {Signý}
							child { node (son1) [xshift=43mm] {son}}
							child { node (son2) [xshift=25mm] {son}}
							child { node (son3) [xshift=10mm] {son}}
							child { node (child4) {child}}
						}
						child { node (sons) {9 more sons}}
		}}};
		\draw[-] (sny) -- (sfj);
	\end{tikzpicture}
\end{frame}

\begin{frame}[fragile]
	\frametitle{\LaTeX Strengths: Trees and Graphs}
	\begin{center}
\begin{tikzpicture}[scale=0.55, every node/.style={scale=0.5}]
 \node (Eph) {Pseudo-Ephraem}[sibling distance=2cm]
	child {node {Pseudo-Augustine}[sibling distance=5cm]
	child {node {Pseudo-Isidore}[sibling distance=2.7cm]
			    child { node (HomU55) {\emph{*HomU 55}}
				child { node {\emph{HomU 55}: CCCC 201}[solid] }
				child { node {\emph{*HomU 9}}[solid][sibling distance=4cm] 
					child { node {\emph{*HomU 9}: CCCC 41 branch}[sibling distance=2.5cm]
						child { node {\emph{HomU 9}: CCCC 41} }
						child { node (HomU27) {\emph{*HomU 27}}[sibling distance=31mm]
							child { node {\emph{HomU 27}: Hatton 113 } }
							child { node[yshift=-2mm] {\emph{HomS 41}} }
						      }
						}
					child { node {\emph{HomU 9}: Vercelli} }
					child { node (HomS4) {\emph{*HomS 4}}[sibling distance=3.5cm]
						child { node {\emph{HomS 4}: Bodley 340} }
						child { node {[\emph{HomS 4}: Vercelli]} }
					      }
					}
				}
		    child { node(HomM8)[xshift=-23mm][yshift=-98mm]{\emph{HomM 8}} }
				child { node {Pseudo-Bede}
					child { node(Msp) {\emph{Muspilli}} }
				      }
			}
		}
	child { node[xshift=12mm][yshift=-8mm] {Otfrid} }
	child { node(Virg){\emph{De virginibus} } }
	;
%\node [xshift=0.83cm][yshift=-5.2cm]{?};
\node (HomS44) [xshift=-0.9cm][yshift=-10.48cm]{\emph{HomS 44}}
	child { node (HomS33)[yshift=0.4cm]{\emph{HomS 33}} }
	;
\draw[-] (Eph) -- (HomU55);
\draw[-] (Eph) -- (Virg);
\draw[dashed] (HomS4) -- (HomU27);
\draw[-] (Eph) -- (HomS44);
\draw[-] (HomU27) -- (HomS44);
\node (q) [xshift=-63mm][yshift=-13cm]{};
\node (Vsp) [xshift=-63mm][yshift=-152mm]{\emph{VespHom 2}};
\draw[dashed] (q) -- (Vsp);
\draw[-] (HomU27) -- (HomM8);
\draw[dashed] (HomU27) -- (HomS33);
%\node [xshift=-2.2cm][yshift=-9.85cm]{?};
%\node [xshift=-2.2cm][yshift=-10.7cm]{?};
\node (WHom3) [xshift=14mm][yshift=-108mm]{\emph{WHom 3}}[sibling distance=2.1cm]
	child { node (WHom5) {\emph{WHom 5}}
		child { node (WHom20) {\emph{WHom 20}}
			child { node (HomU25) {\emph{HomU 25}}}
			child { node (HomU49) {\emph{HomU 49}}}
		      }
	      }
	;
\node (Mk) [xshift=30mm][yshift=-110mm]{Mk 13:12};
\draw[-] (HomS44) -- (WHom3);
\draw[-] (Mk) -- (WHom5);
\end{tikzpicture}
\end{center}
\end{frame}

\begin{frame}[fragile]
	\frametitle{\LaTeX Strengths: Trees}
\begin{minted}{latex}
\begin{tikzpicture}
 \node (Eph) {Pseudo-Ephraem}[sibling distance=2cm]
  child {node {Pseudo-Augustine}[sibling distance=5cm]
  child {node {Pseudo-Isidore}[sibling distance=2.7cm]
   child { node (HomU55) {\emph{*HomU 55}}
   child { node {\emph{HomU 55}: CCCC 201}[solid] }
   child { node {\emph{*HomU 9}}[solid][sibling distance=4cm] 
   child { node {\emph{*HomU 9}: CCCC 41 branch}[sibling distance=2.5cm]
    child { node {\emph{HomU 9}: CCCC 41} }
    child { node (HomU27) {\emph{*HomU 27}}[sibling distance=31mm]
     child { node {\emph{HomU 27}: Hatton 113 } }
     child { node[yshift=-2mm] {\emph{HomS 41}} }
          }
         }
    child { node {\emph{HomU 9}: Vercelli} }
    child { node (HomS4) {\emph{*HomS 4}}[sibling distance=3.5cm]
     child { node {\emph{HomS 4}: Bodley 340} }
     child { node {[\emph{HomS 4}: Vercelli]} }
          }
        }
      }
     child { node(HomM8)[xshift=-23mm][yshift=-98mm]{\emph{HomM 8}} }
     child { node {Pseudo-Bede}
\end{minted}
\end{frame}

\begin{frame}[fragile]
	\frametitle{\LaTeX Strengths: Enumerated Linguistics Examples}

	\enumsentence{Linguists like numbering their example sentences.}
	\enumsentence{They set them off like so.}
\end{frame}


\begin{frame}[fragile]
	\frametitle{\LaTeX Strengths: Runes}

	\begin{block}{Syntax}
\begin{minted}{latex}
\textara{fuþarkgwhnijpRstbemlŋ}
\end{minted}
	\end{block}
	\begin{block}{Output}
	\centering
	\Huge
	\textara{fuþarkgwhnijpRstbemlŋ}
	 \end{block}
\end{frame}

\begin{frame}[fragile]
	\frametitle{Minimal \XeLaTeX Document Structure}
\begin{minted}{latex}
\documentclass{article}    % or "book", "memoir", "beamer"

\begin{document}

Content goes here.         % comments like so

Leave a blank line to start a new paragraph.

\end{document}
\end{minted}
\end{frame}

\begin{frame}[fragile]
	\frametitle{\LaTeX Command Structure}
	\begin{block}{Commands}
\begin{minted}{latex}
\commandname[option1,option2]{mandatoryargument}
\end{minted}
	\end{block}

	\begin{block}{Environments}
\begin{minted}{latex}
\begin{environmentclass}[option1,option2]
Content
\end{environmentclass}
\end{minted}
	\end{block}

	\begin{block}{Variables}
\begin{minted}{latex}
\setlength{\variableName}{newvalue}
\addtolength{\variableName}{marginalvalue}
\setcounter{variablename}{value}
% Typically permitted in body as well as preamble.
\end{minted}
	\end{block}
\end{frame}

\begin{frame}[fragile]
	\frametitle{Commands}

	Valid for remainder of current scope:

\begin{minted}{latex}
\begin{figure}

    This text is justified

    \centering

    This text is centered

\end{figure}

\begin{figure}

    This text is justified

\end{figure}
\end{minted}
\end{frame}

\begin{frame}[fragile]
	\frametitle{Environments}

	Allow you to define their scope:

\begin{minted}{latex}
\begin{center}

    This text is centered

\end{center}
\end{minted}
\end{frame}

\begin{frame}[fragile]
	\frametitle{\texttt{documentclass} Options}

\begin{minted}{latex}
\documentclass[12pt,a4paper,draft,twocolumn,twoside,
 notitlepage]{book}
\end{minted}

\begin{itemize}
\begin{multicols}{2}
	\item Standard classes
		\begin{itemize}
			\item \texttt{book}
			\item \texttt{article}
			\item \texttt{report}
			\item \texttt{memoir}
		\end{itemize}
	\item KOMA package classes
		\begin{itemize}
			\item \texttt{scrbook}
			\item \texttt{scrartcl}
			\item \texttt{scrreprt}
		\end{itemize}
	\end{multicols}
	\begin{multicols}{2}
	\item Paper size options
		\begin{itemize}
			\item \texttt{a4paper}
			\item \texttt{letterpaper}
			\item etc.
		\end{itemize}
	\item Regular font size options
		\begin{itemize}
			\item \texttt{10pt}
			\item \texttt{11pt} (default)
			\item \texttt{12pt}
		\end{itemize}
	\end{multicols}
\item \texttt{twocolumn}: use \texttt{multicol} package for more options
\item \texttt{twoside}: typeset for binding
\item \texttt{anypage}: allow chapter to start on even page
\item Each class has its own defaults
\end{itemize}
\end{frame}

\begin{frame}
	\frametitle{Page Layout}
	\begin{figure}
		\includegraphics{pagelayout}
		\caption{A4 Page Dimensions (CC-BY-SA \href{https://en.wikibooks.org/wiki/LaTeX/Page_Layout#Page_dimensions}{Wikibooks})}
	\end{figure}
\end{frame}

\begin{frame}[fragile]
	\frametitle{Compiling \XeLaTeX, 1: On the Command Line}

\begin{minted}{bash}
xelatex --interaction=nonstopmode filename
\end{minted}
\begin{itemize}
	\item No need to specify the \texttt{.tex} extension;
	\item You'll often want to run it a couple times over.
\end{itemize}
\end{frame}

\begin{frame}[fragile]
	\frametitle{Compiling \XeLaTeX, 2: Using \texttt{vimtex}}

	\begin{itemize}
		\item \mintinline{latex}{\ll} starts continuous compilation and opens the PDF;
		\item Any subsequent “save” command (\mintinline{latex}{:w}) recompiles;
		\item Multiple compilation is automated;
		\item \mintinline{latex}{\ll} (or quitting Vim) ends continuous compilation.
	\end{itemize}

	\begin{itemize}
		\item[\textcolor{red}{!}] On \texttt{ssh}, opening the PDF requires X11 forwarding!
	\end{itemize}
\end{frame}

\begin{frame}[fragile]
	\frametitle{Basic \XeLaTeX Document Structure With Title Data}
\begin{minted}{latex}
\documentclass{article}

\title{Document Title}
\author{Firstname Lastname}
\date{\today}

\begin{document}

\maketitle

Content goes here.

\end{document}
\end{minted}
\end{frame}

\begin{frame}[fragile]
	\frametitle{Content Structure}
\begin{minted}{latex}
\documentclass{book}

\begin{document}

\chapter{An Unexpected Party} % for the "book" class only

\section{Riddles in the Dark}

\subsection{From the Frying-Pan Into the Fire}

\subsubsection{On the Doorstep}

\end{document}
\end{minted}
\end{frame}

\begin{frame}[fragile]
	\frametitle{Basic \XeLaTeX Document Structure With Table of Contents}
\begin{minted}{latex}
\documentclass{article}

\title{Document Title}
\author{Firstname Lastname}
\date{\today}

\begin{document}

\maketitle

\tableofcontents

Content goes here.

\end{document}
\end{minted}
\end{frame}

\begin{frame}[fragile]
\frametitle{Using \LaTeX Packages}
Packages are loaded in the preamble, i.e. after \mintinline{latex}{\documentclass} but before \mintinline{latex}{\begin{document}}:

\begin{minted}{latex}
\documentclass{article}
\usepackage[options]{packagename}

\title{Document Title}
\author{Firstname Lastname}
\date{\today}

\begin{document}

\maketitle

Content goes here.

\end{document}
\end{minted}

\end{frame}

\begin{frame}[fragile]
	\frametitle{Package Documentation}
From the command line, run

\begin{minted}{bash}
texdoc packagename
\end{minted}
\end{frame}

\begin{frame}[fragile]
\frametitle{Global Settings}
Global settings likewise go in the preamble, following (affected) packages:

\begin{minted}{latex}
\documentclass{article}
\usepackage[options]{packagename}

\setsomesetting{value}

\title{Document Title}
\author{Firstname Lastname}
\date{\today}

\begin{document}

\maketitle

Content goes here.

\end{document}
\end{minted}

\end{frame}

\begin{frame}[fragile]
\frametitle{Using \XeLaTeX Font Specification}

\begin{minted}{latex}
\documentclass{article}
\usepackage{fontspec}

\setmainfont{Junicode}

\title{Document Title}
\author{Firstname Lastname}
\date{\today}

\begin{document}

\maketitle

Content goes here.

\end{document}
\end{minted}

\end{frame}

\begin{frame}[fragile]
	\frametitle{Basic Text Formatting}
	\begin{block}{Available by Default}
	\begin{itemize}
		\item \mintinline{latex}{\emph} for \emph{emphasis} (italics);
		\item \mintinline{latex}{\textbf} for \textbf{boldface};
		\item \mintinline{latex}{\textsc} for \textsc{small capitals} (use lowercase);
		\item \mintinline{latex}{\texttt} for \texttt{monospace};
		\item \mintinline{latex}{\textsuperscript} for \textsuperscript{superscript}.
	\end{itemize}
\end{block}
\begin{block}{With the \texttt{ulem} Package}
	\begin{multicols}{2}
	\begin{itemize}
		\item \mintinline{latex}{\uline} for \uline{underlining};
		\item \mintinline{latex}{\dashuline} for \dashuline{dashed};
		\item \mintinline{latex}{\uwave} for \uwave{wavy};
		\item \mintinline{latex}{\sout} for \sout{strikethrough};
		\item \mintinline{latex}{\xout} for \xout{crossed out};
		\item etc. (see \texttt{texdoc ulem})
	\end{itemize}
\end{multicols}

	\begin{itemize}
		\item[\textcolor{red}{!}] Load as \mintinline{latex}{\usepackage[normalem]{ulem}}.
		\end{itemize}
\end{block}

\end{frame}

\begin{frame}[fragile]
	\frametitle{Quotation Marks}

	\begin{block}{\LaTeX}
\begin{minted}{latex}
``Thus'' for double quotes;
`Thus' for single quotes.
\end{minted}
	\end{block}
	\begin{block}{\XeLaTeX}
	\begin{itemize}
		\item If you build a keybinding, you can insert rounded quotes directly.
		\item Better: use the \texttt{csquotes} package and the following syntax:
	\end{itemize}
\begin{minted}{latex}
Introducing \enquote{csquotes}.
\end{minted}
	\end{block}
\end{frame}

\begin{frame}
	\frametitle{Benefits of the \texttt{csquotes} Package}
	\begin{itemize}
		\item Automatically selects single or double quotes (nesting);
		\item Changes quotation style with a single preamble setting.
	\end{itemize}
\end{frame}

\begin{frame}[fragile]
	\frametitle{The \texttt{csquotes} Package}

\begin{block}{Preamble}
\begin{minted}{latex}
\usepackage{fontspec}
\usepackage{polyglossia}
\usepackage[style=american]{csquotes} % or "british",
                                      % "german", etc.
\setdefaultlanguage[variant=american]{english}
\end{minted}
	\end{block}

	\begin{block}{Syntax}
\begin{minted}{latex}
The most basic command is used \enquote{thus}.

\textquote[][,]{She said, \textquote{This ensures correct
 punctuation}} he laughed mysteriously.
\end{minted}

	\end{block}
\end{frame}

\begin{frame}[fragile]
	\frametitle{\texttt{csquotes} Output}
	\begin{block}{Syntax}
\begin{minted}{latex}
This is a \textquote[][.]{quotation}
\end{minted}
	\end{block}
	\begin{block}{With \texttt{style=american}}
		This is a “quotation.”
	\end{block}
	\begin{block}{With \texttt{style=british}}
		This is a ‘quotation.’ \hfill\textcolor{gray}{(NB positioning incorrect)}
	\end{block}
	\begin{block}{With \texttt{style=german}}
		This is a „quotation.“
	\end{block}
\end{frame}

\begin{frame}[fragile]
	\frametitle{Tables 1a: Basic Tables}

	\begin{block}{Syntax}
\begin{minted}{latex}
\begin{tabular}{lcr}
    Left-Aligned & Centered & Right-Aligned\\
    Second row & Second colum & Third column\\
\end{tabular}
\end{minted}
	\end{block}
	\begin{block}{Output}
\begin{tabular}{lcr}
    Left-Aligned & Centered & Right-Aligned\\
    Second row & Second colum & Third column\\
\end{tabular}
	\end{block}
\end{frame}

\begin{frame}[fragile]
	\frametitle{Tables 1b: Basic Tables with Borders}

	\begin{block}{Syntax}
\begin{minted}{latex}
\begin{tabular}{|l|c|r|}
    \hline
    Left-Aligned & Centered & Right-Aligned\\
    \hline
    Second row & Second colum & Third column\\
    \hline
\end{tabular}
\end{minted}
	\end{block}
	\begin{block}{Output}
\begin{tabular}{|l|c|r|}
\hline
Left-Aligned & Centered & Right-Aligned\\
\hline
Second row & Second colum & Third column\\
\hline
\end{tabular}
	\end{block}
\end{frame}

\begin{frame}[fragile]
	\frametitle{Tables 1c: Basic Float Tables with Borders and Caption}

	\begin{block}{Syntax}
\begin{minted}{latex}
\begin{table}
    \begin{tabular}{|l|c|r|}
        \hline
        Left-Aligned & Centered & Right-Aligned\\
        \hline
        Second row & Second colum & Third column\\
       \hline
    \end{tabular}
\end{table}
\end{minted}
	\end{block}
	\begin{block}{Output}
		\begin{table}
   			 \begin{tabular}{|l|c|r|}
   			     \hline
     			   Left-Aligned & Centered & Right-Aligned\\
     			   \hline
      			  Second row & Second colum & Third column\\
     			   \hline
    		\end{tabular}
			\caption{Caption goes here}
		\end{table}
	\end{block}
\end{frame}

\begin{frame}[fragile]
	\frametitle{Tables 1d: Pretty Tables with the \texttt{booktabs} package}

\begin{minted}{latex}
\begin{table}
  \begin{tabular}{lcr}
    \toprule
    \bfseries{Left-Aligned} & \bfseries{Centered} &
     \bfseries{Right-Aligned}\\
    \midrule
    Second row & second colum & third column\\
   \bottomrule
  \end{tabular}
\end{table}
\end{minted}
		\begin{table}
   			 \begin{tabular}{lcr}
   			     \toprule
				 \bfseries{Left-Aligned} & \bfseries{Centered} & \bfseries{Right-Aligned}\\
     			   \midrule
      			  Second row & Second colum & Third column\\
     			   \bottomrule
    		\end{tabular}
			\caption{Caption goes here}
		\end{table}
\end{frame}

\begin{frame}[fragile]
	\frametitle{Tables 1e: Fixed-Width Columns}

\begin{minted}{latex}
\begin{table}
  \begin{tabular}{lcp{22mm}}
    \toprule
    \bfseries{Left-Aligned} & \bfseries{Centered} & \bfseries{Fixed-Width}\\
    \midrule
      Second row & Second colum & Now you can keep typing 
       because lines will wrap\\
   \bottomrule
  \end{tabular}
\end{table}
\end{minted}
		\begin{table}
				\begin{tabular}{lcp{22mm}}
   			     \toprule
				 \bfseries{Left-Aligned} & \bfseries{Centered} & \bfseries{Fixed-Width}\\
     			   \midrule
      			  Second row & Second colum & Now you can keep typing because lines will wrap\\
     			   \bottomrule
    		\end{tabular}
		\end{table}
\end{frame}

\begin{frame}[fragile]
	\frametitle{Tables 1f: Raggedright Fixed-Width Columns}

\begin{minted}{latex}
\begin{table}
  \begin{tabular}{lc>{\raggedright\arraybackslash}p{22mm}}
    \toprule
    \bfseries{Left-Aligned} & \bfseries{Centered} & \bfseries{Fixed-Width}\\
    \midrule
      Second row & Second colum & Now you can keep typing 
       because lines will wrap\\
   \bottomrule
  \end{tabular}
\end{table}
\end{minted}
		\begin{table}
			\begin{tabular}{lc>{\raggedright\arraybackslash}p{22mm}}
   			     \toprule
				 \bfseries{Left-Aligned} & \bfseries{Centered} & \bfseries{Fixed-Width}\\
     			   \midrule
      			  Second row & Second colum & Now you can keep typing because lines will wrap\\
     			   \bottomrule
    		\end{tabular}
		\end{table}
\end{frame}

\begin{frame}[fragile]
	\frametitle{Tables 2: The \texttt{tabularx} Package}

\begin{minted}{latex}
\begin{table}
  \begin{tabularx}{\textwidth}{llX}
    \toprule
    \bfseries{Required Width} & \bfseries{Required Width}
     & \bfseries{Remaining Width}\\
    \midrule
    Some text & Some text & Now you can keep typing
     because lines will wrap\\
   \bottomrule
  \end{tabularx}
\end{table}
\end{minted}
		\begin{table}
           \begin{tabularx}{\textwidth}{llX}
   			     \toprule
				 \bfseries{Required Width} & \bfseries{Required Width} & \bfseries{Remaining Width}\\
     			   \midrule
      			  Some text & Some text & Now you can keep typing because lines will wrap\\
     			   \bottomrule
    		\end{tabularx}
		\end{table}
\end{frame}

\begin{frame}[fragile]
	\frametitle{Tables 3: The \texttt{longtable} Package}
\begin{minted}{latex}
\begin{table}
  \begin{longtable}{ll}
    \toprule
    \bfseries{Column 1} & \bfseries{Column 2}\\
    \midrule
    This table & can extend\\
    over multiple & pages.\\
   \bottomrule
  \end{longtable}
\end{table}
\end{minted}
		\begin{table}
           \begin{longtable}{ll}
   			     \toprule
				 \bfseries{Column 1} & \bfseries{Column 2}\\
     			   \midrule
    					This table & can extend\\
						over multiple & pages.\\
     			   \bottomrule
    		\end{longtable}
		\end{table}
\end{frame}

\begin{frame}[fragile]
	\frametitle{The \texttt{multicol} Package}
	\begin{block}{Syntax}
\begin{minted}{latex}
\begin{multicols}{2}
    \lipsum[1]
\end{multicols}
\end{minted}
\end{block}

\begin{block}{Output}
\begin{multicols}{2}
	\lipsum[1]
\end{multicols}
\end{block}
\end{frame}

\begin{frame}
	\frametitle{Dedicated \LaTeX Editors (Cross-Platform)}
	\begin{itemize}
		\item \href{http://www.xm1math.net/texmaker/}{Texmaker}
		\item \href{https://www.texstudio.org/}{TeXstudio}
	\end{itemize}
\end{frame}

\begin{frame}
	\frametitle{Overleaf: Online Collaborative \LaTeX Editor}
	\centering
	\href{https://www.overleaf.com}{https://www.overleaf.com}
\end{frame}

\begin{frame}[t]
\frametitle{Bibliography}
\nocite{latexbeg}
\nocite{latexcook}
\nocite{wikibooklatex}
\printbibliography
\end{frame}

\end{document}
