text:
\documentclass[]{book}
\usepackage{lmodern}
\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
\usepackage{fixltx2e} % provides \textsubscript
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
  \usepackage[T1]{fontenc}
  \usepackage[utf8]{inputenc}
\else % if luatex or xelatex
  \ifxetex
    \usepackage{mathspec}
  \else
    \usepackage{fontspec}
  \fi
  \defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}
\fi
% use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
% use microtype if available
\IfFileExists{microtype.sty}{%
\usepackage{microtype}
\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\usepackage[margin=1in]{geometry}
\usepackage{hyperref}
\hypersetup{unicode=true,
            pdftitle={Data Science With Python},
            pdfauthor={L A Liggett},
            pdfborder={0 0 0},
            breaklinks=true}
\urlstyle{same}  % don't use monospace font for urls
\usepackage{natbib}
\bibliographystyle{apalike}
\usepackage{color}
\usepackage{fancyvrb}
\newcommand{\VerbBar}{|}
\newcommand{\VERB}{\Verb[commandchars=\\\{\}]}
\DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}}
% Add ',fontsize=\small' for more characters per line
\usepackage{framed}
\definecolor{shadecolor}{RGB}{248,248,248}
\newenvironment{Shaded}{\begin{snugshade}}{\end{snugshade}}
\newcommand{\AlertTok}[1]{\textcolor[rgb]{0.94,0.16,0.16}{#1}}
\newcommand{\AnnotationTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{#1}}}}
\newcommand{\AttributeTok}[1]{\textcolor[rgb]{0.77,0.63,0.00}{#1}}
\newcommand{\BaseNTok}[1]{\textcolor[rgb]{0.00,0.00,0.81}{#1}}
\newcommand{\BuiltInTok}[1]{#1}
\newcommand{\CharTok}[1]{\textcolor[rgb]{0.31,0.60,0.02}{#1}}
\newcommand{\CommentTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textit{#1}}}
\newcommand{\CommentVarTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{#1}}}}
\newcommand{\ConstantTok}[1]{\textcolor[rgb]{0.00,0.00,0.00}{#1}}
\newcommand{\ControlFlowTok}[1]{\textcolor[rgb]{0.13,0.29,0.53}{\textbf{#1}}}
\newcommand{\DataTypeTok}[1]{\textcolor[rgb]{0.13,0.29,0.53}{#1}}
\newcommand{\DecValTok}[1]{\textcolor[rgb]{0.00,0.00,0.81}{#1}}
\newcommand{\DocumentationTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{#1}}}}
\newcommand{\ErrorTok}[1]{\textcolor[rgb]{0.64,0.00,0.00}{\textbf{#1}}}
\newcommand{\ExtensionTok}[1]{#1}
\newcommand{\FloatTok}[1]{\textcolor[rgb]{0.00,0.00,0.81}{#1}}
\newcommand{\FunctionTok}[1]{\textcolor[rgb]{0.00,0.00,0.00}{#1}}
\newcommand{\ImportTok}[1]{#1}
\newcommand{\InformationTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{#1}}}}
\newcommand{\KeywordTok}[1]{\textcolor[rgb]{0.13,0.29,0.53}{\textbf{#1}}}
\newcommand{\NormalTok}[1]{#1}
\newcommand{\OperatorTok}[1]{\textcolor[rgb]{0.81,0.36,0.00}{\textbf{#1}}}
\newcommand{\OtherTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{#1}}
\newcommand{\PreprocessorTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textit{#1}}}
\newcommand{\RegionMarkerTok}[1]{#1}
\newcommand{\SpecialCharTok}[1]{\textcolor[rgb]{0.00,0.00,0.00}{#1}}
\newcommand{\SpecialStringTok}[1]{\textcolor[rgb]{0.31,0.60,0.02}{#1}}
\newcommand{\StringTok}[1]{\textcolor[rgb]{0.31,0.60,0.02}{#1}}
\newcommand{\VariableTok}[1]{\textcolor[rgb]{0.00,0.00,0.00}{#1}}
\newcommand{\VerbatimStringTok}[1]{\textcolor[rgb]{0.31,0.60,0.02}{#1}}
\newcommand{\WarningTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{#1}}}}
\usepackage{longtable,booktabs}
\usepackage{graphicx,grffile}
\makeatletter
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
\makeatother
% Scale images if necessary, so that they will not overflow the page
% margins by default, and it is still possible to overwrite the defaults
% using explicit options in \includegraphics[width, height, ...]{}
\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
\IfFileExists{parskip.sty}{%
\usepackage{parskip}
}{% else
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}
}
\setlength{\emergencystretch}{3em}  % prevent overfull lines
\providecommand{\tightlist}{%
  \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{5}
% Redefines (sub)paragraphs to behave more like sections
\ifx\paragraph\undefined\else
\let\oldparagraph\paragraph
\renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}
\fi
\ifx\subparagraph\undefined\else
\let\oldsubparagraph\subparagraph
\renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
\fi

%%% Use protect on footnotes to avoid problems with footnotes in titles
\let\rmarkdownfootnote\footnote%
\def\footnote{\protect\rmarkdownfootnote}

%%% Change title format to be more compact
\usepackage{titling}

% Create subtitle command for use in maketitle
\newcommand{\subtitle}[1]{
  \posttitle{
    \begin{center}\large#1\end{center}
    }
}

\setlength{\droptitle}{-2em}

  \title{Data Science With Python}
    \pretitle{\vspace{\droptitle}\centering\huge}
  \posttitle{\par}
    \author{L A Liggett}
    \preauthor{\centering\large\emph}
  \postauthor{\par}
      \predate{\centering\large\emph}
  \postdate{\par}
    \date{2019-04-05}

\usepackage{booktabs}
\usepackage{amsthm}
\makeatletter
\def\thm@space@setup{%
  \thm@preskip=8pt plus 2pt minus 4pt
  \thm@postskip=\thm@preskip
}
\makeatother

\begin{document}
\maketitle

{
\setcounter{tocdepth}{1}
\tableofcontents
}
\hypertarget{prerequisites}{%
\chapter{Prerequisites}\label{prerequisites}}

This is a \emph{sample} book written in \textbf{Markdown}. You can use anything that Pandoc's Markdown supports, e.g., a math equation \(a^2 + b^2 = c^2\).

The \textbf{bookdown} package can be installed from CRAN or Github:

\begin{Shaded}
\begin{Highlighting}[]
\KeywordTok{install.packages}\NormalTok{(}\StringTok{"bookdown"}\NormalTok{)}
\CommentTok{# or the development version}
\CommentTok{# devtools::install_github("rstudio/bookdown")}
\end{Highlighting}
\end{Shaded}

Remember each Rmd file contains one and only one chapter, and a chapter is defined by the first-level heading \texttt{\#}.

To compile this example to PDF, you need XeLaTeX. You are recommended to install TinyTeX (which includes XeLaTeX): \url{https://yihui.name/tinytex/}.

\hypertarget{intro}{%
\chapter{Introduction}\label{intro}}

You can label chapter and section titles using \texttt{\{\#label\}} after them, e.g., we can reference Chapter \ref{intro}. If you do not manually label them, there will be automatic labels anyway, e.g., Chapter \ref{visualization}.

Figures and tables with captions will be placed in \texttt{figure} and \texttt{table} environments, respectively.

And this is some other random stuff.

\begin{Shaded}
\begin{Highlighting}[]
\KeywordTok{par}\NormalTok{(}\DataTypeTok{mar =} \KeywordTok{c}\NormalTok{(}\DecValTok{4}\NormalTok{, }\DecValTok{4}\NormalTok{, }\FloatTok{.1}\NormalTok{, }\FloatTok{.1}\NormalTok{))}
\KeywordTok{plot}\NormalTok{(pressure, }\DataTypeTok{type =} \StringTok{'b'}\NormalTok{, }\DataTypeTok{pch =} \DecValTok{19}\NormalTok{)}
\end{Highlighting}
\end{Shaded}

\begin{figure}

{\centering \includegraphics[width=0.8\linewidth]{bookdown-demo_files/figure-latex/nice-fig-1}

}

\caption{Here is a nice figure!}\label{fig:nice-fig}
\end{figure}

Reference a figure by its code chunk label with the \texttt{fig:} prefix, e.g., see Figure \ref{fig:nice-fig}. Similarly, you can reference tables generated from \texttt{knitr::kable()}, e.g., see Table \ref{tab:nice-tab}.

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{knitr}\OperatorTok{::}\KeywordTok{kable}\NormalTok{(}
  \KeywordTok{head}\NormalTok{(iris, }\DecValTok{20}\NormalTok{), }\DataTypeTok{caption =} \StringTok{'Here is a nice table!'}\NormalTok{,}
  \DataTypeTok{booktabs =} \OtherTok{TRUE}
\NormalTok{)}
\end{Highlighting}
\end{Shaded}

\begin{table}[t]

\caption{\label{tab:nice-tab}Here is a nice table!}
\centering
\begin{tabular}{rrrrl}
\toprule
Sepal.Length & Sepal.Width & Petal.Length & Petal.Width & Species\\
\midrule
5.1 & 3.5 & 1.4 & 0.2 & setosa\\
4.9 & 3.0 & 1.4 & 0.2 & setosa\\
4.7 & 3.2 & 1.3 & 0.2 & setosa\\
4.6 & 3.1 & 1.5 & 0.2 & setosa\\
5.0 & 3.6 & 1.4 & 0.2 & setosa\\
\addlinespace
5.4 & 3.9 & 1.7 & 0.4 & setosa\\
4.6 & 3.4 & 1.4 & 0.3 & setosa\\
5.0 & 3.4 & 1.5 & 0.2 & setosa\\
4.4 & 2.9 & 1.4 & 0.2 & setosa\\
4.9 & 3.1 & 1.5 & 0.1 & setosa\\
\addlinespace
5.4 & 3.7 & 1.5 & 0.2 & setosa\\
4.8 & 3.4 & 1.6 & 0.2 & setosa\\
4.8 & 3.0 & 1.4 & 0.1 & setosa\\
4.3 & 3.0 & 1.1 & 0.1 & setosa\\
5.8 & 4.0 & 1.2 & 0.2 & setosa\\
\addlinespace
5.7 & 4.4 & 1.5 & 0.4 & setosa\\
5.4 & 3.9 & 1.3 & 0.4 & setosa\\
5.1 & 3.5 & 1.4 & 0.3 & setosa\\
5.7 & 3.8 & 1.7 & 0.3 & setosa\\
5.1 & 3.8 & 1.5 & 0.3 & setosa\\
\bottomrule
\end{tabular}
\end{table}

\begin{Shaded}
\begin{Highlighting}[]
\ImportTok{import}\NormalTok{ pandas }\ImportTok{as}\NormalTok{ pd}
\NormalTok{x }\OperatorTok{=} \StringTok{'hello, python world!'}
\BuiltInTok{print}\NormalTok{(x.split(}\StringTok{' '}\NormalTok{))}
\end{Highlighting}
\end{Shaded}

\begin{verbatim}
## ['hello,', 'python', 'world!']
\end{verbatim}

You can write citations, too. For example, we are using the \textbf{bookdown} package \citep{R-bookdown} in this sample book, which was built on top of R Markdown and \textbf{knitr} \citep{xie2015}.

\hypertarget{jupyter}{%
\chapter{JupyterLab}\label{jupyter}}

Here is a simple template that I use that controls a couple useful things when starting a new notebook.

\begin{Shaded}
\begin{Highlighting}[]
\ImportTok{import}\NormalTok{ sys}
\NormalTok{sys.path.append(}\StringTok{'../util'}\NormalTok{)}

\OperatorTok{%}\NormalTok{reload_ext autoreload}
\OperatorTok{%}\NormalTok{autoreload }\DecValTok{2}

\ImportTok{from}\NormalTok{ util }\ImportTok{import} \OperatorTok{*}
\ImportTok{import}\NormalTok{ numpy }\ImportTok{as}\NormalTok{ np                  }
\ImportTok{import}\NormalTok{ pandas }\ImportTok{as}\NormalTok{ pd                 }
\ImportTok{from}\NormalTok{ matplotlib }\ImportTok{import}\NormalTok{ pyplot }\ImportTok{as}\NormalTok{ plt}
\ImportTok{import}\NormalTok{ seaborn }\ImportTok{as}\NormalTok{ sns}

\NormalTok{sns.set_palette(}\StringTok{'pastel'}\NormalTok{)}
\NormalTok{sns.set_style(}\StringTok{'ticks'}\NormalTok{)}
\NormalTok{sns.set_context(}\StringTok{'paper'}\NormalTok{, font_scale}\OperatorTok{=}\DecValTok{1}\NormalTok{)}
\end{Highlighting}
\end{Shaded}

It is often convenient to have a notebook automatically refresh the imported libraries so that they can be modified while working on a JupyterLab notebook.

\begin{Shaded}
\begin{Highlighting}[]
\OperatorTok{%}\NormalTok{reload_ext autoreload}
\OperatorTok{%}\NormalTok{autoreload }\DecValTok{2}
\end{Highlighting}
\end{Shaded}

To allow directory organization, dependcies can be separated into different directories and imported into a jupyter notebook using the following import statement.

\begin{Shaded}
\begin{Highlighting}[]
\ImportTok{import}\NormalTok{ sys}
\NormalTok{sys.path.append(}\StringTok{'../util'}\NormalTok{)}
\end{Highlighting}
\end{Shaded}

\hypertarget{visualization}{%
\chapter{Visualization}\label{visualization}}

\hypertarget{matplotlib}{%
\section{Matplotlib}\label{matplotlib}}

Plotting a heatmap.

\begin{Shaded}
\begin{Highlighting}[]
\ImportTok{import}\NormalTok{ matplotlib.pyplot }\ImportTok{as}\NormalTok{ plt}
\ImportTok{import}\NormalTok{ numpy }\ImportTok{as}\NormalTok{ np}
\NormalTok{a }\OperatorTok{=}\NormalTok{ np.random.random((}\DecValTok{16}\NormalTok{, }\DecValTok{16}\NormalTok{))}
\NormalTok{plt.imshow(a, cmap}\OperatorTok{=}\StringTok{'RdBu'', interpolation='}\NormalTok{nearest}\StringTok{')}
\StringTok{plt.show()}
\end{Highlighting}
\end{Shaded}

Possible heatmap colors are:

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{Accent, Accent_r, Blues, Blues_r, BrBG, BrBG_r, BuGn, BuGn_r, BuPu, BuPu_r, CMRmap, CMRmap_r, Dark2, Dark2_r, GnBu, GnBu_r, Greens, Greens_r, Greys, Greys_r, OrRd, OrRd_r, Oranges, Oranges_r, PRGn, PRGn_r, Paired, Paired_r, Pastel1, Pastel1_r, Pastel2, Pastel2_r, PiYG, PiYG_r, PuBu, PuBuGn, PuBuGn_r, PuBu_r, PuOr, PuOr_r, PuRd, PuRd_r, Purples, Purples_r, RdBu, RdBu_r, RdGy, RdGy_r, RdPu, RdPu_r, RdYlBu, RdYlBu_r, RdYlGn, RdYlGn_r, Reds, Reds_r, Set1,}
\NormalTok{Set1_r, Set2, Set2_r, Set3, Set3_r, Spectral, Spectral_r, Wistia, Wistia_r, YlGn, YlGnBu, YlGnBu_r, YlGn_r, YlOrBr, YlOrBr_r, YlOrRd, YlOrRd_r, afmhot, afmhot_r, autumn, autumn_r, binary, binary_r, bone, bone_r, brg, brg_r, bwr, bwr_r, cividis, cividis_r, cool, cool_r, coolwarm, coolwarm_r, copper, copper_r, cubehelix, cubehelix_r, flag, flag_r, gist_earth, gist_earth_r, gist_gray, gist_gray_r, gist_heat, gist_heat_r, gist_ncar, gist_ncar_r, gist_rainbow, gist_rainbow_r,}
\NormalTok{gist_stern, gist_stern_r, gist_yarg, gist_yarg_r, gnuplot, gnuplot2, gnuplot2_r, gnuplot_r, gray, gray_r, hot, hot_r, hsv, hsv_r, icefire, icefire_r, inferno, inferno_r, jet, jet_r, magma, magma_r, mako, mako_r, nipy_spectral, nipy_spectral_r, ocean, ocean_r, pink, pink_r, plasma, plasma_r, prism, prism_r, rainbow, rainbow_r, rocket, rocket_r, seismic, seismic_r, spring, spring_r, summer, summer_r, tab10, tab10_r, tab20, tab20_r, tab20b, tab20b_r, tab20c, tab20c_r, terrain, terrain_r,}
\NormalTok{twilight, twilight_r, twilight_shifted, twilight_shifted_r, viridis, viridis_r, vlag, vlag_r, winter, winter_r}
\end{Highlighting}
\end{Shaded}

A simple venn diagram.

\begin{Shaded}
\begin{Highlighting}[]
\ImportTok{from}\NormalTok{ matplotlib_venn }\ImportTok{import}\NormalTok{ venn2}
\NormalTok{venn2(subsets }\OperatorTok{=}\NormalTok{ (}\DecValTok{3}\NormalTok{, }\DecValTok{2}\NormalTok{, }\DecValTok{1}\NormalTok{))}
\end{Highlighting}
\end{Shaded}

A more complicated venn diagram.

\begin{Shaded}
\begin{Highlighting}[]
\ImportTok{from}\NormalTok{ matplotlib }\ImportTok{import}\NormalTok{ pyplot }\ImportTok{as}\NormalTok{ plt}
\ImportTok{import}\NormalTok{ numpy }\ImportTok{as}\NormalTok{ np}
\ImportTok{from}\NormalTok{ matplotlib_venn }\ImportTok{import}\NormalTok{ venn3, venn3_circles}
\NormalTok{plt.figure(figsize}\OperatorTok{=}\NormalTok{(}\DecValTok{4}\NormalTok{,}\DecValTok{4}\NormalTok{))}
\NormalTok{v }\OperatorTok{=}\NormalTok{ venn3(subsets}\OperatorTok{=}\NormalTok{(}\DecValTok{1}\NormalTok{, }\DecValTok{1}\NormalTok{, }\DecValTok{1}\NormalTok{, }\DecValTok{1}\NormalTok{, }\DecValTok{1}\NormalTok{, }\DecValTok{1}\NormalTok{, }\DecValTok{1}\NormalTok{), set_labels }\OperatorTok{=}\NormalTok{ (}\StringTok{'A'}\NormalTok{, }\StringTok{'B'}\NormalTok{, }\StringTok{'C'}\NormalTok{))}
\NormalTok{v.get_patch_by_id(}\StringTok{'100'}\NormalTok{).set_alpha(}\FloatTok{1.0}\NormalTok{)}
\NormalTok{v.get_patch_by_id(}\StringTok{'100'}\NormalTok{).set_color(}\StringTok{'white'}\NormalTok{)}
\NormalTok{v.get_label_by_id(}\StringTok{'100'}\NormalTok{).set_text(}\StringTok{'Unknown'}\NormalTok{)}
\NormalTok{v.get_label_by_id(}\StringTok{'A'}\NormalTok{).set_text(}\StringTok{'Set "A"'}\NormalTok{)}
\NormalTok{c }\OperatorTok{=}\NormalTok{ venn3_circles(subsets}\OperatorTok{=}\NormalTok{(}\DecValTok{1}\NormalTok{, }\DecValTok{1}\NormalTok{, }\DecValTok{1}\NormalTok{, }\DecValTok{1}\NormalTok{, }\DecValTok{1}\NormalTok{, }\DecValTok{1}\NormalTok{, }\DecValTok{1}\NormalTok{), linestyle}\OperatorTok{=}\StringTok{'dotted'}\NormalTok{)}
\NormalTok{c[}\DecValTok{0}\NormalTok{].set_lw(}\FloatTok{1.0}\NormalTok{)}
\NormalTok{c[}\DecValTok{0}\NormalTok{].set_ls(}\StringTok{'dotted'}\NormalTok{)}
\NormalTok{plt.title(}\StringTok{"Sample Venn diagram"}\NormalTok{)}
\NormalTok{plt.annotate(}\StringTok{'Unknown set'}\NormalTok{, xy}\OperatorTok{=}\NormalTok{v.get_label_by_id(}\StringTok{'100'}\NormalTok{).get_position() }\OperatorTok{-}\NormalTok{ np.array([}\DecValTok{0}\NormalTok{, }\FloatTok{0.05}\NormalTok{]), xytext}\OperatorTok{=}\NormalTok{(}\OperatorTok{-}\DecValTok{70}\NormalTok{,}\OperatorTok{-}\DecValTok{70}\NormalTok{),}
\NormalTok{             ha}\OperatorTok{=}\StringTok{'center'}\NormalTok{, textcoords}\OperatorTok{=}\StringTok{'offset points'}\NormalTok{, bbox}\OperatorTok{=}\BuiltInTok{dict}\NormalTok{(boxstyle}\OperatorTok{=}\StringTok{'round,pad=0.5'}\NormalTok{, fc}\OperatorTok{=}\StringTok{'gray'}\NormalTok{, alpha}\OperatorTok{=}\FloatTok{0.1}\NormalTok{),}
\NormalTok{                          arrowprops}\OperatorTok{=}\BuiltInTok{dict}\NormalTok{(arrowstyle}\OperatorTok{=}\StringTok{'->'}\NormalTok{, connectionstyle}\OperatorTok{=}\StringTok{'arc3,rad=0.5'}\NormalTok{,color}\OperatorTok{=}\StringTok{'gray'}\NormalTok{))}
\NormalTok{                          plt.show()}
\end{Highlighting}
\end{Shaded}

\hypertarget{seaborn}{%
\section{Seaborn}\label{seaborn}}

Here is a general bar plot that includes some commonly used parameters.

\begin{Shaded}
\begin{Highlighting}[]
\CommentTok{# fits my 22 inch monitor}
\NormalTok{plt.figure(figsize}\OperatorTok{=}\NormalTok{(}\FloatTok{19.17}\NormalTok{,}\FloatTok{11.98}\NormalTok{))}
\CommentTok{# order controls the display order of the samples}
\NormalTok{sns.catplot(x}\OperatorTok{=}\StringTok{"Sample"}\NormalTok{, y}\OperatorTok{=}\StringTok{"Somatic"}\NormalTok{, kind}\OperatorTok{=}\StringTok{"bar"}\NormalTok{, data}\OperatorTok{=}\NormalTok{var_counts, order}\OperatorTok{=}\NormalTok{labels)}\OperatorTok{;}
\CommentTok{# keeps x-axis labels, but eliminates the tick mark}
\NormalTok{plt.tick_params(labelbottom}\OperatorTok{=}\VariableTok{True}\NormalTok{, bottom}\OperatorTok{=}\VariableTok{False}\NormalTok{)}
\CommentTok{# trim off the x-axis}
\NormalTok{sns.despine(offset}\OperatorTok{=}\DecValTok{10}\NormalTok{, trim}\OperatorTok{=}\VariableTok{True}\NormalTok{, bottom}\OperatorTok{=}\VariableTok{True}\NormalTok{)}
\CommentTok{# labels}
\NormalTok{plt.title(}\StringTok{''}\NormalTok{)}
\NormalTok{plt.ylabel(}\StringTok{''}\NormalTok{)}
\NormalTok{plt.xlabel(}\StringTok{''}\NormalTok{)}
\CommentTok{# manual control of xlabels}
\NormalTok{labels }\OperatorTok{=}\NormalTok{ [}\StringTok{'Indiv_1-a'}\NormalTok{,}\StringTok{'Indiv_2'}\NormalTok{,}\StringTok{'Indiv_3'}\NormalTok{,}\StringTok{'Indiv_1-b'}\NormalTok{]}
\CommentTok{# control xtick order}
\NormalTok{plt.xticks(}\BuiltInTok{range}\NormalTok{(}\BuiltInTok{len}\NormalTok{(labels)), labels, rotation}\OperatorTok{=}\DecValTok{45}\NormalTok{)}
\CommentTok{# control the number of x-ticks}
\NormalTok{plt.locator_params(axis}\OperatorTok{=}\StringTok{'x'}\NormalTok{, nbins}\OperatorTok{=}\DecValTok{10}\NormalTok{)}
\CommentTok{# legend positioning}
\NormalTok{plt.legend(loc}\OperatorTok{=}\StringTok{'upper right'}\NormalTok{)}
\CommentTok{# log scale}
\NormalTok{plt.gca().set_yscale(}\StringTok{'log'}\NormalTok{)}
\CommentTok{# this is better if neg values are needed}
\NormalTok{plt.gca().set_yscale(}\StringTok{'symlog'}\NormalTok{)}
\CommentTok{# fit plot to display}
\NormalTok{plt.tight_layout()}
\NormalTok{plt.show()}
\CommentTok{# save figure with tight_layout}
\NormalTok{plt.savefig(}\StringTok{"test.svg"}\NormalTok{, }\BuiltInTok{format}\OperatorTok{=}\StringTok{"svg"}\NormalTok{, bbox_inches}\OperatorTok{=}\StringTok{"tight"}\NormalTok{)}
\end{Highlighting}
\end{Shaded}

Signifance information can be added by including p-values and label bars using the following code.

\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{x1, x2 }\OperatorTok{=} \DecValTok{0}\NormalTok{, }\DecValTok{1} \CommentTok{# columns to annotate on the plot}
\NormalTok{y2, y1 }\OperatorTok{=} \DecValTok{20}\NormalTok{, }\DecValTok{15} \CommentTok{# placement of the line and how for down the vertical legs go}
\NormalTok{plt.plot([x1,x1, x2, x2], [y1, y2, y2, y1], linewidth}\OperatorTok{=}\DecValTok{1}\NormalTok{, color}\OperatorTok{=}\StringTok{'k'}\NormalTok{) }\CommentTok{# stats line}
\NormalTok{plt.text((x1}\OperatorTok{+}\NormalTok{x2)}\OperatorTok{*}\NormalTok{.}\DecValTok{5}\NormalTok{, y2}\OperatorTok{+}\DecValTok{2}\NormalTok{, }\StringTok{"p=0.09"}\NormalTok{, ha}\OperatorTok{=}\StringTok{'center'}\NormalTok{, va}\OperatorTok{=}\StringTok{'bottom'}\NormalTok{) }\CommentTok{# p-value or sig}


text:
\section{Class List}
Here are the classes, structs, unions and interfaces with brief descriptions\+:\begin{DoxyCompactList}
\item\contentsline{section}{\mbox{\hyperlink{structstack}{stack}} }{\pageref{structstack}}{}
\item\contentsline{section}{\mbox{\hyperlink{structstack__elem}{stack\+\_\+elem}} }{\pageref{structstack__elem}}{}
\item\contentsline{section}{\mbox{\hyperlink{structstack__ops}{stack\+\_\+ops}} }{\pageref{structstack__ops}}{}
\item\contentsline{section}{\mbox{\hyperlink{structTrie}{Trie}} }{\pageref{structTrie}}{}
\item\contentsline{section}{\mbox{\hyperlink{structTrieIterator}{Trie\+Iterator}} }{\pageref{structTrieIterator}}{}
\item\contentsline{section}{\mbox{\hyperlink{structTrieNode}{Trie\+Node}} }{\pageref{structTrieNode}}{}
\item\contentsline{section}{\mbox{\hyperlink{structTrieOps}{Trie\+Ops}} }{\pageref{structTrieOps}}{}
\end{DoxyCompactList}

domain: tex


text:
\documentclass[english,a4paper,twoside]{scrreprt}

% Used packages
\usepackage{functions}

% Document meta data.
%FIXME: better title & remove draft suffix
\title{Ambient Earth\\
       {\Large \emph{Internship report}}}
\author{Christian Luijten\\\url{christian06@ru.is}\\\url{c.a.a.m.luijten@student.tue.nl}}
\date{11 November 2006}
\institution{
 CADIA group \\
 School of Science and Engineering \\
 \Rvk\ University, \Rvk \\[1em]
 \emph{Under supervision of:\/} \\
 Kristinn R. Thorisson, Ph.D. (\Rvk\ University) \\
 dr.ir. Huub van de Wetering (Eindhoven University of Technology) \\
}

\begin{document}

\acrodef{RU}{\Rvk\ University}
\acrodef{TU/e}{Technical University Eindhoven}
\acrodef{CADIA}{Center for Analysis \& Design of Intelligent Agents}
\acrodef{RSS}{RDF Site Summary}
\acrodef{OPML}{Outline Processor Markup Language}
\acrodef{YAML}{YAML Ain't Markup Language}

\maketitle

\mbox{} \\
\vfill

\begin{adjustwidth}{4em}{4em}
{\scriptsize
  Christian Luijten (\url{christian06@ru.is})

  Copyright \copyright\ 2006 Center for Analysis and Design of Intelligent
  Agents. \\
  \Rvk\ University \\
  All rights reserved

  \url{http://cadia.ru.is/}

  Redistribution and use in source and binary forms, with or without
  modification, is permitted provided that the following conditions are met:

  \begin{itemize}
    \item Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.

    \item Redistributions in binary form must reproduce the above copyright
      notice, this list of conditions and the following disclaimer in the
      documentation and/or other materials provided with the distribution.

    \item Neither the name of its copyright holders nor the names of its
      contributors may be used to endorse or promote products derived from this
      software without specific prior written permission.

  \end{itemize}

  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  POSSIBILITY OF SUCH DAMAGE.
}
\end{adjustwidth}

\include{report/report-preface.inc}

\tableofcontents

\include{report/report-intro.inc}

\include{report/report-assignment.inc}

\include{report/report-planning.inc}

\include{report/report-design.inc}

\include{report/report-evaluation.inc}

\include{report/report-conclusion.inc}

\bibliographystyle{cadia}
\bibliography{bibliography}
\addcontentsline{toc}{chapter}{\refname}

\end{document}


text:
\section{Intégration du CAS au reste du dispositif}

L'emploi d'appareils de \gls{cas} conjointement avec le tir de surface implique une planification minutieuse combinée avec une capacité de s'adapter rapidement une situation qui évolue.\par

Des techniques de séparation sont utilisées à cette fin.

\subsection{Fire Support Coordination Measures (FSCMs)}
	Les \glspl{gc} implémentent dans leur zone des \glspl{fscm} permissives et restrictives pour accélérer le processus d'engagement des cibles; protéger les unités alliées, les populations, l'infrastructure importante, les sites religieux ou culturels; autoriser le tir Joint; établir les conditions pour préparer une opération future.

\begin{e1}

	\item La vocation principale des mesures permissives est d'accélérer l'engagement des cibles.

	\item La vocation principale des mesures restrictives est de protéger les forces alliées.

	\item Pour plus de détails concernant les \glspl{fscm}, cfr. \citetitle{jp309}.

	\itemt{Mesures permissives:}{}

	\begin{e2}

		\itemt{\glsfull{cfl}:} {\glsd{cfl}}

		\itemt{\glsfull{fscl}:} {\glsd{fscl}}

		\efig{fscl}{Positionnement d'une FSCL (\citetitle{jp303})}

		La création d'une \gls{fscl} n'implique pas une \gls{ffa} derrière la \gls{fscl}.

		\item BCL - spécifique à l'USMC

		\itemt{\glsfull{ffa}:} {\glsd{ffa}}

		\itemt{\glsfull{kb}:} {\glsd{kb}}

		\efig[\linewidth][0.4\textheight]{bluekb}{Blue Killbox, extrait du \citetitle{jp309}.}

		\efig[\linewidth][0.4\textheight]{purplekb}{Purple Killbox, extrait du \citetitle{jp309}.}

		\itemt{Statut d'un Killbox} {Une Killbox peut être ``chaude'' (HOT) ou ``froide'' (COLD):}

		\begin{e3}

			\itemt{HOT:}{L'emploi d'armement est autorisé dans la Killbox sans autre forme de coordination ou de déconfliction.}

			\itemt{COLD:}{L'emploi d'armement dans la Killbox n'est \emph{pas} autorisé sans coordination préalable.}

		\end{e3}

		Cfr. \citetitle{jp309}, Annexe A, pour plus d'informations à propos de la Killbox.

	\end{e2}

	\itemt{Mesures restrictives:}{}

	\begin{e2}

		\itemt{\glsfull{nfa}:} {\glsd{nfa}}

		\itemt{\glsfull{rfa}:} {\glsd{rfa}}

		\itemt{\glsfull{rfl}:} {\glsd{rfl}}

		\itemt{\glsfull{aca}:} {\glsd{aca}}

		\begin{e3}

			\itemt{\gls{aca} formelle}{
				L'autorité de contrôle de l'espace aérien établit l'\gls{aca} à la demande du \gls{gc}.

				Les \glspl{aca} formelles demandent une planification détaillée et sont intégrées dans l'\gls{aco}, l'\gls{ato} ou les \gls{spins}.
			}

			\efig{formalaca}{ACA formelle.}

			\itemt{\gls{aca} informelle}{
				Une \gls{aca} informelle est établie par le \gls{gc} au moyen d'une plan de séparation.

				L'\gls{aca} informelle permet d'établir une déconfliction immédiate et temporaire, et, de ce fait, ne durent généralement pas très longtemps.

				De par leur nature immédiate, il peut être difficile pour les autorités de contrôle de s'assurer de leur diffusion correcte.
			}

		\end{e3}

		\itemt{Séparation}{}

		\begin{e3}

			\begin{minipage}{\linewidth}

			\itemt{Séparation latérale}{
				La séparation latérale consiste à délimiter la zone d'engagement en deux (ou plus) parties au moyen d'une ligne.

				Cette ligne peut être une coordonnée MGRS, une latitude/longitude, ou un point particulier du relief.
			}

			\begin{lstlisting}[caption=ACA: Séparation latérale, label=acalateralsep]
				REDWOLF ici PIRATE, rester "à" l'ouest de la rivi"è"re.
			\end{lstlisting}

			\efig{lateralsep}{ACA: Séparation latérale.}
			\end{minipage}

			\begin{minipage}{\linewidth}
			\itemt{Séparation en altitude:}{
				La séparation en altitude peut être utilisée lorsqu'un appareil doit croiser la ligne de tir d'une unité alliée.

				La séparation en altitude en appelant ``Restez au dessus de \ldots{}'' ou ``Restez en dessous de \ldots{}''.

				L'altitude est données en \gls{ft} \gls{msl}, sauf si indiqué autrement.
			}

			\efig{altsep}{ACA: Séparation en altitude.}
			\end{minipage}

			\begin{minipage}{\linewidth}
			\itemt{Combinaison des séparations latérales et verticales:}{}

			\efig{lateralandverticalsep}{ACA: Séparation latérale en altitude.}
			\end{minipage}

			\itemt{Séparation horaire:}{
				La séparation horaire est celle qui demande le plus de préparation.

				Elle est appropriée lorsque de multiples unités alliées doivent engager la même cible.

				Tous les timings se basent sur les \glspl{tot}/\glspl{ttt} des appareils de \gls{cas}.
			}
			\begin{e4}
				\begin{minipage}{\linewidth}
				\itemt{\glsfull{tot}}{
					Le \gls{tot} est l'heure à laquelle les munitions tirées par l'appareil de \gls{cas} sont censées impacter la cible. C'est la méthode la plus facile à utiliser.

					Si le pilote ne peut pas respecter le timing, il doit en informer le \gls{tac} au plus vite.
				}
				\efig{tot}{ACA: Séparation horaire avec un TOT.}
				\end{minipage}

				\begin{minipage}{\linewidth}
				\itemt{\glsfull{ttt}}{
					Le \gls{ttt} donne un temps en minutes et en secondes entre un moment T (appelé ``HACK'') et le moment où les munitions impactent la cible.

					C'est une méthode précise, mais rarement utilisée.

					C'est le \ja{} qui donne le HACK, et les pilotes doivent en accuser réception.
				}

				\begin{lstlisting}[caption=Synchronisation au moyen d'un HACK, label=hacktime]
					REDWOLF ici PIRATE, Time to target 5+00, pr"ê"t... pr"ê"t... HACK.
					PIRATE ici REDWOLF, roger.
				\end{lstlisting}
				\end{minipage}

			\end{e4}

		\end{e3}

		\efig{fscm}{Illustration des différentes FSCMs.}

	\end{e2}
	\begin{minipage}{\linewidth}
	\itemt{\glsfull{acm}:} {\glsd{acm}}

	\begin{e3}
		\itemt{\glsfull{ca}:} {\glsd{ca}}
		\itemt{\glsfull{hidacz}:} {\glsd{hidacz}}
		\itemt{\glsfull{roz}:} {\glsd{roz}}
		\itemt{\glsfull{roa}:} {\glsd{roa}}
		\itemt{\glsfull{mrr}:} {\glsd{mrr}}
		\itemt{\glsfull{saafr}:} {\glsd{saafr}}
	\end{e3}
	\end{minipage}

	\efig{acm}{ACM Joint.}

	Cfr. \citetitle{jp352} pour plus d'informations à propos des \glspl{acm}.

\end{e1}

\subsection{Coordination}

Une fois que la cible est désignée et approuvée, le \ja{} coordonne les points suivants \gls{cas} avec les forces au sol:

\begin{e1}

	\itemt{Limites de la zone de tir:}{
		Les limites de zone de tir sont les mesures de bases pour la coordination du feu.

		Elles sont restrictives de par le fait qu'aucun tir n'est autorisé au delà des limites.
	}

	\itemt{\gls{ada} alliée:}{
		Pour éviter le tir fratricide, le \ja{} annonce ``Appareil allié sur zone''.

		Le \ja{} coordonne avec l'\gls{ada} les \gls{cp}, \gls{ip}, la position de la cible, le nombre et le types d'appareils alliés présents, leur altitude, et leur \gls{tos}.

		Les \gls{spins} et l'\gls{ato} devraient inclure des \glspl{mrr} ou des corridors de retour sécurisés, ainsi les procédures associées, pour les appareils qui reviennent d'une zone de \gls{cas}.
	}

	\itemt{Mesures de contrôle procédural:}{
		Le contrôle procédural fournit aux pilote la direction de la cible, aligne l'appareil pour l'attaque finale ou l'egress, et fournit les séparation avec les autres tirs en cours et les menaces anti-aériennes ennemies.

		Le contrôle procédural inclut:
	}

	\begin{e2}

		\item{Sélection \gls{cp}/\gls{ip}\gls{bp}:}{
			Le \ja{} sélectionne les \glspl{cp}/\glspl{ip}\glspl{bp} en se basant sur les capacités de l'ennemi, l'orientation de la cible, la positions des alliés, la météo, les capacités de l'appareil \gls{cas}, et les \glspl{fscm}.

			Lorsque c'est possible, les \glspl{cp} et \glspl{ip} devraient être des points remarquables du terrain.

			L'\gls{ip} est normalement placé entre 5 et 15 miles nautiques de la cible pour les \glspl{fw}, et les \glspl{bp} entre 1 et 5 km pour les \glspl{rw}.

			Les appareils évoluant à plus haute altitude peuvent nécessiter un \gls{ip} plus éloigné, à 20 miles nautiques de la cible.
		}

		\begin{minipage}{\linewidth}
			\itemt{\glsfull{kh}:} {\glsd{kh}}
		\end{minipage}

		\begin{e3}
			\item La méthode \gls{kh} standard consiste à attribuer une lettre à chaque direction cardinale:
			\begin{e4}
				\item A: nord.
				\item B: est.
				\item C: sud.
				\item D: ouest.
				\item E: centre (point Echo).
			\end{e4}

			Le \ja{} peut également donner une radiale à partir du point Echo si les directions cardinales ne suffisent pas.

			\efig{khex1}{Keyhole: exemple de communication.}

			\begin{e4}

				\begin{minipage}{\linewidth}
				\item Si la situations tactique nécessite qu'un \gls{ip} soit établie au nord de la cible, les instructions du \ja{} pourraient ressembler à:

				\begin{lstlisting}[caption=Keyhole: directions cardinale, label=keyholecard]
				REDWOLF ici PIRATE, pr"é"venez quand pr"ê"t "à" copier point Echo.
				PIRATE ici REDWOLF, pr"ê"t "à" copier.
				REDWOLF, coordonn"é"es point Echo suivent, N42 34.5 E043 51.2E.
				PIRATE, REDWOLF, je copie N42 34.5 E043 51.2.
				REDWOLF, allez Alpha 8km, 200m, rappelez "é"tabli.
				...
				PIRATE, ici REDWOLF, "é"tabli Alpha 8km, 200m.
				\end{lstlisting}
				\end{minipage}

				\begin{minipage}{\linewidth}
				\item Lorsqe les directions cardinales ne suffisent pas, le \ja{} peut utiliser une radiale à partir du point Echo. Par exemple:

				\begin{lstlisting}[caption=Keyhole: radiale, label=keyholerad]
				REDWOLF, allez au 240 "à" 8km, 200m, rappelez "é"tabli.
				...
				PIRATE, ici REDWOLF, "é"tabli 240 "à" 8km, 200m.
				\end{lstlisting}
				\end{minipage}

			\end{e4}

			\efig{keyhole}{Keyhole: illustration}

			\item Le \gls{kh} permet une flexibilité illimitée pour établir des \glspl{ip}, et d'éviter d'avoir à planifier des \glspl{ip} qu'on utilisera probablement jamais partout dans la zone opérationnelle.

			Cependant, en utilisant le \gls{kh}, le \ja{} n'aura probablement pas de point de référence visuel ou géographique marquant via lequel orienter les appareils.

		\end{e3}

		\itemt{Overhead:}{L'Overhead est une attaque à partir de la verticale de la zone cible.}
		\begin{e2}
			\item Pour les attaques au moyen de \glspl{pgm}, une distance accrue sera nécessaire et devrait être spécifier en ligne 1-3.

			Les attaques aux \glspl{pgm} ne permettent pas l'Overhead.

			\item Si l'appareil attaque depuis la verticale, les lignes 1-3 peuvent être ``De la verticale'', ou ``Lignes 1 à 3 pas d'application''.
		\end{e2}

		\begin{minipage}{\linewidth}
			\itemt{\glsfull{of}:} {\glsd{of}}
		\end{minipage}

		\efig{offset}{Décalage (offset).}

		\begin{minipage}{\linewidth}
			\itemt{\glsfull{fah}:} {\glsd{fah}}\label[para]{tofah}
		\end{minipage}

		\begin{e3}
			\item Le \ja{} doit évaluer les avantages d'imposer un \gls{fah} par rapport aux inconvénients et ne l'utiliser que si c'est nécessaire. Un minimum de contraintes doivent être imposées au pilote.

			\item Toute géométrie d'attaque passée lors du CAS-brief est considérée comme une restriction, et doit être répétée par le pilote lors du read-back.
			\begin{minipage}{\linewidth}
			\item Un passage de \gls{fah} peut ressembler à:
			\begin{lstlisting}[caption=FAH: cap magnétique, label=fah1]
			Cap d'attaque final 230.
			\end{lstlisting}
			\begin{lstlisting}[caption=FAH: cap magnétique avec cône, label=fah2]
			Cap d'attaque final 240-300.
			\end{lstlisting}
			\begin{lstlisting}[caption=FAH: cap magnétique avec une fourchette, label=fah3]
			Cap d'attaque final 270 plus ou moins 30 degr"é"s.
			\end{lstlisting}
			\begin{lstlisting}[caption=FAH: direction cardinale, label=fah4]
			Cap d'attaque final du nord-est au sud-ouest.
			\end{lstlisting}
			\begin{lstlisting}[caption=FAH: référence géographique, label=fah5]
			Effectuez toutes les attaques parall"è"lement "à" la route.
			\end{lstlisting}
			\end{minipage}
		\end{e3}

	\end{e2}
	\itemt{Synchronisation}{}
	\begin{e2}
		\itemt{Emploi simultané}{
			Le but est de protéger les appareils alliés tout en limitant au maximum le temps pendant lequel les autres armes ne peuvent pas tirer de peur de toucher un appareil en attaque.
		}
		\itemt{Temps de référence commun}{
			Pour permettre la synchronisation de tous les éléments, il est impératif que tous les participants utilisent la même méthode de timing (\gls{tot} ou \gls{ttt}).
		}

		\itemt{Appui-feu pour le \gls{cas}:}{
			Il y a deux formes principales d'appui-feu pour le \gls{cas}: le marquage et le \gls{sead}.
		}
		\begin{e3}
			\itemt{Marque}{
				Une marque devrait être fournie aux appareils \gls{cas} chaque fois que c'est possible.

				Il faut prévoir le temps nécessaire au pilote pour acquérir la marque.

				le \ja{} doit prévoir un système de marquage redondant au cas ou la méthode prévue en premier lieu ne fonctionne pas.

				La marque peut être fournie par \gls{idf} ou par un \gls{faca}.

				Si l'usage d'une marque visuelle n'est pas possible, on utilisera une marque ``vocale'', qu'on appelle le ``talk-on''. Le \ja{} va simplement diriger l'attention du pilote vers la cible en discutant avec lui. Le \gls{jtac} peut marquer sa propre position pour aider le talk-on (miroir, fumée, \ldots{}), en faisant attention à ne pas révéler les positions alliées à l'ennemi.

			}
			\begin{e4}

				\begin{minipage}{\linewidth}

				\item Le marquage implique l'emploi d'une brevity particulière:

				\efig{markbrevity}{Brevity pour la marque.}

				\end{minipage}

				\itemt{Marque par \gls{idf}:} {
					L'artillerie, les mortiers et le tir depuis une unité navale sont des moyens efficaces de marquer la cible.

					Lorsqu'il y a déjà beaucoup d'activité sur le champ de bataille, il faut faire attention à ce que la marque ne soit pas confondue avec une autre activité au sol.

					Le timing pour la marque est très important. Le \ja{} doit prendre en compte le temps nécessaire pour que la marque soit effective, et le temps nécessaire au pilote pour commencer à scanner la zone.

					La marque est la plus efficace lorsqu'elle tombe à moins de 100m de la cible, mais suffit généralement à guider les appareils \gls{cas} jusqu'à 300m de la cible.
				}
				\itemt{Marque par feu direct:}{
					Bien que cette méthode soit plus facile à mettre en place que l'\gls{idf}, les marques par feu direct sont généralement beaucoup moins visibles depuis les airs.
				}
				\itemt{Marque par \gls{ltd}}{
					Pour les appareils équipés d'un \gls{lst}, la marque laser est très efficace.

					Il faut cependant faire attention à ce que le pilote ne confonde pas la source du pointeur et la zone pointée.

					Lors de l'emploi d'une marque laser, le call-sign de la station qui effectue le pointage et le code laser utilisé seront donnés.

					\important{Le \ja{} doit import un \gls{fah} pour s'assurer que l'appareil acquiert la zone pointée et non pas la source du pointage.}

					Le pilote préviendra 10 secondes avant de demander l'activation du laser.

					\begin{minipage}{\linewidth}

						Le marquage laser implique l'emploi d'une brevity particulière:

						\efig{brevitylaser}{Brevity pour la marque laser.}

					\end{minipage}
				}
				\itemt{Marque par \gls{faca}}{
					Certains appareils \gls{faca} peuvent marquer la cible au moyen de roquettes au phosphore, \gls{ltd}, pointeurs \gls{ir}, ou munitions traçantes.
				}
				\itemt{Marque par pointeur \gls{ir}}{
					Le \ja{} peut utiliser un pointeur \gls{ir} pour marquer la cible de nuit, à condition que les pilotes soient équipés de \glspl{nvg}.

					Contrairement au pointeurs lasers, les pointeurs \gls{ir} ne peuvent pas être utilisés pour guider une munition.

					L'utilisation de pointeurs \gls{ir} doit se faire avec prudence, car ils peuvent révéler la position du \gls{jtac} à l'ennemi.

					Le pointage \gls{ir} devrait idéalement commencer 20 à 30 secondes avant le \gls{tos}/\gls{ttt}, ou lorsque le pilote le demande.

					\begin{minipage}{\linewidth}

						Le marquage \gls{ir} implique l'emploi d'une brevity particulière:

						\efig{brevityir}{Brevity pour la marque infrarouge.}

					\end{minipage}
				}
				\begin{minipage}{\linewidth}
				\itemt{Marques combinées}{
					Le \ja{} peut décider d'employer plusieurs marques de types différents.
				}

					\efig{laserwarning}{Avertissement laser et infrarouge.}

				\end{minipage}
				\itemt{Marque des alliés}{
					Le marquage des unités alliées est la pire méthode pour obtenir un TALLY.

					Cette méthode peut être déroutante et ne doit être utilisée, avec prudence, que si aucune autre méthode n'est possible.
				}
			\end{e4}
			\itemt{\gls{sead}}{}
			\begin{e4}
				\itemt{L'objectif principal du \gls{sead} est de permettre aux appareils alliés d'opérer dans un espace aérien défendu par un système anti-aérien ennemi.}{
					Cela inclut les routes d'ingree/egress.

					Les missions \gls{sead} ne garantissent pas l'immunité.

					Le \ja{} doit évaluer les différents profils de missions possibles pour minimiser l'exposition des appareils alliés aux défenses ennemies connues ou potentielles.

					S'il est impossible d'éviter les défenses ennemies, la vulnérabilité des appareils \gls{cas} doit être mise en balance avec le risque encourus par les appareils \gls{sead} avant de décider si une mission \gls{sead} s'impose.
				}
				\itemt{Coordination}{
					Le \gls{sead} depuis une plateforme aéroportée doit être coordonné et intégré au plan.

					Avant de demander un \gls{cas} nécessitant du \gls{sead}, il faut chercher à accomplir la neutralisation des défenses anti-aériennes ennemies par d'autres moyens (\gls{idf}).

					Le \gls{sead} est le plus efficace contre les \glspl{sam} et \gls{aaa}, et le moins efficace contre les \glspl{manpad} ou les défenses très mobiles.
				}
			\end{e4}
		\end{e3}
	\end{e2}
\end{e1}


text:
%: PAGE TITRE
\begin{titlepage}
	\centering
		{\large\textsc{Université de Sherbrooke}} \\
		Faculté de génie \\
		Département de génie électrique et de génie informatique

        \vfill

		{\bfseries{\huge Rapport de projet} \\ {\Large Rapport final}}

        \vfill

		Conception d'un système embarqué et réseauté \\
		GIF500

        \vfill

		Présenté à \\
        M. Domingo Palao Muñoz

        \vfill

		Présenté par l'équipe 2 :\\ \smallskip%
        \begin{tabular}{r|l}
          \membre{Mathieu}{Dostie}{DOSM2902}
          \membre{Émile}{Fugulin}{FUGE2701}
          \membre{Philippe}{Girard}{GIRP2705}
          \membre{Damien}{Hulmann}{HULD1501}
          \membre{Julien}{Larochelle}{LARJ2526}
          \membre{Samir}{Lechekhab}{LECS2813}
          \membre{Donavan}{Martin}{MARD1206}
        \end{tabular}

        \vfill

		Sherbrooke -- 7 décembre 2017

\end{titlepage}


text:
This problem is designed to assess your ability to compute the forward kinematics (FK) of a serial
chain manipulator. Specifically, you will be computing the forward kinematics of the manipulator arm
of a KUKA youBot. Appendix \ref{app:kinematics} provides a design specification for the youBot arm.
Please note that the design specification gives lengths in millimeters, but the V-REP simulator uses
meters.

To complete this problem, design a ROS service named \texttt{fk} that computes the forward
kinematics for a given arm configuration. Take a look at \texttt{srv/Fk.srv} for the proper
input and output types of your service. You may find it helpful to first derive the
Denavit-Hartenberg parameters of the youBot arm. If you need a refresher on DH parameters or forward
kinematics, \href{https://rpal.cs.cornell.edu/foundations/kinematics.pdf#subsection.3.7}{these
notes} may be helpful.

Note that the return value of \texttt{fk} has type \texttt{PointArray}, which we define for you. Points in this array, which have type \texttt{geometry\_msgs/Point}, are interpreted as the positions of the origins of the arm link frames. Since there are five links in the youBot arm (not including the base), you should put the five origins in the array. For each of the five points in the array, a ball of a different size and color will be displayed in the simulator so that you can see where your \texttt{fk} service believes that each link is located. The final point in the array should be the position of the end-effector.

All of your code for this problem should go in the provided \texttt{src/fk.py} file.
Additionally, \texttt{fk.launch} is completed for you.

\vspace{16pt}
\begin{figure}[h]
  \centering
  \begin{subfigure}[b]{0.475\textwidth}
    \centering
    \includegraphics[width=\textwidth]{figures/p2/problem1.png}
    \caption[]%
    {{\small Correct FK calculation}}
    \label{fig:1a}
  \end{subfigure}
  \hfill
  \begin{subfigure}[b]{0.475\textwidth}
    \centering
    \includegraphics[width=\textwidth]{figures/p2/problem1_debug.png}
    \caption[]%
    {{\small Running in debug mode}}
    \label{fig:1b}
  \end{subfigure}
  \caption{Visualization of forward kinematics calculations. Image (\subref{fig:1a}) shows a correct
    FK calculation with debug mode turned off; note that the blue ball is between the fingers of the
  end-effector. Image (\subref{fig:1b}) shows an example of running the problem in debug mode.}
  \label{fig:1}
\end{figure}

When you run this problem, you will see that the arm moves quickly to a series of random
configurations. If your implementation of the \texttt{fk} service is correct, then you will see a
blue ball between the youBot fingers.

If your implementation has a bug, then it may be difficult to determine from the simulation what is
wrong because the arm moves rapidly. We have therefore provided you with a debug mode. In the file
\texttt{fk.launch}, there is a ROS parameter named \texttt{fk\_debug} that is set to
\texttt{False} by default. When it is set to \texttt{True}, the arm will move slowly through the
entire range of each joint. Furthermore, each ball showing your FK solution will be offset 0.4
meters in front of the robot. If you provide the positions of all five frame origins in the return
value of \texttt{fk}, then using debug mode will help you identify mistakes in your implementation.


text:
\hypertarget{structdoctest_1_1_test_case_exception}{}\doxysection{Dokumentacja struktury doctest\+::Test\+Case\+Exception}
\label{structdoctest_1_1_test_case_exception}\index{doctest::TestCaseException@{doctest::TestCaseException}}

{\ttfamily \#include $<$doctest.\+h$>$}

Diagram współpracy dla doctest\+::Test\+Case\+Exception\+:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=230pt]{structdoctest_1_1_test_case_exception__coll__graph}
\end{center}
\end{figure}
\doxysubsection*{Atrybuty publiczne}
\begin{DoxyCompactItemize}
\item
\mbox{\hyperlink{classdoctest_1_1_string}{String}} \mbox{\hyperlink{structdoctest_1_1_test_case_exception_a656c8971ccbedc7d3a0a38f7c6af927e}{error\+\_\+string}}
\item
bool \mbox{\hyperlink{structdoctest_1_1_test_case_exception_af30d801dae6dd2f4ea01690bbf5faeca}{is\+\_\+crash}}
\end{DoxyCompactItemize}

\doxysubsection{Dokumentacja atrybutów składowych}
\mbox{\Hypertarget{structdoctest_1_1_test_case_exception_a656c8971ccbedc7d3a0a38f7c6af927e}\label{structdoctest_1_1_test_case_exception_a656c8971ccbedc7d3a0a38f7c6af927e}}
\index{doctest::TestCaseException@{doctest::TestCaseException}!error\_string@{error\_string}}
\index{error\_string@{error\_string}!doctest::TestCaseException@{doctest::TestCaseException}}
\doxysubsubsection{\texorpdfstring{error\_string}{error\_string}}
{\footnotesize\ttfamily \mbox{\hyperlink{classdoctest_1_1_string}{String}} doctest\+::\+Test\+Case\+Exception\+::error\+\_\+string}

\mbox{\Hypertarget{structdoctest_1_1_test_case_exception_af30d801dae6dd2f4ea01690bbf5faeca}\label{structdoctest_1_1_test_case_exception_af30d801dae6dd2f4ea01690bbf5faeca}}
\index{doctest::TestCaseException@{doctest::TestCaseException}!is\_crash@{is\_crash}}
\index{is\_crash@{is\_crash}!doctest::TestCaseException@{doctest::TestCaseException}}
\doxysubsubsection{\texorpdfstring{is\_crash}{is\_crash}}
{\footnotesize\ttfamily bool doctest\+::\+Test\+Case\+Exception\+::is\+\_\+crash}

Dokumentacja dla tej struktury została wygenerowana z plików\+:\begin{DoxyCompactItemize}
\item
\mbox{\hyperlink{doctest_8h}{doctest.\+h}}\item
\mbox{\hyperlink{doctest__fwd_8h}{doctest\+\_\+fwd.\+h}}\end{DoxyCompactItemize}


text:
\hypertarget{io_8h}{}\doxysection{deps/cglm/include/cglm/io.h File Reference}
\label{io_8h}\index{deps/cglm/include/cglm/io.h@{deps/cglm/include/cglm/io.h}}
{\ttfamily \#include \char`\"{}common.\+h\char`\"{}}\newline
{\ttfamily \#include $<$stdio.\+h$>$}\newline
{\ttfamily \#include $<$stdlib.\+h$>$}\newline
\doxysubsection*{Macros}
\begin{DoxyCompactItemize}
\item
\#define \mbox{\hyperlink{io_8h_a59d971e0fdd411d4d989f14b33b54c23}{glm\+\_\+mat4\+\_\+print}}(\mbox{\hyperlink{glad_8h_a10a82eabcb59d2fcd74acee063775f90}{v}},  \mbox{\hyperlink{glext_8h_a4af680a6c683f88ed67b76f207f2e6e4}{s}})~(\mbox{\hyperlink{glext_8h_a46df6112013cf583e82b25cebd5cb499}{void}})\mbox{\hyperlink{glad_8h_a10a82eabcb59d2fcd74acee063775f90}{v}}; (\mbox{\hyperlink{glext_8h_a46df6112013cf583e82b25cebd5cb499}{void}})\mbox{\hyperlink{glext_8h_a4af680a6c683f88ed67b76f207f2e6e4}{s}};
\item
\#define \mbox{\hyperlink{io_8h_a5cee3df04b86f581d19ccf47d1b54d13}{glm\+\_\+mat3\+\_\+print}}(\mbox{\hyperlink{glad_8h_a10a82eabcb59d2fcd74acee063775f90}{v}},  \mbox{\hyperlink{glext_8h_a4af680a6c683f88ed67b76f207f2e6e4}{s}})~(\mbox{\hyperlink{glext_8h_a46df6112013cf583e82b25cebd5cb499}{void}})\mbox{\hyperlink{glad_8h_a10a82eabcb59d2fcd74acee063775f90}{v}}; (\mbox{\hyperlink{glext_8h_a46df6112013cf583e82b25cebd5cb499}{void}})\mbox{\hyperlink{glext_8h_a4af680a6c683f88ed67b76f207f2e6e4}{s}};
\item
\#define \mbox{\hyperlink{io_8h_a1a9ab2bcdda2e3e29b1bc53e64869baa}{glm\+\_\+mat2\+\_\+print}}(\mbox{\hyperlink{glad_8h_a10a82eabcb59d2fcd74acee063775f90}{v}},  \mbox{\hyperlink{glext_8h_a4af680a6c683f88ed67b76f207f2e6e4}{s}})~(\mbox{\hyperlink{glext_8h_a46df6112013cf583e82b25cebd5cb499}{void}})\mbox{\hyperlink{glad_8h_a10a82eabcb59d2fcd74acee063775f90}{v}}; (\mbox{\hyperlink{glext_8h_a46df6112013cf583e82b25cebd5cb499}{void}})\mbox{\hyperlink{glext_8h_a4af680a6c683f88ed67b76f207f2e6e4}{s}};
\item
\#define \mbox{\hyperlink{io_8h_ae4745f62c591d2e8068ceba64c6de3bf}{glm\+\_\+vec4\+\_\+print}}(\mbox{\hyperlink{glad_8h_a10a82eabcb59d2fcd74acee063775f90}{v}},  \mbox{\hyperlink{glext_8h_a4af680a6c683f88ed67b76f207f2e6e4}{s}})~(\mbox{\hyperlink{glext_8h_a46df6112013cf583e82b25cebd5cb499}{void}})\mbox{\hyperlink{glad_8h_a10a82eabcb59d2fcd74acee063775f90}{v}}; (\mbox{\hyperlink{glext_8h_a46df6112013cf583e82b25cebd5cb499}{void}})\mbox{\hyperlink{glext_8h_a4af680a6c683f88ed67b76f207f2e6e4}{s}};
\item
\#define \mbox{\hyperlink{io_8h_aebc0e1e6be115d203205076baed429e2}{glm\+\_\+vec3\+\_\+print}}(\mbox{\hyperlink{glad_8h_a10a82eabcb59d2fcd74acee063775f90}{v}},  \mbox{\hyperlink{glext_8h_a4af680a6c683f88ed67b76f207f2e6e4}{s}})~(\mbox{\hyperlink{glext_8h_a46df6112013cf583e82b25cebd5cb499}{void}})\mbox{\hyperlink{glad_8h_a10a82eabcb59d2fcd74acee063775f90}{v}}; (\mbox{\hyperlink{glext_8h_a46df6112013cf583e82b25cebd5cb499}{void}})\mbox{\hyperlink{glext_8h_a4af680a6c683f88ed67b76f207f2e6e4}{s}};
\item
\#define \mbox{\hyperlink{io_8h_a02f73f1e92bb165b34bc44babcf45c88}{glm\+\_\+ivec3\+\_\+print}}(\mbox{\hyperlink{glad_8h_a10a82eabcb59d2fcd74acee063775f90}{v}},  \mbox{\hyperlink{glext_8h_a4af680a6c683f88ed67b76f207f2e6e4}{s}})~(\mbox{\hyperlink{glext_8h_a46df6112013cf583e82b25cebd5cb499}{void}})\mbox{\hyperlink{glad_8h_a10a82eabcb59d2fcd74acee063775f90}{v}}; (\mbox{\hyperlink{glext_8h_a46df6112013cf583e82b25cebd5cb499}{void}})\mbox{\hyperlink{glext_8h_a4af680a6c683f88ed67b76f207f2e6e4}{s}};
\item
\#define \mbox{\hyperlink{io_8h_aa2da704c08e1636f71970950aae5d494}{glm\+\_\+vec2\+\_\+print}}(\mbox{\hyperlink{glad_8h_a10a82eabcb59d2fcd74acee063775f90}{v}},  \mbox{\hyperlink{glext_8h_a4af680a6c683f88ed67b76f207f2e6e4}{s}})~(\mbox{\hyperlink{glext_8h_a46df6112013cf583e82b25cebd5cb499}{void}})\mbox{\hyperlink{glad_8h_a10a82eabcb59d2fcd74acee063775f90}{v}}; (\mbox{\hyperlink{glext_8h_a46df6112013cf583e82b25cebd5cb499}{void}})\mbox{\hyperlink{glext_8h_a4af680a6c683f88ed67b76f207f2e6e4}{s}};
\item
\#define \mbox{\hyperlink{io_8h_a4ed40debeb76ea8d09061cb8077feaf2}{glm\+\_\+versor\+\_\+print}}(\mbox{\hyperlink{glad_8h_a10a82eabcb59d2fcd74acee063775f90}{v}},  \mbox{\hyperlink{glext_8h_a4af680a6c683f88ed67b76f207f2e6e4}{s}})~(\mbox{\hyperlink{glext_8h_a46df6112013cf583e82b25cebd5cb499}{void}})\mbox{\hyperlink{glad_8h_a10a82eabcb59d2fcd74acee063775f90}{v}}; (\mbox{\hyperlink{glext_8h_a46df6112013cf583e82b25cebd5cb499}{void}})\mbox{\hyperlink{glext_8h_a4af680a6c683f88ed67b76f207f2e6e4}{s}};
\item
\#define \mbox{\hyperlink{io_8h_ae4363f1a96cc58e29834546f221938ac}{glm\+\_\+aabb\+\_\+print}}(\mbox{\hyperlink{glad_8h_a10a82eabcb59d2fcd74acee063775f90}{v}},  \mbox{\hyperlink{glext_8h_a7d65d00ca3b0630d9b5c52df855b19f5}{t}},  \mbox{\hyperlink{glext_8h_a4af680a6c683f88ed67b76f207f2e6e4}{s}})~(\mbox{\hyperlink{glext_8h_a46df6112013cf583e82b25cebd5cb499}{void}})\mbox{\hyperlink{glad_8h_a10a82eabcb59d2fcd74acee063775f90}{v}}; (\mbox{\hyperlink{glext_8h_a46df6112013cf583e82b25cebd5cb499}{void}})\mbox{\hyperlink{glext_8h_a7d65d00ca3b0630d9b5c52df855b19f5}{t}}; (\mbox{\hyperlink{glext_8h_a46df6112013cf583e82b25cebd5cb499}{void}})\mbox{\hyperlink{glext_8h_a4af680a6c683f88ed67b76f207f2e6e4}{s}};
\end{DoxyCompactItemize}

\doxysubsection{Macro Definition Documentation}
\mbox{\Hypertarget{io_8h_ae4363f1a96cc58e29834546f221938ac}\label{io_8h_ae4363f1a96cc58e29834546f221938ac}}
\index{io.h@{io.h}!glm\_aabb\_print@{glm\_aabb\_print}}
\index{glm\_aabb\_print@{glm\_aabb\_print}!io.h@{io.h}}
\doxysubsubsection{\texorpdfstring{glm\_aabb\_print}{glm\_aabb\_print}}
{\footnotesize\ttfamily \#define glm\+\_\+aabb\+\_\+print(\begin{DoxyParamCaption}\item[{}]{\mbox{\hyperlink{glad_8h_a10a82eabcb59d2fcd74acee063775f90}{v}},  }\item[{}]{\mbox{\hyperlink{glext_8h_a7d65d00ca3b0630d9b5c52df855b19f5}{t}},  }\item[{}]{\mbox{\hyperlink{glext_8h_a4af680a6c683f88ed67b76f207f2e6e4}{s}} }\end{DoxyParamCaption})~(\mbox{\hyperlink{glext_8h_a46df6112013cf583e82b25cebd5cb499}{void}})\mbox{\hyperlink{glad_8h_a10a82eabcb59d2fcd74acee063775f90}{v}}; (\mbox{\hyperlink{glext_8h_a46df6112013cf583e82b25cebd5cb499}{void}})\mbox{\hyperlink{glext_8h_a7d65d00ca3b0630d9b5c52df855b19f5}{t}}; (\mbox{\hyperlink{glext_8h_a46df6112013cf583e82b25cebd5cb499}{void}})\mbox{\hyperlink{glext_8h_a4af680a6c683f88ed67b76f207f2e6e4}{s}};}

Definition at line 341 of file io.\+h.

\mbox{\Hypertarget{io_8h_a02f73f1e92bb165b34bc44babcf45c88}\label{io_8h_a02f73f1e92bb165b34bc44babcf45c88}}
\index{io.h@{io.h}!glm\_ivec3\_print@{glm\_ivec3\_print}}
\index{glm\_ivec3\_print@{glm\_ivec3\_print}!io.h@{io.h}}
\doxysubsubsection{\texorpdfstring{glm\_ivec3\_print}{glm\_ivec3\_print}}
{\footnotesize\ttfamily \#define glm\+\_\+ivec3\+\_\+print(\begin{DoxyParamCaption}\item[{}]{\mbox{\hyperlink{glad_8h_a10a82eabcb59d2fcd74acee063775f90}{v}},  }\item[{}]{\mbox{\hyperlink{glext_8h_a4af680a6c683f88ed67b76f207f2e6e4}{s}} }\end{DoxyParamCaption})~(\mbox{\hyperlink{glext_8h_a46df6112013cf583e82b25cebd5cb499}{void}})\mbox{\hyperlink{glad_8h_a10a82eabcb59d2fcd74acee063775f90}{v}}; (\mbox{\hyperlink{glext_8h_a46df6112013cf583e82b25cebd5cb499}{void}})\mbox{\hyperlink{glext_8h_a4af680a6c683f88ed67b76f207f2e6e4}{s}};}

Definition at line 338 of file io.\+h.

\mbox{\Hypertarget{io_8h_a1a9ab2bcdda2e3e29b1bc53e64869baa}\label{io_8h_a1a9ab2bcdda2e3e29b1bc53e64869baa}}
\index{io.h@{io.h}!glm\_mat2\_print@{glm\_mat2\_print}}
\index{glm\_mat2\_print@{glm\_mat2\_print}!io.h@{io.h}}
\doxysubsubsection{\texorpdfstring{glm\_mat2\_print}{glm\_mat2\_print}}
{\footnotesize\ttfamily \#define glm\+\_\+mat2\+\_\+print(\begin{DoxyParamCaption}\item[{}]{\mbox{\hyperlink{glad_8h_a10a82eabcb59d2fcd74acee063775f90}{v}},  }\item[{}]{\mbox{\hyperlink{glext_8h_a4af680a6c683f88ed67b76f207f2e6e4}{s}} }\end{DoxyParamCaption})~(\mbox{\hyperlink{glext_8h_a46df6112013cf583e82b25cebd5cb499}{void}})\mbox{\hyperlink{glad_8h_a10a82eabcb59d2fcd74acee063775f90}{v}}; (\mbox{\hyperlink{glext_8h_a46df6112013cf583e82b25cebd5cb499}{void}})\mbox{\hyperlink{glext_8h_a4af680a6c683f88ed67b76f207f2e6e4}{s}};}

Definition at line 335 of file io.\+h.

\mbox{\Hypertarget{io_8h_a5cee3df04b86f581d19ccf47d1b54d13}\label{io_8h_a5cee3df04b86f581d19ccf47d1b54d13}}
\index{io.h@{io.h}!glm\_mat3\_print@{glm\_mat3\_print}}
\index{glm\_mat3\_print@{glm\_mat3\_print}!io.h@{io.h}}
\doxysubsubsection{\texorpdfstring{glm\_mat3\_print}{glm\_mat3\_print}}
{\footnotesize\ttfamily \#define glm\+\_\+mat3\+\_\+print(\begin{DoxyParamCaption}\item[{}]{\mbox{\hyperlink{glad_8h_a10a82eabcb59d2fcd74acee063775f90}{v}},  }\item[{}]{\mbox{\hyperlink{glext_8h_a4af680a6c683f88ed67b76f207f2e6e4}{s}} }\end{DoxyParamCaption})~(\mbox{\hyperlink{glext_8h_a46df6112013cf583e82b25cebd5cb499}{void}})\mbox{\hyperlink{glad_8h_a10a82eabcb59d2fcd74acee063775f90}{v}}; (\mbox{\hyperlink{glext_8h_a46df6112013cf583e82b25cebd5cb499}{void}})\mbox{\hyperlink{glext_8h_a4af680a6c683f88ed67b76f207f2e6e4}{s}};}

Definition at line 334 of file io.\+h.

\mbox{\Hypertarget{io_8h_a59d971e0fdd411d4d989f14b33b54c23}\label{io_8h_a59d971e0fdd411d4d989f14b33b54c23}}
\index{io.h@{io.h}!glm\_mat4\_print@{glm\_mat4\_print}}
\index{glm\_mat4\_print@{glm\_mat4\_print}!io.h@{io.h}}
\doxysubsubsection{\texorpdfstring{glm\_mat4\_print}{glm\_mat4\_print}}
{\footnotesize\ttfamily \#define glm\+\_\+mat4\+\_\+print(\begin{DoxyParamCaption}\item[{}]{\mbox{\hyperlink{glad_8h_a10a82eabcb59d2fcd74acee063775f90}{v}},  }\item[{}]{\mbox{\hyperlink{glext_8h_a4af680a6c683f88ed67b76f207f2e6e4}{s}} }\end{DoxyParamCaption})~(\mbox{\hyperlink{glext_8h_a46df6112013cf583e82b25cebd5cb499}{void}})\mbox{\hyperlink{glad_8h_a10a82eabcb59d2fcd74acee063775f90}{v}}; (\mbox{\hyperlink{glext_8h_a46df6112013cf583e82b25cebd5cb499}{void}})\mbox{\hyperlink{glext_8h_a4af680a6c683f88ed67b76f207f2e6e4}{s}};}

Definition at line 333 of file io.\+h.

\mbox{\Hypertarget{io_8h_aa2da704c08e1636f71970950aae5d494}\label{io_8h_aa2da704c08e1636f71970950aae5d494}}
\index{io.h@{io.h}!glm\_vec2\_print@{glm\_vec2\_print}}
\index{glm\_vec2\_print@{glm\_vec2\_print}!io.h@{io.h}}
\doxysubsubsection{\texorpdfstring{glm\_vec2\_print}{glm\_vec2\_print}}
{\footnotesize\ttfamily \#define glm\+\_\+vec2\+\_\+print(\begin{DoxyParamCaption}\item[{}]{\mbox{\hyperlink{glad_8h_a10a82eabcb59d2fcd74acee063775f90}{v}},  }\item[{}]{\mbox{\hyperlink{glext_8h_a4af680a6c683f88ed67b76f207f2e6e4}{s}} }\end{DoxyParamCaption})~(\mbox{\hyperlink{glext_8h_a46df6112013cf583e82b25cebd5cb499}{void}})\mbox{\hyperlink{glad_8h_a10a82eabcb59d2fcd74acee063775f90}{v}}; (\mbox{\hyperlink{glext_8h_a46df6112013cf583e82b25cebd5cb499}{void}})\mbox{\hyperlink{glext_8h_a4af680a6c683f88ed67b76f207f2e6e4}{s}};}

Definition at line 339 of file io.\+h.

\mbox{\Hypertarget{io_8h_aebc0e1e6be115d203205076baed429e2}\label{io_8h_aebc0e1e6be115d203205076baed429e2}}
\index{io.h@{io.h}!glm\_vec3\_print@{glm\_vec3\_print}}
\index{glm\_vec3\_print@{glm\_vec3\_print}!io.h@{io.h}}
\doxysubsubsection{\texorpdfstring{glm\_vec3\_print}{glm\_vec3\_print}}
{\footnotesize\ttfamily \#define glm\+\_\+vec3\+\_\+print(\begin{DoxyParamCaption}\item[{}]{\mbox{\hyperlink{glad_8h_a10a82eabcb59d2fcd74acee063775f90}{v}},  }\item[{}]{\mbox{\hyperlink{glext_8h_a4af680a6c683f88ed67b76f207f2e6e4}{s}} }\end{DoxyParamCaption})~(\mbox{\hyperlink{glext_8h_a46df6112013cf583e82b25cebd5cb499}{void}})\mbox{\hyperlink{glad_8h_a10a82eabcb59d2fcd74acee063775f90}{v}}; (\mbox{\hyperlink{glext_8h_a46df6112013cf583e82b25cebd5cb499}{void}})\mbox{\hyperlink{glext_8h_a4af680a6c683f88ed67b76f207f2e6e4}{s}};}

Definition at line 337 of file io.\+h.

\mbox{\Hypertarget{io_8h_ae4745f62c591d2e8068ceba64c6de3bf}\label{io_8h_ae4745f62c591d2e8068ceba64c6de3bf}}
\index{io.h@{io.h}!glm\_vec4\_print@{glm\_vec4\_print}}
\index{glm\_vec4\_print@{glm\_vec4\_print}!io.h@{io.h}}
\doxysubsubsection{\texorpdfstring{glm\_vec4\_print}{glm\_vec4\_print}}
{\footnotesize\ttfamily \#define glm\+\_\+vec4\+\_\+print(\begin{DoxyParamCaption}\item[{}]{\mbox{\hyperlink{glad_8h_a10a82eabcb59d2fcd74acee063775f90}{v}},  }\item[{}]{\mbox{\hyperlink{glext_8h_a4af680a6c683f88ed67b76f207f2e6e4}{s}} }\end{DoxyParamCaption})~(\mbox{\hyperlink{glext_8h_a46df6112013cf583e82b25cebd5cb499}{void}})\mbox{\hyperlink{glad_8h_a10a82eabcb59d2fcd74acee063775f90}{v}}; (\mbox{\hyperlink{glext_8h_a46df6112013cf583e82b25cebd5cb499}{void}})\mbox{\hyperlink{glext_8h_a4af680a6c683f88ed67b76f207f2e6e4}{s}};}

Definition at line 336 of file io.\+h.

\mbox{\Hypertarget{io_8h_a4ed40debeb76ea8d09061cb8077feaf2}\label{io_8h_a4ed40debeb76ea8d09061cb8077feaf2}}
\index{io.h@{io.h}!glm\_versor\_print@{glm\_versor\_print}}
\index{glm\_versor\_print@{glm\_versor\_print}!io.h@{io.h}}
\doxysubsubsection{\texorpdfstring{glm\_versor\_print}{glm\_versor\_print}}
{\footnotesize\ttfamily \#define glm\+\_\+versor\+\_\+print(\begin{DoxyParamCaption}\item[{}]{\mbox{\hyperlink{glad_8h_a10a82eabcb59d2fcd74acee063775f90}{v}},  }\item[{}]{\mbox{\hyperlink{glext_8h_a4af680a6c683f88ed67b76f207f2e6e4}{s}} }\end{DoxyParamCaption})~(\mbox{\hyperlink{glext_8h_a46df6112013cf583e82b25cebd5cb499}{void}})\mbox{\hyperlink{glad_8h_a10a82eabcb59d2fcd74acee063775f90}{v}}; (\mbox{\hyperlink{glext_8h_a46df6112013cf583e82b25cebd5cb499}{void}})\mbox{\hyperlink{glext_8h_a4af680a6c683f88ed67b76f207f2e6e4}{s}};}

Definition at line 340 of file io.\+h.


text:
\begin{table}[h!]
\begin{center}
\begin{tabular}{| l || c | c | c | c |}\hline
 & {\bf g.} & {\bf p.} & {\bf i.} & {\bf h.} \\\hline\hline
NOUN & 24.67  & 25.52  & 24.76  & 24.62 \\
X & 0.18  & 0.04  & 0.10  & 0.20 \\\hline
ADP & 11.87  & 12.77  & 13.00  & 11.55 \\
DET & 12.57  & 12.44  & 12.31  & 12.64 \\\hline
VERB & 22.90  & 22.27  & 22.36  & 23.06 \\\hline
ADJ & 5.88  & 5.75  & 5.91  & 5.88 \\
ADV & 7.50  & 6.93  & 6.68  & 7.72 \\\hline
PRT & 3.96  & 3.69  & 4.25  & 3.90 \\
PRON & 6.94  & 7.00  & 7.10  & 6.90 \\
NUM & 0.71  & 0.68  & 0.69  & 0.71 \\
CONJ & 2.81  & 2.90  & 2.84  & 2.81 \\
PUNC & 0.00  & 0.00  & 0.00  & 0.00 \\\hline
\end{tabular}
\caption{POS tags in each Erd\"os sector ({{\bf p.}} for periphery, {{\bf i.}} for intermediary, {{\bf h.}} for hubs).
    Universal POS tags~\cite{{petrov}}:
    VERB - verbs (all tenses and modes);
    NOUN - nouns (common and proper);
    PRON - pronouns;
    ADJ - adjectives;
    ADV - adverbs;
    ADP - adpositions (prepositions and postpositions);
    CONJ - conjunctions;
    DET - determiners;
    NUM - cardinal numbers;
    PRT - particles or other function words;
    X - other: foreign words, typos, abbreviations;
    PUNCT - punctuation.
 TAG: 5}
\end{center}
\end{table}


text:
${\bf f_{23}}$ & \multicolumn{2}{@{}c@{}}{3.0 \quad} & \multicolumn{2}{@{}c@{}}{915 \quad} & \multicolumn{2}{@{}c@{}}{16425 \quad} & \multicolumn{2}{@{}c@{}}{1.8e5 \quad} & \multicolumn{2}{@{}c@{}}{2.0e5 \quad} & \multicolumn{2}{@{}c@{}}{2.1e5 \quad} & \multicolumn{2}{@{}c|@{}}{2.1e5} & 15 & /15\\
 & 2 & .0(1) & \multicolumn{2}{@{}c@{}}{$\infty$} & \multicolumn{2}{@{}c@{}}{$\infty$} & \multicolumn{2}{@{}c@{}}{$\infty$} & \multicolumn{2}{@{}c@{}}{$\infty$} & \multicolumn{2}{@{}c@{}}{$\infty$} & \multicolumn{2}{@{}c|@{}}{$\infty$\textit{1050}} & 0 & /15\\


text:
%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Template File
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\documentclass{/opt/class}

$if(siret)$
  \lfoot{
    \color{gray}
    \footnotesize
    $author$$for(from)$, $from$$endfor$\\
    Siret : $siret$
  }
$endif$

%--------------------------------
% PDF SETUP
%--------------------------------
\hypersetup
{
  pdfauthor={$author$},
  pdfsubject=$subtitle$,
  pdftitle=$title$$if(id)$ n° $id$$endif$,
  linkcolor=blue,
  citecolor=blue,
  filecolor=black,
  urlcolor=blue
}

%--------------------------------
% DOCUMENT
%--------------------------------
\begin{document}

$if(siret)$
  \logo
$endif$

\begin{multicols}{2}
  $if(siret)$
    {\small \textsc{éxecutant}}\\
  $endif$
  \textbf{$author$}\\
  $for(from)$
  $from$\\
  $endfor$
  $if(siret)$
    {\footnotesize Siret : $siret$}
  $endif$

  \begin{flushright}
    $if(siret)$
      {\small \textsc{commanditaire}}\\
    $endif$
    $to$
  \end{flushright}
\end{multicols}

$if(opening)$
  \begin{flushright}
    $city$, le \textbf{$if(date)$$date$$else$\today{}$endif$}\hspace*{72pt}
  \end{flushright}
  \vspace{2em}

  \textbf{Objet :} $subtitle$
  \vspace{2em}

  \setlength{\parindent}{24pt}
  $opening$
  \setlength{\parindent}{0pt}
  \vspace{1em}
$else$
  \hr

  Projet \textbf{$subtitle$}\\
  $title$ n° \textbf{$id$} du \textbf{\today{}} à $city$

  \hr
$endif$

$body$

$if(service)$
  \hr
  \STautoround*{2}
  \STsetdecimalsep{,}
  \renewcommand\STprintnum[1]{\numprint{#1}}

  \begin{flushright}
    \begin{spreadtab}{{tabular}[t t t t]{lp{0.6\linewidth}rl}}
      \hdashline[1pt/1pt]
      @ & @ \textbf{Désignation} & @ \textbf{Prix HT} \\ \hline
      $for(service)$
        @ & @ $service.description$ $if(service.details)$
            \newline \scriptsize $service.details$ \normalsize
          $endif$ & $service.price$ & @ \euro \\
      $endfor$
      \noalign{\vskip 2mm} \hline
      $if(vat)$
        @ & @ \multicolumn{1}{r}{Subtotal}         & :={sum(c1:[0,-1])} & @ \euro \\ \hhline{~~--}
        @ & @ \multicolumn{1}{r}{VAT $vat$\%}      & $vat$/100*[0,-1] & @ \euro \\ \hhline{~~--}
      $endif$
      $if(acompte)$
        @ & @ \multicolumn{1}{r}{Acompte}          & $acompte$ & @ \euro \\ \hhline{~~--}
      $endif$
      @ & @ \multicolumn{1}{r}{\textbf{Total}}   & \textbf{:={$if(vat)$[0,-1]+[0,-2]$else$sum(c1:[0,-1])$endif$}} & @ \euro \\ \hhline{~~--}
    \end{spreadtab}

    \footnotesize TVA non applicable, art. 293B du CGI
  \end{flushright}
$endif$

$if(opening)$
  $closingnote$

  \vspace{1em}

  \begin{flushright}
    $author$\hspace*{72pt}
  \end{flushright}
$else$
  \small
  $closingnote$
  \normalsize
$endif$

$if(payment)$
  \hr
  $for(payment)$
    \begin{multicols}{2}
      [
        Paiement par \textbf{$payment.type$}
      ]
      $for(payment.data)$
        \textbf{$payment.data.name$} $payment.data.value$\\
      $endfor$
    \end{multicols}
  $endfor$
$endif$

\end{document}


text:
\begin{details}
    \name{Stephen Belcher}
    % include some dynamically-generated data too.
    \immediate\write18{./output-details.bash}\input{outputs/details.tex}
    \email{sbelcher+jobs}{gmail}
    \repo{https://github.com/sycobuny/resume}
\end{details}

\begin{objective}
    To obtain positions which would enable continued learning, sharing of new
    knowledge, and growth in the technical community, as well as facilitate
    the development of new software and technologies.
\end{objective}

\begin{skills}
    \begin{category}{Computer Languages}
        \skill{%
            TypeScript, JavaScript, and Angular, for building single-page
            applications as well as complex database- and API-driven systems
        }
        \skill{%
            Ruby, including extensive experience with Ruby on Rails,
            Sinatra/Padrino, and wxRuby
        }
        \skill{%
            Perl, including modern web frameworks like Mojolicious, database
            connection with DBI and internal functions in PL/Perl in
            PostgreSQL, familiarity with complex regular expressions, and
            GUI development using the Perl/Tk and wxPerl frameworks
        }
        \skill{%
            Various reporting languages/technologies, such as \LaTeX\ and
            XML-based XLST/XSL-FO dialects
        }
        \skill{%
            PHP, including developing abstract database model systems and
            simplified testing frameworks for producing readable, reliable and
            maintanable code
        }
        \skill{%
            Visual Basic, particularly regarding automated forms in Microsoft
            Office applications
        }
        \skill{%
            Puppet, Java, C/C++, HTML/HAML, CSS/Sass, Vimscript, and Markdown
        }
    \end{category}

    \begin{category}{Database and System Administration}
        \skill{%
            Administration of both Linux and FreeBSD server environments,
            including scheduling tasks with cron, setting up web server and
            database server daemon processes, and management of software
            packages and utilities
        }
        \skill{%
            Setting up and managing systems using Puppet, including developing
            custom modules, types, providers, and functions in native Ruby
        }
        \skill{%
            Administration and upgrades for local GitLab instances for private
            collaborative coding
        }
        \skill{%
            PostgreSQL administration experience, including designing custom
            datatypes, functions, triggers, views, and server tuning and
            creation of automatic management and monitoring scripts
        }
        \skill{%
            Experience designing and implementing databases in MySQL and
            SQLite
        }
        \skill{%
            Familiarity with accessing and working with multiple legacy
            systems, including Microsoft Access and FoxPro
        }
    \end{category}

    \begin{category}{Other}
        \skill{%
            Frequent technical speaker at technical meetings and conferences,
            with clear and concise talks on various topics
        }
        \skill{%
            Host of the Baltimore Vim user group, holding monthly meetings
            with regular talks by local professionals
        }
        \skill{%
            Volunteer organizer for the DC/Baltimore Perl Workshop 2014--2016
        }
        \skill{%
            Volunteer organizer and SOC Chair for the 2017 Perl Conference in
            Alexandria, VA
        }
    \end{category}
\end{skills}

\begin{jobs}
    \begin{job}{Programmer}{Kelly Services, Inc.}
        \duration{December 2011}{Present}
        \accomplishments{%
            Responsible for maintaining large-scale existing web applications
            using various languages, such as Ruby, Python, PHP and Perl, and
            database engines, such as PostgreSQL and MySQL\@. This includes
            fixing bugs, patching security holes, as well as adding new
            feature requests from users.

            Designed multiple new websites from the ground up, including
            meeting with stakeholders to assess requirements, create work
            estimates, and develop using modern practices to ensure ease of
            future maintenance.

            Fostered a culture of good practices, including use of revision
            control for projects and development of open-souce tools to
            increase re-usability of software. Also encouraged strong
            foundational security standards to guarantee applications are
            written more securely from the outset, ensuring greater stability
            overall.

            Maintained systems using Puppet with custom-written modules,
            types, and classes, and managed GitLab along with GitLab-CI for
            more productive development.
        }
    \end{job}

    \begin{job}{Database Consultant}{EBL Engineers, LLC}
        \duration{December 2011}{Present}
        \accomplishments{
            Maintenance of existing database and application infrastructure
            for continued use, including security updates and maintaining
            backup scripts.
        }
    \end{job}

    \begin{job}{Database Manager}{EBL Engineers, LLC}
        \duration{June 2005}{December 2011}
        \accomplishments{%
            Work included creating applications for use in maintaining
            hospital accreditation according to continually-updated standards
            from The Joint Commission in service of the Clinical Research
            Center of the National Institutes of Health.

            Designed a database to represent a hospital facility, its
            operations and staff, including ongoing construction projects,
            equipment, and periodic maintenance. The database includes the
            ability to monitor the facility's temporal evolution through time,
            taking into account modification of physical space over time
            through construction projects.

            Designed and implemented various interfaces to the database,
            according to the evolving needs of the organization. These include
            server APIs, web interfaces, cross-platform GUI controls, and
            automatic reporting to CSV, PDF, and other formats.

            Hired and managed a system administrator/programmer to decrease
            time to develop deliverables and enhance the quality of finished
            work.  Worked with the system administrator in developing a set of
            security controls for government standards compliance.
        }
    \end{job}
\end{jobs}

\begin{education}
    \begin{degree}{Bachelor of Music}{Peabody Conservatory}
        \received{May 2005}
        \achievement{%
            Studied computer science at parent university Johns Hopkins,
            including coursework on programming, data structures, and
            CPU/Assembler fundamentals
        }
        \achievement{Dean's List}
    \end{degree}

    \begin{degree}{High School Diploma}{Baltimore School for the Arts}
        \received{May 2002}
        \achievement{%
            Member of the Daniel Ramos Chapter of the National Honor Society
        }
    \end{degree}
\end{education}


text:
% language=uk

\usemodule[fnt-23]
\usemodule[fnt-25]

\startcomponent mk-math

\environment mk-environment

\chapter{Unicode math}

{\em I assume that the reader is somewhat familiar with math in
\TEX. Although in \CONTEXT\ we try to support the concepts and
symbols used in the \TEX\ community we have our own way of
implementing math. The fact that \CONTEXT\ is not used extensively
for conventional math journals permits us to rigourously
re|-|implement mechanisms. Of course the user interfaces mostly
remain the same.}

\subject{introduction}

The \LUATEX\ project entered a new stage when end of 2008 and
beginning of 2009 math got opened up. Although \TEX\ can handle
math pretty good we had a few wishes that we hoped to fulfill in
the process. That \TEX's math machinery is a rather independent
subsystem is reflected in the fact that after parsing there is an
intermediate list of so called noads (math elements), which then
gets converted into a node list (glyphs, kerns, penalties, glue and
more). This conversion can be intercepted by a callback and a
macro package can do whatever it likes with the list of noads as
long as it returns a proper list.

Of course \CONTEXT\ does support math and that is visible in its
code base:

\startitemize

\item Due to the fact that we need to be able to switch to
alternative styles the font system is quite complex and in
\CONTEXT\ \MKII\ math font definitions (and changes) are good for
50\% of the time involved. In \MKIV\ we can use a more efficient
model.

\item Because some usage of \CONTEXT\ demands the mix of several
completely different encoded math fonts there is a dedicated math
encoding subsystem in \MKII. In \MKIV\ we will use \UNICODE\
exclusively.

\item Some constructs (and symbols) are implemented in a way that
we find suboptimal. In the perspective of \UNICODE\ in \MKIV\ we
aim at all symbols being real characters. This is possible because
all important constructs (like roots, accents and delimiters) are
supported by the engine.

\item In order to fit vertical spacing around math (think for
instance of typesetting on a grid) in \MKII\ we have ended up with
rather messy and suboptimal code. \footnote {This is because
spacing before and after formulas has to cooperate with spacing of
structural components that surround it.} The expectation is that
we can improve that.

\stopitemize

In the following sections I will discuss a few of the
implementation details of the font related issues in \MKIV. Of
course a few years from now the actual solutions we implemented
might look different but the principles remain the same. Also, as
with other components of \LUATEX\ Taco and I worked in parallel on
the code and its usage, which made both our tasks easier.

\subject{transition}

In \TEX, math typesetting uses a special concept called families.
Each math component (number, letter, symbol, etc) is member of a
family. Because we have three sizes (text, script and
scriptscript) this results in a family||size matrix of defined
fonts. Because the number of glyphs in a font was limited to 256,
in practice it meant that we had quite some font definitions. The
minimum number of families was~4 (roman, italic, symbol, and
extension) but in practice several more could be active (sans,
bold, mono|-|spaced, more symbols, etc.) for specific alphabets or
extra symbols (for instance \AMS\ set A and B). The total number
of families in traditional \TEX\ is limited to 16, and one easily
hits this maximum. In that case, some 16 times 3 fonts are defined
for one size of which in practice only a few are really used in the
typesetting.

A potential source of confusion is bold math. Bold in math can
either mean having some bold letters, or having the whole formula
in bold. In practice this means that for a complete bold formula
one has to define the whole lot using bold fonts. A complication
is that the math symbols (etc) are kind of bound to families and
so we end up with either redefining symbols, or reusing the
families (which is easier and faster). In any case there is a
performance issue involved due to the rather massive switch from
normal to bold.

In \UNICODE\ all alphabets that make sense as well as all math
symbols are part of the definition although unfortunately some
alphabets have their letters spread over the \UNICODE\ vector and
not in a range (like blackboard). This forces all applications
that want to support math to implement similar hacks to deal with
it.

In \MKIV\ we will assume that we have \UNICODE\ aware math fonts,
like \OPENTYPE. The font that sets the standard is Microsoft
Cambria. The upcoming (I'm writing this in January 2009) \TEX Gyre
fonts will be compliant to this standard but they're not yet there
and so we have a problem. The way out is to define virtual fonts
and now that \LUATEX\ math is extended to cover all of \UNICODE\
as well as provides access to the (intermediate) math lists this
has become feasible. This also permits us to test \LUATEX\
with both Cambria and Latin Modern Virtual Math.

The advantage is that we can stick to just one family for all
shapes which simplifies the underlying \TEX\ code enormously.
First of all we need to define way less fonts (which is partially
compensated by loading them as part of the virtual font) and all
math aspects can now be dealt with using the character data
tables.

One tricky aspect of the new approach is that the Latin Modern
fonts have design sizes, so we have to define several virtual
fonts. On the other hand, fonts like Cambria have alternative
script and scriptscript shapes which is controlled by the \type
{ssty} feature, a gsub alternate that provides some alternative
sizes for a couple of hundred characters that matter.

\starttabulate[|l|l|l|]
\NC text         \NC \type {lmmi12 at 12pt} \NC \type {cambria at 12pt with ssty=no} \NC \NR
\NC script       \NC \type {lmmi8  at  8pt} \NC \type {cambria at  8pt with ssty=1}  \NC \NR
\NC scriptscript \NC \type {lmmi6  at  6pt} \NC \type {cambria at  6pt with ssty=2}  \NC \NR
\stoptabulate

So Cambria not so much has design sizes but shapes optimized
relative to the text variant: in the following example we see text
in red, script in green and scriptscript in blue.

\startbuffer
\definefontfeature[math][analyze=false,script=math,language=dflt]

\definefontfeature[text]        [math][ssty=no]
\definefontfeature[script]      [math][ssty=1]
\definefontfeature[scriptscript][math][ssty=2]
\stopbuffer

\typebuffer \getbuffer

Let us first look at Cambria:

\startbuffer
\startoverlay
    {\definedfont[name:cambriamath*scriptscript at 150pt]\mkblue  X}
    {\definedfont[name:cambriamath*script       at 150pt]\mkgreen X}
    {\definedfont[name:cambriamath*text         at 150pt]\mkred   X}
\stopoverlay
\stopbuffer

\typebuffer \startlinecorrection \getbuffer \stoplinecorrection

When we compare them scaled down as happens in real script and
scriptscript we get:

\startbuffer
\startoverlay
    {\definedfont[name:cambriamath*scriptscript at 120pt]\mkblue  X}
    {\definedfont[name:cambriamath*script       at  80pt]\mkgreen X}
    {\definedfont[name:cambriamath*text         at  60pt]\mkred   X}
\stopoverlay
\stopbuffer

\typebuffer \startlinecorrection \getbuffer \stoplinecorrection

Next we see (scaled) Latin Modern:

\startbuffer
\startoverlay
    {\definedfont[LMRoman8-Regular  at 150pt]\mkblue  X}
    {\definedfont[LMRoman10-Regular at 150pt]\mkgreen X}
    {\definedfont[LMRoman12-Regular at 150pt]\mkred   X}
\stopoverlay
\stopbuffer

\typebuffer \startlinecorrection \getbuffer \stoplinecorrection

In practice we will see:

\startbuffer
\startoverlay
    {\definedfont[LMRoman8-Regular  at 120pt]\mkblue  X}
    {\definedfont[LMRoman10-Regular at  80pt]\mkgreen X}
    {\definedfont[LMRoman12-Regular at  60pt]\mkred   X}
\stopoverlay
\stopbuffer

\typebuffer \startlinecorrection \getbuffer \stoplinecorrection

Both methods probably work out well although you need to keep in
mind that the \OPENTYPE\ \type {ssty} feature is not so much a
design size related feature.

An \OPENTYPE\ font can have a specification for the script and
scriptscript size. By default we listen to this specification instead
of the one imposed by the bodyfont environment. When you turn on
tracing

\starttyping
\enabletrackers[otf.math]
\stoptyping

you will get messages like:

\starttyping
asked scriptscript size: 458752, used: 471859.2 (102.86 %)
asked script size: 589824, used: 574095.36 (97.33 %)
\stoptyping

The differences between the defaults and the font recommendations
are not that large so by default we listen to the font specification.

\usetypescript[cambria] \start \setupbodyfont[cambria] \stop

\definefontfeature[math-script]      [math-script]      [mathsize=no]
\definefontfeature[math-scriptscript][math-scriptscript][mathsize=no]

\definetypeface [cambria-ns] [rm] [serif] [cambria] [default]
\definetypeface [cambria-ns] [tt] [mono]  [modern]  [default]
\definetypeface [cambria-ns] [mm] [math]  [cambria] [default]

\usetypescript[cambria-ns] \start \setupbodyfont[cambria-ns] \stop

\startlinecorrection
\scale
  [width=\textwidth]
  {\backgroundline
     [darkgray]
     {\startoverlay
       {\white\switchtobodyfont   [cambria]$\sum_{i=0}^n$}
       {\mkred\switchtobodyfont[cambria-ns]$\sum_{i=0}^n$}
     \stopoverlay
     \startoverlay
       {\white\switchtobodyfont   [cambria]$\int_{i=0}^n$}
       {\mkred\switchtobodyfont[cambria-ns]$\int_{i=0}^n$}
     \stopoverlay
     \startoverlay
       {\white\switchtobodyfont   [cambria]$\log_{i=0}^n$}
       {\mkred\switchtobodyfont[cambria-ns]$\log_{i=0}^n$}
     \stopoverlay
     \startoverlay
       {\white\switchtobodyfont   [cambria]$\cos_{i=0}^n$}
       {\mkred\switchtobodyfont[cambria-ns]$\cos_{i=0}^n$}
     \stopoverlay
     \startoverlay
       {\white\switchtobodyfont   [cambria]$\prod_{i=0}^n$}
       {\mkred\switchtobodyfont[cambria-ns]$\prod_{i=0}^n$}
     \stopoverlay}}
\stoplinecorrection

\definefontfeature[math-script]      [math-script]      [mathsize=yes]
\definefontfeature[math-scriptscript][math-scriptscript][mathsize=yes]

In this overlay the white text is scaled according to the
specification in the font, while the red text is scaled according
to the bodyfont environment (12/7/5 points).

\subject{going virtual}

The number of math fonts (used) in the \TEX\ community is
relatively small and of those only Latin Modern (which builds upon
Computer Modern) has design sizes. This means that the amount of
\UNICODE\ compliant virtual math fonts that we have to make is not
that large. We could have used an already present virtual
composition mechanism but instead we made a handy helper function
that does a more efficient job. This means that a definition looks
(a bit simplified) as follows:

\starttyping
mathematics.make_font ( "lmroman10-math", {
  { name="lmroman10-regular", features="virtualmath", main=true },
  { name="lmmi10", vector="tex-mi", skewchar=0x7F },
  { name="lmsy10", vector="tex-sy", skewchar=0x30, parameters=true } ,
  { name="lmex10", vector="tex-ex", extension=true } ,
  { name="msam10", vector="tex-ma" },
  { name="msbm10", vector="tex-mb" },
  { name="lmroman10-bold", "tex-bf" } ,
  { name="lmmib10", vector="tex-bi", skewchar=0x7F } ,
  { name="lmsans10-regular", vector="tex-ss", optional=true },
  { name="lmmono10-regular", vector="tex-tt", optional=true },
} )
\stoptyping

For the \TEX Gyre Pagella it looks this way:

\starttyping
mathematics.make_font ( "px-math", {
  { name="texgyrepagella-regular", features="virtualmath", main=true },
  { name="pxr", vector="tex-mr" } ,
  { name="pxmi", vector="tex-mi", skewchar=0x7F },
  { name="pxsy", vector="tex-sy", skewchar=0x30, parameters=true } ,
  { name="pxex", vector="tex-ex", extension=true } ,
  { name="pxsya", vector="tex-ma" },
  { name="pxsyb", vector="tex-mb" },
} )
\stoptyping

As you can see, it is possible to add alphabets, given that there is
a suitable vector that maps glyph indices onto \UNICODE s. It is good
to know that this function only defines the way such a font is
constructed. The actual construction is delayed till the font is
needed.

Such a virtual font is used in typescripts (the building blocks of
typeface definitions in \CONTEXT) as follows:

\starttyping
\starttypescript [math] [palatino] [name]
  \definefontsynonym [MathRoman] [pxmath@px-math]
  \loadmapfile[original-youngryu-px.map]
\stoptypescript
\stoptyping

If you're familiar with the way fonts are defined in \CONTEXT, you will
notice that we no longer need to define MathItalic, MathSymbol and
additional symbol fonts. Of course users don't have to deal with
these issues themselves. The \type {@} triggers the virtual
font builder.

You can imagine that in \MKII\ switching to another font style or size
involves initializing (or at least checking) involves some 30 to 40
font definitions when it comes to math (the number of used
families times 3, the number o fmath sizes.). And even if we take
into account that fonts are loaded only once, this checking and
enabling takes time. Keep in mind that in \CONTEXT\ we can have
several math font sets active in one document which comes at a
price.

In \MKIV\ we use one family (at three sizes). Of course we need to
load the font (and more than one in the case of virtual variants)
but when switching bodyfont sizes we only need to enable one
(already defined) math font. And that really saves time. This is
one of the areas where we gain back time that we loose elsewhere
by extending core functionality using \LUA\ (like \OPENTYPE\
support).

\subject{dimensions}

By setting font related dimensions you can control the way \TEX\
positions math elements relative to each other. Math fonts have a
few more dimensions than regular text fonts. But \OPENTYPE\ math
fonts like Cambria have quite some more. There is a nice booklet
published by Microsoft, \quote {Mathematical Typesetting}, where
dealing with math is discussed in the perspective of their word
processor and \TEX. In the booklet some of the parameters are
discussed and since many of them are rather special it makes no
sense (yet) to elaborate on them here. \footnote {Googling on
\quote {Ulrich Vieth}, \quote {TeX} and \quote {conferences} might
give you some hits on articles on these matters.} Figuring out
their meaning was quite a challenge.

I am the first to admit that the current code in \MKIV\ that deals
with math parameters is somewhat messy. There are several reasons
for this:

\startitemize[packed]
\item We can pass parameters as \type {MathConstants} table in the
      \TFM\ table that we pass to the core engine.
\item We can use some named parameters, like \type {x_height} and
      pass those in the \type {parameters} table.
\item We can use the traditional font dimension numbers in the
      \type {parameters} table, but since they overlap for symbol and
      extensible fonts, that is asking for troubles.
\stopitemize

Because in \MKIV\ we create virtual fonts at run|-|time and use just
one family, we fill the \type {MathConstants} table for
traditional fonts as well. Future versions may use the upcoming
mechanisms of font parameter sets at the macro level. These can be
defined for each of the sizes (display, text, script and
scriptscript, and the last three in cramped form as well) but
since a font only carries one set, we currently use a compromise.

\subject{tracing}

One of the nice aspects of the opened up math machinery is that it
permits us to get a more detailed look at what happens. It also
fits nicely in the way we always want to visualize things in
\CONTEXT\ using color, although most users are probably unaware of
many such features because they don't need them as I do.

\startbuffer
\enabletrackers[math.analyzing]
\ruledhbox{$a = \sqrt{b^2 + \sin{c} - {1 \over \gamma}}$}
\disabletrackers[math.analyzing]
\stopbuffer

\typebuffer \startbaselinecorrection \getbuffer \stopbaselinecorrection

This tracker option colors characters depending on their nature and the
fact that they are remapped. The tracker also was handy during development
of \LUATEX\ especially for checking if attributes migrated right in
constructed symbols.

For over a year I had been using a partial \UNICODE\ math
implementation in some projects but for serious math the vectors
needed to be completed. In order to help the \quote {math
department} of the \CONTEXT\ development team (Aditya Mahajan,
Mojca Miklavec, Taco Hoekwater and myself) we have some extra
tracing options, like

\startbuffer
\showmathfontcharacters[list=0x0007B]
\stopbuffer

\typebuffer

\start \blank \getbuffer \blank \stop

The simple variant with no arguments would have extended this
document with many pages of such descriptions.

Another handy command (defined in module \type{fnt-25}) is the following:

\starttyping
\ShowCompleteFont{name:cambria}{9pt}{1}
\ShowCompleteFont{dummy@lmroman10-math}{10pt}{1}
\stoptyping

This will for instance for Cambria generate between 50 and 100
pages of character tables.

\startbuffer[mathtest]
$abc \bf abc \bi abc$
$\mathscript abcdefghijklmnopqrstuvwxyz %
  1234567890 ABCDEFGHIJKLMNOPQRSTUVWXYZ$
$\mathfraktur abcdefghijklmnopqrstuvwxyz %
  1234567890 ABCDEFGHIJKLMNOPQRSTUVWXYZ$
$\mathblackboard abcdefghijklmnopqrstuvwxyz %
  1234567890 ABCDEFGHIJKLMNOPQRSTUVWXYZ$
$\mathscript abc IRZ \mathfraktur abc IRZ %
  \mathblackboard abc IRZ \ss abc IRZ 123$
\stopbuffer

If you look at the following samples you can imagine how coloring
the characters and replacements helped figuring out the alphabets
We use the following input (stored in a buffer):

\typebuffer [mathtest]

For testing Cambria we say:

\starttyping
\usetypescript[cambria]
\switchtobodyfont[cambria,11pt]
\enabletrackers[math.analyzing]
\getbuffer[mathtest] % the input shown before
\disabletrackers[math.analyzing]
\stoptyping

And we get:

\usetypescript[cambria] % global

\startlines
\switchtobodyfont[cambria,10pt]
\enabletrackers[math.analyzing]
\getbuffer[mathtest] % the input shown before
\disabletrackers[math.analyzing]
\stoplines

For the virtualized Latin Modern we say:

\starttyping
\usetypescript[modern]
\switchtobodyfont[modern,11pt]
\enabletrackers[math.analyzing]
\getbuffer[mathtest] % the input shown before
\disabletrackers[math.analyzing]
\stoptyping

This gives:

\usetypescript[modern] % global

\startlines
\switchtobodyfont[modern,11pt]
\enabletrackers[math.analyzing]
\getbuffer[mathtest]
\disabletrackers[math.analyzing]
\stoplines

These two samples demonstrate that Cambria has a rather complete
repertoire of shapes which is no surprise because it is a recent
font that also serves as a showcase for \UNICODE\ and \OPENTYPE\
driven math.

Commands like \type {\mathscript} sets an attribute. When we post|-|process
the noad list and encounter this attribute, we remap the characters to
the desired variant. Of course this happens selectively. So, a capital~A
(\type {0x0041}) becomes a capital script~A (\type {0x1D49C}). Of course
this solution is rather \CONTEXT\ specific and there are other ways to
achieve the same goal (like using more families and switching family).

\subject{special cases}

Because we now are operating in the \UNICODE\ domain, we run into
problems if we keep defining some of the math symbols in the
traditional \TEX\ way. Even with the \AMS\ fonts available we
still end up with some characters that are represented by
combining others. Take for instance $\neq$ which is composed of
two characters. Because in \MKIV\ we want to have all
characters in their pure form we use a virtual replacement for
them. In \MKIV\ speak it looks like this:

\starttyping
local function negate(main,unicode,basecode)
    local characters = main.characters
    local basechar = characters[basecode]
    local ht, wd = basechar.height, basechar.width
    characters[unicode] = {
        width    = wd,
        height   = ht,
        depth    = basechar.depth,
        italic   = basechar.italic,
        kerns    = basechar.kerns,
        commands = {
            { "slot", 1, basecode },