%% ================================================================================
%% Document class
%% ================================================================================

\documentclass[
%%%%%%%%%% Start of customizable section %%%%%%%%%%
english,
ngerman,
10pt,%             supported values: 10pt, 11pt, 12pt
aspectratio=169,%  common values: 169, 1610, 43
%%%%%%%%%% End of customizable section %%%%%%%%%%
% handout % activate to compile without overlays
]{beamer}
\usetheme{Juelich}
% \fzjset{title=allcaps}         % to set the title in allcaps
\fzjset{title=regular}         % to set the title regular
% \fzjset{subtitle=allcaps}      % to set the title in allcaps for short text
\fzjset{subtitle=regular}      % to set the title regular and in a smaller font for long text
% \fzjset{part=allcaps}          % to set the part in allcaps for short text
% \fzjset{part=regular}          % to set the part regular and in a smaller font for long text
% \fzjset{frametitle=allcaps}    % to set the frametitle in allcaps for short text
\fzjset{frametitle=regular}    % to set the frametitle regular font for long
% text

% % edit beamertheme-juelich template
% % reference
% % https://gitlab.jsc.fz-juelich.de/kabadshow1/beamertheme-juelich/-/blob/master/tutorial/tutorial.pdf
% %
% %
% add partner logos to slide template footer
% supported: footer element1, footer element2, footer element3
%
% the original hdslee logo is not aligned with the fzj logo. use a slightly
% clipped and shifted one instead.
% \setbeamertemplate{footer
%   element2}[logo]{../resources/fig/logos/hds-lee/originals/HDS_LEE_Logo_CMYK.pdf}
\setbeamertemplate{footer
  element1}[logo]{../resources/fig/logos/hds-lee/adapted/HDS_LEE_Logo_CMYK_0.1per-less-border.pdf}
% \setbeamertemplate{footer
%   element1}[logo]{../resources/fig/logos/hida/HiDA_Logo_RGB_kompakt.png}
% \setbeamertemplate{footer
%   element2}[logo]{../resources/fig/logos/casus.science/Logo-CASUS-color.png}
% % reset to default / remove partner logos
% \setbeamertemplate{footer element2}[default]


%% ================================================================================
%% PDF Compilation options
%% ================================================================================

% Slides with speaking notes compilation
% notes handling (see beamer userguide). choose one of the option (first=default)
\usepackage{pgfpages}
\setbeameroption{hide notes}
% \setbeameroption{show only notes}
% \setbeameroption{show notes on second screen=right} % right=default
% \setbeameroption{show notes}


%% ================================================================================
%% Packages
%% ================================================================================

%% page setup
\usepackage{changepage}         % e.g. for adjusting left right margin;
                                % concrete use case:
                                % beamer input too wide tikz figure.
                                % reference:
                                % https://tex.stackexchange.com/a/308180



% increase beamer footer font size (default: {5}, or {5}{7} (dunno what the 2nd
% arg does.))
\setbeamerfont{footline}{size=\fontsize{7}{9}\selectfont}

%% ----------------------------------------------------------------------
% language
\usepackage[ngerman,main=english]{babel}
\usepackage[babel]{csquotes}    % language-aware quotes

%% ----------------------------------------------------------------------
% graphics, colors
\usepackage{xcolor}
\usepackage{graphics}
\usepackage{subcaption} % for env subfigure

\usepackage{spot}               % spotlight highlighting for beamer
                                % unfortunately, doesn't always work correctly
                                % = unreliable.

\usepackage{textpos}            % for absolute positioning of any content

% package caption: for adding captions to includegraphics figures via minipage
% reference: https://tex.stackexchange.com/a/238641
\usepackage[font=scriptsize,labelfont=it]{caption} % Required for specifying captions
% figure captions in beamer: remove the prefix 'Figure' for captions.
\captionsetup[figure]{labelformat=empty,justification=raggedright,singlelinecheck=false}


\usepackage{tikz}               % well, it's tikz. here currently used for:
                                % putting custom highlights on top of other
                                % things with absolute positioning (see
                                % user_macros -> hilibox).

                                % pgf and tikz configuration and sub-package loading

