% Some custom commands for writing Physics Notes etc
% (C) University of Leeds 2007
% Author: Gavin Burnell <g.burnell@leeds.ac.uk>
% with additional material supplied by Prof. Peter Olmsted

\usepackage{accents}

% From PDO Exam template
\newcommand{\coherence}{\ensuremath{\xi_0}}
\newcommand{\lambdaL}{\ensuremath{\lambda_L}}
\newcommand{\del}{\boldsymbol{\nabla}}
\newcommand{\curl}[1]{\del\times\vec{#1}}
\renewcommand{\div}[1]{\del\cdot\vec{#1}}
\newcommand{\uvec}[1]{\boldsymbol{\widehat{#1}}}
\newcommand{\vecg}[1]{{\boldsymbol{#1}}}
\newcommand{\vect}[1]{\ensuremath{\protect\underaccent{\tilde}{\boldsymbol{#1}}}}
\newcommand{\gtitle}[1]{{\sf #1}}
\newcommand{\note}[1]{[\textbf{#1}]}
\newcommand{\refnote}[1]{{\,{\textsl{\scriptsize [#1]}}}}
\newcommand{\kb}{k_{\scriptscriptstyle B}}
\newcommand{\kbT}{k_{\scriptscriptstyle B}T}
\newcommand{\concept}[2]{\noindent{\textbf{#1} {#2}}\\[5truept]}
\newcommand{\question}[2]{[{\bf Ex:} #1 \textsl{#2}]}
\newcommand{\ie}{\emph{i.e.\/}}
\newcommand{\etc}{\emph{etc\/}}
\newcommand{\eg}{\emph{e.g.\/}}
\newcommand{\Eg}{\emph{E.g.\/}}
\newcommand{\dimp}{d\!\!\!\hskip1truept^-}
\newcommand{\pd}[3]{\left.\frac{\partial #1}{\partial #2}\right|_{#3}}
\newcommand{\pdd}[2]{\frac{\partial #1}{\partial #2}}
\newcommand{\units}[1]{\ensuremath{\,\mathrm{#1}}}
\newcommand{\hint}[1]{\textit{[#1]}}
\newcommand{\pts}[1]{\hspace*{0.1cm}\hfill[#1]}
\newcommand{\ptsmk}[1]{\phantom{.}\hfill[#1~Marks]}
\newcommand{\twocol}[4]{\parbox[t]{#1}{#3}\quad\parbox[t]{#2}{#4}}
\newcommand{\mean}[1]{\left\langle #1\right\rangle}
\newcommand{\Z}{{\cal Z\/}}
\renewcommand{\L}{{\cal L\/}}
\renewcommand{\H}{{\cal H\/}}
\newcommand{\ket}[1]{\left|#1\right.\rangle}
\newcommand{\bra}[1]{\langle\left.#1\right|}
\newcommand{\micron}{\mu\textrm{m}}
\renewcommand{\i}{\uvec{i}}
\renewcommand{\j}{\uvec{j}}
\renewcommand{\k}{\uvec{k}}
\renewcommand{\bar}[1]{\ensuremath{\overline{#1}}}
\newcommand{\conv}{\ensuremath{\,\circledast\,}}
\newenvironment{rubric}[1]{
\begin{center}
\Large \bf #1
\end{center}
\begin{singlespace}
\bf }{
\end{singlespace}}
%
% Defines an environment for making multiple choice questions
%
\newenvironment{multipleguess}[1]{
\begin{samepage}
\item #1
\begin{enumerate}[label={\bf \Alpha*},itemsep=-1ex]
}{
\end{enumerate}
\end{samepage}
\pagebreak[0] }

%
% Imports an eps file to make a figure
%
% \exfig[Filename_prefix]{figure number} imports a file called Filename_prefix-#.eps
%
\newcommand{\exfig}[2][Figs]{
\hspace{0.1cm}\newline
\begin{center}
\includegraphics{#1-#2}
\end{center}
}

% Starts a new section on a new page and resets the equation numbering
%
\newcommand{\newsection}[1]{
    \clearpage
    \setcounter{equation}{0}
    \section{#1}
}

% Redefines the equation numbering to be section.number in arabic format
\renewcommand{\theequation}{
    \thesection.\arabic{equation}
}

%Marginal Notes

% A quick figure command \figure{filename/label}{caption}
\newcommand{\fig}[3][t]{
    \begin{figure}[#1]
        \centering
        \includegraphics{#2}
        \caption{\protect #3} \label{#2}
    \end{figure}
}

% Warnings are in bold font with a suitable marginal picture
\newcommand{\warning}[2][warning]{
\begin{samepage}
    \bigskip
    \marginpar[
        \vspace{0.0cm}
        \includegraphics{warning}
    ]{
        \vspace{0.0cm}
        \hfill
        \includegraphics{warning}
    }{
        \bf #2
        \bigskip}
\end{samepage}
}

% Keypoints are in italics with a left or right arrow depending on the margin
\newcommand{\keypoint}[2][keypoint]{
\begin{samepage}
    \bigskip
    \marginpar[
        \vspace{0.0cm}
        \includegraphics{keypointl}
    ]{
        \vspace{0.0cm}
        \hfill
        \includegraphics{keypointr}
    }{
        \it #2 \bigskip}
\end{samepage}
 }

% Ponders are things to think about. Normal text with a question mark in the margin
\newcommand{\ponder}[2][ponder]{
\begin{samepage}
    \bigskip
    \marginpar[
        \vspace{0.0cm}
        \includegraphics{ponder}
    ]{
        \vspace{0.0cm}
        \hfill
        \includegraphics{ponder}
    }{
        #2 \bigskip}
\end{samepage}
}


%Formatting

\newcommand{\degree}{%
    \ensuremath{^\circ}%
}

\newcommand{\half}{%
    \ensuremath{\frac{1}{2}}%
}

\newcommand{\qrtr}{%
    \ensuremath{\frac{1}{4}}%
}

\newcommand{\tqrtr}{%
    \ensuremath{\frac{3}{4}}%
}

\newcommand{\x}{%
    \ensuremath{\times}%
}

\newcommand{\super}[1]{%
    \ensuremath{^\mathrm{\mbox{#1}}}%
}

\newcommand{\sub}[1]{%
    \ensuremath{_\mathrm{\mbox{#1}}}%
}

%Physical quantities

\newcommand{\KE}{%
   E\sub{k}%
}

\newcommand{\PE}{%
    E\sub{p}%
}

\newcommand{\EE}{%
    E\sub{Elec}%
}

\newcommand{\Eelastic}{%
    E\sub{elastic}%
}

\newcommand{\strain}{%
    \ensuremath{\epsilon}%
}

\newcommand{\stress}{%
    \ensuremath{\sigma}%
}

\newcommand{\sy}{%
    \ensuremath{\sigma_y}%
}

%Physical constants

\newcommand{\NA}{%
    N\sub{A}%
}

\newcommand{\Tc}{\ensuremath{\mathrm{T_C}}}


% SI Units

\newcommand{\ms}[1][-1]{%
    \ensuremath{\mathrm{ms^{#1}}}%
}

\newcommand{\ohm}{%
    \units{\Omega}%
}
\newcommand{\E}[1]{%
    \ensuremath{\x 10^{#1}}%
}

\newcommand{\ion}[2]{%
\ensuremath{\,\mbox{#1}^{#2}\,}%
}

% Superconductivity bits
\newcommand{\lgl}{\ensuremath{\lambda_{GL}}}
\newcommand{\xgl}{\ensuremath{\xi_{GL}}}
\newcommand{\agl}{\ensuremath{\alpha'\left(T-T_C\right)}}

