
%% ----- Packages -----

% Language and Character encoding
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

% Math Symbols
\usepackage[fleqn]{amsmath} % fleqn to set the equations left
\usepackage{amssymb}
\usepackage{amsthm} 

% Standard Packages
\usepackage{paralist} % for compactitem und compactenum
\usepackage{ellipsis}
% \usepackage{fixltx2e} % fixltx2e is not required with releases after 2005(fixltx2e)
\usepackage{lmodern} % Latin Modern
\frenchspacing

\usepackage[final]{microtype}
\usepackage{amsfonts}
\usepackage{booktabs}
\usepackage{graphicx}
\usepackage{epstopdf} % necessary using MikTeX
\usepackage{epigraph}
\usepackage{xspace}
\usepackage{bm}
\usepackage{marginnote}
\usepackage{subcaption}
\usepackage{caption}
\captionsetup[subfigure]{labelformat=simple}
\captionsetup{font=small,labelfont={bf,sf}}
\captionsetup[sub]{font=small,labelfont={sf}}
\renewcommand\thesubfigure{(\alph{subfigure})}

% Additional Optional Packages
%\usepackage[notcite,notref]{showkeys} % Show names of labels
\usepackage{changes} % \added{...}, deleted{...} or \replaced{great}{small}
\usepackage{nth}     % oridinal numbers: 1st, 2nd, ... by \nth{1}, \nth{2}, ...
                     % \usepackage[super]{nth} % Option 'super' not available at University
\usepackage{enumitem}
\usepackage{dsfont}
\usepackage{xcolor}
\usepackage{accents}
\usepackage{url} \urlstyle{sf} 
\usepackage[per=frac,fraction=frac]{siunitx} %\si{...} units...
\usepackage{wrapfig}
\usepackage{capt-of}
\usepackage{xspace} % dynamic space
\usepackage{multicol}
\usepackage{minibox}
%\usepackage{enumerate}
%\usepackage{bookmark}

\usepackage{tikz}

\usepackage{longtable} % \begin{longtable} ... breaks the table in case of pagebreak (instead of tabular)

\usepackage{ltablex}   % tabularx instead of tabular environment possible with pagebreak...
% Instead of: \begin{tabular}[t]{p{2.4cm} p{13.2cm}} (No pagebreak)
% Use:  \begin{tabularx}{\linewidth}{p{2.4cm} p{13.2cm}} (automatic pagebreak)

\usepackage{textcomp} % required for option upquote=true in lstset