% tikz setup config from jsc gsp18 presentation
\usetikzlibrary{positioning,calc}
\usetikzlibrary{mindmap,trees,shadows,arrows}
\usetikzlibrary{arrows}
\usetikzlibrary{fpu}
\usetikzlibrary{3d}
\usetikzlibrary{shapes}
\usetikzlibrary{shapes.geometric}
\usetikzlibrary{automata}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{patterns}
\usetikzlibrary{fit}
\usetikzlibrary{backgrounds}
\usetikzlibrary{matrix}
\usetikzlibrary{scopes}
\usetikzlibrary{shapes.symbols}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{intersections}
\usetikzlibrary{graphs, graphs.standard}
\usetikzlibrary{chains}

\newcommand{\includetikz}[1]{%
  % \tikzsetnextfilename{#1}%
  \input{Figures/#1.tikz}%
}

\tikzset{
  invisible/.style={opacity=0},
  visible on/.style={alt={#1{}{invisible}}},
  alt/.code args={<#1>#2#3}{%
    \alt<#1>{\pgfkeysalso{#2}}{\pgfkeysalso{#3}} % \pgfkeysalso doesn't change the path
  },
}

% additional fzj colors from beamercolorthemejuelich.sty
\definecolor{fzjblue50}{RGB}{0,91,130}
\definecolor{fzjblue35}{RGB}{166,198,211}
\definecolor{fzjblue30}{RGB}{178,206,217}
\definecolor{fzjblue20}{RGB}{204,222,236}
\definecolor{fzjblue10}{RGB}{229,239,242}
\definecolor{fzjgray80}{RGB}{81,81,81}
\definecolor{fzjgray50}{RGB}{156,156,156}
\definecolor{fzjgray30}{RGB}{185,185,185}
\definecolor{fzjgray20}{RGB}{204,204,204}
\definecolor{fzjgray10}{RGB}{229,229,229}
\definecolor{fzjgray05}{RGB}{242,242,242}
\definecolor{fzjbranchred}{RGB}{212,45,18}
\definecolor{fzjbranchyellow}{RGB}{230,175,17}
\definecolor{fzjbranchblue}{RGB}{6,194,255}
\definecolor{fzjlightred}{RGB}{198,141,132}
\definecolor{fzjlightgreen}{RGB}{164,181,153}
\definecolor{fzjlightyellow}{RGB}{235,212,167}


% make \href / \url commands use linebreak for long links.
% reference: https://tex.stackexchange.com/a/3034
\PassOptionsToPackage{hyphens}{url}\usepackage{hyperref}

\usepackage{hyperref}
%% ----------------------------------------------------------------------
% hyperref config
\def\firstname{Johannes}
\def\familyname{Wasmer}
\def\FileAuthor{\firstname \familyname}
\def\FileTitle{talk-mlpfpo24-wasmer}
\def\FileSubject{Master colloquium}
\def\FileKeyWords{density functional theory, machine learning, exchange interaction}
% \def\FileCreator{\LaTeX}
\def\FileCreator{FZJ PGI-1}

\hypersetup{%
  unicode, % enable Umlaute in pdf hyperlinks and the pdf toc
  pdfauthor   = \FileAuthor,%
  pdftitle    = \FileTitle,%
  pdfsubject  = \FileSubject,%
  pdfkeywords = \FileKeyWords,%
  pdfcreator  = \FileCreator,%
  pdfproducer = \FileCreator
}

% link colors
\definecolor{url-links-color}{HTML}{2A1B81}
\hypersetup{colorlinks,%
            % linkcolor=,%
            % urlcolor=url-links-color
}

%% ----------------------------------------------------------------------

%% ----------------------------------------------------------------------
% tables

\usepackage{tabulary}           % text-wrapping columns in tables; reference w. example:
% https://en.wikibooks.org/wiki/LaTeX/Tables#The_tabulary_package

\usepackage{booktabs}           % opinionated table formats (toprule midrule bottomrule)
\usepackage{colortbl}
\usepackage{tabularx}

\usepackage{booktabs,threeparttable}
% example threeparttable:
%
% \begin{alertblock}{}
%   \begin{table}
%     \begin{threeparttable}[b]
%       % \caption{example table}
%       \begin{tabular}{ll}
%         \toprule
%         column A & column B \\
%         \midrule
%         first datapoint\tnote{1} & datapoint two \\
%         datapoint three & datapoint four \\
%         \bottomrule
%       \end{tabular}
%       \begin{tablenotes}
%       \item[1] Note one
%       \end{tablenotes}
%     \end{threeparttable}
%   \end{table}
% \end{alertblock}


% settings for the design of tables
\arrayrulecolor{fzjblue}


%% ----------------------------------------------------------------------
% fonts, characters, symbols
\usepackage{amsmath}
\usepackage{bbold} % only for \mathbb{1} identity, for now
\usepackage{latexsym} % replaces amssymb
% \usepackage{fontawesome} % loads fancy web symbols 2016
\usepackage{fontawesome5} % loads fancy web symbols 2022
\usepackage{tipa}        % allows to use \textpipe (for adjustable symbol |)
\usepackage{emoji}

% % note: commented out bm cause suddenly and without any changes in the
% offending document, led to error 'Too many math alphabets used in version
% normal' in a tikz picture which did not use bm, after having added some math
% in another inputted tex file. could not make the error go away without
% commenting out bm. for now, use \boldsymbol{} instead when needed.
%
% \usepackage{bm}                 % rec. way to write bold greek, eg \(f(\bm{x})=y\)
% tell bm to limit its alphabet use, to avoid error 'Too many math alphabets
% used in version normal'.
% % reference: https://tex.stackexchange.com/a/243541
% \renewcommand\hmmax{0}
% \renewcommand\bmmax{0}

\usepackage{siunitx}            % scientific notation, SI units
\sisetup{output-exponent-marker=\ensuremath{\mathrm{e}}} % print 1e6 as 1e6, not
                                % 1 x 10^6

% \usepackage{physics}
\usepackage{braket}             % Dirac notation

% commented out package braket, because ceriotti's cosmo/dirac-rep.tex for
% structural representations uses the physics package whose dirac not. syntax
% clashes with the one from braket. otherwise the braket package is preferred!
%
% if switching braket <-> physics, the code has to be updated.
%
% braket \braket{a|b} = physics \bra{a}\ket{b}
% braket \braket{a|O|a} = physics \expval{O}{a}
% etc.
% %%%

\usepackage{mhchem} % chemical formulae with \ce{H2O}


%% ----------------------------------------------------------------------
% lists

\usepackage{enumitem}           % control spacing in lists. reference:
                                % https://tex.stackexchange.com/a/10689.
                                % not used: beamer and enumitem don't mix. reference:
                                % https://tex.stackexchange.com/a/31524.
                                % instead, do it locally, like this:
                                % https://tex.stackexchange.com/a/12374.
                                % Or this:
                                % https://jayrobwilliams.com/posts/2019/10/better-beamer.

% --------------------------------------------------
% make itemize items evenly spaced and spread across page.
% Note: this is only applied to item lists at the top level of a frame,
% not if they are in another environment, e.g. columns. for that, use the
% manual solutions above.
% reference:
% https://jayrobwilliams.com/posts/2019/10/better-beamer.
\makeatletter
\renewcommand{\itemize}[1][]{%
	\beamer@ifempty{#1}{}{\def\beamer@defaultospec{#1}}%
	\ifnum \@itemdepth >2\relax\@toodeep\else
	\advance\@itemdepth\@ne
	\beamer@computepref\@itemdepth% sets \beameritemnestingprefix
	\usebeamerfont{itemize/enumerate \beameritemnestingprefix body}%
	\usebeamercolor[fg]{itemize/enumerate \beameritemnestingprefix body}%
	\usebeamertemplate{itemize/enumerate \beameritemnestingprefix body begin}%
	\list
	{\usebeamertemplate{itemize \beameritemnestingprefix item}}
	{\def\makelabel##1{%
			{%
				\hss\llap{{%
						\usebeamerfont*{itemize \beameritemnestingprefix item}%
						\usebeamercolor[fg]{itemize \beameritemnestingprefix item}##1}}%
			}%
		}%
	}
	\fi%
	\setlength\itemsep{\fill}
	\ifnum \@itemdepth >1
	\vfill
	\fi%
	\beamer@cramped%
	\raggedright%
	\beamer@firstlineitemizeunskip%
}
\def\enditemize{\ifhmode\unskip\fi\endlist%
	\usebeamertemplate{itemize/enumerate \beameritemnestingprefix body end}
	\ifnum \@itemdepth >1
	\vfil
	\fi%
}
\makeatother
% --------------------------------------------------



%% ----------------------------------------------------------------------
% listings / code
\usepackage{verbatim}
\usepackage{fancyvrb}           % for Verbatim env (change font size etc)

% \usepackage{listings}           % in presentation, prefer minted
% \lstset{
%   basicstyle=\ttfamily\footnotesize,
%   breaklines=true}

\usepackage{minted}             % code listings with syntax highlighting
                                % (requires python)
\newminted{python}{fontsize=\scriptsize,
  linenos,
  numbersep=8pt,
  gobble=4,
  frame=lines,
  bgcolor=bg,
  framesep=3mm}

% bibliography
\usepackage[citestyle=authoryear, bibstyle=authoryear,backend=biber]{biblatex}
% \addbibresource{../bibliography/bibliography.bib}
\addbibresource{../resources/bib/bibliography.bib}

% turn off '(visited on ...)' string in cited references (biblatex command)
\DeclareFieldFormat{urldate}{}

% reduce footcite size.
% (note: this reduces all footnote sizes. but in beamer, this is okay. web says
% that alternative (ifffootnote) is discouraged, leads to redefinition conflicts.
% Reference: bhttps://tex.stackexchange.com/a/27209)
\renewcommand{\footnotesize}{\scriptsize}


% %% ----------------------------------------------------------------------
% % jupyter notebook TeX output config
% % not used since too many changes. instead use minted for [In] and Verbatim
% % env for output.
% \input{config_jupyter-notebook}

%% ----------------------------------------------------------------------
% programming in TeX / LaTeX

% package ifthen: LateX version of TeX control structures
% (TeX: \if, \ifx, etc.; ifthen: \newboolean, \setbooleans, \ifthenelse, etc.)
\usepackage{ifthen}

%% ----------------------------------------------------------------------
% Other packages / Miscellaneous

\usepackage{etoolbox}           % for 1) adjust toc line spacing, see below

\usepackage{pdfpages}           % for inserting external PDF slides
                                % reference https://tex.stackexchange.com/a/57455

%% ================================================================================
%% Other settings
%% ================================================================================

% toc: adjust beamer toc line spacing (tableofcontents).
% description: patches the sectionintoc command: replace default with other value.
% reason: default spacing was too large.
% note: requires  package etoolbox.
% note: tried several solutions, this only one that worked.
% reference: https://tex.stackexchange.com/a/51458
\makeatletter
\patchcmd{\beamer@sectionintoc}{\vskip1.5em}{\vskip0.5em}{}{}
\makeatother

% % toc: make toc appear only at begininng
% \begin{frame}
%   \frametitle{Overview}
%   \tableofcontents
% \end{frame}

% toc: make toc appear between each section, make noncurrent entries transparent
\AtBeginSection[]
{
  \begin{frame}
    \frametitle{Outline}
    \tableofcontents[currentsection]
  \end{frame}
}

% toc: decrease transparency for noncurrent else too invisible
% reference: https://esc-now.de/_/latex-beamer-klasse-transparenz-im-inhaltverzeichnis/?lang=en
\setbeamertemplate{section in toc shaded}[default][60]
\setbeamertemplate{subsection in toc shaded}[default][60]

% footnotes: reset counter on every frame
% reference: https://tex.stackexchange.com/a/530528
\AtBeginEnvironment{frame}{\setcounter{footnote}{0}}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: "../presentation"
%%% mode: flyspell
%%% ispell-local-dictionary: "english"
%%% End:
