[tab] deepmind.cls (tex)
%%%%%%%%%
%
% Basic style file for DeepMind open-access papers, internal reports, and unpublished % 
% papers.
%
% This class allows for several options depending on the preferences of the authors.
% Use it in the following way, with the full set of option possible:
% \documentclass[11pt, a4paper, twocolumn, logo, address, copyright, nonumbering, 
% internal]{deepmind} 
%
% Options:
%    - 11pt: Sets the normal font size of the text. Can be only 10, 11, 12pt.
%    - a4paper: Paper size. Usually would not adjust.
%    - twocolumn: Makes the paper into two column mode; single column by default.
%    - logo: Adds the DeepMind logo to the top left. No logo included if left out.
%    - address: Add a postal address for correspondence to the bottom footer.
%    - copyright: Add a copyright statement to the first page of the paper in the left footnote
%    - nonumbering: Uses unnumbered sections.
%    - internal: for internal only docs that should not be shared externally. 
%           Can only use techreportnumber with this option.
%
% Date of Paper
%   The report is by default given the curren date in the top right. If you want to fix the 
%   date: add the date to your preamble with your own date as follows:
%   
enewcommand{	oday}{1 January 2000}
%
% Confidentiality
%   Change the confidentiality statement for internal docs by adding this in the preable 
%   
enewcommand{\internal}{Confidential.}
%   
% ----------------
% Licence: This template is released under the Creative Commons licence 
% Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
%
%
% Known issues:
%   - Package todonotes does not work in the abstract
%
% Version history: 
% v0.31, May 2019 - Allow corresponding authors without internal option
% v0.3, March 2019 - Math font consistency, better handling of optional arguments
% v0.2, January 2019 - Consistency of fonts, margins, additional notes
% v0.1, December 2018 - Initial version for testing
%
% Ongoing Review
%    We review and improve this regularly. 
%    Send comments to shakir@
%
%  DeepMind, London, 2019
%
% %%%%%%%%%%%%%%%

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{deepmind} % no versioning; versioning does not work well with arxiv.

%%======== Pckage options and base class ========
\RequirePackage{xifthen}

ewboolean{nonumbering}

ewboolean{logo}

ewboolean{address}

ewboolean{copyright}

ewboolean{internal}
\DeclareOption{nonumbering}{\setboolean{nonumbering}{false}}
\DeclareOption{logo}{\setboolean{logo}{true}}
\DeclareOption{address}{\setboolean{address}{true}}
\DeclareOption{copyright}{\setboolean{copyright}{true}}
\DeclareOption{internal}{\setboolean{internal}{true}}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{extarticle}}
\ProcessOptions
\LoadClass{extarticle}

%%======== Packages Required ========
% Fonts and language
\AtEndOfClass{\RequirePackage[tracking=smallcaps]{microtype}}
\RequirePackage[utf8]{inputenc}
\RequirePackage[english]{babel}
\RequirePackage{amsthm, amsmath, amsfonts, amssymb}
\RequirePackage{cmap}
\RequirePackage[T1]{fontenc}
\RequirePackage{url}
\RequirePackage[colorlinks=true, allcolors=blue]{hyperref}
\RequirePackage{pifont}
\RequirePackage[dvipsnames]{xcolor}
\RequirePackage{textcomp} % For copyright symbol styling
\RequirePackage[overload]{textcase}
%\RequirePackage{balance}
%% *Graphics, tables and other formatting
\RequirePackage{graphicx}
\RequirePackage{colortbl}
\RequirePackage{booktabs}
\RequirePackage{changepage}
\RequirePackage{enumitem} % For reducing bullet list item separation
\RequirePackage{tabularx}
\RequirePackage{datetime}
% Headers and footers
\RequirePackage{fancyhdr}  % custom headers/footers
\RequirePackage{lastpage}  % Number of pages in the document
% Lists and their spacing
\RequirePackage{enumitem} 
\setlist[itemize]{noitemsep}
\setlist[enumerate]{noitemsep}
% Title, Abstract, Bibliography
\RequirePackage[explicit]{titlesec}
\RequirePackage{bibentry}
\RequirePackage{mdframed}
\RequirePackage{caption}
\RequirePackage{needspace}

%%======== Can use any of these fonts ======== 
%\RequirePackage{charter}
%\RequirePackage[scaled]{helvet}
%\RequirePackage{bookman}
%\RequirePackage{times}
%\RequirePackage[default]{opensans} %fosfamily
%\usepackage{antpolt}
% Math fonts
%\RequirePackage{mathpazo} % Palatino
%\usepackage{euler} % for math fints

% Use Bitstream Charter as the main font. Does not include a typewriter font.
\RequirePackage{XCharter}
\RequirePackage[xcharter,bigdelims,vvarbb]{newtxmath}

% Use the typewriter font from lmodern, scaled up to match Charter's xheight.
% You may wish to add the "p" option to use the proportional font instead of
% the monospaced one, which might look nicer in cases where you do not need
% aligned columns
\RequirePackage[scaled=1.1]{zlmtt}

%%======== Margins and column spacing ========
\RequirePackage[left=2.2cm,%
right=2.2cm,%
top=3cm,%
bottom=3cm,%
headheight=40pt,%
headsep=20pt,%
%showframe, % for testing
a4paper]{geometry}%
\setlength{\columnsep}{15pt} % Distance between the two columns of text
%\setlength{\parindent}{0pt}
\setlength{\parskip}{0.5\baselineskip}

%% *Custom font sizes and styles

ewcommand{\watermarkfont}{\color{black50}
ormalfont\fontsize{10}{12}\selectfont}

ewcommand{\headerfont}{
ormalfont\sffamily\fontsize{8}{10}\selectfont}

ewcommand{	itlefont}{\color{black}
ormalfont\bfseries\fontsize{21}{23}\selectfont} 

ewcommand{\datesfont}{
ormalfont\sffamily\itshape\fontsize{8}{10}\selectfont}

ewcommand\urlheaderfont{\color{blue}\fontsize{8}{10}\selectfont}

ewcommand{\absfont}{\bfseries\linespread{1.2}\fontsize{10}{12}\selectfont}

ewcommand{\keywordstitlefont}{\bfseries\linespread{1.2}\fontsize{8}{10}\selectfont}

ewcommand{\keywordsfont}{\itshape\linespread{1.2}\fontsize{11}{12}\selectfont}

ewcommand{\copyrightfont}{
ormalfont\fontsize{7}{9}\selectfont}

ewcommand{\footerfont}{\color{black}
ormalfont\fontsize{8}{10}\selectfont}

ewcommand{\subjectfont}{\color{white}\bfseries\fontsize{10}{12}\selectfont}

ewcommand{\headingfont}{\color{black}\bfseries\fontsize{13}{14}\selectfont}

ewcommand{	paine}[1]{{\color{blue} (Tom : #1)}}


ewcommand{\keywords}[1]{\def\@keywords{#1}}

ewtoks\correspondingauthor

ewtoks\paperurl

ewtoks
eportnumber

% Dates and Times for footer
%
ewdateformat{monthyeardate}{\THEDAY{ }\monthname[\THEMONTH] \THEYEAR}
% ISO-8601 date format

ewdateformat{monthyeardate}{\THEYEAR-\THEMONTH-\THEDAY}

\setcounter{secnumdepth}{3}
\ifthenelse{\boolean{nonumbering}}{\setcounter{secnumdepth}{0}}{}

%%========  Author and affiliation ========
\RequirePackage{authblk}
\setcounter{Maxaffil}{0}
\setlength{\affilsep}{0.2em}

enewcommand\Authfont{
ormalfont\bfseries\fontsize{9}{13}\selectfont}

enewcommand\Affilfont{
ormalfont\fontsize{8}{10}\selectfont}
\makeatletter

enewcommand\AB@affilsepx{, \protect\Affilfont}
\makeatother

enewcommand\Authands{ and }


ewcommand{\internalonly}{Confidential - DeepMind, do not share or forward externally.}

ewcommand{\copyrightext}{\footerfont 	extcopyright\, 	he\year{} DeepMind. All rights 
reserved}


%%======== Header and Footer Content ========
%
% Header and Footer for the first page
\pagestyle{fancy}   % Enables the custom headers/footers
\fancypagestyle{firststyle}{
	\fancyhead[L]{
		\ifthenelse{\boolean{logo}}{
			\includegraphics[width=100pt]{assets/dmlogo}
	 }{}
}
\fancyhead[R]{
	\ifdefined\paperurl
	\if
elax	he\paperurl
elax \else 
		\href{	he\paperurl}{\urlheaderfont \itshape 	he\paperurl}\\ \fi
	\else \fi
	{\footerfont\itshape\monthyeardate	oday}
}
\fancyhead[C]{}
%
\fancyfoot[L]{
	\ifdefined\correspondingauthor
	\if
elax	he\correspondingauthor
elax 
	\else \footerfont\itshape  {Corresponding author(s): 	he\correspondingauthor \\} \fi
	\else \fi
    \ifthenelse{\boolean{internal}}{\footerfont \internalonly \\}{\footerfont\bfseries
elax}
	\ifthenelse{\boolean{address}}{
		\itshape\footerfont DeepMind, 5 New Street Square, London EC4A 3TW \\}{} 
	\ifthenelse{\boolean{copyright}}{\copyrightext}{}
}
\fancyfoot[R]{
	\ifthenelse{\boolean{internal}}{
	\ifdefined
eportnumber
	\if
elax	he
eportnumber
elax 
	\else \footerfont\itshape  {\footerfont \bfseries DeepMind Technical Report 	he
eportnumber} \fi
	\else \fi
	}{\footerfont\bfseries
elax}
}
\fancyfoot[C]{\footerfont\bfseries
elax}}

% Header and Footer for pages from 2 onwards
\fancyhead[L,R]{}
\makeatletter
\fancyhead[C]{\footerfont \@title}
\makeatother
\fancyfoot[C]{}
\fancyfoot[L]{
	\ifthenelse{\boolean{internal}}{\footerfont \internalonly
ewline 
		\ifdefined
eportnumber
		\if
elax	he
eportnumber
elax 
		\else \footerfont {DM-TR 	he
eportnumber} \fi
		\else \fi}{\footerfont\bfseries
elax}
}
\fancyfoot[R]{\footerfont 	hepage}

% Header and footer rules (coloured).

enewcommand{\headrulewidth}{1pt}

enewcommand{\footrulewidth}{1pt}
\let\DefaultHeadRule\headrule
\let\DefaultFootRule\footrule

enewcommand{\headrule}{\color{gray}\DefaultHeadRule}

enewcommand{\footrule}{	extcolor{gray}{\DefaultFootRule}}


enewenvironment{abstract}
{\par
oindent\\  \ignorespaces \bfseries}
{\par\bigskip}

%%========  Bibliography using bibtex ========
\addto{\captionsenglish}{
enewcommand{
efname}{References}}

ewcommand{\citeas}[1]{\Needspace*{8\baselineskip}
oindent\bibentry{#1}}
% Uncomment the next line if you want the  numbered refs to be "1." instead of "[1]".
%\makeatletter 
enewcommand\@biblabel[1]{#1.} \makeatother

%%======== Abstract and section formatting ========
\def\xabstract{abstract}
\long\def\abstract#1\end#2{\def	wo{#2}\ifx	wo\xabstract 
	\long\gdef	heabstract{\ignorespaces#1}
	\def\go{\end{abstract}}\else
	ypeout{^^J^^J PLEASE DO NOT USE ANY \string\begin\space \string\end^^J
	COMMANDS WITHIN ABSTRACT^^J^^J}#1\end{#2}
\gdef	heabstract{\vskip12pt BADLY FORMED ABSTRACT: PLEASE DO
NOT USE {	t\string\begin...\string\end} COMMANDS WITHIN
THE ABSTRACT\vskip12pt}\let\go
elax\fi
\go}

% Define an environment with abstract content and styling
\makeatletter

ewcommand{\abscontent}{
	
oindent
	\parbox{\dimexpr\linewidth}{\absfont 	heabstract}
	\@ifundefined{@keywords}{}{
		\vskip1em 
oindent \keywordsfont  Keywords: \@keywords}
}

\if@twocolumn%

enewcommand{\maketitle}{
		wocolumn[
	\begin{adjustwidth}{0pt}{24pt}
		\begin{flushleft}
			{
				{ 
aggedright 	itlefont 
				\@title\par}%
				\vskip11pt
				{
aggedright \@author\par}
				\vskip20pt%
			}%
		\end{flushleft}
	\end{adjustwidth}

		\abscontent
	\vskip20pt%
	]
		hispagestyle{firststyle}
}%
\else% \@twocolumnfalse

enewcommand{\maketitle}{\bgroup\setlength{\parindent}{0pt}
	\begin{adjustwidth}{0pt}{24pt}
		\begin{flushleft}
			{
				{
aggedright 	itlefont \@title\par}%
				\vskip11pt
				{
aggedright \@author\par}
				\vskip20pt%
			}%
		\end{flushleft}
	\end{adjustwidth}
	\egroup
	{%
		{\abscontent}
	}%
		hispagestyle{firststyle}
}%
\fi
\makeatother

	itleformat{\section}
{\large\bfseries\headingfont}
{	hesection.}
{0.5em}
%{\MakeUppercase{#1}}[]
{#1}
[]
	itleformat{name=\section,numberless}
{\large\bfseries\headingfont}
{}
{0em}
%{\MakeUppercase{#1}}[]
{#1}
[]
	itleformat{\subsection}
{\bfseries}
{	hesubsection.}
{0.5em}
{#1}
[]
	itleformat{\subsubsection}% [runin] If want to have inline for the subsubsect
{\bfseries\itshape}
{	hesubsubsection.}
{0.5em}
{#1}
[]

	itlespacing*{\section}{0pc}{3ex plus4pt minus3pt}{5pt}
%	itlespacing*{\section}{0pc}{1ex }{\baselineskip}
	itlespacing*{\subsection}{0pc}{2.5ex plus3pt minus2pt}{2pt}
	itlespacing*{\subsubsection}{0pc}{2ex plus2.5pt minus1.5pt}{2pt}
%	itlespacing*{\paragraph}{0pc}{2ex plus2pt minus1pt}{0pt}

%%======== Captions in tables and figures ========
\DeclareCaptionLabelSeparator{pipe}{ $\vert$ }% or $\vert$
\captionsetup{labelfont={}, %{bf,sf},%
labelsep=space,%
figurename=Figure,%
labelsep=pipe,
singlelinecheck=off,%
%justification=centering
}