% inline equation number
\newcommand*{\ineqno}[1]{\refstepcounter{equation}\label{#1}(\theequation)}

\usepackage{listings}
% MATLAB environment for source code in lstlisting
\lstloadlanguages{Matlab}
\lstset{%
float=ht, % float does not work globally..., see workaround below
basicstyle={\small\sffamily}, % alternative: ttfamily
literate=*{*}{\normalfont{*}}1, % Solution of the problem that asterik is vertically centered
columns=fullflexible, % fullflexible, flexible and fixed
frame=tb,
% language=Matlab,
upquote=true, % Simple quotes in source code are the correct ones... (otherwise MATLAB error...)
numbers=left,
numberstyle={\tiny},
showstringspaces=false,
captionpos=b, % lstlisting: define position of caption
keepspaces=true
}
% float workaround:
\makeatletter
\let\lst@floatdefault\lst@float
\makeatother

\usepackage{hyperref} % last package: exceptions: geometry, dblaccnt
\hypersetup{
pdftitle = {User Guide for IPscatt},
pdfsubject = {},
pdfauthor = {Florian B\"urgel, Kamil S. Kazimierski, and Armin Lechleiter},
pdfkeywords = {Inverse Scattering Problem, Sparsity Regularization, Total Variation, Primal-Dual Algorithm, MATLAB Toolbox IPscatt},
colorlinks = true, allcolors = blue, % true/false
%hidelinks, % all links hidden...
draft = false} % true/false

% \usepackage[width=16.5cm,top=2.25cm]{geometry} % load it after hyperref
\usepackage[width=16.5cm,top=3cm,bottom=4cm]{geometry} % load it after hyperref
\usepackage{dblaccnt} % load it after hyperref (before produces errors...)

%% ----- Declare Colors -----

\definecolor{blue}{rgb}{0,0,0.8}
\definecolor{green}{rgb}{0,0.5,0}
\definecolor{red}{rgb}{1,0,0}
\definecolor{orange}{rgb}{1,0.55,0}
\definecolor{gray}{rgb}{0.3,0.3,0.3}
% Commands for colors: note that {{...}} is important, otherwise the rest of the document is colored...
\newcommand{\blue}[1]{{\color{blue}{#1}}}   % \blue{...}
\newcommand{\green}[1]{{\color{green}{#1}}} % \green{...}
\newcommand{\red}[1]{{\color{red}{#1}}}     % \red{...}
\newcommand{\orange}[1]{{\color{orange}{#1}}}     % \orange{...}
\newcommand{\gray}[1]{{\color{gray}{#1}}}     % \grey{...}

% ----- Colors in Table -----
\usepackage{colortbl} % e. g. \cellcolor{gray}{0.9}
\newcommand{\highcol}{\cellcolor{gray!10}}

%% ----- Document specific -----

%\setlength{\parindent}{0in} % no indentation % suppress it with \noindent at the beginning of a line, e.g. \noindent\begin{tabular} is very useful
% \setlength{\mathindent}{0pt} % no indent for formulas, default: 15pt
\setlength{\marginparwidth}{2 cm}
% \pagestyle{headings}

% Renew itemize (smaller space between lines)
\let\tempone\itemize
\let\temptwo\enditemize
\renewenvironment{itemize}{\tempone\addtolength{\itemsep}{-0.5\baselineskip}}{\temptwo}

% Footnotes
\renewcommand*{\thefootnote}{\fnsymbol{footnote}} % Symbols for footnotes (instead of numbers)
%\renewcommand*{\thefootnote}{\arabic{footnote}} % default: switch back to arabic numbering in footnotes

%% ----- Declare Theorems -----

\theoremstyle{definition}
\newtheorem{defi}{Definition}[section] % definition
\newtheorem{prob}[defi]{Problem}       % problem
\newtheorem{exam}[defi]{Example}       % example
\newtheorem{algo}[defi]{Algorithm}     % algorithm
\theoremstyle{plain}
\newtheorem{rema}[defi]{Remark}        % remark
\newtheorem{theo}[defi]{Theorem}       % theorem
\newtheorem{lemm}[defi]{Lemma}         % lemma
\newtheorem{coro}[defi]{Corollary}     % corollary

%% ----- Symbols -----
\newcommand*{\formc}{\framebox[0.4cm]{\textsf{C}}}  % continuous formula
\newcommand*{\formd}{\framebox[0.4cm]{\textsf{D}}}  % discretized formula
\newcommand*{\forms}{\framebox[0.4cm]{\textsf{S}}}  % source code

%% ----- Definitions and commands... -----

% Declare Mathematical Operators
\DeclareMathOperator*{\argmin}{arg\,min}
\newcommand*{\real}{\mathrm{Re}}  % real part (\Re is defined yet)
\newcommand*{\imag}{\mathrm{Im}}  % imaginary part (\Im is defined yet)

% Declare Mathematical Sets
\newcommand*{\R}{\mathbb{R}}      % real numbers
\newcommand*{\C}{\mathbb{C}}      % complex numbers
\newcommand*{\N}{\mathbb{N}}      % natural numbers
\newcommand*{\Z}{\mathbb{Z}}      % set of all integers
\newcommand*{\K}{\mathbb{K}}
\renewcommand{\S}{\mathbb{S}}     % unit sphere

% Declare Mathematical Symbols
\newcommand{\im}{\mathrm{i}}    % imaginary unit i
\newcommand{\e}{\mathrm{e}}     % exponential function
\newcommand{\adj}{\mathrm{H}}	% adjoint matrix is hermitian matrix: use A^\adj
% Note: transpose: A^\top

% Declare Mathematis: Integral
\newcommand{\dif}{\mathrm{d}}
\renewcommand*{\d }[1]{\thinspace \dif #1} % call: $\int_0^x g(y) \d{y}$

% IPscatt: mathcal
\newcommand{\F}{\mathcal{F}}  % forward operator
\newcommand{\G}{\mathcal{G}}  % grid
\newcommand{\HM}{\mathcal{H}} % harmonic monomial (hmonomial in matchIncField.m)
\newcommand{\V}{\mathcal{V}}  % matrix V: \V c \approx u^\Inc|_{\Gamma_\Sca}.
% \newcommand{\Mul}{\mathcal{M}} % multi-static (not used)

% IPscatt: Operators
\newcommand{\grad}{\operatorname{grad}} % gradient
\newcommand{\dive}{\operatorname{div}}  % divergence
\newcommand{\supp}{\operatorname{supp}} % support

\newcommand{\SL}{\operatorname{SL}}        % single-layer
\newcommand{\LipS}[1]{T_{#1}}              % Symbol for the Lippmann-Schwinger Operator
\newcommand{\LipSd}[1]{T_{#1}}             % Symbol for the discretized LS-Operator

\newcommand{\iproj}[1]{\mathcal{I}_{[#1]}} % Interval projection
\newcommand{\stepf}[1]{\text{step}_{[#1]}} % Step function

% IPscatt
\newcommand{\ROI}{{D}}                % region of interest (ROI): (continuous) D
\newcommand{\CD}{{D_{2R}}}            % computational domain (CD): (continuous) D_{2R}
\newcommand{\ROID}{\C^{N_\mathrm{D}}} % region of interest (ROI): discretized: C^{N_D} (N_D is \NROI)
\newcommand{\CDD}{\C_N^d}             % computational domain (CD): discretized: C_N^d
\newcommand{\ROIS}{\textsf{ROI}}      % region of interest (ROI): pseudocode: \textsf{} sf... s... (code: seti.gridROI)
\newcommand{\CDS}{\textsf{CD}}        % computational domain (CD): pseudocode: \textsf{} sf... s... (code: seti.grid)

\newcommand{\TX}{{\Gamma_\Inc}}       % transmitters: (continuous) \Gamma_i
\newcommand{\RX}{{\Gamma_\Sca}}       % receivers: (continuous) \Gamma_s
\newcommand{\TXD}{\C^{N_\Inc}}        % transmitters: discretized: C^{N_i}
\newcommand{\RXD}{\C^{N_\Sca}}        % receivers: discretized: C^{N_s}
\newcommand{\TXS}{\textsf{incPnts}}   % transmitters: pseudocode: incPnts
\newcommand{\RXS}{\textsf{measPnts}}  % receivers: pseudocode: measPnts
\newcommand{\TXM}{\mathrm{TX}}   % transmitters: mathrm TX
\newcommand{\RXM}{\mathrm{RX}}   % receivers: mathrm RX

\newcommand{\dS}{\mathrm{dS}}  % approximation of the infinitesimal element
\newcommand{\dV}{h_N^d}        % area/volume of the infinitesimal element (pixel/voxel) of CD

% IPscatt: norms and inner products
\newcommand{\HS}{\mathrm{HS}}       % Hilbert-Schmidt norm
\newcommand{\fro}{\mathrm{F}}       % Frobenius norm
\newcommand{\WS}{\mathrm{dis}}      % norm of discrepancy term..., and corresponding inner product
\newcommand{\sparse}{\mathrm{spa}}  % norm of sparsity penalty
%\newcommand{\spa}{\mathrm{roi}}    % norm of sparsity penalty, was deleted
\newcommand{\TV}{\mathrm{tv}}       % norm of total variation (TV) penalty (fg)
\newcommand{\normROI}{\mathrm{roi}} % norm of ROI

% IPscatt: names of penalty terms
\newcommand{\dis}{\mathrm{dis}}    % discrepancy: f_dis
\newcommand{\gra}{\mathrm{tv}}     % total variation penalty (in code: gra)
\newcommand{\phy}{\mathrm{phy}}    % penalty for physical bounds

% IPscatt: auxiliary to penalty terms
\newcommand{\SpaPhy}{\mathrm{rp}}  % v_rp alt: _{sp}

% IPscatt: fields
\newcommand{\Inc}{\mathrm{i}} % incident field u^i as well as transmitters' positions
\newcommand{\Sca}{\mathrm{s}} % scattered field u^s as well as receivers' positions, e. g. u^\Inc|_{\Gamma_\Sca}
\newcommand{\Tot}{\mathrm{t}} % total field u^t

% IPscatt: forward scattering
\newcommand{\msdata}{F_\mathrm{meas}} % multi-static data (the data) (at receivers' positions)
% \newcommand{\NROI}{N_{\mathrm{D}}}  % f_\NROI results in an error: ``Double subscript''; It works with f_{\NROI} or additional brackets in defintion of newcommand
\newcommand{\NROI}{{N_{\mathrm{D}}}}  % number of grid points in ROI
\newcommand{\shi}{\mathrm{shi}}       % shift

% IPscatt: names
\newcommand{\FFT}{\mathrm{FFT}} % FFT: Fast Fourier transform

% IPscatt: subindexes for iteration
\newcommand{\inn}{\mathrm{in}}  % inner iteration
\newcommand{\out}{\mathrm{out}} % outer iteration

% IPscatt: Convex Analysis
\newcommand{\fenchel}{\ast} % Fenchel conjugate symbol

% IPcatt: Identify complex and real matrices 
\newcommand{\CtoR}{\mathrm{T}}      % complex to real
\newcommand{\RtoC}{\mathrm{T}^{-1}} % real to complex

% IPscatt: Fourier transform
\newcommand{\factorKernel}{\Psi_{2R}}              % Fourier coefficients in the definition of V_2R
\newcommand{\factorKernelN}{\Psi_{N}}              % array of Fourier coefficients in V_N_D
\newcommand{\factorKernelNshi}{\widehat{\Phi}_{N}} % shifted version of Fourier coefficients

% IPscatt: Operator Symbols
\newcommand{\pmul}{\odot{}}        % element-wise multiplication
\newcommand{\pmulop}[1]{(#1\pmul)} % operator of element-wise multiplication

% IPscatt: Other mathrm...
\newcommand{\x}{\mathrm{x}}
\newcommand{\y}{\mathrm{y}}
\newcommand{\mat}{\mathrm{Mat}}
\newcommand{\born}{\mathrm{B}}

% IPscatt: Names in Text
\newcommand{\IPscatt}{\textsf{IPscatt}\xspace} % toolbox's name: \textsf{tboxIPscatt} and dynamic space
\newcommand{\MATLAB}{\textsf{MATLAB}\xspace}

